Lines Matching +full:right +full:- +full:aligned

1 //===- PPC.cpp ------------------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
27 CGF.Builder.CreateConstInBoundsByteGEP(RealAddr, SlotSize - EltSize); in complexTempStructure()
29 2 * SlotSize - EltSize); in complexTempStructure()
34 llvm::Type *EltTy = CGF.ConvertTypeForMem(CTy->getElementType()); in complexTempStructure()
56 // 0-31: r0-31, the 4-byte or 8-byte general-purpose registers in PPC_initDwarfEHRegSizeTable()
59 // 32-63: fp0-31, the 8-byte floating-point registers in PPC_initDwarfEHRegSizeTable()
62 // 64-67 are various 4-byte or 8-byte special-purpose registers: in PPC_initDwarfEHRegSizeTable()
69 // 68-76 are various 4-byte special-purpose registers: in PPC_initDwarfEHRegSizeTable()
70 // 68-75 cr0-7 in PPC_initDwarfEHRegSizeTable()
74 // 77-108: v0-31, the 16-byte vector registers in PPC_initDwarfEHRegSizeTable()
95 // 64-bit only registers: in PPC_initDwarfEHRegSizeTable()
106 /// AIXABIInfo - The AIX XCOFF ABI information.
152 // Return true if the ABI requires Ty to be passed sign- or zero-
156 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in isPromotableTypeForABI()
157 Ty = EnumTy->getDecl()->getIntegerType(); in isPromotableTypeForABI()
167 // need to extend all 32-bit types, since the ABI requires promotion to 64 in isPromotableTypeForABI()
169 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) in isPromotableTypeForABI()
170 switch (BT->getKind()) { in isPromotableTypeForABI()
182 if (RetTy->isAnyComplexType()) in classifyReturnType()
185 if (RetTy->isVectorType()) in classifyReturnType()
188 if (RetTy->isVoidType()) in classifyReturnType()
201 if (Ty->isAnyComplexType()) in classifyArgumentType()
204 if (Ty->isVectorType()) in classifyArgumentType()
208 // Records with non-trivial destructors/copy-constructors should not be in classifyArgumentType()
226 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) in getParamTypeAlignment()
227 Ty = CTy->getElementType(); in getParamTypeAlignment()
229 if (Ty->isVectorType()) in getParamTypeAlignment()
248 // size, the ABI calls for the real and imaginary parts to be right-adjusted in EmitVAArg()
254 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) { in EmitVAArg()
275 auto GVId = GV->getName(); in setTargetAttributes()
277 // Is this a global variable specified by the user as toc-data? in setTargetAttributes()
286 GV->getParent()->getDataLayout().getPointerSizeInBits() / 8; in setTargetAttributes()
290 ASTContext &Context = D->getASTContext(); in setTargetAttributes()
292 const auto *Ty = VarD->getType().getTypePtr(); in setTargetAttributes()
294 Ty->isRecordType() ? Ty->getAs<RecordType>()->getDecl() : nullptr; in setTargetAttributes()
296 bool EmitDiagnostic = UserSpecifiedTOC && GV->hasExternalLinkage(); in setTargetAttributes()
299 M.getDiags().Report(D->getLocation(), diag::warn_toc_unsupported_type) in setTargetAttributes()
302 if (!Ty || Ty->isIncompleteType()) in setTargetAttributes()
304 else if (RDecl && RDecl->hasFlexibleArrayMember()) in setTargetAttributes()
307 else if (VarD->getTLSKind() != VarDecl::TLS_None) in setTargetAttributes()
309 else if (PointerSize < Context.getTypeInfo(VarD->getType()).Width / 8) in setTargetAttributes()
314 "variable is aligned wider than a pointer"); in setTargetAttributes()
315 else if (D->hasAttr<SectionAttr>()) in setTargetAttributes()
318 else if (GV->hasExternalLinkage() || in setTargetAttributes()
319 (M.getCodeGenOpts().AllTocData && !GV->hasLocalLinkage())) in setTargetAttributes()
320 GVar->addAttribute("toc-data"); in setTargetAttributes()
324 // PowerPC-32
326 /// PPC32_SVR4_ABIInfo - The 32-bit PowerPC ELF (SVR4) ABI information.
374 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) in getParamTypeAlignment()
375 Ty = CTy->getElementType(); in getParamTypeAlignment()
377 if (Ty->isVectorType()) in getParamTypeAlignment()
381 // For single-element float/vector structs, we consider the whole type in getParamTypeAlignment()
385 const BuiltinType *BT = EltType->getAs<BuiltinType>(); in getParamTypeAlignment()
386 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) || in getParamTypeAlignment()
387 (BT && BT->isFloatingPoint())) in getParamTypeAlignment()
392 return CharUnits::fromQuantity(AlignTy->isVectorType() ? 16 : 4); in getParamTypeAlignment()
399 // -msvr4-struct-return puts small aggregates in GPR3 and GPR4. in classifyReturnType()
402 // System V ABI (1995), page 3-22, specified: in classifyReturnType()
405 // > 8-byte aligned memory area and then the low addressed word were in classifyReturnType()
406 // > loaded into r3 and the high-addressed word into r4. Bits beyond in classifyReturnType()
409 // GCC for big-endian PPC32 inserts the pad before the first member, in classifyReturnType()
439 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) { in EmitVAArg()
453 bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64; in EmitVAArg()
454 bool isInt = !Ty->isFloatingType(); in EmitVAArg()
455 bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64; in EmitVAArg()
458 // with the argument-lowering code. in EmitVAArg()
463 // The calling convention either uses 1-2 GPRs or 1 FPR. in EmitVAArg()
502 // Floating-point registers start after the general-purpose registers. in EmitVAArg()
518 // Increase the used-register count. in EmitVAArg()
587 case CodeGenOptions::SRCK_OnStack: // -maix-struct-return in isStructReturnInRegABI()
589 case CodeGenOptions::SRCK_InRegs: // -msvr4-struct-return in isStructReturnInRegABI()
606 // PowerPC-64
610 /// PPC64_SVR4_ABIInfo - The 64-bit PowerPC ELF (SVR4) ABI information.
634 // floating-point value) to avoid pushing them to memory on function
642 // One exception: An aggregate containing a single floating-point in computeInfo()
646 const BuiltinType *BT = T->getAs<BuiltinType>(); in computeInfo()
647 if ((T->isVectorType() && getContext().getTypeSize(T) == 128) || in computeInfo()
648 (BT && BT->isFloatingPoint())) { in computeInfo()
700 // Return true if the ABI requires Ty to be passed sign- or zero-
705 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in isPromotableTypeForABI()
706 Ty = EnumTy->getDecl()->getIntegerType(); in isPromotableTypeForABI()
713 // extend all 32-bit types, since the ABI requires promotion to 64 bits. in isPromotableTypeForABI()
714 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) in isPromotableTypeForABI()
715 switch (BT->getKind()) { in isPromotableTypeForABI()
723 if (const auto *EIT = Ty->getAs<BitIntType>()) in isPromotableTypeForABI()
724 if (EIT->getNumBits() < 64) in isPromotableTypeForABI()
730 /// isAlignedParamType - Determine whether a type requires 16-byte or
734 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) in getParamTypeAlignment()
735 Ty = CTy->getElementType(); in getParamTypeAlignment()
738 return Ty->isRealFloatingType() && &getContext().getFloatTypeSemantics( in getParamTypeAlignment()
743 // passed via reference, smaller types are not aligned). in getParamTypeAlignment()
744 if (Ty->isVectorType()) { in getParamTypeAlignment()
748 // precision floating-point values in IEEE BINARY 128 QUADRUPLE PRECISION in getParamTypeAlignment()
749 // format are supported, map them to a single quadword, quadword aligned. in getParamTypeAlignment()
753 // For single-element float/vector structs, we consider the whole type in getParamTypeAlignment()
758 const BuiltinType *BT = EltType->getAs<BuiltinType>(); in getParamTypeAlignment()
759 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) || in getParamTypeAlignment()
760 (BT && BT->isFloatingPoint())) in getParamTypeAlignment()
773 bool UsesVector = AlignAsType->isVectorType() || in getParamTypeAlignment()
789 // double, long double, or 128-bit vectors. in isHomogeneousAggregateBaseType()
790 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { in isHomogeneousAggregateBaseType()
791 if (BT->getKind() == BuiltinType::Float || in isHomogeneousAggregateBaseType()
792 BT->getKind() == BuiltinType::Double || in isHomogeneousAggregateBaseType()
793 BT->getKind() == BuiltinType::LongDouble || in isHomogeneousAggregateBaseType()
794 BT->getKind() == BuiltinType::Ibm128 || in isHomogeneousAggregateBaseType()
796 (BT->getKind() == BuiltinType::Float128))) { in isHomogeneousAggregateBaseType()
802 if (const VectorType *VT = Ty->getAs<VectorType>()) { in isHomogeneousAggregateBaseType()
815 Base->isFloat128Type()) || in isHomogeneousAggregateSmallEnough()
816 Base->isVectorType()) ? 1 in isHomogeneousAggregateSmallEnough()
827 if (Ty->isAnyComplexType()) in classifyArgumentType()
830 // Non-Altivec vector types are passed in GPRs (smaller than 16 bytes) in classifyArgumentType()
832 if (Ty->isVectorType()) { in classifyArgumentType()
842 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
843 if (EIT->getNumBits() > 128) in classifyArgumentType()
866 // back-end to store the argument to memory. in classifyArgumentType()
872 // properly aligned in the argument save area doubleword). in classifyArgumentType()
900 if (RetTy->isVoidType()) in classifyReturnType()
903 if (RetTy->isAnyComplexType()) in classifyReturnType()
906 // Non-Altivec vector types are returned in GPRs (smaller than 16 bytes) in classifyReturnType()
908 if (RetTy->isVectorType()) { in classifyReturnType()
918 if (const auto *EIT = RetTy->getAs<BitIntType>()) in classifyReturnType()
919 if (EIT->getNumBits() > 128) in classifyReturnType()
957 // Based on ARMABIInfo::EmitVAArg, adjusted for 64-bit machine.
966 // the ABI calls for the real and imaginary parts to be right-adjusted in EmitVAArg()
971 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) { in EmitVAArg()
985 // register, which means that after spilling on big-endian targets they will in EmitVAArg()
986 // be right-aligned in their argument slot. This is uncommon; for a variety of in EmitVAArg()
987 // reasons, other big-endian targets don't end up right-aligning aggregate in EmitVAArg()
988 // types this way, and so right-alignment only applies to fundamental types. in EmitVAArg()
989 // So on PPC64, we must force the use of right-alignment even for aggregates. in EmitVAArg()
1010 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi", in emitTargetMetadata()
1013 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi", in emitTargetMetadata()
1016 CGM.getModule().addModuleFlag(llvm::Module::Error, "float-abi", in emitTargetMetadata()