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;
137 AIXTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT,
bool Is64Bit)
138 : TargetCodeGenInfo(std::make_unique<AIXABIInfo>(CGT, Is64Bit)),
140 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
144 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
145 llvm::Value *Address)
const override;
147 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
148 CodeGen::CodeGenModule &M)
const override;
154bool AIXABIInfo::isPromotableTypeForABI(
QualType Ty)
const {
157 Ty = ED->getIntegerType();
160 if (getContext().isPromotableIntegerType(Ty))
169 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
170 switch (BT->getKind()) {
171 case BuiltinType::Int:
172 case BuiltinType::UInt:
181ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy)
const {
192 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
198ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty)
const {
211 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
214 CharUnits CCAlign = getParamTypeAlignment(Ty);
215 CharUnits TyAlign = getContext().getTypeAlignInChars(Ty);
218 CCAlign, getDataLayout().getAllocaAddrSpace(),
223 return (isPromotableTypeForABI(Ty)
228CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty)
const {
230 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
231 Ty = CTy->getElementType();
243RValue AIXABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
244 QualType Ty, AggValueSlot Slot)
const {
246 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
247 TypeInfo.Align = getParamTypeAlignment(Ty);
258 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
259 CharUnits EltSize = TypeInfo.Width / 2;
260 if (EltSize < SlotSize)
265 SlotSize,
true, Slot);
268bool AIXTargetCodeGenInfo::initDwarfEHRegSizeTable(
269 CodeGen::CodeGenFunction &CGF, llvm::Value *Address)
const {
273void AIXTargetCodeGenInfo::setTargetAttributes(
274 const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M)
const {
279 auto GVId = GV->getName();
282 bool UserSpecifiedTOC =
286 if (UserSpecifiedTOC ||
289 const unsigned long PointerSize =
290 GV->getParent()->getDataLayout().getPointerSizeInBits() / 8;
291 auto *VarD = dyn_cast<VarDecl>(D);
292 assert(VarD &&
"Invalid declaration of global variable.");
296 const auto *Ty = VarD->getType().getTypePtr();
299 bool EmitDiagnostic = UserSpecifiedTOC && GV->hasExternalLinkage();
300 auto reportUnsupportedWarning = [&](
bool ShouldEmitWarning, StringRef Msg) {
301 if (ShouldEmitWarning)
306 reportUnsupportedWarning(EmitDiagnostic,
"of incomplete type");
308 reportUnsupportedWarning(EmitDiagnostic,
309 "it contains a flexible array member");
311 reportUnsupportedWarning(EmitDiagnostic,
"of thread local storage");
313 reportUnsupportedWarning(EmitDiagnostic,
314 "variable is larger than a pointer");
315 else if (PointerSize < Alignment)
316 reportUnsupportedWarning(EmitDiagnostic,
317 "variable is aligned wider than a pointer");
318 else if (D->
hasAttr<SectionAttr>())
319 reportUnsupportedWarning(EmitDiagnostic,
320 "variable has a section attribute");
321 else if (GV->hasExternalLinkage() ||
323 GVar->addAttribute(
"toc-data");
330class PPC32_SVR4_ABIInfo :
public DefaultABIInfo {
332 bool IsRetSmallStructInRegABI;
334 CharUnits getParamTypeAlignment(QualType Ty)
const;
337 PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT,
bool SoftFloatABI,
338 bool RetSmallStructInRegABI)
339 : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI),
340 IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
344 void computeInfo(CGFunctionInfo &FI)
const override {
351 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
352 AggValueSlot Slot)
const override;
355class PPC32TargetCodeGenInfo :
public TargetCodeGenInfo {
357 PPC32TargetCodeGenInfo(CodeGenTypes &CGT,
bool SoftFloatABI,
358 bool RetSmallStructInRegABI)
359 : TargetCodeGenInfo(std::make_unique<PPC32_SVR4_ABIInfo>(
360 CGT, SoftFloatABI, RetSmallStructInRegABI)) {}
362 static bool isStructReturnInRegABI(
const llvm::Triple &Triple,
363 const CodeGenOptions &Opts);
365 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
370 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
371 llvm::Value *Address)
const override;
375CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
377 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
378 Ty = CTy->getElementType();
386 const Type *AlignTy =
nullptr;
388 const BuiltinType *BT = EltType->getAs<BuiltinType>();
389 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||
399ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
404 (Size = getContext().getTypeSize(RetTy)) <= 64) {
419 llvm::Type *CoerceTy = llvm::Type::getIntNTy(getVMContext(), Size);
429RValue PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList,
430 QualType Ty, AggValueSlot Slot)
const {
431 if (getTarget().getTriple().isOSDarwin()) {
432 auto TI = getContext().getTypeInfoInChars(Ty);
433 TI.Align = getParamTypeAlignment(Ty);
441 const unsigned OverflowLimit = 8;
442 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
456 bool isI64 = Ty->
isIntegerType() && getContext().getTypeSize(Ty) == 64;
458 bool isF64 = Ty->
isFloatingType() && getContext().getTypeSize(Ty) == 64;
464 CGBuilderTy &Builder = CGF.
Builder;
468 if (isInt || IsSoftFloatABI) {
469 NumRegsAddr = Builder.CreateStructGEP(VAList, 0,
"gpr");
471 NumRegsAddr = Builder.CreateStructGEP(VAList, 1,
"fpr");
474 llvm::Value *NumRegs = Builder.CreateLoad(NumRegsAddr,
"numUsedRegs");
477 if (isI64 || (isF64 && IsSoftFloatABI)) {
478 NumRegs = Builder.CreateAdd(NumRegs, Builder.getInt8(1));
479 NumRegs = Builder.CreateAnd(NumRegs, Builder.getInt8((uint8_t) ~1U));
483 Builder.CreateICmpULT(NumRegs, Builder.getInt8(OverflowLimit),
"cond");
489 Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);
491 llvm::Type *DirectTy = CGF.
ConvertType(Ty), *ElementTy = DirectTy;
500 Address RegSaveAreaPtr = Builder.CreateStructGEP(VAList, 4);
501 RegAddr = Address(Builder.CreateLoad(RegSaveAreaPtr), CGF.
Int8Ty,
506 if (!(isInt || IsSoftFloatABI)) {
507 RegAddr = Builder.CreateConstInBoundsByteGEP(RegAddr,
514 llvm::Value *RegOffset =
515 Builder.CreateMul(NumRegs, Builder.getInt8(RegSize.
getQuantity()));
516 RegAddr = Address(Builder.CreateInBoundsGEP(
523 Builder.CreateAdd(NumRegs,
524 Builder.getInt8((isI64 || (isF64 && IsSoftFloatABI)) ? 2 : 1));
525 Builder.CreateStore(NumRegs, NumRegsAddr);
535 Builder.CreateStore(Builder.getInt8(OverflowLimit), NumRegsAddr);
543 Size = TypeInfo.Width.alignTo(OverflowAreaAlign);
548 Address OverflowAreaAddr = Builder.CreateStructGEP(VAList, 3);
549 Address OverflowArea =
550 Address(Builder.CreateLoad(OverflowAreaAddr,
"argp.cur"), CGF.
Int8Ty,
554 if (Align > OverflowAreaAlign) {
563 OverflowArea = Builder.CreateConstInBoundsByteGEP(OverflowArea, Size);
564 Builder.CreateStore(OverflowArea.
emitRawPointer(CGF), OverflowAreaAddr);
576 Result = Address(Builder.CreateLoad(
Result,
"aggr"), ElementTy,
577 getContext().getTypeAlignInChars(Ty));
583bool PPC32TargetCodeGenInfo::isStructReturnInRegABI(
584 const llvm::Triple &Triple,
const CodeGenOptions &Opts) {
585 assert(Triple.isPPC32());
587 switch (Opts.getStructReturnConvention()) {
596 if (Triple.isOSBinFormatELF() && !Triple.isOSLinux())
603PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
604 llvm::Value *Address)
const {
614class PPC64_SVR4_ABIInfo :
public ABIInfo {
615 static const unsigned GPRBits = 64;
622 : ABIInfo(CGT),
Kind(
Kind), IsSoftFloatABI(SoftFloatABI) {}
624 bool isPromotableTypeForABI(QualType Ty)
const;
625 CharUnits getParamTypeAlignment(QualType Ty)
const;
630 bool isHomogeneousAggregateBaseType(QualType Ty)
const override;
631 bool isHomogeneousAggregateSmallEnough(
const Type *Ty,
632 uint64_t Members)
const override;
640 void computeInfo(CGFunctionInfo &FI)
const override {
649 const BuiltinType *BT =
T->
getAs<BuiltinType>();
661 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
662 AggValueSlot Slot)
const override;
665class PPC64_SVR4_TargetCodeGenInfo :
public TargetCodeGenInfo {
671 std::make_unique<PPC64_SVR4_ABIInfo>(CGT,
Kind, SoftFloatABI)) {
673 std::make_unique<SwiftABIInfo>(CGT,
false);
676 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
681 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
682 llvm::Value *Address)
const override;
683 void emitTargetMetadata(CodeGen::CodeGenModule &CGM,
684 const llvm::MapVector<GlobalDecl, StringRef>
685 &MangledDeclNames)
const override;
688class PPC64TargetCodeGenInfo :
public TargetCodeGenInfo {
690 PPC64TargetCodeGenInfo(CodeGenTypes &CGT)
691 : TargetCodeGenInfo(std::make_unique<DefaultABIInfo>(CGT)) {}
693 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
698 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
699 llvm::Value *Address)
const override;
706PPC64_SVR4_ABIInfo::isPromotableTypeForABI(QualType Ty)
const {
709 Ty = ED->getIntegerType();
712 if (isPromotableIntegerTypeForABI(Ty))
717 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
719 case BuiltinType::Int:
720 case BuiltinType::UInt:
726 if (
const auto *EIT = Ty->
getAs<BitIntType>())
727 if (EIT->getNumBits() < 64)
735CharUnits PPC64_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
737 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
738 Ty = CTy->getElementType();
740 auto FloatUsesVector = [
this](QualType Ty){
742 Ty) == &llvm::APFloat::IEEEquad();
749 }
else if (FloatUsesVector(Ty)) {
758 const Type *AlignAsType =
nullptr;
761 const BuiltinType *BT = EltType->
getAs<BuiltinType>();
762 if ((EltType->
isVectorType() && getContext().getTypeSize(EltType) == 128) ||
764 AlignAsType = EltType;
770 if (!AlignAsType && Kind == PPC64_SVR4_ABIKind::ELFv2 &&
777 FloatUsesVector(QualType(AlignAsType, 0));
790bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateBaseType(QualType Ty)
const {
793 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>()) {
794 if (BT->
getKind() == BuiltinType::Float ||
795 BT->
getKind() == BuiltinType::Double ||
796 BT->
getKind() == BuiltinType::LongDouble ||
797 BT->
getKind() == BuiltinType::Ibm128 ||
798 (getContext().getTargetInfo().hasFloat128Type() &&
799 (BT->
getKind() == BuiltinType::Float128))) {
805 if (
const VectorType *VT = Ty->
getAs<VectorType>()) {
806 if (getContext().getTypeSize(VT) == 128)
812bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateSmallEnough(
813 const Type *Base, uint64_t Members)
const {
817 ((getContext().getTargetInfo().hasFloat128Type() &&
818 Base->isFloat128Type()) ||
819 Base->isVectorType()) ? 1
820 : (getContext().getTypeSize(Base) + 63) / 64;
823 return Members * NumRegs <= 8;
827PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty)
const {
838 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
840 else if (Size < 128) {
841 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
846 if (
const auto *EIT = Ty->
getAs<BitIntType>())
847 if (EIT->getNumBits() > 128)
848 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
853 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
856 uint64_t ABIAlign = getParamTypeAlignment(Ty).getQuantity();
862 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
863 isHomogeneousAggregate(Ty, Base, Members)) {
864 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
865 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
873 uint64_t Bits = getContext().getTypeSize(Ty);
874 if (Bits > 0 && Bits <= 8 * GPRBits) {
875 llvm::Type *CoerceTy;
881 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
886 uint64_t NumRegs = llvm::alignTo(Bits, RegBits) / RegBits;
887 llvm::Type *RegTy = llvm::IntegerType::get(getVMContext(), RegBits);
888 CoerceTy = llvm::ArrayType::get(RegTy, NumRegs);
897 getDataLayout().getAllocaAddrSpace(),
898 true, TyAlign > ABIAlign);
901 return (isPromotableTypeForABI(Ty)
907PPC64_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
919 return getNaturalAlignIndirect(RetTy,
920 getDataLayout().getAllocaAddrSpace());
921 else if (Size < 128) {
922 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
927 if (
const auto *EIT = RetTy->
getAs<BitIntType>())
928 if (EIT->getNumBits() > 128)
929 return getNaturalAlignIndirect(
930 RetTy, getDataLayout().getAllocaAddrSpace(),
false);
936 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
937 isHomogeneousAggregate(RetTy, Base, Members)) {
938 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
939 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
944 uint64_t Bits = getContext().getTypeSize(RetTy);
945 if (Kind == PPC64_SVR4_ABIKind::ELFv2 && Bits <= 2 * GPRBits) {
949 llvm::Type *CoerceTy;
950 if (Bits > GPRBits) {
951 CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits);
952 CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy);
955 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
960 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
968RValue PPC64_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
969 QualType Ty, AggValueSlot Slot)
const {
970 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
971 TypeInfo.Align = getParamTypeAlignment(Ty);
981 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
982 CharUnits EltSize = TypeInfo.Width / 2;
983 if (EltSize < SlotSize)
1001 SlotSize,
true, Slot,
1006PPC64_SVR4_TargetCodeGenInfo::initDwarfEHRegSizeTable(
1007 CodeGen::CodeGenFunction &CGF,
1008 llvm::Value *Address)
const {
1013void PPC64_SVR4_TargetCodeGenInfo::emitTargetMetadata(
1014 CodeGen::CodeGenModule &CGM,
1015 const llvm::MapVector<GlobalDecl, StringRef> &MangledDeclNames)
const {
1019 if (flt == &llvm::APFloat::PPCDoubleDouble())
1020 CGM.
getModule().addModuleFlag(llvm::Module::Error,
"float-abi",
1021 llvm::MDString::get(Ctx,
"doubledouble"));
1022 else if (flt == &llvm::APFloat::IEEEquad())
1023 CGM.
getModule().addModuleFlag(llvm::Module::Error,
"float-abi",
1024 llvm::MDString::get(Ctx,
"ieeequad"));
1025 else if (flt == &llvm::APFloat::IEEEdouble())
1026 CGM.
getModule().addModuleFlag(llvm::Module::Error,
"float-abi",
1027 llvm::MDString::get(Ctx,
"ieeedouble"));
1032PPC64TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
1033 llvm::Value *Address)
const {
1038std::unique_ptr<TargetCodeGenInfo>
1040 return std::make_unique<AIXTargetCodeGenInfo>(CGM.
getTypes(), Is64Bit);
1043std::unique_ptr<TargetCodeGenInfo>
1045 bool RetSmallStructInRegABI = PPC32TargetCodeGenInfo::isStructReturnInRegABI(
1047 return std::make_unique<PPC32TargetCodeGenInfo>(CGM.
getTypes(), SoftFloatABI,
1048 RetSmallStructInRegABI);
1051std::unique_ptr<TargetCodeGenInfo>
1053 return std::make_unique<PPC64TargetCodeGenInfo>(CGM.
getTypes());
1058 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)
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.
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.
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)
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
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
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.
const FunctionProtoType * T
@ 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 * UnqualPtrTy