[cfe-dev] [LLVMdev] ARM EABI Exceptions

Bill Wendling wendling at apple.com
Thu May 20 11:56:09 PDT 2010


On May 20, 2010, at 2:34 AM, Renato Golin wrote:

> Hi Duncan,
> 
>> if you compile with -fverbose-asm you should get some helpful comments
>> in the
>> action table. 
> 
> I can't compile directly with clang, I need first to generate IR than use
> LLC to generate the assembly. LLC doesn't accept that option. :(
> 
> I don't know why, but my changes only took effect on LLC, maybe I'm doing
> something wrong when compiling clang...
> 
> 
>> You could also send the tables to the mailing list.
> 
> I did, my first post. Attached again, just in case.
> 
> 
>> These aren't intrinsics, they are C++ standard library functions.
> 
> Sorry, you're right.
> 
Hi Renato,

I looked at the .s file you sent. We end up at the throw here:

.Ltmp9:
        ldr     r1, .LCPI1_2
        bl      __cxa_throw
.Ltmp10:


This has an action table of:

        .long   .Ltmp9-.Leh_func_begin1 @ Region start
        .long   .Ltmp10-.Ltmp9          @ Region length
        .long   .Ltmp11-.Leh_func_begin1 @ Landing pad
        .uleb128        3               @ Action

The action record is this:

        .sleb128        1               @   TypeInfo index
        .sleb128        0               @   Next action

(Here are the type infos

        .long   _ZTIc                   @ TypeInfo
        .long   _ZTIi                   @ TypeInfo
        .long   0                       @ TypeInfo
)

So the landing pad is a "catch-all", which is how LLVM does things (*mutter*guh*mutter*). That falls into here:

.Ltmp14:
        bl      _Unwind_Resume_or_Rethrow
.Ltmp15:

Which has an action table of:

        .long   .Ltmp14-.Leh_func_begin1 @ Region start
        .long   .Ltmp15-.Ltmp14         @ Region length
        .long   .Ltmp21-.Leh_func_begin1 @ Landing pad
        .uleb128        7               @ Action

And action record:

        .sleb128        3               @   TypeInfo index
        .sleb128        -3              @   Next action

So it'll try to catch a character type. If it can't, then it tries this action record:

        .sleb128        2               @   TypeInfo index
        .sleb128        -3              @   Next action

Which is an integer type. It should catch this, so it should go to the landing pad .Ltmp21. It should make its way to this lump of code:

.LBB1_20:                               @ %catch.next
        cmp     r1, #2
        bne     .LBB1_27
@ BB#21:                                @ %match27
        mov     r0, r4
        bl      __cxa_begin_catch
        ldr     r1, [r0]
        str     r1, [sp, #8]

And eventually the __cxa_end_catch here:

.LBB1_25:                               @ %match.end38
.Ltmp30:
        bl      __cxa_end_catch
.Ltmp31:

Is this the behavior you're seeing?

-bw





More information about the cfe-dev mailing list