Doing a volatile write on a struct type causes LLVM to emit some annoying loads/stores using the stack. This seems to be because the volatile operation gets converted to a volatile memcpy, and both the source (RAM) and the destination (MMIO) get treated as volatile.
I suspect that selecting repr(transparent) instead of repr(C) would fix this. Is it possible to have a way to change the default repr?
Basically given:
/// Interrupt Register
#[bitbybit::bitfield(u32, debug, default = 0)]
pub struct Ir {
#[bit(4, rw)]
pub cr_interrupt: [bool; 4],
#[bit(0, rw)]
pub mr_interrupt: [bool; 4],
}
I'd like to change the output from:
#[repr(C)]
/// Interrupt Register
pub struct Ir {
raw_value: u32,
}
to:
#[repr(transparent)]
/// Interrupt Register
pub struct Ir {
raw_value: u32,
}
``
Doing a volatile write on a struct type causes LLVM to emit some annoying loads/stores using the stack. This seems to be because the volatile operation gets converted to a volatile memcpy, and both the source (RAM) and the destination (MMIO) get treated as volatile.
I suspect that selecting
repr(transparent)instead ofrepr(C)would fix this. Is it possible to have a way to change the default repr?Basically given:
I'd like to change the output from:
to: