[llvm-commits] [llvm] r81424 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
Bill Wendling
isanbard at gmail.com
Wed Sep 9 23:28:01 PDT 2009
Hi Duncan,
>>
>> Don't hardcode the TType format size. In fact, rework the code so
>> that it's more
>> like what GCC outputs. The mysterious code to insert padding wasn't
>> in GCC at
>> all.
>
> woah, be careful here! The type infos need to be aligned. GCC does
> this by inserting padding just before the type infos. However this
> changes the size of the exception table, so you need to take this into
> account when you output the exception table size. However, the size
> is
> output using a variable length encoding. So by increasing the size by
> inserting padding, you may increase the number of bytes used for
> writing
> the size. If it increases, say by one byte, then you now need to
> output
> one less byte of padding to get the typeinfos aligned. However this
> decreases the size of the exception table. This changes the value you
> have to output for the exception table size. Due to the variable
> length
> encoding, the number of bytes used for writing the length may
> decrease.
> If so, you then have to increase the amount of padding. And so on.
> If
> you look carefully at the GCC code you will see that it indeed does
> this
> in a loop, going on and on until the values stabilize (if they ever
> do -
> I couldn't convince myself that they always would). Because this
> was so
> horrible, I chose another solution: don't output padding inside the
> table like GCC does, instead output it before the table.
>
> So please don't follow GCC here, and please don't output alignment
> directives inside the table - it's a horrible can of worms.
>
I reverted that part of the patch. Thanks for the explanation. Please
let me know how Ada does with the DwarfException.cpp changes I did
today.
-bw
More information about the llvm-commits
mailing list