[Mlir-commits] [mlir] [mlir][LLVM] Add the `byte` type to the LLVM dialect (PR #203795)
Fabian Mora
llvmlistbot at llvm.org
Mon Jun 15 04:39:03 PDT 2026
Markus =?utf-8?q?Böck?= <markus.boeck02 at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/203795 at github.com>
================
@@ -203,6 +203,21 @@ LLVMArrayType::getPreferredAlignment(const DataLayout &dataLayout,
return dataLayout.getTypePreferredAlignment(getElementType());
}
+//===----------------------------------------------------------------------===//
+// LLVMByteType
+//===----------------------------------------------------------------------===//
+
+llvm::TypeSize
+LLVMByteType::getTypeSizeInBits(const DataLayout &dataLayout,
+ DataLayoutEntryListRef params) const {
+ return llvm::TypeSize::getFixed(getBitWidth());
+}
+
+uint64_t LLVMByteType::getABIAlignment(const DataLayout &dataLayout,
+ DataLayoutEntryListRef params) const {
+ return llvm::PowerOf2Ceil(llvm::divideCeil(getBitWidth(), 8));
----------------
fabianmcg wrote:
This seems to assume that bytes are 8 bits, which is not true in general.
https://github.com/llvm/llvm-project/pull/203795
More information about the Mlir-commits
mailing list