[llvm-commits] [llvm] r43620 - in /llvm/trunk: include/llvm/Target/ lib/Analysis/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/ lib/ExecutionEngine/Interpreter/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/
Duncan Sands
baldrick at free.fr
Fri Nov 2 02:04:51 PDT 2007
> > Now, how far we are from ability to use arbitrary precision integers
> > to represent struct bit fields directly ?
> >
> > translating
> > struct STest4 {char a; int b:2; int c:3; int d; } st4;
> > into
> > %struct.STest4 = type { i8, i2, i3, i32 }
> > instead of
> > %struct.STest4 = type { i8, i8, i32 }
> > ?:)
> >
> We won't ever want to do that. "apints in structs" will be stored
> with their extra bits as garbage: they won't pack together. {i2, i3}
> will take two bytes for example. In practice, we will always have to
> compile the above into { i8, i8, i32 }.
Yes, this is correct. That said, you could always load b via an i2 load.
It might be convenient to use apints to load the minimum number of bits,
though it's not clear that it wins you anything much. However the final
value may need to end up in an apint to satisfy C semantics, see PR1721.
Ciao,
Duncan.
More information about the llvm-commits
mailing list