[PATCH] D19181: Map Attribute in the C API.

Amaury SECHET via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 01:42:28 PDT 2016


deadalnix added a comment.

In http://reviews.llvm.org/D19181#424905, @jyknight wrote:

> There's some things missing:
>
> - No way to enumerate which attributes are present.


True. That's not the most useful use case in practice, but it can be added.

> - No way to access or create integer-valued attributes.


That's why LLVMAttributeRef needs to be exposed. All is needed to support new kind of attribute is a new builder, and then the same accessors can be used to set them.

> - No way to access or create string attributes.


Same as for int attributes + They need a new getter.

> The LLVMGetCallSiteAttr (and related) function is missing an "index" parameter -- at least I assume you mean for there to be such a parameter, like the old LLVMGetInstrAttribute?

> 

> If so: why does it make sense to have one function that handles all of function, return, and param attributes for call instructions, depending on the value of an index parameter, but to use three functions to do the same for declarations/definitions?

> 

> If not: can you clarify what the intended usage of the function is?


Yes they need one extra index parameter, sorry.

  void LLVMAddCallSiteAttr(LLVMValueRef Fn, unsigned Idx, LLVMAttributeRef A);
  void LLVMRemoveCallSiteAttr(LLVMValueRef Fn, unsigned Idx, unsigned KindID);
  LLVMAttributeRef LLVMGetCallSiteAttr(LLVMValueRef Fn, unsigned Idx, unsigned KindID);

An alternative is to support both function and callsites in the 3 other sets of setters/getters and get rid of that one.


http://reviews.llvm.org/D19181





More information about the llvm-commits mailing list