[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:35 PDT 2024


================
@@ -128,6 +128,16 @@ class CodeGenTypes {
   /// memory representation is usually i8 or i32, depending on the target.
   llvm::Type *ConvertTypeForMem(QualType T, bool ForBitField = false);
 
+  /// Check that size and ABI alignment of given LLVM type matches size and
+  /// alignment of given AST type. If they don't, values of the type need to be
+  /// emitted as byte array.
+  bool typeRequiresSplitIntoByteArray(QualType ASTTy,
+                                      llvm::Type *LLVMTy = nullptr);
+
+  /// For AST types with special memory representation returns type
+  /// that ought to be used for load and store operations.
----------------
rjmccall wrote:

```
  /// Given that T is a scalar type, return the IR type that should
  /// be used for load and store operations.  For example, this might
  /// be i8 for _Bool or i96 for _BitInt(65).  The store size of the
  /// load/store type (as reported by LLVM's data layout) is always
  /// the same as the alloc size of the memory representation type
  /// returned by ConvertTypeForMem.
  ///
  /// As an optimization, if you already know the scalar value type
  /// for T (as would be returned by ConvertType), you can pass
  /// it as the second argument so that it does not need to be
  /// recomputed in common cases where the value type and
  /// load/store type are the same.
```

https://github.com/llvm/llvm-project/pull/91364


More information about the cfe-commits mailing list