diff options
author | Shoaib Meenai <smeenai@fb.com> | 2024-11-07 14:36:29 -0800 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2024-11-07 14:36:29 -0800 |
commit | 69adad4ee21b88d93aa2ee158702a877946268be (patch) | |
tree | fe96b10e812e6316d15e2a7864131f1e7ac60c1c | |
parent | 6e9ae17ac9d0ba2f98081c6079fe7edbcb0cdf0a (diff) | |
download | llvm-users/smeenai/2/orig.zip llvm-users/smeenai/2/orig.tar.gz llvm-users/smeenai/2/orig.tar.bz2 |
[clang][CIR] Merge the mlir::cir namespace into cirusers/smeenai/2/orig
https://github.com/llvm/clangir/issues/1025 discusses the motivation.
The mechanical parts of this change were done via:
find clang \( -name '*.h' -o -name '*.cpp' -o -name '*.td' \) -print0 | xargs -0 perl -pi -e 's/mlir::cir/cir/g'
find clang \( -name '*.h' -o -name '*.cpp' \) -print0 | xargs -0 perl -pi -e 's/::cir/cir/g'
There were some manual fixups and a clang-format run afterwards.
ghstack-source-id: fe96b10e812e6316d15e2a7864131f1e7ac60c1c
ghstack-comment-id: 2463364322
Pull Request resolved: https://github.com/llvm/llvm-project/pull/115386
-rw-r--r-- | clang/include/clang/CIR/Dialect/IR/CIRDialect.td | 14 | ||||
-rw-r--r-- | clang/include/clang/CIR/Dialect/IR/CIROps.td | 8 | ||||
-rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenModule.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenerator.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CIR/Dialect/IR/CIRAttrs.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 10 | ||||
-rw-r--r-- | clang/lib/CIR/Dialect/IR/CIRTypes.cpp | 2 | ||||
-rw-r--r-- | clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 2 |
8 files changed, 22 insertions, 20 deletions
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td index 69d6e97..305a064 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td @@ -22,7 +22,7 @@ def CIR_Dialect : Dialect { let summary = "A high-level dialect for analyzing and optimizing Clang " "supported languages"; - let cppNamespace = "::mlir::cir"; + let cppNamespace = "::cir"; let useDefaultAttributePrinterParser = 0; let useDefaultTypePrinterParser = 0; @@ -31,13 +31,15 @@ def CIR_Dialect : Dialect { void registerAttributes(); void registerTypes(); - Type parseType(DialectAsmParser &parser) const override; - void printType(Type type, DialectAsmPrinter &printer) const override; + mlir::Type parseType(mlir::DialectAsmParser &parser) const override; + void printType(mlir::Type type, + mlir::DialectAsmPrinter &printer) const override; - Attribute parseAttribute(DialectAsmParser &parser, - Type type) const override; + mlir::Attribute parseAttribute(mlir::DialectAsmParser &parser, + mlir::Type type) const override; - void printAttribute(Attribute attr, DialectAsmPrinter &os) const override; + void printAttribute(mlir::Attribute attr, + mlir::DialectAsmPrinter &os) const override; }]; } diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index c0440fa..4462eb6 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -51,12 +51,12 @@ include "mlir/Interfaces/SideEffectInterfaces.td" // following: // // class CIRFooOpLowering -// : public mlir::OpConversionPattern<mlir::cir::FooOp> { +// : public mlir::OpConversionPattern<cir::FooOp> { // public: -// using OpConversionPattern<mlir::cir::FooOp>::OpConversionPattern; +// using OpConversionPattern<cir::FooOp>::OpConversionPattern; // // mlir::LogicalResult matchAndRewrite( -// mlir::cir::FooOp op, +// cir::FooOp op, // OpAdaptor adaptor, // mlir::ConversionPatternRewriter &rewriter) const override { // rewriter.replaceOpWithNewOp<mlir::LLVM::BarOp>( @@ -92,7 +92,7 @@ def FuncOp : CIR_Op<"func"> { let skipDefaultBuilders = 1; - let builders = [OpBuilder<(ins "StringRef":$name)>]; + let builders = [OpBuilder<(ins "llvm::StringRef":$name)>]; let hasCustomAssemblyFormat = 1; let hasVerifier = 1; diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 5a6fc27..4e8a8cc 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -77,7 +77,7 @@ void CIRGenModule::buildGlobal(clang::GlobalDecl gd) { void CIRGenModule::buildGlobalFunctionDefinition(clang::GlobalDecl gd, mlir::Operation *op) { auto const *funcDecl = cast<FunctionDecl>(gd.getDecl()); - auto funcOp = builder.create<mlir::cir::FuncOp>( + auto funcOp = builder.create<cir::FuncOp>( getLoc(funcDecl->getSourceRange()), funcDecl->getIdentifier()->getName()); theModule.push_back(funcOp); } diff --git a/clang/lib/CIR/CodeGen/CIRGenerator.cpp b/clang/lib/CIR/CodeGen/CIRGenerator.cpp index 825f78d..85367a9 100644 --- a/clang/lib/CIR/CodeGen/CIRGenerator.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenerator.cpp @@ -35,7 +35,7 @@ void CIRGenerator::Initialize(ASTContext &astCtx) { this->astCtx = &astCtx; mlirCtx = std::make_unique<mlir::MLIRContext>(); - mlirCtx->loadDialect<mlir::cir::CIRDialect>(); + mlirCtx->loadDialect<cir::CIRDialect>(); cgm = std::make_unique<clang::CIRGen::CIRGenModule>(*mlirCtx.get(), astCtx, codeGenOpts, diags); } diff --git a/clang/lib/CIR/Dialect/IR/CIRAttrs.cpp b/clang/lib/CIR/Dialect/IR/CIRAttrs.cpp index 6d74d72..7d42da1 100644 --- a/clang/lib/CIR/Dialect/IR/CIRAttrs.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRAttrs.cpp @@ -13,7 +13,7 @@ #include "clang/CIR/Dialect/IR/CIRDialect.h" using namespace mlir; -using namespace mlir::cir; +using namespace cir; //===----------------------------------------------------------------------===// // General CIR parsing / printing diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index e0b38a2..f666e5a 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -17,13 +17,13 @@ #include "clang/CIR/Dialect/IR/CIROpsDialect.cpp.inc" using namespace mlir; -using namespace mlir::cir; +using namespace cir; //===----------------------------------------------------------------------===// // CIR Dialect //===----------------------------------------------------------------------===// -void mlir::cir::CIRDialect::initialize() { +void cir::CIRDialect::initialize() { registerTypes(); registerAttributes(); addOperations< @@ -36,8 +36,8 @@ void mlir::cir::CIRDialect::initialize() { // FuncOp //===----------------------------------------------------------------------===// -void mlir::cir::FuncOp::build(OpBuilder &builder, OperationState &result, - StringRef name) { +void cir::FuncOp::build(OpBuilder &builder, OperationState &result, + StringRef name) { result.addAttribute(SymbolTable::getSymbolAttrName(), builder.getStringAttr(name)); } @@ -56,7 +56,7 @@ void cir::FuncOp::print(OpAsmPrinter &p) { p.printSymbolName(getSymName()); } -mlir::LogicalResult mlir::cir::FuncOp::verify() { return success(); } +mlir::LogicalResult cir::FuncOp::verify() { return success(); } //===----------------------------------------------------------------------===// // TableGen'd op method definitions diff --git a/clang/lib/CIR/Dialect/IR/CIRTypes.cpp b/clang/lib/CIR/Dialect/IR/CIRTypes.cpp index 167c237..4eeb70f 100644 --- a/clang/lib/CIR/Dialect/IR/CIRTypes.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRTypes.cpp @@ -13,7 +13,7 @@ #include "clang/CIR/Dialect/IR/CIRDialect.h" using namespace mlir; -using namespace mlir::cir; +using namespace cir; //===----------------------------------------------------------------------===// // General CIR parsing / printing diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 60fde03..3f95a1e 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -67,7 +67,7 @@ CreateFrontendBaseAction(CompilerInstance &CI) { case EmitBC: return std::make_unique<EmitBCAction>(); case EmitCIR: #if CLANG_ENABLE_CIR - return std::make_unique<::cir::EmitCIRAction>(); + return std::make_unique<cir::EmitCIRAction>(); #else llvm_unreachable("CIR suppport not built into clang"); #endif |