[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 24 05:58:34 PDT 2025
================
@@ -0,0 +1,26 @@
+#include "llvm/ABI/ABIInfo.h"
+
+using namespace llvm::abi;
+bool ABIInfo::isAggregateTypeForABI(const Type *Ty) const {
+ // Member pointers are always aggregates
+ if (Ty->isMemberPointer())
+ return true;
+
+ // Check for fundamental scalar types
+ if (Ty->isInteger() || Ty->isFloat() || Ty->isPointer())
+ return false;
+
+ // Everything else is treated as aggregate
+ return true;
+}
+
+// Check if an integer type should be promoted
+bool ABIInfo::isPromotableIntegerType(const IntegerType *Ty) const {
+ unsigned BitWidth = Ty->getSizeInBits().getFixedValue();
+ return BitWidth < 32;
+}
+
+// Create indirect return with natural alignment
+ABIArgInfo ABIInfo::getNaturalAlignIndirect(const Type *Ty) const {
+ return ABIArgInfo::getIndirect(Ty->getAlignment().value(), /*ByVal=*/true);
----------------
nikic wrote:
I expect this is not going to do the right thing for types with explicit align attribute, but we'll see...
https://github.com/llvm/llvm-project/pull/140112
More information about the llvm-commits
mailing list