[Mlir-commits] [mlir] [MLIR][LLVM] Block address support (PR #134335)

Tobias Gysi llvmlistbot at llvm.org
Fri Apr 4 01:10:38 PDT 2025


================
@@ -3815,6 +3840,55 @@ void InlineAsmOp::getEffects(
   }
 }
 
+//===----------------------------------------------------------------------===//
+// BlockAddressOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult
+BlockAddressOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
+  Operation *symbol = symbolTable.lookupSymbolIn(parentLLVMModule(*this),
+                                                 getBlockAddr().getFunction());
+  auto function = dyn_cast_or_null<LLVMFuncOp>(symbol);
+
+  if (!function)
+    return emitOpError("must reference a function defined by 'llvm.func'");
+
+  return success();
+}
+
+LLVMFuncOp BlockAddressOp::getFunction(SymbolTableCollection &symbolTable) {
+  return dyn_cast_or_null<LLVMFuncOp>(symbolTable.lookupSymbolIn(
+      parentLLVMModule(*this), getBlockAddr().getFunction()));
+}
+
+BlockTagOp BlockAddressOp::getBlockTagOp() {
+  auto m = (*this)->getParentOfType<ModuleOp>();
----------------
gysit wrote:

Could we use `parentLLVMModule` here as well?

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


More information about the Mlir-commits mailing list