[PATCH] D19181: Map Attribute in the C API.
whitequark via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 27 20:30:33 PDT 2016
whitequark added a comment.
@jyknight
> Why do you say adding a single attribute is the most common use-case? I'd expect the most common use to be to be creating a function definition/declaration/call instruction from scratch, with a given set of specified function/parameter/return-value attributes. Which is ideally suited for constructing an attribute set, and then calling a setter to place it onto the instruction. Why do you think RMW operations would be primary?
Based on the way bindings are implemented, and compatibility requirements, I expect that the majority of bindings will wish to stay compatible with code using their existing interface, which means adding attributes one by one. The interface that I proposed (LLVMAttributeRef + array getters/setters) allows them to painlessly upgrade from the old interface to the new one, and once they are ready to set attributes in bulk, much like AttributeSet works, they can easily opt in by using the array setters.
Whereas with your proposal, a significant overhaul of existing code is required to stay at the same place wrt amount of FFI calls.
Having the attribute position as a parameter is a minor convenience for LLVM-C maintainers. For bindings, both APIs are equally laborous to use but the one you propose also requires duplicating a enum within the binding code. So, I have no strong opinion of it but I don't see much point either.
http://reviews.llvm.org/D19181
More information about the llvm-commits
mailing list