10#include "TargetInfo.h"
12#include "llvm/Support/CodeGen.h"
22 SlotSize, SlotSize,
true);
30 2 * SlotSize - EltSize);
45 llvm::Value *
Address,
bool Is64Bit,
52 llvm::IntegerType *i8 = CGF.
Int8Ty;
53 llvm::Value *Four8 = llvm::ConstantInt::get(i8, 4);
54 llvm::Value *Eight8 = llvm::ConstantInt::get(i8, 8);
55 llvm::Value *Sixteen8 = llvm::ConstantInt::get(i8, 16);
108class AIXABIInfo :
public ABIInfo {
110 const unsigned PtrByteSize;
111 CharUnits getParamTypeAlignment(QualType Ty)
const;
114 AIXABIInfo(CodeGen::CodeGenTypes &CGT,
bool Is64Bit)
115 : ABIInfo(CGT), Is64Bit(Is64Bit), PtrByteSize(Is64Bit ? 8 : 4) {}
117 bool isPromotableTypeForABI(QualType Ty)
const;
122 void computeInfo(CGFunctionInfo &FI)
const override {
130 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
131 AggValueSlot Slot)
const override;
134 void appendAttributeMangling(TargetClonesAttr *Attr,
unsigned Index,
135 raw_ostream &Out)
const override;
136 void appendAttributeMangling(StringRef AttrStr,
137 raw_ostream &Out)
const override;
140void AIXABIInfo::appendAttributeMangling(TargetClonesAttr *
Attr,
unsigned Index,
141 raw_ostream &Out)
const {
142 appendAttributeMangling(Attr->getFeatureStr(Index), Out);
145void AIXABIInfo::appendAttributeMangling(StringRef AttrStr,
146 raw_ostream &Out)
const {
147 if (AttrStr ==
"default") {
152 const TargetInfo &TI = CGT.getTarget();
155 if (!Info.
CPU.empty()) {
156 assert(Info.
Features.empty() &&
"cannot have both a CPU and a feature");
157 Out <<
".cpu_" << Info.
CPU;
167 std::string MangledName(
Feature.drop_front(1));
168 std::replace(MangledName.begin(), MangledName.end(),
'-',
'_');
170 Out <<
"." << (
Feature.starts_with(
"-") ?
"no_" :
"") << MangledName;
174 llvm_unreachable(
"Invalid target_clones parameter");
177class AIXTargetCodeGenInfo :
public TargetCodeGenInfo {
181 AIXTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT,
bool Is64Bit)
182 : TargetCodeGenInfo(std::make_unique<AIXABIInfo>(CGT, Is64Bit)),
184 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
188 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
189 llvm::Value *Address)
const override;
191 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
192 CodeGen::CodeGenModule &M)
const override;
198bool AIXABIInfo::isPromotableTypeForABI(QualType Ty)
const {
201 Ty = ED->getIntegerType();
204 if (getContext().isPromotableIntegerType(Ty))
213 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
214 switch (BT->getKind()) {
215 case BuiltinType::Int:
216 case BuiltinType::UInt:
225ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy)
const {
236 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
242ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty)
const {
255 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
258 CharUnits CCAlign = getParamTypeAlignment(Ty);
259 CharUnits TyAlign = getContext().getTypeAlignInChars(Ty);
262 CCAlign, getDataLayout().getAllocaAddrSpace(),
267 return (isPromotableTypeForABI(Ty)
272CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty)
const {
274 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
275 Ty = CTy->getElementType();
287RValue AIXABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
288 QualType Ty, AggValueSlot Slot)
const {
290 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
291 TypeInfo.Align = getParamTypeAlignment(Ty);
302 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
303 CharUnits EltSize = TypeInfo.Width / 2;
304 if (EltSize < SlotSize)
309 SlotSize,
true, Slot);
312bool AIXTargetCodeGenInfo::initDwarfEHRegSizeTable(
313 CodeGen::CodeGenFunction &CGF, llvm::Value *Address)
const {
317void AIXTargetCodeGenInfo::setTargetAttributes(
318 const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M)
const {
323 auto GVId = GV->getName();
326 bool UserSpecifiedTOC =
330 if (UserSpecifiedTOC ||
333 const unsigned long PointerSize =
334 GV->getParent()->getDataLayout().getPointerSizeInBits() / 8;
335 auto *VarD = dyn_cast<VarDecl>(D);
336 assert(VarD &&
"Invalid declaration of global variable.");
340 const auto *Ty = VarD->getType().getTypePtr();
343 bool EmitDiagnostic = UserSpecifiedTOC && GV->hasExternalLinkage();
344 auto reportUnsupportedWarning = [&](
bool ShouldEmitWarning, StringRef Msg) {
345 if (ShouldEmitWarning)
350 reportUnsupportedWarning(EmitDiagnostic,
"of incomplete type");
352 reportUnsupportedWarning(EmitDiagnostic,
353 "it contains a flexible array member");
355 reportUnsupportedWarning(EmitDiagnostic,
"of thread local storage");
357 reportUnsupportedWarning(EmitDiagnostic,
358 "variable is larger than a pointer");
359 else if (PointerSize < Alignment)
360 reportUnsupportedWarning(EmitDiagnostic,
361 "variable is aligned wider than a pointer");
362 else if (D->
hasAttr<SectionAttr>())
363 reportUnsupportedWarning(EmitDiagnostic,
364 "variable has a section attribute");
365 else if (GV->hasExternalLinkage() ||
367 GVar->addAttribute(
"toc-data");
374class PPC32_SVR4_ABIInfo :
public DefaultABIInfo {
376 bool IsRetSmallStructInRegABI;
378 CharUnits getParamTypeAlignment(QualType Ty)
const;
381 PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT,
bool SoftFloatABI,
382 bool RetSmallStructInRegABI)
383 : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI),
384 IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
388 void computeInfo(CGFunctionInfo &FI)
const override {
395 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
396 AggValueSlot Slot)
const override;
399class PPC32TargetCodeGenInfo :
public TargetCodeGenInfo {
401 PPC32TargetCodeGenInfo(CodeGenTypes &CGT,
bool SoftFloatABI,
402 bool RetSmallStructInRegABI)
403 : TargetCodeGenInfo(std::make_unique<PPC32_SVR4_ABIInfo>(
404 CGT, SoftFloatABI, RetSmallStructInRegABI)) {}
406 static bool isStructReturnInRegABI(
const llvm::Triple &Triple,
407 const CodeGenOptions &Opts);
409 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
414 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
415 llvm::Value *Address)
const override;
419CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
421 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
422 Ty = CTy->getElementType();
430 const Type *AlignTy =
nullptr;
432 const BuiltinType *BT = EltType->getAs<BuiltinType>();
433 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||
443ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
448 (Size = getContext().getTypeSize(RetTy)) <= 64) {
463 llvm::Type *CoerceTy = llvm::Type::getIntNTy(getVMContext(), Size);
473RValue PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList,
474 QualType Ty, AggValueSlot Slot)
const {
475 if (getTarget().
getTriple().isOSDarwin()) {
476 auto TI = getContext().getTypeInfoInChars(Ty);
477 TI.Align = getParamTypeAlignment(Ty);
485 const unsigned OverflowLimit = 8;
486 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
500 bool isI64 = Ty->
isIntegerType() && getContext().getTypeSize(Ty) == 64;
502 bool isF64 = Ty->
isFloatingType() && getContext().getTypeSize(Ty) == 64;
508 CGBuilderTy &Builder = CGF.
Builder;
512 if (isInt || IsSoftFloatABI) {
513 NumRegsAddr = Builder.CreateStructGEP(VAList, 0,
"gpr");
515 NumRegsAddr = Builder.CreateStructGEP(VAList, 1,
"fpr");
518 llvm::Value *NumRegs = Builder.CreateLoad(NumRegsAddr,
"numUsedRegs");
521 if (isI64 || (isF64 && IsSoftFloatABI)) {
522 NumRegs = Builder.CreateAdd(NumRegs, Builder.getInt8(1));
523 NumRegs = Builder.CreateAnd(NumRegs, Builder.getInt8((
uint8_t) ~1U));
527 Builder.CreateICmpULT(NumRegs, Builder.getInt8(OverflowLimit),
"cond");
533 Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);
535 llvm::Type *DirectTy = CGF.
ConvertType(Ty), *ElementTy = DirectTy;
544 Address RegSaveAreaPtr = Builder.CreateStructGEP(VAList, 4);
545 RegAddr =
Address(Builder.CreateLoad(RegSaveAreaPtr), CGF.
Int8Ty,
550 if (!(isInt || IsSoftFloatABI)) {
551 RegAddr = Builder.CreateConstInBoundsByteGEP(RegAddr,
558 llvm::Value *RegOffset =
559 Builder.CreateMul(NumRegs, Builder.getInt8(RegSize.
getQuantity()));
560 RegAddr =
Address(Builder.CreateInBoundsGEP(
567 Builder.CreateAdd(NumRegs,
568 Builder.getInt8((isI64 || (isF64 && IsSoftFloatABI)) ? 2 : 1));
569 Builder.CreateStore(NumRegs, NumRegsAddr);
579 Builder.CreateStore(Builder.getInt8(OverflowLimit), NumRegsAddr);
587 Size = TypeInfo.Width.alignTo(OverflowAreaAlign);
592 Address OverflowAreaAddr = Builder.CreateStructGEP(VAList, 3);
594 Address(Builder.CreateLoad(OverflowAreaAddr,
"argp.cur"), CGF.
Int8Ty,
598 if (Align > OverflowAreaAlign) {
607 OverflowArea = Builder.CreateConstInBoundsByteGEP(OverflowArea, Size);
608 Builder.CreateStore(OverflowArea.
emitRawPointer(CGF), OverflowAreaAddr);
621 getContext().getTypeAlignInChars(Ty));
627bool PPC32TargetCodeGenInfo::isStructReturnInRegABI(
628 const llvm::Triple &Triple,
const CodeGenOptions &Opts) {
629 assert(Triple.isPPC32());
631 switch (Opts.getStructReturnConvention()) {
640 if (Triple.isOSBinFormatELF() && !Triple.isOSLinux())
647PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
648 llvm::Value *Address)
const {
658class PPC64_SVR4_ABIInfo :
public ABIInfo {
659 static const unsigned GPRBits = 64;
666 : ABIInfo(CGT),
Kind(
Kind), IsSoftFloatABI(SoftFloatABI) {}
668 bool isPromotableTypeForABI(QualType Ty)
const;
669 CharUnits getParamTypeAlignment(QualType Ty)
const;
674 bool isHomogeneousAggregateBaseType(QualType Ty)
const override;
675 bool isHomogeneousAggregateSmallEnough(
const Type *Ty,
676 uint64_t Members)
const override;
684 void computeInfo(CGFunctionInfo &FI)
const override {
693 const BuiltinType *BT =
T->
getAs<BuiltinType>();
705 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
706 AggValueSlot Slot)
const override;
709class PPC64_SVR4_TargetCodeGenInfo :
public TargetCodeGenInfo {
715 std::make_unique<PPC64_SVR4_ABIInfo>(CGT,
Kind, SoftFloatABI)) {
717 std::make_unique<SwiftABIInfo>(CGT,
false);
720 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
725 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
726 llvm::Value *Address)
const override;
729class PPC64TargetCodeGenInfo :
public TargetCodeGenInfo {
731 PPC64TargetCodeGenInfo(CodeGenTypes &CGT)
732 : TargetCodeGenInfo(std::make_unique<DefaultABIInfo>(CGT)) {}
734 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
739 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
740 llvm::Value *Address)
const override;
747PPC64_SVR4_ABIInfo::isPromotableTypeForABI(QualType Ty)
const {
750 Ty = ED->getIntegerType();
753 if (isPromotableIntegerTypeForABI(Ty))
758 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
760 case BuiltinType::Int:
761 case BuiltinType::UInt:
767 if (
const auto *EIT = Ty->
getAs<BitIntType>())
768 if (EIT->getNumBits() < 64)
776CharUnits PPC64_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
778 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
779 Ty = CTy->getElementType();
781 auto FloatUsesVector = [
this](QualType Ty){
783 Ty) == &llvm::APFloat::IEEEquad();
790 }
else if (FloatUsesVector(Ty)) {
799 const Type *AlignAsType =
nullptr;
802 const BuiltinType *BT = EltType->
getAs<BuiltinType>();
803 if ((EltType->
isVectorType() && getContext().getTypeSize(EltType) == 128) ||
805 AlignAsType = EltType;
811 if (!AlignAsType && Kind == PPC64_SVR4_ABIKind::ELFv2 &&
818 FloatUsesVector(QualType(AlignAsType, 0));
831bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateBaseType(QualType Ty)
const {
834 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>()) {
835 if (BT->
getKind() == BuiltinType::Float ||
836 BT->
getKind() == BuiltinType::Double ||
837 BT->
getKind() == BuiltinType::LongDouble ||
838 BT->
getKind() == BuiltinType::Ibm128 ||
839 (getContext().getTargetInfo().hasFloat128Type() &&
840 (BT->
getKind() == BuiltinType::Float128))) {
846 if (
const VectorType *VT = Ty->
getAs<VectorType>()) {
847 if (getContext().getTypeSize(VT) == 128)
853bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateSmallEnough(
854 const Type *Base, uint64_t Members)
const {
858 ((getContext().getTargetInfo().hasFloat128Type() &&
859 Base->isFloat128Type()) ||
860 Base->isVectorType()) ? 1
861 : (getContext().getTypeSize(Base) + 63) / 64;
864 return Members * NumRegs <= 8;
868PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty)
const {
879 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
881 else if (Size < 128) {
882 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
887 if (
const auto *EIT = Ty->
getAs<BitIntType>())
888 if (EIT->getNumBits() > 128)
889 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
894 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
897 uint64_t ABIAlign = getParamTypeAlignment(Ty).getQuantity();
903 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
904 isHomogeneousAggregate(Ty, Base, Members)) {
905 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
906 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
914 uint64_t Bits = getContext().getTypeSize(Ty);
915 if (Bits > 0 && Bits <= 8 * GPRBits) {
916 llvm::Type *CoerceTy;
922 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
927 uint64_t NumRegs = llvm::alignTo(Bits, RegBits) / RegBits;
928 llvm::Type *RegTy = llvm::IntegerType::get(getVMContext(), RegBits);
929 CoerceTy = llvm::ArrayType::get(RegTy, NumRegs);
938 getDataLayout().getAllocaAddrSpace(),
939 true, TyAlign > ABIAlign);
942 return (isPromotableTypeForABI(Ty)
948PPC64_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
960 return getNaturalAlignIndirect(RetTy,
961 getDataLayout().getAllocaAddrSpace());
962 else if (Size < 128) {
963 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
968 if (
const auto *EIT = RetTy->
getAs<BitIntType>())
969 if (EIT->getNumBits() > 128)
970 return getNaturalAlignIndirect(
971 RetTy, getDataLayout().getAllocaAddrSpace(),
false);
977 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
978 isHomogeneousAggregate(RetTy, Base, Members)) {
979 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
980 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
985 uint64_t Bits = getContext().getTypeSize(RetTy);
986 if (Kind == PPC64_SVR4_ABIKind::ELFv2 && Bits <= 2 * GPRBits) {
990 llvm::Type *CoerceTy;
991 if (Bits > GPRBits) {
992 CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits);
993 CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy);
996 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
1001 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
1009RValue PPC64_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
1010 QualType Ty, AggValueSlot Slot)
const {
1011 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
1012 TypeInfo.Align = getParamTypeAlignment(Ty);
1022 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
1023 CharUnits EltSize = TypeInfo.Width / 2;
1024 if (EltSize < SlotSize)
1042 SlotSize,
true, Slot,
1047PPC64_SVR4_TargetCodeGenInfo::initDwarfEHRegSizeTable(
1048 CodeGen::CodeGenFunction &CGF,
1049 llvm::Value *Address)
const {
1055PPC64TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
1056 llvm::Value *Address)
const {
1061std::unique_ptr<TargetCodeGenInfo>
1063 return std::make_unique<AIXTargetCodeGenInfo>(CGM.
getTypes(), Is64Bit);
1066std::unique_ptr<TargetCodeGenInfo>
1068 bool RetSmallStructInRegABI = PPC32TargetCodeGenInfo::isStructReturnInRegABI(
1070 return std::make_unique<PPC32TargetCodeGenInfo>(CGM.
getTypes(), SoftFloatABI,
1071 RetSmallStructInRegABI);
1074std::unique_ptr<TargetCodeGenInfo>
1076 return std::make_unique<PPC64TargetCodeGenInfo>(CGM.
getTypes());
1081 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 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="")
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)
@ Address
A pointer to a ValueDecl.
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
const FunctionProtoType * T
U cast(CodeGen::Address addr)
int32_t uint32_t uint32_t __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