Skip to content

Commit

Permalink
[MLIR][Interfaces] Do not use extraClassDefnition
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrodin committed Feb 7, 2025
1 parent b388d6a commit 2a631ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
12 changes: 0 additions & 12 deletions mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -782,11 +782,6 @@ def LLVM_CallOp : LLVM_MemAccessOpBase<"call",
/// Returns the callee function type.
LLVMFunctionType getCalleeFunctionType();
}];
let extraClassDefinition = [{
std::optional<::mlir::StringRef> $cppClass::getUserSymbol() {
return getCallee();
}
}];
}

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -1226,13 +1221,6 @@ def LLVM_AddressOfOp : LLVM_Op<"mlir.addressof",
LLVMFuncOp getFunction(SymbolTableCollection &symbolTable);

}];

let extraClassDefinition = [{
std::optional<::mlir::StringRef> $cppClass::getUserSymbol() {
return {getGlobalName()};
}
}];

let assemblyFormat = "$global_name attr-dict `:` qualified(type($res))";

let hasFolder = 1;
Expand Down
5 changes: 5 additions & 0 deletions mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,7 @@ LogicalResult CallOp::verifySymbolUses(SymbolTableCollection &symbolTable) {

return success();
}
std::optional<::mlir::StringRef> CallOp::getUserSymbol() { return getCallee(); }

void CallOp::print(OpAsmPrinter &p) {
auto callee = getCallee();
Expand Down Expand Up @@ -2071,6 +2072,10 @@ AddressOfOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
return success();
}

std::optional<::mlir::StringRef> AddressOfOp::getUserSymbol() {
return getGlobalName();
}

// AddressOfOp constant-folds to the global symbol name.
OpFoldResult LLVM::AddressOfOp::fold(FoldAdaptor) {
return getGlobalNameAttr();
Expand Down

0 comments on commit 2a631ae

Please sign in to comment.