From 9b9c647cefea0a81fdf7d2bf6586a13f99d9a2cf Mon Sep 17 00:00:00 2001 From: River Riddle Date: Mon, 11 Nov 2019 18:18:02 -0800 Subject: Add support for nested symbol references. This change allows for adding additional nested references to a SymbolRefAttr to allow for further resolving a symbol if that symbol also defines a SymbolTable. If a referenced symbol also defines a symbol table, a nested reference can be used to refer to a symbol within that table. Nested references are printed after the main reference in the following form: symbol-ref-attribute ::= symbol-ref-id (`::` symbol-ref-id)* Example: module @reference { func @nested_reference() } my_reference_op @reference::@nested_reference Given that SymbolRefAttr is now more general, the existing functionality centered around a single reference is moved to a derived class FlatSymbolRefAttr. Followup commits will add support to lookups, rauw, etc. for scoped references. PiperOrigin-RevId: 279860501 --- mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mlir/lib/Target/LLVMIR/ModuleTranslation.cpp') diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp index 69f7e933d49..7f3ce5a738f 100644 --- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -52,7 +52,7 @@ llvm::Constant *ModuleTranslation::getLLVMConstant(llvm::Type *llvmType, return llvm::ConstantInt::get(llvmType, intAttr.getValue()); if (auto floatAttr = attr.dyn_cast()) return llvm::ConstantFP::get(llvmType, floatAttr.getValue()); - if (auto funcAttr = attr.dyn_cast()) + if (auto funcAttr = attr.dyn_cast()) return functionMapping.lookup(funcAttr.getValue()); if (auto splatAttr = attr.dyn_cast()) { auto *sequentialType = cast(llvmType); @@ -194,7 +194,7 @@ LogicalResult ModuleTranslation::convertOperation(Operation &opInst, auto convertCall = [this, &builder](Operation &op) -> llvm::Value * { auto operands = lookupValues(op.getOperands()); ArrayRef operandsRef(operands); - if (auto attr = op.getAttrOfType("callee")) { + if (auto attr = op.getAttrOfType("callee")) { return builder.CreateCall(functionMapping.lookup(attr.getValue()), operandsRef); } else { -- cgit v1.2.3