[LLVMdev] Building function parameter AttributeSets quickly

Vesa Norilo vnorilo at siba.fi
Fri Jul 5 14:50:26 PDT 2013


Hi all,

Is there an efficient way to construct an AttributeSet for the purpose of  
constructing a Function?

The only (public) way I've found to designate the parameter index of  
attributes is via the addAttribute methods of the Function class or the  
AttributeSet. This is quite inefficient as a new AttributeSet is  
constructed every time. In fact, it takes the bulk of the time my codegen  
consumes when dealing with large parameter sets.

"HowToUseAttributes" suggests that AttrBuilder can be used as a mutable  
helper for this purpose. However, it seems to me that this can build the  
set of attributes that describe a single parameter, rather than a full set  
with indices.

I'm essentially looking for something like:
static AttributeSet get(LLVMContext &C, ArrayRef<std::pair<unsigned,  
Attribute> > Attrs);

But it is marked private.

Am I just missing the right way to do this?

Thanks!
Vesa



More information about the llvm-dev mailing list