[LLVMdev] Exception Tables in latest LLVM
Duncan Sands
baldrick at free.fr
Fri Sep 2 09:31:31 PDT 2011
Hi Yiannis,
>>> I have been using llvm 2.8 (i know ancient history!) for a backend that i was
>>> implementing. I have been trying to port my patches to latest llvm (svn build)
>>> lately but i have one problem as far as the Exception Handling mechanism is
>>> concerned. It seems that there are no Exception Tables generated any more such
>>> as the one below:
you need to add a landingpad instruction to the start of each basic block with
is that unwind target of an invoke. Since you only seem to be interested in
cleanups, something like this should do:
declare i32 @__gcc_personality_v0(i32, i64, i8*, i8*)
...
invoke void @foo() to label %cont unwind label %lp
lp:
%tmp = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)*
@__gcc_personality_v0 cleanup
...
Ciao, Duncan.
>>
>> got some example bitcode for which you see this (or, rather, don't see this
>> since the problem is that you are not seeing exception tables)?
>>
>> Ciao, Duncan.
>>
>>>
>>> .section .gcc_except_table,"a", at progbits
>>> .align 4
>>> GCC_except_table0:
>>> .Lexception0:
>>> .byte 255 # @LPStart Encoding = omit
>>> .byte 3 # @TType Encoding = udata4
>>> .uleb128 41 # @TType base offset
>>> .byte 3 # Call site Encoding = udata4
>>> .uleb128 39 # Call site table length
>>> .Lset0 = .Leh_func_begin0-.Leh_func_begin0 # Region start
>>> .long .Lset0
>>> .Lset1 = .Ltmp0-.Leh_func_begin0 # Region length
>>> .long .Lset1
>>> .long 0 # Landing pad
>>> .uleb128 0 # Action
>>> .Lset2 = .Ltmp0-.Leh_func_begin0 # Region start
>>> .long .Lset2
>>> .Lset3 = .Ltmp1-.Ltmp0 # Region length
>>> .long .Lset3
>>> .Lset4 = .Ltmp2-.Leh_func_begin0 # Landing pad
>>> .long .Lset4
>>> .uleb128 0 # Action
>>> .Lset5 = .Ltmp1-.Leh_func_begin0 # Region start
>>> .long .Lset5
>>> .Lset6 = .Leh_func_end0-.Ltmp1 # Region length
>>> .long .Lset6
>>> .long 0 # Landing pad
>>> .uleb128 0 # Action
>>> .align 4
>>>
>>>
>>> I've searched for this but i couldn't find some documentation about the changes
>>> in the EH staff and the documentation on the website is not complete... Is there
>>> any way i can force the generation of these tables in current LLVM?
>>>
>>> Thanks in advance,
>>> Yiannis
>>>
> Hi Duncan,
>
> Sorry for my omission! I attach an example (test_0.ll). I do:
> llvm-as < test_0.ll | llc
> and i get output-llvm28.txt with the 2.8 versions of the tools and i repeat with
> the latest versions from the svn repo and i get output-llvm30.txt.
>
> As you can see there is a:
> .section .gcc_except_table,"a", at progbits
> ....
> in the 2.8 output just below the code segment while there is no such section in
> the 3.0 case!
>
> Thanks again,
> Yiannis
More information about the llvm-dev
mailing list