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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 19:44:04 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;
----------------
nikic wrote:

I see. In that case I think it would make sense to add the unwrap for BasicBlock**. (Maybe just as a static function inside this file?)

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


More information about the llvm-commits mailing list