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;
161 assert(0 &&
"specifying target features on an FMV is unsupported on AIX");
164class AIXTargetCodeGenInfo :
public TargetCodeGenInfo {
168 AIXTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT,
bool Is64Bit)
169 : TargetCodeGenInfo(std::make_unique<AIXABIInfo>(CGT, Is64Bit)),
171 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
175 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
176 llvm::Value *Address)
const override;
178 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
179 CodeGen::CodeGenModule &M)
const override;
185bool AIXABIInfo::isPromotableTypeForABI(QualType Ty)
const {
188 Ty = ED->getIntegerType();
191 if (getContext().isPromotableIntegerType(Ty))
200 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
201 switch (BT->getKind()) {
202 case BuiltinType::Int:
203 case BuiltinType::UInt:
212ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy)
const {
223 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
229ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty)
const {
242 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
245 CharUnits CCAlign = getParamTypeAlignment(Ty);
246 CharUnits TyAlign = getContext().getTypeAlignInChars(Ty);
249 CCAlign, getDataLayout().getAllocaAddrSpace(),
254 return (isPromotableTypeForABI(Ty)
259CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty)
const {
261 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
262 Ty = CTy->getElementType();
274RValue AIXABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
275 QualType Ty, AggValueSlot Slot)
const {
277 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
278 TypeInfo.Align = getParamTypeAlignment(Ty);
289 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
290 CharUnits EltSize = TypeInfo.Width / 2;
291 if (EltSize < SlotSize)
296 SlotSize,
true, Slot);
299bool AIXTargetCodeGenInfo::initDwarfEHRegSizeTable(
300 CodeGen::CodeGenFunction &CGF, llvm::Value *Address)
const {
304void AIXTargetCodeGenInfo::setTargetAttributes(
305 const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M)
const {
310 auto GVId = GV->getName();
313 bool UserSpecifiedTOC =
317 if (UserSpecifiedTOC ||
320 const unsigned long PointerSize =
321 GV->getParent()->getDataLayout().getPointerSizeInBits() / 8;
322 auto *VarD = dyn_cast<VarDecl>(D);
323 assert(VarD &&
"Invalid declaration of global variable.");
327 const auto *Ty = VarD->getType().getTypePtr();
330 bool EmitDiagnostic = UserSpecifiedTOC && GV->hasExternalLinkage();
331 auto reportUnsupportedWarning = [&](
bool ShouldEmitWarning, StringRef Msg) {
332 if (ShouldEmitWarning)
337 reportUnsupportedWarning(EmitDiagnostic,
"of incomplete type");
339 reportUnsupportedWarning(EmitDiagnostic,
340 "it contains a flexible array member");
342 reportUnsupportedWarning(EmitDiagnostic,
"of thread local storage");
344 reportUnsupportedWarning(EmitDiagnostic,
345 "variable is larger than a pointer");
346 else if (PointerSize < Alignment)
347 reportUnsupportedWarning(EmitDiagnostic,
348 "variable is aligned wider than a pointer");
349 else if (D->
hasAttr<SectionAttr>())
350 reportUnsupportedWarning(EmitDiagnostic,
351 "variable has a section attribute");
352 else if (GV->hasExternalLinkage() ||
354 GVar->addAttribute(
"toc-data");
361class PPC32_SVR4_ABIInfo :
public DefaultABIInfo {
363 bool IsRetSmallStructInRegABI;
365 CharUnits getParamTypeAlignment(QualType Ty)
const;
368 PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT,
bool SoftFloatABI,
369 bool RetSmallStructInRegABI)
370 : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI),
371 IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
375 void computeInfo(CGFunctionInfo &FI)
const override {
382 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
383 AggValueSlot Slot)
const override;
386class PPC32TargetCodeGenInfo :
public TargetCodeGenInfo {
388 PPC32TargetCodeGenInfo(CodeGenTypes &CGT,
bool SoftFloatABI,
389 bool RetSmallStructInRegABI)
390 : TargetCodeGenInfo(std::make_unique<PPC32_SVR4_ABIInfo>(
391 CGT, SoftFloatABI, RetSmallStructInRegABI)) {}
393 static bool isStructReturnInRegABI(
const llvm::Triple &Triple,
394 const CodeGenOptions &Opts);
396 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
401 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
402 llvm::Value *Address)
const override;
406CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
408 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
409 Ty = CTy->getElementType();
417 const Type *AlignTy =
nullptr;
419 const BuiltinType *BT = EltType->getAs<BuiltinType>();
420 if ((EltType->isVectorType() && getContext().getTypeSize(EltType) == 128) ||
430ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
435 (Size = getContext().getTypeSize(RetTy)) <= 64) {
450 llvm::Type *CoerceTy = llvm::Type::getIntNTy(getVMContext(), Size);
460RValue PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList,
461 QualType Ty, AggValueSlot Slot)
const {
462 if (getTarget().
getTriple().isOSDarwin()) {
463 auto TI = getContext().getTypeInfoInChars(Ty);
464 TI.Align = getParamTypeAlignment(Ty);
472 const unsigned OverflowLimit = 8;
473 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
487 bool isI64 = Ty->
isIntegerType() && getContext().getTypeSize(Ty) == 64;
489 bool isF64 = Ty->
isFloatingType() && getContext().getTypeSize(Ty) == 64;
495 CGBuilderTy &Builder = CGF.
Builder;
499 if (isInt || IsSoftFloatABI) {
500 NumRegsAddr = Builder.CreateStructGEP(VAList, 0,
"gpr");
502 NumRegsAddr = Builder.CreateStructGEP(VAList, 1,
"fpr");
505 llvm::Value *NumRegs = Builder.CreateLoad(NumRegsAddr,
"numUsedRegs");
508 if (isI64 || (isF64 && IsSoftFloatABI)) {
509 NumRegs = Builder.CreateAdd(NumRegs, Builder.getInt8(1));
510 NumRegs = Builder.CreateAnd(NumRegs, Builder.getInt8((
uint8_t) ~1U));
514 Builder.CreateICmpULT(NumRegs, Builder.getInt8(OverflowLimit),
"cond");
520 Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);
522 llvm::Type *DirectTy = CGF.
ConvertType(Ty), *ElementTy = DirectTy;
531 Address RegSaveAreaPtr = Builder.CreateStructGEP(VAList, 4);
532 RegAddr =
Address(Builder.CreateLoad(RegSaveAreaPtr), CGF.
Int8Ty,
537 if (!(isInt || IsSoftFloatABI)) {
538 RegAddr = Builder.CreateConstInBoundsByteGEP(RegAddr,
545 llvm::Value *RegOffset =
546 Builder.CreateMul(NumRegs, Builder.getInt8(RegSize.
getQuantity()));
547 RegAddr =
Address(Builder.CreateInBoundsGEP(
554 Builder.CreateAdd(NumRegs,
555 Builder.getInt8((isI64 || (isF64 && IsSoftFloatABI)) ? 2 : 1));
556 Builder.CreateStore(NumRegs, NumRegsAddr);
566 Builder.CreateStore(Builder.getInt8(OverflowLimit), NumRegsAddr);
574 Size = TypeInfo.Width.alignTo(OverflowAreaAlign);
579 Address OverflowAreaAddr = Builder.CreateStructGEP(VAList, 3);
581 Address(Builder.CreateLoad(OverflowAreaAddr,
"argp.cur"), CGF.
Int8Ty,
585 if (Align > OverflowAreaAlign) {
594 OverflowArea = Builder.CreateConstInBoundsByteGEP(OverflowArea, Size);
595 Builder.CreateStore(OverflowArea.
emitRawPointer(CGF), OverflowAreaAddr);
608 getContext().getTypeAlignInChars(Ty));
614bool PPC32TargetCodeGenInfo::isStructReturnInRegABI(
615 const llvm::Triple &Triple,
const CodeGenOptions &Opts) {
616 assert(Triple.isPPC32());
618 switch (Opts.getStructReturnConvention()) {
627 if (Triple.isOSBinFormatELF() && !Triple.isOSLinux())
634PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
635 llvm::Value *Address)
const {
645class PPC64_SVR4_ABIInfo :
public ABIInfo {
646 static const unsigned GPRBits = 64;
653 : ABIInfo(CGT),
Kind(
Kind), IsSoftFloatABI(SoftFloatABI) {}
655 bool isPromotableTypeForABI(QualType Ty)
const;
656 CharUnits getParamTypeAlignment(QualType Ty)
const;
661 bool isHomogeneousAggregateBaseType(QualType Ty)
const override;
662 bool isHomogeneousAggregateSmallEnough(
const Type *Ty,
663 uint64_t Members)
const override;
671 void computeInfo(CGFunctionInfo &FI)
const override {
680 const BuiltinType *BT =
T->
getAs<BuiltinType>();
692 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
693 AggValueSlot Slot)
const override;
696class PPC64_SVR4_TargetCodeGenInfo :
public TargetCodeGenInfo {
702 std::make_unique<PPC64_SVR4_ABIInfo>(CGT,
Kind, SoftFloatABI)) {
704 std::make_unique<SwiftABIInfo>(CGT,
false);
707 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
712 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
713 llvm::Value *Address)
const override;
716class PPC64TargetCodeGenInfo :
public TargetCodeGenInfo {
718 PPC64TargetCodeGenInfo(CodeGenTypes &CGT)
719 : TargetCodeGenInfo(std::make_unique<DefaultABIInfo>(CGT)) {}
721 int getDwarfEHStackPointer(CodeGen::CodeGenModule &M)
const override {
726 bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
727 llvm::Value *Address)
const override;
734PPC64_SVR4_ABIInfo::isPromotableTypeForABI(QualType Ty)
const {
737 Ty = ED->getIntegerType();
740 if (isPromotableIntegerTypeForABI(Ty))
745 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>())
747 case BuiltinType::Int:
748 case BuiltinType::UInt:
754 if (
const auto *EIT = Ty->
getAs<BitIntType>())
755 if (EIT->getNumBits() < 64)
763CharUnits PPC64_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty)
const {
765 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>())
766 Ty = CTy->getElementType();
768 auto FloatUsesVector = [
this](QualType Ty){
770 Ty) == &llvm::APFloat::IEEEquad();
777 }
else if (FloatUsesVector(Ty)) {
786 const Type *AlignAsType =
nullptr;
789 const BuiltinType *BT = EltType->
getAs<BuiltinType>();
790 if ((EltType->
isVectorType() && getContext().getTypeSize(EltType) == 128) ||
792 AlignAsType = EltType;
798 if (!AlignAsType && Kind == PPC64_SVR4_ABIKind::ELFv2 &&
805 FloatUsesVector(QualType(AlignAsType, 0));
818bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateBaseType(QualType Ty)
const {
821 if (
const BuiltinType *BT = Ty->
getAs<BuiltinType>()) {
822 if (BT->
getKind() == BuiltinType::Float ||
823 BT->
getKind() == BuiltinType::Double ||
824 BT->
getKind() == BuiltinType::LongDouble ||
825 BT->
getKind() == BuiltinType::Ibm128 ||
826 (getContext().getTargetInfo().hasFloat128Type() &&
827 (BT->
getKind() == BuiltinType::Float128))) {
833 if (
const VectorType *VT = Ty->
getAs<VectorType>()) {
834 if (getContext().getTypeSize(VT) == 128)
840bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateSmallEnough(
841 const Type *Base, uint64_t Members)
const {
845 ((getContext().getTargetInfo().hasFloat128Type() &&
846 Base->isFloat128Type()) ||
847 Base->isVectorType()) ? 1
848 : (getContext().getTypeSize(Base) + 63) / 64;
851 return Members * NumRegs <= 8;
855PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty)
const {
866 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
868 else if (Size < 128) {
869 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
874 if (
const auto *EIT = Ty->
getAs<BitIntType>())
875 if (EIT->getNumBits() > 128)
876 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
881 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
884 uint64_t ABIAlign = getParamTypeAlignment(Ty).getQuantity();
890 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
891 isHomogeneousAggregate(Ty, Base, Members)) {
892 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
893 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
901 uint64_t Bits = getContext().getTypeSize(Ty);
902 if (Bits > 0 && Bits <= 8 * GPRBits) {
903 llvm::Type *CoerceTy;
909 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
914 uint64_t NumRegs = llvm::alignTo(Bits, RegBits) / RegBits;
915 llvm::Type *RegTy = llvm::IntegerType::get(getVMContext(), RegBits);
916 CoerceTy = llvm::ArrayType::get(RegTy, NumRegs);
925 getDataLayout().getAllocaAddrSpace(),
926 true, TyAlign > ABIAlign);
929 return (isPromotableTypeForABI(Ty)
935PPC64_SVR4_ABIInfo::classifyReturnType(QualType RetTy)
const {
947 return getNaturalAlignIndirect(RetTy,
948 getDataLayout().getAllocaAddrSpace());
949 else if (Size < 128) {
950 llvm::Type *CoerceTy = llvm::IntegerType::get(getVMContext(), Size);
955 if (
const auto *EIT = RetTy->
getAs<BitIntType>())
956 if (EIT->getNumBits() > 128)
957 return getNaturalAlignIndirect(
958 RetTy, getDataLayout().getAllocaAddrSpace(),
false);
964 if (Kind == PPC64_SVR4_ABIKind::ELFv2 &&
965 isHomogeneousAggregate(RetTy, Base, Members)) {
966 llvm::Type *BaseTy = CGT.ConvertType(QualType(Base, 0));
967 llvm::Type *CoerceTy = llvm::ArrayType::get(BaseTy, Members);
972 uint64_t Bits = getContext().getTypeSize(RetTy);
973 if (Kind == PPC64_SVR4_ABIKind::ELFv2 && Bits <= 2 * GPRBits) {
977 llvm::Type *CoerceTy;
978 if (Bits > GPRBits) {
979 CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits);
980 CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy);
983 llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8));
988 return getNaturalAlignIndirect(RetTy, getDataLayout().getAllocaAddrSpace());
996RValue PPC64_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
997 QualType Ty, AggValueSlot Slot)
const {
998 auto TypeInfo = getContext().getTypeInfoInChars(Ty);
999 TypeInfo.Align = getParamTypeAlignment(Ty);
1009 if (
const ComplexType *CTy = Ty->
getAs<ComplexType>()) {
1010 CharUnits EltSize = TypeInfo.Width / 2;
1011 if (EltSize < SlotSize)
1029 SlotSize,
true, Slot,
1034PPC64_SVR4_TargetCodeGenInfo::initDwarfEHRegSizeTable(
1035 CodeGen::CodeGenFunction &CGF,
1036 llvm::Value *Address)
const {
1042PPC64TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
1043 llvm::Value *Address)
const {
1048std::unique_ptr<TargetCodeGenInfo>
1050 return std::make_unique<AIXTargetCodeGenInfo>(CGM.
getTypes(), Is64Bit);
1053std::unique_ptr<TargetCodeGenInfo>
1055 bool RetSmallStructInRegABI = PPC32TargetCodeGenInfo::isStructReturnInRegABI(
1057 return std::make_unique<PPC32TargetCodeGenInfo>(CGM.
getTypes(), SoftFloatABI,
1058 RetSmallStructInRegABI);
1061std::unique_ptr<TargetCodeGenInfo>
1063 return std::make_unique<PPC64TargetCodeGenInfo>(CGM.
getTypes());
1068 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
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 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.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
const FunctionProtoType * T
@ Type
The name was classified as a type.
U cast(CodeGen::Address addr)
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 uint8_t
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 uint32_t
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
CharUnits getPointerSize() const
llvm::PointerType * DefaultPtrTy
std::vector< std::string > Features