From 4edb5f2fdc49edf3b2dc6471d781cbe436548348 Mon Sep 17 00:00:00 2001 From: ghehg <166402688+ghehg@users.noreply.github.com> Date: Tue, 21 May 2024 20:40:47 -0400 Subject: [PATCH] [CIR] Move CIRDataLayout.h into include/clang/CIR/Dialect/IR (#621) Move it up for visibility, just like the other dialect headers. --- .../clang/CIR/Dialect/IR}/CIRDataLayout.h | 7 +++---- clang/lib/CIR/CodeGen/CIRGenAtomic.cpp | 3 ++- clang/lib/CIR/CodeGen/CIRGenBuilder.h | 2 +- clang/lib/CIR/CodeGen/CIRGenDecl.cpp | 4 ++-- clang/lib/CIR/CodeGen/CIRGenException.cpp | 4 ++-- clang/lib/CIR/CodeGen/CIRGenExprConst.cpp | 4 ++-- clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp | 2 +- clang/lib/CIR/CodeGen/CIRGenModule.h | 10 +++++----- clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) rename clang/{lib/CIR/CodeGen => include/clang/CIR/Dialect/IR}/CIRDataLayout.h (96%) diff --git a/clang/lib/CIR/CodeGen/CIRDataLayout.h b/clang/include/clang/CIR/Dialect/IR/CIRDataLayout.h similarity index 96% rename from clang/lib/CIR/CodeGen/CIRDataLayout.h rename to clang/include/clang/CIR/Dialect/IR/CIRDataLayout.h index ef9f737a5620..88e030fb424a 100644 --- a/clang/lib/CIR/CodeGen/CIRDataLayout.h +++ b/clang/include/clang/CIR/Dialect/IR/CIRDataLayout.h @@ -9,10 +9,9 @@ // it easier to port some of LLVM codegen layout logic to CIR. //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_LIB_CIR_CIRDATALAYOUT_H -#define LLVM_CLANG_LIB_CIR_CIRDATALAYOUT_H +#ifndef LLVM_CLANG_CIR_DIALECT_IR_CIRDATALAYOUT_H +#define LLVM_CLANG_CIR_DIALECT_IR_CIRDATALAYOUT_H -#include "UnimplementedFeatureGuarding.h" #include "mlir/Dialect/DLTI/DLTI.h" #include "mlir/IR/BuiltinOps.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" @@ -92,4 +91,4 @@ class CIRDataLayout { } // namespace cir -#endif \ No newline at end of file +#endif diff --git a/clang/lib/CIR/CodeGen/CIRGenAtomic.cpp b/clang/lib/CIR/CodeGen/CIRGenAtomic.cpp index 95d3b28682b4..6f6b8c91d84e 100644 --- a/clang/lib/CIR/CodeGen/CIRGenAtomic.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenAtomic.cpp @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// #include "Address.h" -#include "CIRDataLayout.h" + #include "CIRGenFunction.h" #include "CIRGenModule.h" #include "CIRGenOpenMPRuntime.h" @@ -20,6 +20,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/StmtVisitor.h" #include "clang/CIR/Dialect/IR/CIRAttrs.h" +#include "clang/CIR/Dialect/IR/CIRDataLayout.h" #include "clang/CIR/Dialect/IR/CIRDialect.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h index ea4676ac193c..e49f0f7b32db 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h +++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h @@ -10,7 +10,6 @@ #define LLVM_CLANG_LIB_CIR_CIRGENBUILDER_H #include "Address.h" -#include "CIRDataLayout.h" #include "CIRGenRecordLayout.h" #include "CIRGenTypeCache.h" #include "UnimplementedFeatureGuarding.h" @@ -19,6 +18,7 @@ #include "clang/AST/Type.h" #include "clang/CIR/Dialect/Builder/CIRBaseBuilder.h" #include "clang/CIR/Dialect/IR/CIRAttrs.h" +#include "clang/CIR/Dialect/IR/CIRDataLayout.h" #include "clang/CIR/Dialect/IR/CIRDialect.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" diff --git a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp index d1abfeeeb8c5..79623f4f362f 100644 --- a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp @@ -10,7 +10,6 @@ // //===----------------------------------------------------------------------===// -#include "CIRDataLayout.h" #include "CIRGenBuilder.h" #include "CIRGenCstEmitter.h" #include "CIRGenFunction.h" @@ -24,6 +23,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/ExprCXX.h" +#include "clang/CIR/Dialect/IR/CIRDataLayout.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" #include "llvm/Support/ErrorHandling.h" @@ -824,7 +824,7 @@ void CIRGenFunction::buildDecl(const Decl &D) { return; case Decl::NamespaceAlias: - case Decl::Using: // using X; [C++] + case Decl::Using: // using X; [C++] case Decl::UsingEnum: // using enum X; [C++] case Decl::UsingDirective: // using namespace X; [C++] assert(!UnimplementedFeature::generateDebugInfo()); diff --git a/clang/lib/CIR/CodeGen/CIRGenException.cpp b/clang/lib/CIR/CodeGen/CIRGenException.cpp index 1c0b686154f4..da34c762ac96 100644 --- a/clang/lib/CIR/CodeGen/CIRGenException.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenException.cpp @@ -10,7 +10,6 @@ // //===----------------------------------------------------------------------===// -#include "CIRDataLayout.h" #include "CIRGenCXXABI.h" #include "CIRGenCleanup.h" #include "CIRGenFunction.h" @@ -19,6 +18,7 @@ #include "clang/AST/StmtVisitor.h" #include "clang/CIR/Dialect/IR/CIRAttrs.h" +#include "clang/CIR/Dialect/IR/CIRDataLayout.h" #include "clang/CIR/Dialect/IR/CIRDialect.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" @@ -886,4 +886,4 @@ mlir::Operation *CIRGenFunction::getInvokeDestImpl() { mlir::Operation *CIRGenFunction::getTerminateLandingPad() { llvm_unreachable("NYI"); -} \ No newline at end of file +} diff --git a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp index ab40081c42e7..bad23ad72560 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp @@ -10,7 +10,6 @@ // //===----------------------------------------------------------------------===// #include "Address.h" -#include "CIRDataLayout.h" #include "CIRGenCstEmitter.h" #include "CIRGenFunction.h" #include "CIRGenModule.h" @@ -25,6 +24,7 @@ #include "clang/AST/StmtVisitor.h" #include "clang/Basic/Builtins.h" #include "clang/CIR/Dialect/IR/CIRAttrs.h" +#include "clang/CIR/Dialect/IR/CIRDataLayout.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Sequence.h" @@ -1875,4 +1875,4 @@ mlir::Attribute ConstantEmitter::emitNullForMemory(mlir::Location loc, CGM.buildNullConstant(T, loc).getDefiningOp()); assert(cstOp && "expected cir.const op"); return emitForMemory(CGM, cstOp.getValue(), T); -} \ No newline at end of file +} diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index d1284d268a2c..d0f2181044fe 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// #include "Address.h" -#include "CIRDataLayout.h" #include "CIRGenFunction.h" #include "CIRGenModule.h" #include "CIRGenOpenMPRuntime.h" @@ -19,6 +18,7 @@ #include "clang/AST/StmtVisitor.h" #include "clang/CIR/Dialect/IR/CIRAttrs.h" +#include "clang/CIR/Dialect/IR/CIRDataLayout.h" #include "clang/CIR/Dialect/IR/CIRDialect.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.h b/clang/lib/CIR/CodeGen/CIRGenModule.h index 946d3d2e5a7b..205dcaf62393 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.h +++ b/clang/lib/CIR/CodeGen/CIRGenModule.h @@ -13,7 +13,6 @@ #ifndef LLVM_CLANG_LIB_CODEGEN_CIRGENMODULE_H #define LLVM_CLANG_LIB_CODEGEN_CIRGENMODULE_H -#include "CIRDataLayout.h" #include "CIRGenBuilder.h" #include "CIRGenCall.h" #include "CIRGenTypeCache.h" @@ -27,6 +26,7 @@ #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" #include "clang/CIR/Dialect/IR/CIRAttrs.h" +#include "clang/CIR/Dialect/IR/CIRDataLayout.h" #include "clang/CIR/Dialect/IR/CIRDialect.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" #include "clang/CIR/Dialect/IR/CIRTypes.h" @@ -222,10 +222,10 @@ class CIRGenModule : public CIRGenTypeCache { mlir::cir::GlobalOp getOrInsertGlobal(mlir::Location loc, StringRef Name, mlir::Type Ty); - static mlir::cir::GlobalOp createGlobalOp(CIRGenModule &CGM, - mlir::Location loc, StringRef name, - mlir::Type t, bool isCst = false, - mlir::Operation *insertPoint = nullptr); + static mlir::cir::GlobalOp + createGlobalOp(CIRGenModule &CGM, mlir::Location loc, StringRef name, + mlir::Type t, bool isCst = false, + mlir::Operation *insertPoint = nullptr); // FIXME: Hardcoding priority here is gross. void AddGlobalCtor(mlir::cir::FuncOp Ctor, int Priority = 65535); diff --git a/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp b/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp index 485b89f75125..cdd1495f6064 100644 --- a/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp +++ b/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp @@ -1,5 +1,4 @@ -#include "CIRDataLayout.h" #include "CIRGenBuilder.h" #include "CIRGenModule.h" #include "CIRGenTypes.h" @@ -10,6 +9,7 @@ #include "clang/AST/DeclCXX.h" #include "clang/AST/RecordLayout.h" #include "clang/CIR/Dialect/IR/CIRAttrs.h" +#include "clang/CIR/Dialect/IR/CIRDataLayout.h" #include "llvm/IR/DataLayout.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h"