[llvm-commits] [PATCH] Revised LandingPadInst Patch

Bill Wendling wendling at apple.com
Tue Aug 9 13:57:53 PDT 2011


On Aug 9, 2011, at 11:25 AM, Bill Wendling wrote:

> On Aug 9, 2011, at 2:32 AM, Duncan Sands wrote:
> 
>> Hi Bill,
>> 
>>>> An alternative is to have: for a catch, an operand which is a (bitcast) global
>>>> or null*; for a filter, an operand which is a constant array, each element of
>>>> which is a (bitcast) global or null*.  Thus each clause would only take up one
>>>> operand.
>>> 
>>> 
>>> The "OperandList" setup for the Instructions is rather complex as it is. Having two or more OperandLists (one list for each 'filter' array) gets very complex very quickly. And we want an OperandList-like data structure so that it can track uses of the LLVM IR objects.
>> 
>> I think you misunderstood.  I meant something like this:
>> 
>> @_ZTIc = external constant i8*
>> @_ZTId = external constant i8*
>> @_ZTIPKc = external constant i8*
>> 
>> %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
>>      cleanup
>>      i8** @_ZTIc          ; catch because global variable
>>      [0 x i8**] []        ; (empty) filter because constant array
>>      i8** @_ZTIc          ; catch because global variable
>>      [0 x i8**] []        ; (empty) filter because constant array
>>      i8** @_ZTId          ; catch because global variable
>>      [2 x i8**] [ i8** @_ZTIPKc, i8** @_ZTId ] ; filter because constant array
>> 
>> Ciao, Duncan.
> 
> Ah! I think I understand. So it's not so much that the arrays would be splatted out into the OperandList, but that they would be referenced from there (or something).
> 
> BTW, care must be taken. An empty filter has a specific meaning in this scheme: it's equivalent to a "throw()" in C++.
> 

That worked! Here's the revised patch. It now has no more (obvious) grossness in the LandingPadInst instruction. I modified the LangRef.html doc to show this change.

My only concern with going this route is that we no longer have a way to add additional clauses to the instruction. I could modify the patch slightly to add the clause type to the OperandList. So something like this:

OperandList[1] = ConstantInt::get(LandingPadInst::Catch)
OperandList[2] = i8** @_ZTIc
OperandList[3] = ConstantInst::get(LandingPadInst::Filter)
OperandList[4] = [2 x i8**] [ i8** @_ZTIPKc, i8** @_ZTId ]
etc.

Please review this and let me know if there are any further issues. :-)

-bw

-------------- next part --------------
A non-text attachment was scrubbed...
Name: landingpadinst.3.diff
Type: application/octet-stream
Size: 34960 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110809/d244538d/attachment.obj>
-------------- next part --------------




More information about the llvm-commits mailing list