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;
160 assert(0 &&
"specifying target features on an FMV is unsupported on AIX");
163class AIXTargetCodeGenInfo :
public TargetCodeGenInfo {
167 AIXTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT,
bool Is64Bit)
168 : TargetCodeGenInfo(std::make_unique<AIXABIInfo>(CGT, Is64Bit)),
170 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
174 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
175 llvm::Value *Address)
const override;
177 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
178 CodeGen::CodeGenModule &M)
const override;
184bool AIXABIInfo::isPromotableTypeForABI(QualType Ty)
const {
187 Ty = ED->getIntegerType();
190 if (getContext().isPromotableIntegerType(Ty))
199 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
200 switch (BT->getKind()) {
201 case BuiltinType::Int:
202 case BuiltinType::UInt:
211ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy)
const {
222 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
228ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty)
const {
241 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
244 CharUnits CCAlign = getParamTypeAlignment(Ty);
245 CharUnits TyAlign = getContext().getTypeAlignInChars(Ty);
248 CCAlign, getDataLayout().getAllocaAddrSpace(),
253 return (isPromotableTypeForABI(Ty)
258CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty)
const {
260 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
261 Ty = CTy->getElementType();
273RValue AIXABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
274 QualType Ty, AggValueSlot Slot)
const {
276 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
277 TypeInfo.Align = getParamTypeAlignment(Ty);
288 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
289 CharUnits EltSize = TypeInfo.Width / 2;
290 if (EltSize < SlotSize)
295 SlotSize,
true, Slot);
298bool AIXTargetCodeGenInfo::initDwarfEHRegSizeTable(
299 CodeGen::CodeGenFunction &CGF, llvm::Value *Address)
const {
303void AIXTargetCodeGenInfo::setTargetAttributes(
304 const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M)
const {
309 auto GVId = GV->getName();
312 bool UserSpecifiedTOC =
316 if (UserSpecifiedTOC ||
319 const unsigned long PointerSize =
320 GV->getParent()->getDataLayout().getPointerSizeInBits() / 8;
321 auto *VarD = dyn_cast<VarDecl>(D);
322 assert(VarD &&
"Invalid declaration of global variable.");
326 const auto *Ty = VarD->getType().getTypePtr();
329 bool EmitDiagnostic = UserSpecifiedTOC && GV->hasExternalLinkage();
330 auto reportUnsupportedWarning = [&](
bool ShouldEmitWarning, StringRef Msg) {
331 if (ShouldEmitWarning)
336 reportUnsupportedWarning(EmitDiagnostic,
"of incomplete type");
338 reportUnsupportedWarning(EmitDiagnostic,
339 "it contains a flexible array member");
341 reportUnsupportedWarning(EmitDiagnostic,
"of thread local storage");
343 reportUnsupportedWarning(EmitDiagnostic,
344 "variable is larger than a pointer");
345 else if (PointerSize < Alignment)
346 reportUnsupportedWarning(EmitDiagnostic,
347 "variable is aligned wider than a pointer");
348 else if (D->
hasAttr<SectionAttr>())
349 reportUnsupportedWarning(EmitDiagnostic,
350 "variable has a section attribute");
351 else if (GV->hasExternalLinkage() ||
353 GVar->addAttribute(
"toc-data");
360class PPC32_SVR4_ABIInfo :
public DefaultABIInfo {
362 bool IsRetSmallStructInRegABI;
364 CharUnits getParamTypeAlignment(QualType Ty)
const;
367 PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT,
bool SoftFloatABI,
368 bool RetSmallStructInRegABI)
369 : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI),
370 IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
374 void computeInfo(CGFunctionInfo &FI)
const override {
381 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
382 AggValueSlot Slot)
const override;
385class PPC32TargetCodeGenInfo :
public TargetCodeGenInfo {
387 PPC32TargetCodeGenInfo(CodeGenTypes &CGT,
bool SoftFloatABI,
388 bool RetSmallStructInRegABI)
389 : TargetCodeGenInfo(std::make_unique<PPC32_SVR4_ABIInfo>(
390 CGT, SoftFloatABI, RetSmallStructInRegABI)) {}
392 static bool isStructReturnInRegABI(
const llvm::Triple &Triple,
393 const CodeGenOptions &Opts);
395 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
400 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
401 llvm::Value *Address)
const override;
405CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
407 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
408 Ty = CTy->getElementType();
416 const Type *AlignTy =
nullptr;
418 const BuiltinType *BT = EltType->getAs<BuiltinType>();
419 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||
429ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
434 (Size = getContext().getTypeSize(RetTy)) <= 64) {
449 llvm::Type *CoerceTy = llvm::Type::getIntNTy(getVMContext(), Size);
459RValue PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList,
460 QualType Ty, AggValueSlot Slot)
const {
461 if (getTarget().
getTriple().isOSDarwin()) {
462 auto TI = getContext().getTypeInfoInChars(Ty);
463 TI.Align = getParamTypeAlignment(Ty);
471 const unsigned OverflowLimit = 8;
472 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
486 bool isI64 = Ty->
isIntegerType() && getContext().getTypeSize(Ty) == 64;
488 bool isF64 = Ty->
isFloatingType() && getContext().getTypeSize(Ty) == 64;
494 CGBuilderTy &Builder = CGF.
Builder;
498 if (isInt || IsSoftFloatABI) {
499 NumRegsAddr = Builder.CreateStructGEP(VAList, 0,
"gpr");
501 NumRegsAddr = Builder.CreateStructGEP(VAList, 1,
"fpr");
504 llvm::Value *NumRegs = Builder.CreateLoad(NumRegsAddr,
"numUsedRegs");
507 if (isI64 || (isF64 && IsSoftFloatABI)) {
508 NumRegs = Builder.CreateAdd(NumRegs, Builder.getInt8(1));
509 NumRegs = Builder.CreateAnd(NumRegs, Builder.getInt8((uint8_t) ~1U));
513 Builder.CreateICmpULT(NumRegs, Builder.getInt8(OverflowLimit),
"cond");
519 Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);
521 llvm::Type *DirectTy = CGF.
ConvertType(Ty), *ElementTy = DirectTy;
530 Address RegSaveAreaPtr = Builder.CreateStructGEP(VAList, 4);
531 RegAddr = Address(Builder.CreateLoad(RegSaveAreaPtr), CGF.
Int8Ty,
536 if (!(isInt || IsSoftFloatABI)) {
537 RegAddr = Builder.CreateConstInBoundsByteGEP(RegAddr,
544 llvm::Value *RegOffset =
545 Builder.CreateMul(NumRegs, Builder.getInt8(RegSize.
getQuantity()));
546 RegAddr = Address(Builder.CreateInBoundsGEP(
553 Builder.CreateAdd(NumRegs,
554 Builder.getInt8((isI64 || (isF64 && IsSoftFloatABI)) ? 2 : 1));
555 Builder.CreateStore(NumRegs, NumRegsAddr);
565 Builder.CreateStore(Builder.getInt8(OverflowLimit), NumRegsAddr);
573 Size = TypeInfo.Width.alignTo(OverflowAreaAlign);
578 Address OverflowAreaAddr = Builder.CreateStructGEP(VAList, 3);
579 Address OverflowArea =
580 Address(Builder.CreateLoad(OverflowAreaAddr,
"argp.cur"), CGF.
Int8Ty,
584 if (Align > OverflowAreaAlign) {
593 OverflowArea = Builder.CreateConstInBoundsByteGEP(OverflowArea, Size);
594 Builder.CreateStore(OverflowArea.
emitRawPointer(CGF), OverflowAreaAddr);
606 Result = Address(Builder.CreateLoad(
Result,
"aggr"), ElementTy,
607 getContext().getTypeAlignInChars(Ty));
613bool PPC32TargetCodeGenInfo::isStructReturnInRegABI(
614 const llvm::Triple &Triple,
const CodeGenOptions &Opts) {
615 assert(Triple.isPPC32());
617 switch (Opts.getStructReturnConvention()) {
626 if (Triple.isOSBinFormatELF() && !Triple.isOSLinux())
633PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
634 llvm::Value *Address)
const {
644class PPC64_SVR4_ABIInfo :
public ABIInfo {
645 static const unsigned GPRBits = 64;
652 : ABIInfo(CGT),
Kind(
Kind), IsSoftFloatABI(SoftFloatABI) {}
654 bool isPromotableTypeForABI(QualType Ty)
const;
655 CharUnits getParamTypeAlignment(QualType Ty)
const;
660 bool isHomogeneousAggregateBaseType(QualType Ty)
const override;
661 bool isHomogeneousAggregateSmallEnough(
const Type *Ty,
662 uint64_t Members)
const override;
670 void computeInfo(CGFunctionInfo &FI)
const override {
679 const BuiltinType *BT = T->
getAs<BuiltinType>();
680 if ((T->
isVectorType() && getContext().getTypeSize(T) == 128) ||
691 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
692 AggValueSlot Slot)
const override;
695class PPC64_SVR4_TargetCodeGenInfo :
public TargetCodeGenInfo {
701 std::make_unique<PPC64_SVR4_ABIInfo>(CGT,
Kind, SoftFloatABI)) {
703 std::make_unique<SwiftABIInfo>(CGT,
false);
706 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
711 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
712 llvm::Value *Address)
const override;
713 void emitTargetMetadata(CodeGen::CodeGenModule &CGM,
714 const llvm::MapVector<GlobalDecl, StringRef>
715 &MangledDeclNames)
const override;
718class PPC64TargetCodeGenInfo :
public TargetCodeGenInfo {
720 PPC64TargetCodeGenInfo(CodeGenTypes &CGT)
721 : TargetCodeGenInfo(std::make_unique<DefaultABIInfo>(CGT)) {}
723 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
728 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
729 llvm::Value *Address)
const override;
736PPC64_SVR4_ABIInfo::isPromotableTypeForABI(QualType Ty)
const {
739 Ty = ED->getIntegerType();
742 if (isPromotableIntegerTypeForABI(Ty))
747 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
749 case BuiltinType::Int:
750 case BuiltinType::UInt:
756 if (
const auto *EIT = Ty->
getAs<BitIntType>())
757 if (EIT->getNumBits() < 64)
765CharUnits PPC64_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
767 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
768 Ty = CTy->getElementType();
770 auto FloatUsesVector = [
this](QualType Ty){
772 Ty) == &llvm::APFloat::IEEEquad();
779 }
else if (FloatUsesVector(Ty)) {
788 const Type *AlignAsType =
nullptr;
791 const BuiltinType *BT = EltType->
getAs<BuiltinType>();
792 if ((EltType->
isVectorType() && getContext().getTypeSize(EltType) == 128) ||
794 AlignAsType = EltType;
800 if (!AlignAsType && Kind == PPC64_SVR4_ABIKind::ELFv2 &&
807 FloatUsesVector(QualType(AlignAsType, 0));
820bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateBaseType(QualType Ty)
const {
823 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>()) {
824 if (BT->
getKind() == BuiltinType::Float ||
825 BT->
getKind() == BuiltinType::Double ||
826 BT->
getKind() == BuiltinType::LongDouble ||
827 BT->
getKind() == BuiltinType::Ibm128 ||
828 (getContext().getTargetInfo().hasFloat128Type() &&
829 (BT->
getKind() == BuiltinType::Float128))) {
835 if (
const VectorType *VT = Ty->
getAs<VectorType>()) {
836 if (getContext().getTypeSize(VT) == 128)
842bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateSmallEnough(
843 const Type *Base, uint64_t Members)
const {
847 ((getContext().getTargetInfo().hasFloat128Type() &&
848 Base->isFloat128Type()) ||
849 Base->isVectorType()) ? 1
850 : (getContext().getTypeSize(Base) + 63) / 64;
853 return Members * NumRegs <= 8;
857PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty)
const {
868 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
870 else if (Size < 128) {
871 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
876 if (
const auto *EIT = Ty->
getAs<BitIntType>())
877 if (EIT->getNumBits() > 128)
878 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
883 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
886 uint64_t ABIAlign = getParamTypeAlignment(Ty).getQuantity();
892 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
893 isHomogeneousAggregate(Ty, Base, Members)) {
894 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
895 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
903 uint64_t Bits = getContext().getTypeSize(Ty);
904 if (Bits > 0 && Bits <= 8 * GPRBits) {
905 llvm::Type *CoerceTy;
911 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
916 uint64_t NumRegs = llvm::alignTo(Bits, RegBits) / RegBits;
917 llvm::Type *RegTy = llvm::IntegerType::get(getVMContext(), RegBits);
918 CoerceTy = llvm::ArrayType::get(RegTy, NumRegs);
927 getDataLayout().getAllocaAddrSpace(),
928 true, TyAlign > ABIAlign);
931 return (isPromotableTypeForABI(Ty)
937PPC64_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
949 return getNaturalAlignIndirect(RetTy,
950 getDataLayout().getAllocaAddrSpace());
951 else if (Size < 128) {
952 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
957 if (
const auto *EIT = RetTy->
getAs<BitIntType>())
958 if (EIT->getNumBits() > 128)
959 return getNaturalAlignIndirect(
960 RetTy, getDataLayout().getAllocaAddrSpace(),
false);
966 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
967 isHomogeneousAggregate(RetTy, Base, Members)) {
968 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
969 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
974 uint64_t Bits = getContext().getTypeSize(RetTy);
975 if (Kind == PPC64_SVR4_ABIKind::ELFv2 && Bits <= 2 * GPRBits) {
979 llvm::Type *CoerceTy;
980 if (Bits > GPRBits) {
981 CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits);
982 CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy);
985 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
990 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
998RValue PPC64_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
999 QualType Ty, AggValueSlot Slot)
const {
1000 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
1001 TypeInfo.Align = getParamTypeAlignment(Ty);
1011 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
1012 CharUnits EltSize = TypeInfo.Width / 2;
1013 if (EltSize < SlotSize)
1031 SlotSize,
true, Slot,
1036PPC64_SVR4_TargetCodeGenInfo::initDwarfEHRegSizeTable(
1037 CodeGen::CodeGenFunction &CGF,
1038 llvm::Value *Address)
const {
1043void PPC64_SVR4_TargetCodeGenInfo::emitTargetMetadata(
1044 CodeGen::CodeGenModule &CGM,
1045 const llvm::MapVector<GlobalDecl, StringRef> &MangledDeclNames)
const {
1049 if (flt == &llvm::APFloat::PPCDoubleDouble())
1050 CGM.
getModule().addModuleFlag(llvm::Module::Error,
"float-abi",
1051 llvm::MDString::get(Ctx,
"doubledouble"));
1052 else if (flt == &llvm::APFloat::IEEEquad())
1053 CGM.
getModule().addModuleFlag(llvm::Module::Error,
"float-abi",
1054 llvm::MDString::get(Ctx,
"ieeequad"));
1055 else if (flt == &llvm::APFloat::IEEEdouble())
1056 CGM.
getModule().addModuleFlag(llvm::Module::Error,
"float-abi",
1057 llvm::MDString::get(Ctx,
"ieeedouble"));
1062PPC64TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
1063 llvm::Value *Address)
const {
1068std::unique_ptr<TargetCodeGenInfo>
1070 return std::make_unique<AIXTargetCodeGenInfo>(CGM.
getTypes(), Is64Bit);
1073std::unique_ptr<TargetCodeGenInfo>
1075 bool RetSmallStructInRegABI = PPC32TargetCodeGenInfo::isStructReturnInRegABI(
1077 return std::make_unique<PPC32TargetCodeGenInfo>(CGM.
getTypes(), SoftFloatABI,
1078 RetSmallStructInRegABI);
1081std::unique_ptr<TargetCodeGenInfo>
1083 return std::make_unique<PPC64TargetCodeGenInfo>(CGM.
getTypes());
1088 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)
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
CharUnits - This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
getQuantity - 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 CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - 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 getIndirect(CharUnits Alignment, unsigned AddrSpace, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)
static ABIArgInfo getExtend(QualType Ty, llvm::Type *T=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.
llvm::Module & getModule() const
DiagnosticsEngine & getDiags() const
CodeGenTypes & getTypes()
const TargetInfo & getTarget() const
const llvm::DataLayout & getDataLayout() const
const llvm::Triple & getTriple() const
const CodeGenOptions & getCodeGenOpts() const
llvm::LLVMContext & getLLVMContext()
bool isLongDoubleReferenced() 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
const llvm::fltSemantics & getLongDoubleFormat() 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="")
llvm::Value * emitRoundPointerUpToAlignment(CodeGenFunction &CGF, llvm::Value *Ptr, CharUnits Align)
bool isAggregateTypeForABI(QualType T)
const Type * isSingleElementStruct(QualType T, ASTContext &Context)
isSingleElementStruct - Determine if a structure is a "singleelement struct", i.e.
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)
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
@ Result
The result type of a method or function.
@ Type
The name was classified as a type.
U cast(CodeGen::Address addr)
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
CharUnits getPointerSize() const
llvm::PointerType * DefaultPtrTy
std::vector< std::string > Features