10#include "TargetInfo.h"
21 SlotSize, SlotSize,
true);
29 2 * SlotSize - EltSize);
44 llvm::Value *
Address,
bool Is64Bit,
51 llvm::IntegerType *i8 = CGF.
Int8Ty;
52 llvm::Value *Four8 = llvm::ConstantInt::get(i8, 4);
53 llvm::Value *Eight8 = llvm::ConstantInt::get(i8, 8);
54 llvm::Value *Sixteen8 = llvm::ConstantInt::get(i8, 16);
107class AIXABIInfo :
public ABIInfo {
109 const unsigned PtrByteSize;
110 CharUnits getParamTypeAlignment(QualType Ty)
const;
113 AIXABIInfo(CodeGen::CodeGenTypes &CGT,
bool Is64Bit)
114 : ABIInfo(CGT), Is64Bit(Is64Bit), PtrByteSize(Is64Bit ? 8 : 4) {}
116 bool isPromotableTypeForABI(QualType Ty)
const;
121 void computeInfo(CGFunctionInfo &FI)
const override {
129 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
130 AggValueSlot Slot)
const override;
133 void appendAttributeMangling(TargetClonesAttr *Attr,
unsigned Index,
134 raw_ostream &Out)
const override;
135 void appendAttributeMangling(StringRef AttrStr,
136 raw_ostream &Out)
const override;
139void AIXABIInfo::appendAttributeMangling(TargetClonesAttr *
Attr,
unsigned Index,
140 raw_ostream &Out)
const {
141 appendAttributeMangling(Attr->getFeatureStr(Index), Out);
144void AIXABIInfo::appendAttributeMangling(StringRef AttrStr,
145 raw_ostream &Out)
const {
146 if (AttrStr ==
"default") {
151 const TargetInfo &TI = CGT.getTarget();
154 if (!Info.
CPU.empty()) {
155 assert(Info.
Features.empty() &&
"cannot have both a CPU and a feature");
156 Out <<
".cpu_" << Info.
CPU;
166 std::string MangledName(
Feature.drop_front(1));
167 std::replace(MangledName.begin(), MangledName.end(),
'-',
'_');
169 Out <<
"." << (
Feature.starts_with(
"-") ?
"no_" :
"") << MangledName;
173 llvm_unreachable(
"Invalid target_clones parameter");
176class AIXTargetCodeGenInfo :
public TargetCodeGenInfo {
180 AIXTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT,
bool Is64Bit)
181 : TargetCodeGenInfo(std::make_unique<AIXABIInfo>(CGT, Is64Bit)),
183 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
187 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
188 llvm::Value *Address)
const override;
190 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
191 CodeGen::CodeGenModule &M)
const override;
197bool AIXABIInfo::isPromotableTypeForABI(QualType Ty)
const {
200 Ty = ED->getIntegerType();
203 if (getContext().isPromotableIntegerType(Ty))
212 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
213 switch (BT->getKind()) {
214 case BuiltinType::Int:
215 case BuiltinType::UInt:
224ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy)
const {
235 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
241ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty)
const {
254 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
257 CharUnits CCAlign = getParamTypeAlignment(Ty);
258 CharUnits TyAlign = getContext().getTypeAlignInChars(Ty);
261 CCAlign, getDataLayout().getAllocaAddrSpace(),
266 return (isPromotableTypeForABI(Ty)
271CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty)
const {
273 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
274 Ty = CTy->getElementType();
286RValue AIXABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
287 QualType Ty, AggValueSlot Slot)
const {
289 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
290 TypeInfo.Align = getParamTypeAlignment(Ty);
301 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
302 CharUnits EltSize = TypeInfo.Width / 2;
303 if (EltSize < SlotSize)
308 SlotSize,
true, Slot);
311bool AIXTargetCodeGenInfo::initDwarfEHRegSizeTable(
312 CodeGen::CodeGenFunction &CGF, llvm::Value *Address)
const {
316void AIXTargetCodeGenInfo::setTargetAttributes(
317 const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M)
const {
322 auto GVId = GV->getName();
325 bool UserSpecifiedTOC =
329 if (UserSpecifiedTOC ||
332 const unsigned long PointerSize =
333 GV->getParent()->getDataLayout().getPointerSizeInBits() / 8;
334 auto *VarD = dyn_cast<VarDecl>(D);
335 assert(VarD &&
"Invalid declaration of global variable.");
339 const auto *Ty = VarD->getType().getTypePtr();
342 bool EmitDiagnostic = UserSpecifiedTOC && GV->hasExternalLinkage();
343 auto reportUnsupportedWarning = [&](
bool ShouldEmitWarning, StringRef Msg) {
344 if (ShouldEmitWarning)
349 reportUnsupportedWarning(EmitDiagnostic,
"of incomplete type");
351 reportUnsupportedWarning(EmitDiagnostic,
352 "it contains a flexible array member");
354 reportUnsupportedWarning(EmitDiagnostic,
"of thread local storage");
356 reportUnsupportedWarning(EmitDiagnostic,
357 "variable is larger than a pointer");
358 else if (PointerSize < Alignment)
359 reportUnsupportedWarning(EmitDiagnostic,
360 "variable is aligned wider than a pointer");
361 else if (D->
hasAttr<SectionAttr>())
362 reportUnsupportedWarning(EmitDiagnostic,
363 "variable has a section attribute");
364 else if (GV->hasExternalLinkage() ||
366 GVar->addAttribute(
"toc-data");
373class PPC32_SVR4_ABIInfo :
public DefaultABIInfo {
375 bool IsRetSmallStructInRegABI;
377 CharUnits getParamTypeAlignment(QualType Ty)
const;
380 PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT,
bool SoftFloatABI,
381 bool RetSmallStructInRegABI)
382 : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI),
383 IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
387 void computeInfo(CGFunctionInfo &FI)
const override {
394 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
395 AggValueSlot Slot)
const override;
398class PPC32TargetCodeGenInfo :
public TargetCodeGenInfo {
400 PPC32TargetCodeGenInfo(CodeGenTypes &CGT,
bool SoftFloatABI,
401 bool RetSmallStructInRegABI)
402 : TargetCodeGenInfo(std::make_unique<PPC32_SVR4_ABIInfo>(
403 CGT, SoftFloatABI, RetSmallStructInRegABI)) {}
405 static bool isStructReturnInRegABI(
const llvm::Triple &Triple,
406 const CodeGenOptions &Opts);
408 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
413 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
414 llvm::Value *Address)
const override;
418CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
420 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
421 Ty = CTy->getElementType();
429 const Type *AlignTy =
nullptr;
431 const BuiltinType *BT = EltType->getAs<BuiltinType>();
432 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||
442ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
447 (Size = getContext().getTypeSize(RetTy)) <= 64) {
462 llvm::Type *CoerceTy = llvm::Type::getIntNTy(getVMContext(), Size);
472RValue PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList,
473 QualType Ty, AggValueSlot Slot)
const {
474 if (getTarget().
getTriple().isOSDarwin()) {
475 auto TI = getContext().getTypeInfoInChars(Ty);
476 TI.Align = getParamTypeAlignment(Ty);
484 const unsigned OverflowLimit = 8;
485 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
499 bool isI64 = Ty->
isIntegerType() && getContext().getTypeSize(Ty) == 64;
501 bool isF64 = Ty->
isFloatingType() && getContext().getTypeSize(Ty) == 64;
507 CGBuilderTy &Builder = CGF.
Builder;
511 if (isInt || IsSoftFloatABI) {
512 NumRegsAddr = Builder.CreateStructGEP(VAList, 0,
"gpr");
514 NumRegsAddr = Builder.CreateStructGEP(VAList, 1,
"fpr");
517 llvm::Value *NumRegs = Builder.CreateLoad(NumRegsAddr,
"numUsedRegs");
520 if (isI64 || (isF64 && IsSoftFloatABI)) {
521 NumRegs = Builder.CreateAdd(NumRegs, Builder.getInt8(1));
522 NumRegs = Builder.CreateAnd(NumRegs, Builder.getInt8((
uint8_t) ~1U));
526 Builder.CreateICmpULT(NumRegs, Builder.getInt8(OverflowLimit),
"cond");
532 Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);
534 llvm::Type *DirectTy = CGF.
ConvertType(Ty), *ElementTy = DirectTy;
543 Address RegSaveAreaPtr = Builder.CreateStructGEP(VAList, 4);
544 RegAddr =
Address(Builder.CreateLoad(RegSaveAreaPtr), CGF.
Int8Ty,
549 if (!(isInt || IsSoftFloatABI)) {
550 RegAddr = Builder.CreateConstInBoundsByteGEP(RegAddr,
557 llvm::Value *RegOffset =
558 Builder.CreateMul(NumRegs, Builder.getInt8(RegSize.
getQuantity()));
559 RegAddr =
Address(Builder.CreateInBoundsGEP(
566 Builder.CreateAdd(NumRegs,
567 Builder.getInt8((isI64 || (isF64 && IsSoftFloatABI)) ? 2 : 1));
568 Builder.CreateStore(NumRegs, NumRegsAddr);
578 Builder.CreateStore(Builder.getInt8(OverflowLimit), NumRegsAddr);
586 Size = TypeInfo.Width.alignTo(OverflowAreaAlign);
591 Address OverflowAreaAddr = Builder.CreateStructGEP(VAList, 3);
593 Address(Builder.CreateLoad(OverflowAreaAddr,
"argp.cur"), CGF.
Int8Ty,
597 if (Align > OverflowAreaAlign) {
606 OverflowArea = Builder.CreateConstInBoundsByteGEP(OverflowArea, Size);
607 Builder.CreateStore(OverflowArea.
emitRawPointer(CGF), OverflowAreaAddr);
620 getContext().getTypeAlignInChars(Ty));
626bool PPC32TargetCodeGenInfo::isStructReturnInRegABI(
627 const llvm::Triple &Triple,
const CodeGenOptions &Opts) {
628 assert(Triple.isPPC32());
630 switch (Opts.getStructReturnConvention()) {
639 if (Triple.isOSBinFormatELF() && !Triple.isOSLinux())
646PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
647 llvm::Value *Address)
const {
657class PPC64_SVR4_ABIInfo :
public ABIInfo {
658 static const unsigned GPRBits = 64;
665 : ABIInfo(CGT),
Kind(
Kind), IsSoftFloatABI(SoftFloatABI) {}
667 bool isPromotableTypeForABI(QualType Ty)
const;
668 CharUnits getParamTypeAlignment(QualType Ty)
const;
669 const Type *getSingleElementFPOrVectorType(QualType Ty)
const;
674 bool isHomogeneousAggregateBaseType(QualType Ty)
const override;
675 bool isHomogeneousAggregateSmallEnough(
const Type *Ty,
684 void computeInfo(CGFunctionInfo &FI)
const override {
691 if (
const Type *T = getSingleElementFPOrVectorType(I.type)) {
699 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
700 AggValueSlot Slot)
const override;
703class PPC64_SVR4_TargetCodeGenInfo :
public TargetCodeGenInfo {
709 std::make_unique<PPC64_SVR4_ABIInfo>(CGT,
Kind, SoftFloatABI)) {
711 std::make_unique<SwiftABIInfo>(CGT,
false);
714 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
719 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
720 llvm::Value *Address)
const override;
723class PPC64TargetCodeGenInfo :
public TargetCodeGenInfo {
725 PPC64TargetCodeGenInfo(CodeGenTypes &CGT)
726 : TargetCodeGenInfo(std::make_unique<DefaultABIInfo>(CGT)) {}
728 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
733 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
734 llvm::Value *Address)
const override;
741PPC64_SVR4_ABIInfo::isPromotableTypeForABI(QualType Ty)
const {
744 Ty = ED->getIntegerType();
747 if (isPromotableIntegerTypeForABI(Ty))
752 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
754 case BuiltinType::Int:
755 case BuiltinType::UInt:
761 if (
const auto *EIT = Ty->
getAs<BitIntType>())
762 if (EIT->getNumBits() < 64)
770CharUnits PPC64_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
772 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
773 Ty = CTy->getElementType();
775 auto FloatUsesVector = [
this](QualType Ty){
777 Ty) == &llvm::APFloat::IEEEquad();
784 }
else if (FloatUsesVector(Ty)) {
793 const Type *AlignAsType = getSingleElementFPOrVectorType(Ty);
798 if (!AlignAsType && Kind == PPC64_SVR4_ABIKind::ELFv2 &&
805 FloatUsesVector(QualType(AlignAsType, 0));
822PPC64_SVR4_ABIInfo::getSingleElementFPOrVectorType(QualType Ty)
const {
824 Kind != PPC64_SVR4_ABIKind::ELFv1 ||
825 getContext().getLangOpts().isCompatibleWith(LangOptions::ClangABI::Ver23);
830 const BuiltinType *BT = EltType->
getAs<BuiltinType>();
831 if ((EltType->
isVectorType() && getContext().getTypeSize(EltType) == 128) ||
837bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateBaseType(QualType Ty)
const {
840 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>()) {
841 if (BT->
getKind() == BuiltinType::Float ||
842 BT->
getKind() == BuiltinType::Double ||
843 BT->
getKind() == BuiltinType::LongDouble ||
844 BT->
getKind() == BuiltinType::Ibm128 ||
845 (getContext().getTargetInfo().hasFloat128Type() &&
846 (BT->
getKind() == BuiltinType::Float128))) {
852 if (
const VectorType *VT = Ty->
getAs<VectorType>()) {
853 if (getContext().getTypeSize(VT) == 128)
859bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateSmallEnough(
864 ((getContext().getTargetInfo().hasFloat128Type() &&
865 Base->isFloat128Type()) ||
866 Base->isVectorType()) ? 1
867 : (getContext().getTypeSize(Base) + 63) / 64;
870 return Members * NumRegs <= 8;
874PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty)
const {
885 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
887 else if (Size < 128) {
888 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
893 if (
const auto *EIT = Ty->
getAs<BitIntType>())
894 if (EIT->getNumBits() > 128)
895 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
900 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
903 uint64_t ABIAlign = getParamTypeAlignment(Ty).getQuantity();
909 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
910 isHomogeneousAggregate(Ty, Base, Members)) {
911 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
912 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
920 uint64_t Bits = getContext().getTypeSize(Ty);
921 if (Bits > 0 && Bits <= 8 * GPRBits) {
922 llvm::Type *CoerceTy;
928 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
933 uint64_t NumRegs = llvm::alignTo(Bits, RegBits) / RegBits;
934 llvm::Type *RegTy = llvm::IntegerType::get(getVMContext(), RegBits);
935 CoerceTy = llvm::ArrayType::get(RegTy, NumRegs);
944 getDataLayout().getAllocaAddrSpace(),
945 true, TyAlign > ABIAlign);
948 return (isPromotableTypeForABI(Ty)
954PPC64_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
966 return getNaturalAlignIndirect(RetTy,
967 getDataLayout().getAllocaAddrSpace());
968 else if (Size < 128) {
969 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
974 if (
const auto *EIT = RetTy->
getAs<BitIntType>())
975 if (EIT->getNumBits() > 128)
976 return getNaturalAlignIndirect(
977 RetTy, getDataLayout().getAllocaAddrSpace(),
false);
983 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
984 isHomogeneousAggregate(RetTy, Base, Members)) {
985 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
986 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
991 uint64_t Bits = getContext().getTypeSize(RetTy);
992 if (Kind == PPC64_SVR4_ABIKind::ELFv2 && Bits <= 2 * GPRBits) {
996 llvm::Type *CoerceTy;
997 if (Bits > GPRBits) {
998 CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits);
999 CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy);
1002 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
1007 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
1015RValue PPC64_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
1016 QualType Ty, AggValueSlot Slot)
const {
1017 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
1018 TypeInfo.Align = getParamTypeAlignment(Ty);
1028 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
1029 CharUnits EltSize = TypeInfo.Width / 2;
1030 if (EltSize < SlotSize)
1048 SlotSize,
true, Slot,
1053PPC64_SVR4_TargetCodeGenInfo::initDwarfEHRegSizeTable(
1054 CodeGen::CodeGenFunction &CGF,
1055 llvm::Value *Address)
const {
1061PPC64TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
1062 llvm::Value *Address)
const {
1067std::unique_ptr<TargetCodeGenInfo>
1069 return std::make_unique<AIXTargetCodeGenInfo>(CGM.
getTypes(), Is64Bit);
1072std::unique_ptr<TargetCodeGenInfo>
1074 bool RetSmallStructInRegABI = PPC32TargetCodeGenInfo::isStructReturnInRegABI(
1076 return std::make_unique<PPC32TargetCodeGenInfo>(CGM.
getTypes(), SoftFloatABI,
1077 RetSmallStructInRegABI);
1080std::unique_ptr<TargetCodeGenInfo>
1082 return std::make_unique<PPC64TargetCodeGenInfo>(CGM.
getTypes());
1087 return std::make_unique<PPC64_SVR4_TargetCodeGenInfo>(CGM.
getTypes(), Kind,
static RValue complexTempStructure(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, CharUnits SlotSize, CharUnits EltSize, const ComplexType *CTy)
static bool PPC_initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::Value *Address, bool Is64Bit, bool IsAIX)
Result
Implement __builtin_bit_cast and related operations.
static StringRef getTriple(const Command &Job)
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
TypeInfoChars getTypeInfoInChars(const Type *T) const
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
Attr - This represents one attribute.
bool isFloatingPoint() const
This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
Get the raw integer representation of this quantity.
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
static constexpr CharUnits fromQuantity(QuantityType Quantity)
Construct a CharUnits quantity from a raw integer type.
std::vector< std::string > TocDataVarsUserSpecified
List of global variables explicitly specified by the user as toc-data.
std::vector< std::string > NoTocDataVars
List of global variables that over-ride the toc-data default.
static ABIArgInfo getIgnore()
static ABIArgInfo getDirect(llvm::Type *T=nullptr, unsigned Offset=0, llvm::Type *Padding=nullptr, bool CanBeFlattened=true, unsigned Align=0)
static ABIArgInfo getExtend(QualType Ty, llvm::Type *T=nullptr, llvm::Type *Padding=nullptr)
static ABIArgInfo getIndirect(CharUnits Alignment, unsigned AddrSpace, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)
static ABIArgInfo getDirectInReg(llvm::Type *T=nullptr)
ABIInfo - Target specific hooks for defining how a type should be passed or returned from functions.
virtual void appendAttributeMangling(TargetAttr *Attr, raw_ostream &Out) const
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
CharUnits getAlignment() const
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Address withElementType(llvm::Type *ElemTy) const
Return address with different element type, but same pointer and alignment.
Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Given a pointer to i8, adjust it by a given constant offset.
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
RecordArgABI
Specify how one should pass an argument of a record type.
@ RAA_DirectInMemory
Pass it on the stack using its defined layout.
ABIArgInfo & getReturnInfo()
CanQualType getReturnType() const
MutableArrayRef< ArgInfo > arguments()
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::Type * ConvertType(QualType T)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
RValue EmitLoadOfAnyValue(LValue V, AggValueSlot Slot=AggValueSlot::ignored(), SourceLocation Loc={})
Like EmitLoadOfLValue but also handles complex and aggregate types.
ASTContext & getContext() const
llvm::Type * ConvertTypeForMem(QualType T)
void EmitBranch(llvm::BasicBlock *Block)
EmitBranch - Emit a branch to the specified basic block from the current insert block,...
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
This class organizes the cross-function state that is used while generating LLVM code.
DiagnosticsEngine & getDiags() const
CodeGenTypes & getTypes()
const llvm::DataLayout & getDataLayout() const
const llvm::Triple & getTriple() const
const CodeGenOptions & getCodeGenOpts() const
ABIArgInfo classifyReturnType(QualType RetTy) const
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
static RValue getAggregate(Address addr, bool isVolatile=false)
Convert an Address to an RValue.
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
Complex values, per C99 6.2.5p11.
QualType getElementType() const
ASTContext & getASTContext() const LLVM_READONLY
SourceLocation getLocation() const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
A (possibly-)qualified type.
bool hasFlexibleArrayMember() const
virtual ParsedTargetAttr parseTargetAttr(StringRef Str) const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isAnyComplexType() const
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isVectorType() const
bool isRealFloatingType() const
Floating point categories.
bool isFloatingType() const
const T * getAs() const
Member-template getAs<specific type>'.
@ TLS_None
Not a TLS variable.
ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type)
Classify the rules for how to pass a particular type.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
CGCXXABI::RecordArgABI getRecordArgABI(const RecordType *RT, CGCXXABI &CXXABI)
bool classifyReturnType(const CGCXXABI &CXXABI, CGFunctionInfo &FI, const ABIInfo &Info)
std::unique_ptr< TargetCodeGenInfo > createPPC64_SVR4_TargetCodeGenInfo(CodeGenModule &CGM, PPC64_SVR4_ABIKind Kind, bool SoftFloatABI)
Address emitVoidPtrDirectVAArg(CodeGenFunction &CGF, Address VAListAddr, llvm::Type *DirectTy, CharUnits DirectSize, CharUnits DirectAlign, CharUnits SlotSize, bool AllowHigherAlign, bool ForceRightAdjust=false)
Emit va_arg for a platform using the common void* representation, where arguments are simply emitted ...
std::unique_ptr< TargetCodeGenInfo > createAIXTargetCodeGenInfo(CodeGenModule &CGM, bool Is64Bit)
bool isRecordWithSIMDVectorType(ASTContext &Context, QualType Ty)
RValue emitVoidPtrVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType ValueTy, bool IsIndirect, TypeInfoChars ValueInfo, CharUnits SlotSizeAndAlign, bool AllowHigherAlign, AggValueSlot Slot, bool ForceRightAdjust=false)
Emit va_arg for a platform using the common void* representation, where arguments are simply emitted ...
Address emitMergePHI(CodeGenFunction &CGF, Address Addr1, llvm::BasicBlock *Block1, Address Addr2, llvm::BasicBlock *Block2, const llvm::Twine &Name="")
const Type * isSingleElementRecord(QualType T, ASTContext &Context)
isSingleElementRecord - Determine if a record is a "singleelement record", i.e.
llvm::Value * emitRoundPointerUpToAlignment(CodeGenFunction &CGF, llvm::Value *Ptr, CharUnits Align)
bool isAggregateTypeForABI(QualType T)
const Type * isSingleElementStruct(QualType T, ASTContext &Context)
isSingleElementStruct - Like isSingleElementRecord, but neither T nor any record nested in it may be ...
void AssignToArrayRange(CodeGen::CGBuilderTy &Builder, llvm::Value *Array, llvm::Value *Value, unsigned FirstIndex, unsigned LastIndex)
QualType useFirstFieldIfTransparentUnion(QualType Ty)
Pass transparent unions as if they were the type of the first element.
std::unique_ptr< TargetCodeGenInfo > createPPC32TargetCodeGenInfo(CodeGenModule &CGM, bool SoftFloatABI)
std::unique_ptr< TargetCodeGenInfo > createPPC64TargetCodeGenInfo(CodeGenModule &CGM)
@ Address
A pointer to a ValueDecl.
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
U cast(CodeGen::Address addr)
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 uint64_t
int32_t uint32_t uint32_t __builtin_riscv_mhracc_i32 __builtin_riscv_mhraccu_u32 __builtin_riscv_mhraccsu_i32 __builtin_riscv_mhacc_h1_i32 __builtin_riscv_mhaccsu_h1_i32 __builtin_riscv_mulqr_i32 __builtin_riscv_mqrwacc_i64 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 uint8_t
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
CharUnits getPointerSize() const
llvm::PointerType * DefaultPtrTy
std::vector< std::string > Features