[llvm] [C API] Add function to create constantRange attributes to C API (PR #90505)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 21:09:02 PDT 2024


================
@@ -178,6 +179,19 @@ LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A) {
   return wrap(Attr.getValueAsType());
 }
 
+LLVMAttributeRef LLVMCreateConstantRangeAttribute(
+    LLVMContextRef C, unsigned KindID, LLVMTypeRef IntTy,
+    unsigned LowerNumWords, const uint64_t LowerWords[], unsigned UpperNumWords,
+    const uint64_t UpperWords[]) {
+  unsigned BitWidth = unwrap<IntegerType>(IntTy)->getBitWidth();
----------------
andjo403 wrote:

yes think that is a good change only did it like this to match the IR but it is not the same here as we here have a name of the variable. it also was like that in LLVMConstIntOfArbitraryPrecision but there it is also used to get the context, but think that it is more in sync with the other create attribute functions to have context in this function also.

https://github.com/llvm/llvm-project/pull/90505


More information about the llvm-commits mailing list