diff --git a/third_party/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/third_party/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td index f4f6f20c0c0..33844ac070d 100644 --- a/third_party/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td +++ b/third_party/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td @@ -442,10 +442,10 @@ def LLVM_UnreachableOp : LLVM_TerminatorOp<"unreachable", []> { let printer = [{ *p << getOperationName(); }]; } -// Pseudo-operations (do not appear in LLVM IR but necessary for the dialect to -// work correctly). +// Auxiliary operations (do not appear in LLVM IR but necessary for the dialect +// to work correctly). def LLVM_AddressOfOp - : LLVM_OneResultOp<"addressof">, + : LLVM_OneResultOp<"mlir.addressof">, Arguments<(ins SymbolRefAttr:$global_name)> { let builders = [ OpBuilder<"Builder *builder, OperationState *result, LLVMType resType, " @@ -461,7 +461,8 @@ def LLVM_AddressOfOp ]; let extraClassDeclaration = [{ - /// Return the llvm.global operation that defined the value referenced here. + /// Return the llvm.mlir.global operation that defined the value referenced + /// here. GlobalOp getGlobal(); }]; @@ -471,7 +472,7 @@ def LLVM_AddressOfOp } def LLVM_GlobalOp - : LLVM_ZeroResultOp<"global">, + : LLVM_ZeroResultOp<"mlir.global">, Arguments<(ins TypeAttr:$type, UnitAttr:$constant, StrAttr:$sym_name, AnyAttr:$value)> { @@ -534,13 +535,13 @@ def LLVM_LLVMFuncOp : LLVM_ZeroResultOp<"func", }]; } -def LLVM_UndefOp : LLVM_OneResultOp<"undef", [NoSideEffect]>, +def LLVM_UndefOp : LLVM_OneResultOp<"mlir.undef", [NoSideEffect]>, LLVM_Builder<"$res = llvm::UndefValue::get($_resultType);"> { let parser = [{ return parseUndefOp(parser, result); }]; let printer = [{ printUndefOp(p, *this); }]; } def LLVM_ConstantOp - : LLVM_OneResultOp<"constant", [NoSideEffect]>, + : LLVM_OneResultOp<"mlir.constant", [NoSideEffect]>, Arguments<(ins AnyAttr:$value)>, LLVM_Builder<"$res = getLLVMConstant($_resultType, $value, $_location);"> { diff --git a/third_party/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h b/third_party/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h index 584d2a84fe9..c3304d4172c 100644 --- a/third_party/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h +++ b/third_party/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h @@ -89,7 +89,7 @@ private: ModuleOp mlirModule; std::unique_ptr llvmModule; - // Mappings between llvm.global definitions and corresponding globals. + // Mappings between llvm.mlir.global definitions and corresponding globals. llvm::DenseMap globalsMapping; protected: diff --git a/third_party/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/third_party/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp index 27ee2f62a4e..96dc9f65fc6 100644 --- a/third_party/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/third_party/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -779,7 +779,7 @@ static void printUndefOp(OpAsmPrinter *p, UndefOp &op) { *p << " : " << op.res()->getType(); } -// ::= `llvm.undef` attribute-dict? : type +// ::= `llvm.mlir.undef` attribute-dict? : type static ParseResult parseUndefOp(OpAsmParser *parser, OperationState *result) { Type type; @@ -825,7 +825,8 @@ static ParseResult parseAddressOfOp(OpAsmParser *parser, static LogicalResult verify(AddressOfOp op) { auto global = op.getGlobal(); if (!global) - return op.emitOpError("must reference a global defined by 'llvm.global'"); + return op.emitOpError( + "must reference a global defined by 'llvm.mlir.global'"); if (global.getType().getPointerTo() != op.getResult()->getType()) return op.emitOpError( @@ -844,7 +845,7 @@ static void printConstantOp(OpAsmPrinter *p, ConstantOp &op) { *p << " : " << op.res()->getType(); } -// ::= `llvm.constant` `(` attribute `)` attribute-list? : type +// ::= `llvm.mlir.constant` `(` attribute `)` attribute-list? : type static ParseResult parseConstantOp(OpAsmParser *parser, OperationState *result) { Attribute valueAttr; @@ -894,8 +895,8 @@ static void printGlobalOp(OpAsmPrinter *p, GlobalOp op) { p->printType(op.type()); } -// ::= `llvm.global` `constant`? `@` identifier `(` attribute `)` -// attribute-list? (`:` type)? +// ::= `llvm.mlir.global` `constant`? `@` identifier +// `(` attribute `)` attribute-list? (`:` type)? // // The type can be omitted for string attributes, in which case it will be // inferred from the value of the string as [strlen(value) x i8]. diff --git a/third_party/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/third_party/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp index e872794d426..198aa8fcf3c 100644 --- a/third_party/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/third_party/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -297,7 +297,8 @@ LogicalResult ModuleTranslation::convertBlock(Block &bb, bool ignoreArguments) { return success(); } -// Create named global variables that correspond to llvm.global definitions. +// Create named global variables that correspond to llvm.mlir.global +// definitions. void ModuleTranslation::convertGlobals() { for (auto op : mlirModule.getOps()) { llvm::Constant *cst;