[PATCH] D19081: Add LLVMGetAttrKindIDInContext in the C API in order to facilitate migration away from LLVMAttribute

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 19:54:16 PDT 2016


jyknight added a subscriber: jyknight.
jyknight added a comment.

So, the problem this is solving isn't that we need to be able to dynamically assign attribute ids, but that the C api uses a bitmask for attributes, rather than identifying them by, say, small ints, and thus it runs out of space.

But, what is the plan withLLVMGetAttribute (and similar) functions which cannot work if LLVMAttribute isn't a bitmap, since it returns just a single value?

There's also further issues which perhaps should be considered as part of a revamp of the C attribute access APIs: attributes aren't actually a simple flag, but can also have values. Align is already handled via extra functions in the C API, but there's a bunch of others now, too. Should all of those also get their own functions added? The "Target-dependent" attributes are one special case of that -- arbitrary string attribute names and values -- but the C API currently only supports setting them not retrieving them, and only on functions, not parameters.

I'd really like to see a more fleshed-out proposal for what the final state is expected to be.


http://reviews.llvm.org/D19081





More information about the llvm-commits mailing list