[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 8 15:25:36 PDT 2024
================
@@ -118,6 +124,39 @@ llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T, bool ForBitField) {
return R;
}
+bool CodeGenTypes::typeRequiresSplitIntoByteArray(QualType ASTTy,
+ llvm::Type *LLVMTy) {
+ if (!LLVMTy)
+ LLVMTy = ConvertType(ASTTy);
+
+ CharUnits ASTSize = Context.getTypeSizeInChars(ASTTy);
+ CharUnits LLVMSize =
+ CharUnits::fromQuantity(getDataLayout().getTypeAllocSize(LLVMTy));
+ return ASTSize != LLVMSize;
+}
+
+llvm::Type *CodeGenTypes::convertTypeForLoadStore(QualType T,
+ llvm::Type *LLVMTy) {
+ if (!LLVMTy)
+ LLVMTy = ConvertType(T);
+
+ if (!T->isBitIntType() && LLVMTy->isIntegerTy(1))
+ return llvm::IntegerType::get(getLLVMContext(),
+ (unsigned)Context.getTypeSize(T));
+
+ if (T->isBitIntType()) {
----------------
rjmccall wrote:
You can avoid a second call to `isBitIntType()` by just putting this block before the one above it.
https://github.com/llvm/llvm-project/pull/91364
More information about the cfe-commits
mailing list