[clang] [clang][PowerPC] Add flag to enable compatibility with GNU for complex arguments (PR #77732)
Kishan Parmar via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 14 05:22:54 PDT 2024
================
@@ -337,12 +347,58 @@ CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty) const {
return CharUnits::fromQuantity(4);
}
+ABIArgInfo PPC32_SVR4_ABIInfo::handleComplex(uint64_t &TypeSize) const {
+ llvm::Type *ElemTy;
+ unsigned RegsNeeded; // Registers Needed for Complex.
+
+ if (TypeSize == 64) {
+ ElemTy = llvm::Type::getInt64Ty(getVMContext());
+ RegsNeeded = 1;
+ } else {
+ ElemTy = llvm::Type::getInt32Ty(getVMContext());
+ RegsNeeded = (TypeSize + 31) / 32;
+ }
+ return ABIArgInfo::getDirect(llvm::ArrayType::get(ElemTy, RegsNeeded));
+}
+
+ABIArgInfo PPC32_SVR4_ABIInfo::classifyArgumentType(QualType Ty,
+ int &ArgGPRsLeft) const {
+ assert(ArgGPRsLeft <= NumArgGPRs && "Arg GPR tracking underflow");
+ Ty = useFirstFieldIfTransparentUnion(Ty);
+
+ ASTContext &Context = getContext();
+
+ uint64_t TypeSize = Context.getTypeSize(Ty);
+
+ if (IsComplexInRegABI && Ty->isAnyComplexType() &&
+ TypeSize <= RegLen * ArgGPRsLeft) {
+ assert(Ty->isAnyComplexType() && "Ty must be Complex type.");
----------------
Long5hot wrote:
I apologize because, There's a bug here. for if not IsComplexInRegABI we need to --ArgGPRsLeft;
Will test and update the review accordingly.
Thank you.
https://github.com/llvm/llvm-project/pull/77732
More information about the cfe-commits
mailing list