Skip to content

[clang][CIR] Merge the mlir::cir namespace into cir #115386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions clang/include/clang/CIR/Dialect/IR/CIRDialect.td
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}];
}

Expand Down
8 changes: 4 additions & 4 deletions clang/include/clang/CIR/Dialect/IR/CIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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>(
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/Dialect/IR/CIRAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/CIR/Dialect/IR/CIRDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand All @@ -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));
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/Dialect/IR/CIRTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading