aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenModule.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 2a37d6c..d3b3b06 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -57,6 +57,18 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
FP80Ty = cir::FP80Type::get(&getMLIRContext());
FP128Ty = cir::FP128Type::get(&getMLIRContext());
+ PointerAlignInBytes =
+ astContext
+ .toCharUnitsFromBits(
+ astContext.getTargetInfo().getPointerAlign(LangAS::Default))
+ .getQuantity();
+
+ // TODO(CIR): Should be updated once TypeSizeInfoAttr is upstreamed
+ const unsigned sizeTypeSize =
+ astContext.getTypeSize(astContext.getSignedSizeType());
+ PtrDiffTy =
+ cir::IntType::get(&getMLIRContext(), sizeTypeSize, /*isSigned=*/true);
+
theModule->setAttr(cir::CIRDialect::getTripleAttrName(),
builder.getStringAttr(getTriple().str()));
}