#include "ABIInfoImpl.h"
#include "TargetInfo.h"
#include "clang/Basic/DiagnosticFrontend.h"
#include "llvm/ADT/SmallBitVector.h"
usingnamespaceclang;
usingnamespaceclang::CodeGen;
namespace {
bool IsX86_MMXType(llvm::Type *IRType) { … }
static llvm::Type *X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
StringRef Constraint,
llvm::Type *Ty) { … }
static bool isX86VectorTypeForVectorCall(ASTContext &Context, QualType Ty) { … }
static bool isX86VectorCallAggregateSmallEnough(uint64_t NumMembers) { … }
static ABIArgInfo getDirectX86Hva(llvm::Type* T = nullptr) { … }
struct CCState { … };
class X86_32ABIInfo : public ABIInfo { … };
class X86_32SwiftABIInfo : public SwiftABIInfo { … };
class X86_32TargetCodeGenInfo : public TargetCodeGenInfo { … };
}
static void rewriteInputConstraintReferences(unsigned FirstIn,
unsigned NumNewOuts,
std::string &AsmString) { … }
void X86_32TargetCodeGenInfo::addReturnRegisterOutputs(
CodeGenFunction &CGF, LValue ReturnSlot, std::string &Constraints,
std::vector<llvm::Type *> &ResultRegTypes,
std::vector<llvm::Type *> &ResultTruncRegTypes,
std::vector<LValue> &ResultRegDests, std::string &AsmString,
unsigned NumOutputs) const { … }
bool X86_32ABIInfo::shouldReturnTypeInRegister(QualType Ty,
ASTContext &Context) const { … }
static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) { … }
static bool addFieldSizes(ASTContext &Context, const RecordDecl *RD,
uint64_t &Size) { … }
static bool addBaseAndFieldSizes(ASTContext &Context, const CXXRecordDecl *RD,
uint64_t &Size) { … }
bool X86_32ABIInfo::canExpandIndirectArgument(QualType Ty) const { … }
ABIArgInfo X86_32ABIInfo::getIndirectReturnResult(QualType RetTy, CCState &State) const { … }
ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy,
CCState &State) const { … }
unsigned X86_32ABIInfo::getTypeStackAlignInBytes(QualType Ty,
unsigned Align) const { … }
ABIArgInfo X86_32ABIInfo::getIndirectResult(QualType Ty, bool ByVal,
CCState &State) const { … }
X86_32ABIInfo::Class X86_32ABIInfo::classify(QualType Ty) const { … }
bool X86_32ABIInfo::updateFreeRegs(QualType Ty, CCState &State) const { … }
bool X86_32ABIInfo::shouldAggregateUseDirect(QualType Ty, CCState &State,
bool &InReg,
bool &NeedsPadding) const { … }
bool X86_32ABIInfo::shouldPrimitiveUseInReg(QualType Ty, CCState &State) const { … }
void X86_32ABIInfo::runVectorCallFirstPass(CGFunctionInfo &FI, CCState &State) const { … }
ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, CCState &State,
unsigned ArgIndex) const { … }
void X86_32ABIInfo::computeInfo(CGFunctionInfo &FI) const { … }
void
X86_32ABIInfo::addFieldToArgStruct(SmallVector<llvm::Type *, 6> &FrameFields,
CharUnits &StackOffset, ABIArgInfo &Info,
QualType Type) const { … }
static bool isArgInAlloca(const ABIArgInfo &Info) { … }
void X86_32ABIInfo::rewriteWithInAlloca(CGFunctionInfo &FI) const { … }
RValue X86_32ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
QualType Ty, AggValueSlot Slot) const { … }
bool X86_32TargetCodeGenInfo::isStructReturnInRegABI(
const llvm::Triple &Triple, const CodeGenOptions &Opts) { … }
static void addX86InterruptAttrs(const FunctionDecl *FD, llvm::GlobalValue *GV,
CodeGen::CodeGenModule &CGM) { … }
void X86_32TargetCodeGenInfo::setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const { … }
bool X86_32TargetCodeGenInfo::initDwarfEHRegSizeTable(
CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const { … }
namespace {
static unsigned getNativeVectorSizeForAVXABI(X86AVXABILevel AVXLevel) { … }
class X86_64ABIInfo : public ABIInfo { … };
class WinX86_64ABIInfo : public ABIInfo { … };
class X86_64TargetCodeGenInfo : public TargetCodeGenInfo { … };
}
static void initFeatureMaps(const ASTContext &Ctx,
llvm::StringMap<bool> &CallerMap,
const FunctionDecl *Caller,
llvm::StringMap<bool> &CalleeMap,
const FunctionDecl *Callee) { … }
static bool checkAVXParamFeature(DiagnosticsEngine &Diag,
SourceLocation CallLoc,
const llvm::StringMap<bool> &CallerMap,
const llvm::StringMap<bool> &CalleeMap,
QualType Ty, StringRef Feature,
bool IsArgument) { … }
static bool checkAVX512ParamFeature(DiagnosticsEngine &Diag,
SourceLocation CallLoc,
const llvm::StringMap<bool> &CallerMap,
const llvm::StringMap<bool> &CalleeMap,
QualType Ty, bool IsArgument) { … }
static bool checkAVXParam(DiagnosticsEngine &Diag, ASTContext &Ctx,
SourceLocation CallLoc,
const llvm::StringMap<bool> &CallerMap,
const llvm::StringMap<bool> &CalleeMap, QualType Ty,
bool IsArgument) { … }
void X86_64TargetCodeGenInfo::checkFunctionCallABI(CodeGenModule &CGM,
SourceLocation CallLoc,
const FunctionDecl *Caller,
const FunctionDecl *Callee,
const CallArgList &Args,
QualType ReturnType) const { … }
std::string TargetCodeGenInfo::qualifyWindowsLibrary(StringRef Lib) { … }
namespace {
class WinX86_32TargetCodeGenInfo : public X86_32TargetCodeGenInfo { … };
}
void WinX86_32TargetCodeGenInfo::setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const { … }
namespace {
class WinX86_64TargetCodeGenInfo : public TargetCodeGenInfo { … };
}
void WinX86_64TargetCodeGenInfo::setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const { … }
void X86_64ABIInfo::postMerge(unsigned AggregateSize, Class &Lo,
Class &Hi) const { … }
X86_64ABIInfo::Class X86_64ABIInfo::merge(Class Accum, Class Field) { … }
void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, Class &Lo,
Class &Hi, bool isNamedArg, bool IsRegCall) const { … }
ABIArgInfo X86_64ABIInfo::getIndirectReturnResult(QualType Ty) const { … }
bool X86_64ABIInfo::IsIllegalVectorType(QualType Ty) const { … }
ABIArgInfo X86_64ABIInfo::getIndirectResult(QualType Ty,
unsigned freeIntRegs) const { … }
llvm::Type *X86_64ABIInfo::GetByteVectorType(QualType Ty) const { … }
static bool BitsContainNoUserData(QualType Ty, unsigned StartBit,
unsigned EndBit, ASTContext &Context) { … }
static llvm::Type *getFPTypeAtOffset(llvm::Type *IRType, unsigned IROffset,
const llvm::DataLayout &TD) { … }
llvm::Type *X86_64ABIInfo::
GetSSETypeAtOffset(llvm::Type *IRType, unsigned IROffset,
QualType SourceTy, unsigned SourceOffset) const { … }
llvm::Type *X86_64ABIInfo::
GetINTEGERTypeAtOffset(llvm::Type *IRType, unsigned IROffset,
QualType SourceTy, unsigned SourceOffset) const { … }
static llvm::Type *
GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi,
const llvm::DataLayout &TD) { … }
ABIArgInfo X86_64ABIInfo::
classifyReturnType(QualType RetTy) const { … }
ABIArgInfo
X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned freeIntRegs,
unsigned &neededInt, unsigned &neededSSE,
bool isNamedArg, bool IsRegCall) const { … }
ABIArgInfo
X86_64ABIInfo::classifyRegCallStructTypeImpl(QualType Ty, unsigned &NeededInt,
unsigned &NeededSSE,
unsigned &MaxVectorWidth) const { … }
ABIArgInfo
X86_64ABIInfo::classifyRegCallStructType(QualType Ty, unsigned &NeededInt,
unsigned &NeededSSE,
unsigned &MaxVectorWidth) const { … }
void X86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const { … }
static Address EmitX86_64VAArgFromMemory(CodeGenFunction &CGF,
Address VAListAddr, QualType Ty) { … }
RValue X86_64ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
QualType Ty, AggValueSlot Slot) const { … }
RValue X86_64ABIInfo::EmitMSVAArg(CodeGenFunction &CGF, Address VAListAddr,
QualType Ty, AggValueSlot Slot) const { … }
ABIArgInfo WinX86_64ABIInfo::reclassifyHvaArgForVectorCall(
QualType Ty, unsigned &FreeSSERegs, const ABIArgInfo ¤t) const { … }
ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, unsigned &FreeSSERegs,
bool IsReturnType, bool IsVectorCall,
bool IsRegCall) const { … }
void WinX86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const { … }
RValue WinX86_64ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
QualType Ty, AggValueSlot Slot) const { … }
std::unique_ptr<TargetCodeGenInfo> CodeGen::createX86_32TargetCodeGenInfo(
CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI,
unsigned NumRegisterParameters, bool SoftFloatABI) { … }
std::unique_ptr<TargetCodeGenInfo> CodeGen::createWinX86_32TargetCodeGenInfo(
CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI,
unsigned NumRegisterParameters) { … }
std::unique_ptr<TargetCodeGenInfo>
CodeGen::createX86_64TargetCodeGenInfo(CodeGenModule &CGM,
X86AVXABILevel AVXLevel) { … }
std::unique_ptr<TargetCodeGenInfo>
CodeGen::createWinX86_64TargetCodeGenInfo(CodeGenModule &CGM,
X86AVXABILevel AVXLevel) { … }