[LLVMdev] Attributes & CloneFunctionInto

Ralf Karrenberg Chareos at gmx.de
Wed May 15 08:51:09 PDT 2013


Hi John,

thanks for the pointer. However, I'd rather avoid rolling a custom 
implementation. After all, it's not like I want to do something 
drastically different...
I had sorted out the problem for 3.2 as well as a previous version of 
3.3 trunk, but the API changed about a hundred times. Now as it 
apparently has stabilized, I moved to a the 3.3 release branch just to 
find that even my previous workarounds don't work anymore.

I can't understand why the API of llvm::Function does not simply provide 
two functions
- setAttribute(unsigned paramIdx, AttributeKind A) and
- removeAttribute(unsigned paramIdx, AttributeKind A).

Cheers,
Ralf

On 5/15/13 5:39 PM, John Criswell wrote:
> On 5/15/13 10:27 AM, Ralf Karrenberg wrote:
>> Hi,
>>
>> I am again struggling to find my way around the Attribute classes.
>> What I want to do is clone a function into a declaration where some
>> parameters may have a different alignment.
>> CloneFunctionInto in debug mode hits an assertion which is marked with
>> a FIXME (Attributes.cpp:673).
>> I would be totally fine with any kind of workaround, e.g. removing all
>> attributes from the target declaration, then cloning, and then setting
>> the correct attributes.
>> However, I can't find a way to modify an existing alignment *in any
>> way* without hitting an assertion (the other one being line 727 for
>> removeAttributes). I've also tried using addAttributes() and
>> setAttributes() to set the alignment to 0, but this seems to be
>> ignored...
>
> SAFECode clones a function to change the alignment of byval arguments.
> You can look at the code at
> http://llvm.org/viewvc/llvm-project/safecode/branches/release_32/lib/BaggyBoundsChecks/BaggyBoundsChecks.cpp?revision=177641&view=markup.
>
>
> Note that the code works with LLVM 3.2.
>
> -- John T.
>
>>
>> Any help on this? :)
>>
>> Thanks,
>> Ralf
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



More information about the llvm-dev mailing list