[llvm] [C API] Add getters and build function for CallBr (PR #91154)

Benji Smith via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 03:51:22 PDT 2024


================
@@ -3258,6 +3270,30 @@ LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr,
   return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
 }
 
+LLVMValueRef LLVMBuildCallBr(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
+                             LLVMBasicBlockRef DefaultDest,
+                             LLVMBasicBlockRef *IndrectDests,
+                             unsigned NumIndrectDests, LLVMValueRef *Args,
+                             unsigned NumArgs, LLVMOperandBundleRef *Bundles,
+                             unsigned NumBundles, const char *Name) {
+
+  SmallVector<OperandBundleDef, 8> OBs;
+  for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {
+    OperandBundleDef *OB = unwrap(Bundle);
+    OBs.push_back(*OB);
+  }
+
+  SmallVector<BasicBlock *, 8> IDs;
----------------
Benjins wrote:

I tried this, but it looks like `DEFINE_SIMPLE_CONVERSION_FUNCTIONS` only defines the single pointer conversion. Some types, e.g. `LLVMTypeRef`, also define an explicit double-pointer `wrap` and `unwrap`, but basic blocks do not afaict

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


More information about the llvm-commits mailing list