<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Nov 1, 2007, at 1:53 PM, Duncan Sands wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">Finally, I made one change which I think wise but others might</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">consider pointless and suboptimal: in an unpacked struct the</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">amount of space allocated for a field is now given by the ABI</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">size rather than getTypeStoreSize.<SPAN class="Apple-converted-space">  </SPAN>I did this because every</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">other place that reserves memory for a type (eg: alloca) now</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">uses getABITypeSize, and I didn't want to make an exception</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">for unpacked structs, i.e. I did it to make things more uniform.</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">This only effects structs containing long doubles and arbitrary</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">precision integers.<SPAN class="Apple-converted-space">  </SPAN>If someone wants to pack these types more</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">tightly they can always use a packed struct.</FONT></P> </BLOCKQUOTE></DIV><BR><DIV>Naively, I just used getTypeSizeInBits() clang yesterday. I'll sync up clang once dust settles on llvm side in next day or two. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Now, how far we are from ability to use arbitrary precision integers to represent struct bit fields directly ?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>translating</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">      </SPAN>struct STest4 {char a; int b:2; int c:3; int d; } st4;</DIV><DIV>into</DIV><DIV>        %struct.STest4 = type { i8, i2, i3, i32 }</DIV><DIV>instead of</DIV><DIV>        %struct.STest4 = type { i8, i8, i32 }</DIV><DIV>?:)</DIV><DIV>-</DIV><DIV>Devang</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV></BODY></HTML>