forked from OSchip/llvm-project
Standardize accesses to the TargetInfo in IR-gen.
Patch by Stephen Lin! llvm-svn: 179638
This commit is contained in:
parent
0d9dd73847
commit
c8e0170578
|
@ -22,6 +22,7 @@ namespace llvm {
|
|||
|
||||
namespace clang {
|
||||
class ASTContext;
|
||||
class TargetInfo;
|
||||
|
||||
namespace CodeGen {
|
||||
class CGFunctionInfo;
|
||||
|
@ -196,6 +197,7 @@ namespace clang {
|
|||
ASTContext &getContext() const;
|
||||
llvm::LLVMContext &getVMContext() const;
|
||||
const llvm::DataLayout &getDataLayout() const;
|
||||
const TargetInfo &getTarget() const;
|
||||
|
||||
/// Return the calling convention to use for system runtime
|
||||
/// functions.
|
||||
|
|
|
@ -327,7 +327,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E, llvm::Value *Dest) {
|
|||
CharUnits alignChars = getContext().getTypeAlignInChars(AtomicTy);
|
||||
unsigned Align = alignChars.getQuantity();
|
||||
unsigned MaxInlineWidthInBits =
|
||||
getContext().getTargetInfo().getMaxAtomicInlineWidth();
|
||||
getTarget().getMaxAtomicInlineWidth();
|
||||
bool UseLibcall = (Size != Align ||
|
||||
getContext().toBits(sizeChars) > MaxInlineWidthInBits);
|
||||
|
||||
|
|
|
@ -2082,7 +2082,8 @@ llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) {
|
|||
|
||||
bool Packed = false;
|
||||
CharUnits Align = getContext().getDeclAlign(D);
|
||||
if (Align > getContext().toCharUnitsFromBits(Target.getPointerAlign(0))) {
|
||||
if (Align >
|
||||
getContext().toCharUnitsFromBits(getTarget().getPointerAlign(0))) {
|
||||
// We have to insert padding.
|
||||
|
||||
// The struct above has 2 32-bit integers.
|
||||
|
|
|
@ -296,7 +296,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType);
|
||||
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *ZeroUndef = Builder.getInt1(Target.isCLZForZeroUndef());
|
||||
Value *ZeroUndef = Builder.getInt1(getTarget().isCLZForZeroUndef());
|
||||
Value *Result = Builder.CreateCall2(F, ArgValue, ZeroUndef);
|
||||
if (Result->getType() != ResultType)
|
||||
Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
|
||||
|
@ -313,7 +313,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
Value *F = CGM.getIntrinsic(Intrinsic::ctlz, ArgType);
|
||||
|
||||
llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *ZeroUndef = Builder.getInt1(Target.isCLZForZeroUndef());
|
||||
Value *ZeroUndef = Builder.getInt1(getTarget().isCLZForZeroUndef());
|
||||
Value *Result = Builder.CreateCall2(F, ArgValue, ZeroUndef);
|
||||
if (Result->getType() != ResultType)
|
||||
Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
|
||||
|
@ -1430,7 +1430,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
const char *Name = getContext().BuiltinInfo.GetName(BuiltinID);
|
||||
Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
|
||||
if (const char *Prefix =
|
||||
llvm::Triple::getArchTypePrefix(Target.getTriple().getArch()))
|
||||
llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch()))
|
||||
IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix, Name);
|
||||
|
||||
if (IntrinsicID != Intrinsic::not_intrinsic) {
|
||||
|
@ -1501,7 +1501,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
|
||||
Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
|
||||
const CallExpr *E) {
|
||||
switch (Target.getTriple().getArch()) {
|
||||
switch (getTarget().getTriple().getArch()) {
|
||||
case llvm::Triple::arm:
|
||||
case llvm::Triple::thumb:
|
||||
return EmitARMBuiltinExpr(BuiltinID, E);
|
||||
|
@ -1852,7 +1852,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
// Generate target-independent intrinsic; also need to add second argument
|
||||
// for whether or not clz of zero is undefined; on ARM it isn't.
|
||||
Function *F = CGM.getIntrinsic(Intrinsic::ctlz, Ty);
|
||||
Ops.push_back(Builder.getInt1(Target.isCLZForZeroUndef()));
|
||||
Ops.push_back(Builder.getInt1(getTarget().isCLZForZeroUndef()));
|
||||
return EmitNeonCall(F, Ops, "vclz");
|
||||
}
|
||||
case ARM::BI__builtin_neon_vcnt_v:
|
||||
|
|
|
@ -837,12 +837,11 @@ bool CodeGenModule::ReturnTypeUsesFPRet(QualType ResultType) {
|
|||
default:
|
||||
return false;
|
||||
case BuiltinType::Float:
|
||||
return getContext().getTargetInfo().useObjCFPRetForRealType(TargetInfo::Float);
|
||||
return getTarget().useObjCFPRetForRealType(TargetInfo::Float);
|
||||
case BuiltinType::Double:
|
||||
return getContext().getTargetInfo().useObjCFPRetForRealType(TargetInfo::Double);
|
||||
return getTarget().useObjCFPRetForRealType(TargetInfo::Double);
|
||||
case BuiltinType::LongDouble:
|
||||
return getContext().getTargetInfo().useObjCFPRetForRealType(
|
||||
TargetInfo::LongDouble);
|
||||
return getTarget().useObjCFPRetForRealType(TargetInfo::LongDouble);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -853,7 +852,7 @@ bool CodeGenModule::ReturnTypeUsesFP2Ret(QualType ResultType) {
|
|||
if (const ComplexType *CT = ResultType->getAs<ComplexType>()) {
|
||||
if (const BuiltinType *BT = CT->getElementType()->getAs<BuiltinType>()) {
|
||||
if (BT->getKind() == BuiltinType::LongDouble)
|
||||
return getContext().getTargetInfo().useObjCFP2RetForComplexLongDouble();
|
||||
return getTarget().useObjCFP2RetForComplexLongDouble();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -710,7 +710,7 @@ void CodeGenFunction::EmitConstructorBody(FunctionArgList &Args) {
|
|||
// Before we go any further, try the complete->base constructor
|
||||
// delegation optimization.
|
||||
if (CtorType == Ctor_Complete && IsConstructorDelegationValid(Ctor) &&
|
||||
CGM.getContext().getTargetInfo().getCXXABI().hasConstructorVariants()) {
|
||||
CGM.getTarget().getCXXABI().hasConstructorVariants()) {
|
||||
if (CGDebugInfo *DI = getDebugInfo())
|
||||
DI->EmitLocation(Builder, Ctor->getLocEnd());
|
||||
EmitDelegateCXXConstructorCall(Ctor, Ctor_Base, Args);
|
||||
|
@ -1278,7 +1278,7 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) {
|
|||
EnterDtorCleanups(Dtor, Dtor_Complete);
|
||||
|
||||
if (!isTryBody &&
|
||||
CGM.getContext().getTargetInfo().getCXXABI().hasDestructorVariants()) {
|
||||
CGM.getTarget().getCXXABI().hasDestructorVariants()) {
|
||||
EmitCXXDestructorCall(Dtor, Dtor_Base, /*ForVirtualBase=*/false,
|
||||
/*Delegating=*/false, LoadCXXThis());
|
||||
break;
|
||||
|
|
|
@ -642,7 +642,7 @@ llvm::DIType CGDebugInfo::CreatePointerLikeType(unsigned Tag,
|
|||
// Size is always the size of a pointer. We can't use getTypeSize here
|
||||
// because that does not return the correct value for references.
|
||||
unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy);
|
||||
uint64_t Size = CGM.getContext().getTargetInfo().getPointerWidth(AS);
|
||||
uint64_t Size = CGM.getTarget().getPointerWidth(AS);
|
||||
uint64_t Align = CGM.getContext().getTypeAlign(Ty);
|
||||
|
||||
return DBuilder.createPointerType(CreatePointeeType(PointeeTy, Unit),
|
||||
|
@ -984,7 +984,7 @@ llvm::DIType CGDebugInfo::getOrCreateInstanceMethodType(
|
|||
const PointerType *ThisPtrTy = cast<PointerType>(ThisPtr);
|
||||
QualType PointeeTy = ThisPtrTy->getPointeeType();
|
||||
unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy);
|
||||
uint64_t Size = CGM.getContext().getTargetInfo().getPointerWidth(AS);
|
||||
uint64_t Size = CGM.getTarget().getPointerWidth(AS);
|
||||
uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy);
|
||||
llvm::DIType PointeeType = getOrCreateType(PointeeTy, Unit);
|
||||
llvm::DIType ThisPtrType = DBuilder.createPointerType(PointeeType, Size, Align);
|
||||
|
@ -2398,7 +2398,7 @@ llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
|
|||
|
||||
CharUnits Align = CGM.getContext().getDeclAlign(VD);
|
||||
if (Align > CGM.getContext().toCharUnitsFromBits(
|
||||
CGM.getContext().getTargetInfo().getPointerAlign(0))) {
|
||||
CGM.getTarget().getPointerAlign(0))) {
|
||||
CharUnits FieldOffsetInBytes
|
||||
= CGM.getContext().toCharUnitsFromBits(FieldOffset);
|
||||
CharUnits AlignedOffsetInBytes
|
||||
|
@ -2494,7 +2494,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
|
|||
addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));
|
||||
// offset of __forwarding field
|
||||
offset = CGM.getContext().toCharUnitsFromBits(
|
||||
CGM.getContext().getTargetInfo().getPointerWidth(0));
|
||||
CGM.getTarget().getPointerWidth(0));
|
||||
addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
|
||||
addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpDeref));
|
||||
addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));
|
||||
|
|
|
@ -900,7 +900,7 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
|
|||
CharUnits allocaAlignment = alignment;
|
||||
if (isByRef)
|
||||
allocaAlignment = std::max(allocaAlignment,
|
||||
getContext().toCharUnitsFromBits(Target.getPointerAlign(0)));
|
||||
getContext().toCharUnitsFromBits(getTarget().getPointerAlign(0)));
|
||||
Alloc->setAlignment(allocaAlignment.getQuantity());
|
||||
DeclPtr = Alloc;
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ CreateGlobalInitOrDestructFunction(CodeGenModule &CGM,
|
|||
if (!CGM.getLangOpts().AppleKext) {
|
||||
// Set the section if needed.
|
||||
if (const char *Section =
|
||||
CGM.getContext().getTargetInfo().getStaticInitSectionSpecifier())
|
||||
CGM.getTarget().getStaticInitSectionSpecifier())
|
||||
Fn->setSection(Section);
|
||||
}
|
||||
|
||||
|
|
|
@ -1341,7 +1341,7 @@ static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) {
|
|||
// Reference values are always non-null and have the width of a pointer.
|
||||
if (Field->getType()->isReferenceType())
|
||||
NumNonZeroBytes += CGF.getContext().toCharUnitsFromBits(
|
||||
CGF.getContext().getTargetInfo().getPointerWidth(0));
|
||||
CGF.getTarget().getPointerWidth(0));
|
||||
else
|
||||
NumNonZeroBytes += GetNumNonZeroBytesInInit(E, CGF);
|
||||
}
|
||||
|
|
|
@ -1634,8 +1634,8 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
|
|||
else {
|
||||
llvm::APFloat F(static_cast<float>(amount));
|
||||
bool ignored;
|
||||
F.convert(CGF.Target.getLongDoubleFormat(), llvm::APFloat::rmTowardZero,
|
||||
&ignored);
|
||||
F.convert(CGF.getTarget().getLongDoubleFormat(),
|
||||
llvm::APFloat::rmTowardZero, &ignored);
|
||||
amt = llvm::ConstantFP::get(VMContext, F);
|
||||
}
|
||||
value = Builder.CreateFAdd(value, amt, isInc ? "inc" : "dec");
|
||||
|
|
|
@ -714,7 +714,7 @@ PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM,
|
|||
}
|
||||
|
||||
llvm::Triple::ArchType arch =
|
||||
CGM.getContext().getTargetInfo().getTriple().getArch();
|
||||
CGM.getTarget().getTriple().getArch();
|
||||
|
||||
// Most architectures require memory to fit within a single cache
|
||||
// line, so the alignment has to be at least the size of the access.
|
||||
|
|
|
@ -1949,8 +1949,8 @@ llvm::Constant *CGObjCCommonMac::BuildGCBlockLayout(CodeGenModule &CGM,
|
|||
bool hasUnion = false;
|
||||
SkipIvars.clear();
|
||||
IvarsInfo.clear();
|
||||
unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0);
|
||||
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
|
||||
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
|
||||
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
|
||||
|
||||
// __isa is the first field in block descriptor and must assume by runtime's
|
||||
// convention that it is GC'able.
|
||||
|
@ -2077,7 +2077,7 @@ void CGObjCCommonMac::BuildRCRecordLayout(const llvm::StructLayout *RecLayout,
|
|||
|
||||
if (RecFields.empty())
|
||||
return;
|
||||
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
|
||||
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
|
||||
|
||||
for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
|
||||
const FieldDecl *Field = RecFields[i];
|
||||
|
@ -2316,8 +2316,8 @@ llvm::Constant *CGObjCCommonMac::getBitmapBlockLayout(bool ComputeByrefLayout) {
|
|||
llvm::Constant *nullPtr = llvm::Constant::getNullValue(CGM.Int8PtrTy);
|
||||
if (RunSkipBlockVars.empty())
|
||||
return nullPtr;
|
||||
unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0);
|
||||
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
|
||||
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
|
||||
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
|
||||
unsigned WordSizeInBytes = WordSizeInBits/ByteSizeInBits;
|
||||
|
||||
// Sort on byte position; captures might not be allocated in order,
|
||||
|
@ -2468,8 +2468,8 @@ llvm::Constant *CGObjCCommonMac::BuildRCBlockLayout(CodeGenModule &CGM,
|
|||
RunSkipBlockVars.clear();
|
||||
bool hasUnion = false;
|
||||
|
||||
unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0);
|
||||
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
|
||||
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
|
||||
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
|
||||
unsigned WordSizeInBytes = WordSizeInBits/ByteSizeInBits;
|
||||
|
||||
const BlockDecl *blockDecl = blockInfo.getBlockDecl();
|
||||
|
@ -4537,8 +4537,8 @@ void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI,
|
|||
|
||||
if (RecFields.empty())
|
||||
return;
|
||||
unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0);
|
||||
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
|
||||
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
|
||||
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
|
||||
if (!RD && CGM.getLangOpts().ObjCAutoRefCount) {
|
||||
const FieldDecl *FirstField = RecFields[0];
|
||||
FirstFieldDelta =
|
||||
|
|
|
@ -117,7 +117,7 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF,
|
|||
// a synthesized ivar can never be a bit-field, so this is safe.
|
||||
uint64_t FieldBitOffset = LookupFieldBitOffset(CGF.CGM, OID, 0, Ivar);
|
||||
uint64_t BitOffset = FieldBitOffset % CGF.CGM.getContext().getCharWidth();
|
||||
uint64_t AlignmentBits = CGF.CGM.getContext().getTargetInfo().getCharAlign();
|
||||
uint64_t AlignmentBits = CGF.CGM.getTarget().getCharAlign();
|
||||
uint64_t BitFieldSize = Ivar->getBitWidthValue(CGF.getContext());
|
||||
CharUnits StorageSize =
|
||||
CGF.CGM.getContext().toCharUnitsFromBits(
|
||||
|
|
|
@ -276,7 +276,7 @@ bool CGRecordLayoutBuilder::LayoutBitfields(const ASTRecordLayout &Layout,
|
|||
uint64_t FirstFieldOffset = Layout.getFieldOffset(FirstFieldNo);
|
||||
uint64_t NextFieldOffsetInBits = Types.getContext().toBits(NextFieldOffset);
|
||||
|
||||
unsigned CharAlign = Types.getContext().getTargetInfo().getCharAlign();
|
||||
unsigned CharAlign = Types.getTarget().getCharAlign();
|
||||
assert(FirstFieldOffset % CharAlign == 0 &&
|
||||
"First field offset is misaligned");
|
||||
CharUnits FirstFieldOffsetInBytes
|
||||
|
@ -352,7 +352,7 @@ bool CGRecordLayoutBuilder::LayoutBitfields(const ASTRecordLayout &Layout,
|
|||
assert(EndOffset >= (FirstFieldOffset + TotalBits) &&
|
||||
"End offset is not past the end of the known storage bits.");
|
||||
uint64_t SpaceBits = EndOffset - FirstFieldOffset;
|
||||
uint64_t LongBits = Types.getContext().getTargetInfo().getLongWidth();
|
||||
uint64_t LongBits = Types.getTarget().getLongWidth();
|
||||
uint64_t WidenedBits = (StorageBits / LongBits) * LongBits +
|
||||
llvm::NextPowerOf2(StorageBits % LongBits - 1);
|
||||
assert(WidenedBits >= StorageBits && "Widening shrunk the bits!");
|
||||
|
@ -455,7 +455,7 @@ CGRecordLayoutBuilder::LayoutUnionField(const FieldDecl *Field,
|
|||
return 0;
|
||||
|
||||
unsigned StorageBits = llvm::RoundUpToAlignment(
|
||||
FieldSize, Types.getContext().getTargetInfo().getCharAlign());
|
||||
FieldSize, Types.getTarget().getCharAlign());
|
||||
CharUnits NumBytesToAppend
|
||||
= Types.getContext().toCharUnitsFromBits(StorageBits);
|
||||
|
||||
|
@ -814,7 +814,7 @@ bool CGRecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
|
|||
|
||||
// Lay out the virtual bases. The MS ABI uses a different
|
||||
// algorithm here due to the lack of primary virtual bases.
|
||||
if (Types.getContext().getTargetInfo().getCXXABI().hasPrimaryVBases()) {
|
||||
if (Types.getTarget().getCXXABI().hasPrimaryVBases()) {
|
||||
RD->getIndirectPrimaryBases(IndirectPrimaryBases);
|
||||
if (Layout.isPrimaryBaseVirtual())
|
||||
IndirectPrimaryBases.insert(Layout.getPrimaryBase());
|
||||
|
|
|
@ -1451,7 +1451,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str,
|
|||
for (unsigned i = 0, e = StrVal.size()-1; i != e; ++i) {
|
||||
if (StrVal[i] != '\n') continue;
|
||||
SourceLocation LineLoc = Str->getLocationOfByte(i+1, SM, LangOpts,
|
||||
CGF.Target);
|
||||
CGF.getTarget());
|
||||
Locs.push_back(llvm::ConstantInt::get(CGF.Int32Ty,
|
||||
LineLoc.getRawEncoding()));
|
||||
}
|
||||
|
@ -1471,7 +1471,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
|||
for (unsigned i = 0, e = S.getNumOutputs(); i != e; i++) {
|
||||
TargetInfo::ConstraintInfo Info(S.getOutputConstraint(i),
|
||||
S.getOutputName(i));
|
||||
bool IsValid = Target.validateOutputConstraint(Info); (void)IsValid;
|
||||
bool IsValid = getTarget().validateOutputConstraint(Info); (void)IsValid;
|
||||
assert(IsValid && "Failed to parse output constraint");
|
||||
OutputConstraintInfos.push_back(Info);
|
||||
}
|
||||
|
@ -1479,8 +1479,9 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
|||
for (unsigned i = 0, e = S.getNumInputs(); i != e; i++) {
|
||||
TargetInfo::ConstraintInfo Info(S.getInputConstraint(i),
|
||||
S.getInputName(i));
|
||||
bool IsValid = Target.validateInputConstraint(OutputConstraintInfos.data(),
|
||||
S.getNumOutputs(), Info);
|
||||
bool IsValid =
|
||||
getTarget().validateInputConstraint(OutputConstraintInfos.data(),
|
||||
S.getNumOutputs(), Info);
|
||||
assert(IsValid && "Failed to parse input constraint"); (void)IsValid;
|
||||
InputConstraintInfos.push_back(Info);
|
||||
}
|
||||
|
@ -1504,13 +1505,14 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
|||
|
||||
// Simplify the output constraint.
|
||||
std::string OutputConstraint(S.getOutputConstraint(i));
|
||||
OutputConstraint = SimplifyConstraint(OutputConstraint.c_str() + 1, Target);
|
||||
OutputConstraint = SimplifyConstraint(OutputConstraint.c_str() + 1,
|
||||
getTarget());
|
||||
|
||||
const Expr *OutExpr = S.getOutputExpr(i);
|
||||
OutExpr = OutExpr->IgnoreParenNoopCasts(getContext());
|
||||
|
||||
OutputConstraint = AddVariableConstraints(OutputConstraint, *OutExpr,
|
||||
Target, CGM, S);
|
||||
getTarget(), CGM, S);
|
||||
|
||||
LValue Dest = EmitLValue(OutExpr);
|
||||
if (!Constraints.empty())
|
||||
|
@ -1591,13 +1593,13 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
|||
|
||||
// Simplify the input constraint.
|
||||
std::string InputConstraint(S.getInputConstraint(i));
|
||||
InputConstraint = SimplifyConstraint(InputConstraint.c_str(), Target,
|
||||
InputConstraint = SimplifyConstraint(InputConstraint.c_str(), getTarget(),
|
||||
&OutputConstraintInfos);
|
||||
|
||||
InputConstraint =
|
||||
AddVariableConstraints(InputConstraint,
|
||||
*InputExpr->IgnoreParenNoopCasts(getContext()),
|
||||
Target, CGM, S);
|
||||
getTarget(), CGM, S);
|
||||
|
||||
llvm::Value *Arg = EmitAsmInput(Info, InputExpr, Constraints);
|
||||
|
||||
|
@ -1649,7 +1651,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
|||
StringRef Clobber = S.getClobber(i);
|
||||
|
||||
if (Clobber != "memory" && Clobber != "cc")
|
||||
Clobber = Target.getNormalizedGCCRegisterName(Clobber);
|
||||
Clobber = getTarget().getNormalizedGCCRegisterName(Clobber);
|
||||
|
||||
if (i != 0 || NumConstraints != 0)
|
||||
Constraints += ',';
|
||||
|
@ -1660,7 +1662,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
|||
}
|
||||
|
||||
// Add machine specific clobbers
|
||||
std::string MachineClobbers = Target.getClobbers();
|
||||
std::string MachineClobbers = getTarget().getClobbers();
|
||||
if (!MachineClobbers.empty()) {
|
||||
if (!Constraints.empty())
|
||||
Constraints += ',';
|
||||
|
|
|
@ -31,8 +31,7 @@ using namespace clang;
|
|||
using namespace CodeGen;
|
||||
|
||||
CodeGenFunction::CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext)
|
||||
: CodeGenTypeCache(cgm), CGM(cgm),
|
||||
Target(CGM.getContext().getTargetInfo()),
|
||||
: CodeGenTypeCache(cgm), CGM(cgm), Target(cgm.getTarget()),
|
||||
Builder(cgm.getModule().getContext()),
|
||||
SanitizePerformTypeCheck(CGM.getSanOpts().Null |
|
||||
CGM.getSanOpts().Alignment |
|
||||
|
@ -279,8 +278,8 @@ void CodeGenFunction::EmitFunctionInstrumentation(const char *Fn) {
|
|||
void CodeGenFunction::EmitMCountInstrumentation() {
|
||||
llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, false);
|
||||
|
||||
llvm::Constant *MCountFn = CGM.CreateRuntimeFunction(FTy,
|
||||
Target.getMCountName());
|
||||
llvm::Constant *MCountFn =
|
||||
CGM.CreateRuntimeFunction(FTy, getTarget().getMCountName());
|
||||
EmitNounwindRuntimeCall(MCountFn);
|
||||
}
|
||||
|
||||
|
|
|
@ -1300,6 +1300,7 @@ public:
|
|||
return getInvokeDestImpl();
|
||||
}
|
||||
|
||||
const TargetInfo &getTarget() const { return Target; }
|
||||
llvm::LLVMContext &getLLVMContext() { return CGM.getLLVMContext(); }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
|
|
@ -55,7 +55,7 @@ using namespace CodeGen;
|
|||
static const char AnnotationSection[] = "llvm.metadata";
|
||||
|
||||
static CGCXXABI &createCXXABI(CodeGenModule &CGM) {
|
||||
switch (CGM.getContext().getTargetInfo().getCXXABI().getKind()) {
|
||||
switch (CGM.getTarget().getCXXABI().getKind()) {
|
||||
case TargetCXXABI::GenericAArch64:
|
||||
case TargetCXXABI::GenericARM:
|
||||
case TargetCXXABI::iOS:
|
||||
|
@ -73,16 +73,14 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
|
|||
const TargetOptions &TO, llvm::Module &M,
|
||||
const llvm::DataLayout &TD,
|
||||
DiagnosticsEngine &diags)
|
||||
: Context(C), LangOpts(C.getLangOpts()), CodeGenOpts(CGO), TargetOpts(TO),
|
||||
TheModule(M), TheDataLayout(TD), TheTargetCodeGenInfo(0), Diags(diags),
|
||||
ABI(createCXXABI(*this)),
|
||||
Types(*this),
|
||||
TBAA(0),
|
||||
VTables(*this), ObjCRuntime(0), OpenCLRuntime(0), CUDARuntime(0),
|
||||
: Context(C), LangOpts(C.getLangOpts()), CodeGenOpts(CGO), TheModule(M),
|
||||
Diags(diags), TheDataLayout(TD), Target(C.getTargetInfo()),
|
||||
ABI(createCXXABI(*this)), VMContext(M.getContext()), TBAA(0),
|
||||
TheTargetCodeGenInfo(0), Types(*this), VTables(*this),
|
||||
ObjCRuntime(0), OpenCLRuntime(0), CUDARuntime(0),
|
||||
DebugInfo(0), ARCData(0), NoObjCARCExceptionsMetadata(0),
|
||||
RRData(0), CFConstantStringClassRef(0),
|
||||
ConstantStringClassRef(0), NSConstantStringType(0),
|
||||
VMContext(M.getContext()),
|
||||
NSConcreteGlobalBlock(0), NSConcreteStackBlock(0),
|
||||
BlockObjectAssign(0), BlockObjectDispose(0),
|
||||
BlockDescriptorType(0), GenericBlockLiteralType(0),
|
||||
|
@ -256,10 +254,6 @@ void CodeGenModule::DecorateInstruction(llvm::Instruction *Inst,
|
|||
Inst->setMetadata(llvm::LLVMContext::MD_tbaa, TBAAInfo);
|
||||
}
|
||||
|
||||
bool CodeGenModule::isTargetDarwin() const {
|
||||
return getContext().getTargetInfo().getTriple().isOSDarwin();
|
||||
}
|
||||
|
||||
void CodeGenModule::Error(SourceLocation loc, StringRef error) {
|
||||
unsigned diagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, error);
|
||||
getDiags().Report(Context.getFullLoc(loc), diagID);
|
||||
|
@ -2361,7 +2355,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
|
|||
GV = new llvm::GlobalVariable(getModule(), C->getType(), true,
|
||||
llvm::GlobalVariable::PrivateLinkage, C,
|
||||
"_unnamed_cfstring_");
|
||||
if (const char *Sect = getContext().getTargetInfo().getCFStringSection())
|
||||
if (const char *Sect = getTarget().getCFStringSection())
|
||||
GV->setSection(Sect);
|
||||
Entry.setValue(GV);
|
||||
|
||||
|
@ -2486,8 +2480,8 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) {
|
|||
// FIXME. Fix section.
|
||||
if (const char *Sect =
|
||||
LangOpts.ObjCRuntime.isNonFragile()
|
||||
? getContext().getTargetInfo().getNSStringNonFragileABISection()
|
||||
: getContext().getTargetInfo().getNSStringSection())
|
||||
? getTarget().getNSStringNonFragileABISection()
|
||||
: getTarget().getNSStringSection())
|
||||
GV->setSection(Sect);
|
||||
Entry.setValue(GV);
|
||||
|
||||
|
|
|
@ -233,15 +233,22 @@ class CodeGenModule : public CodeGenTypeCache {
|
|||
ASTContext &Context;
|
||||
const LangOptions &LangOpts;
|
||||
const CodeGenOptions &CodeGenOpts;
|
||||
const TargetOptions &TargetOpts;
|
||||
llvm::Module &TheModule;
|
||||
const llvm::DataLayout &TheDataLayout;
|
||||
mutable const TargetCodeGenInfo *TheTargetCodeGenInfo;
|
||||
DiagnosticsEngine &Diags;
|
||||
const llvm::DataLayout &TheDataLayout;
|
||||
const TargetInfo &Target;
|
||||
CGCXXABI &ABI;
|
||||
CodeGenTypes Types;
|
||||
CodeGenTBAA *TBAA;
|
||||
llvm::LLVMContext &VMContext;
|
||||
|
||||
CodeGenTBAA *TBAA;
|
||||
|
||||
mutable const TargetCodeGenInfo *TheTargetCodeGenInfo;
|
||||
|
||||
// This should not be moved earlier, since its initialization depends on some
|
||||
// of the previous reference members being already initialized and also checks
|
||||
// if TheTargetCodeGenInfo is NULL
|
||||
CodeGenTypes Types;
|
||||
|
||||
/// VTables - Holds information about C++ vtables.
|
||||
CodeGenVTables VTables;
|
||||
friend class CodeGenVTables;
|
||||
|
@ -255,8 +262,8 @@ class CodeGenModule : public CodeGenTypeCache {
|
|||
RREntrypoints *RRData;
|
||||
|
||||
// WeakRefReferences - A set of references that have only been seen via
|
||||
// a weakref so far. This is used to remove the weak of the reference if we ever
|
||||
// see a direct reference or a definition.
|
||||
// a weakref so far. This is used to remove the weak of the reference if we
|
||||
// ever see a direct reference or a definition.
|
||||
llvm::SmallPtrSet<llvm::GlobalValue*, 10> WeakRefReferences;
|
||||
|
||||
/// DeferredDecls - This contains all the decls which have definitions but
|
||||
|
@ -369,7 +376,6 @@ class CodeGenModule : public CodeGenTypeCache {
|
|||
|
||||
bool isTriviallyRecursive(const FunctionDecl *F);
|
||||
bool shouldEmitFunction(const FunctionDecl *F);
|
||||
llvm::LLVMContext &VMContext;
|
||||
|
||||
/// @name Cache for Blocks Runtime Globals
|
||||
/// @{
|
||||
|
@ -433,9 +439,6 @@ public:
|
|||
return *CUDARuntime;
|
||||
}
|
||||
|
||||
/// getCXXABI() - Return a reference to the configured C++ ABI.
|
||||
CGCXXABI &getCXXABI() { return ABI; }
|
||||
|
||||
ARCEntrypoints &getARCEntrypoints() const {
|
||||
assert(getLangOpts().ObjCAutoRefCount && ARCData != 0);
|
||||
return *ARCData;
|
||||
|
@ -489,21 +492,24 @@ public:
|
|||
}
|
||||
|
||||
ASTContext &getContext() const { return Context; }
|
||||
const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; }
|
||||
const LangOptions &getLangOpts() const { return LangOpts; }
|
||||
const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; }
|
||||
llvm::Module &getModule() const { return TheModule; }
|
||||
CodeGenTypes &getTypes() { return Types; }
|
||||
CodeGenVTables &getVTables() { return VTables; }
|
||||
VTableContext &getVTableContext() { return VTables.getVTableContext(); }
|
||||
DiagnosticsEngine &getDiags() const { return Diags; }
|
||||
const llvm::DataLayout &getDataLayout() const { return TheDataLayout; }
|
||||
const TargetInfo &getTarget() const { return Context.getTargetInfo(); }
|
||||
const TargetInfo &getTarget() const { return Target; }
|
||||
CGCXXABI &getCXXABI() { return ABI; }
|
||||
llvm::LLVMContext &getLLVMContext() { return VMContext; }
|
||||
const TargetCodeGenInfo &getTargetCodeGenInfo();
|
||||
bool isTargetDarwin() const;
|
||||
|
||||
|
||||
bool shouldUseTBAA() const { return TBAA != 0; }
|
||||
|
||||
const TargetCodeGenInfo &getTargetCodeGenInfo();
|
||||
|
||||
CodeGenTypes &getTypes() { return Types; }
|
||||
|
||||
CodeGenVTables &getVTables() { return VTables; }
|
||||
VTableContext &getVTableContext() { return VTables.getVTableContext(); }
|
||||
|
||||
llvm::MDNode *getTBAAInfo(QualType QTy);
|
||||
llvm::MDNode *getTBAAInfoForVTablePtr();
|
||||
llvm::MDNode *getTBAAStructInfo(QualType QTy);
|
||||
|
@ -574,8 +580,8 @@ public:
|
|||
return GetAddrOfGlobalVar(cast<VarDecl>(GD.getDecl()));
|
||||
}
|
||||
|
||||
/// CreateOrReplaceCXXRuntimeVariable - Will return a global variable of the given
|
||||
/// type. If a variable with a different type already exists then a new
|
||||
/// CreateOrReplaceCXXRuntimeVariable - Will return a global variable of the
|
||||
/// given type. If a variable with a different type already exists then a new
|
||||
/// variable with the right type will be created and all uses of the old
|
||||
/// variable will be replaced with a bitcast to the new variable.
|
||||
llvm::GlobalVariable *
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
using namespace clang;
|
||||
using namespace CodeGen;
|
||||
|
||||
CodeGenTypes::CodeGenTypes(CodeGenModule &CGM)
|
||||
: Context(CGM.getContext()), Target(Context.getTargetInfo()),
|
||||
TheModule(CGM.getModule()), TheDataLayout(CGM.getDataLayout()),
|
||||
TheABIInfo(CGM.getTargetCodeGenInfo().getABIInfo()),
|
||||
TheCXXABI(CGM.getCXXABI()),
|
||||
CodeGenOpts(CGM.getCodeGenOpts()), CGM(CGM) {
|
||||
CodeGenTypes::CodeGenTypes(CodeGenModule &cgm)
|
||||
: CGM(cgm), Context(cgm.getContext()), TheModule(cgm.getModule()),
|
||||
TheDataLayout(cgm.getDataLayout()),
|
||||
Target(cgm.getTarget()), TheCXXABI(cgm.getCXXABI()),
|
||||
CodeGenOpts(cgm.getCodeGenOpts()),
|
||||
TheABIInfo(cgm.getTargetCodeGenInfo().getABIInfo()) {
|
||||
SkippedLayout = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,14 +60,17 @@ namespace CodeGen {
|
|||
class CodeGenTypes {
|
||||
public:
|
||||
// Some of this stuff should probably be left on the CGM.
|
||||
CodeGenModule &CGM;
|
||||
ASTContext &Context;
|
||||
const TargetInfo &Target;
|
||||
llvm::Module &TheModule;
|
||||
const llvm::DataLayout &TheDataLayout;
|
||||
const ABIInfo &TheABIInfo;
|
||||
const TargetInfo &Target;
|
||||
CGCXXABI &TheCXXABI;
|
||||
const CodeGenOptions &CodeGenOpts;
|
||||
CodeGenModule &CGM;
|
||||
|
||||
// This should not be moved earlier, since its initialization depends on some
|
||||
// of the previous reference members being already initialized
|
||||
const ABIInfo &TheABIInfo;
|
||||
|
||||
private:
|
||||
/// The opaque type map for Objective-C interfaces. All direct
|
||||
|
@ -107,14 +110,14 @@ private:
|
|||
llvm::DenseMap<const Type *, llvm::Type *> TypeCache;
|
||||
|
||||
public:
|
||||
CodeGenTypes(CodeGenModule &CGM);
|
||||
CodeGenTypes(CodeGenModule &cgm);
|
||||
~CodeGenTypes();
|
||||
|
||||
const llvm::DataLayout &getDataLayout() const { return TheDataLayout; }
|
||||
const TargetInfo &getTarget() const { return Target; }
|
||||
ASTContext &getContext() const { return Context; }
|
||||
const ABIInfo &getABIInfo() const { return TheABIInfo; }
|
||||
const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; }
|
||||
const TargetInfo &getTarget() const { return Target; }
|
||||
CGCXXABI &getCXXABI() const { return TheCXXABI; }
|
||||
llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ public:
|
|||
}
|
||||
|
||||
CodeGen::CGCXXABI *CodeGen::CreateItaniumCXXABI(CodeGenModule &CGM) {
|
||||
switch (CGM.getContext().getTargetInfo().getCXXABI().getKind()) {
|
||||
switch (CGM.getTarget().getCXXABI().getKind()) {
|
||||
// For IR-generation purposes, there's no significant difference
|
||||
// between the ARM and iOS ABIs.
|
||||
case TargetCXXABI::GenericARM:
|
||||
|
|
|
@ -55,6 +55,9 @@ const llvm::DataLayout &ABIInfo::getDataLayout() const {
|
|||
return CGT.getDataLayout();
|
||||
}
|
||||
|
||||
const TargetInfo &ABIInfo::getTarget() const {
|
||||
return CGT.getTarget();
|
||||
}
|
||||
|
||||
void ABIArgInfo::dump() const {
|
||||
raw_ostream &OS = llvm::errs();
|
||||
|
@ -551,8 +554,7 @@ public:
|
|||
|
||||
int getDwarfEHStackPointer(CodeGen::CodeGenModule &CGM) const {
|
||||
// Darwin uses different dwarf register numbers for EH.
|
||||
if (CGM.isTargetDarwin()) return 5;
|
||||
|
||||
if (CGM.getTarget().getTriple().isOSDarwin()) return 5;
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1022,7 @@ bool X86_32TargetCodeGenInfo::initDwarfEHRegSizeTable(
|
|||
// 8 is %eip.
|
||||
AssignToArrayRange(Builder, Address, Four8, 0, 8);
|
||||
|
||||
if (CGF.CGM.isTargetDarwin()) {
|
||||
if (CGF.CGM.getTarget().getTriple().isOSDarwin()) {
|
||||
// 12-16 are st(0..4). Not sure why we stop at 4.
|
||||
// These have size 16, which is sizeof(long double) on
|
||||
// platforms with 8-byte alignment for that type.
|
||||
|
@ -1145,7 +1147,7 @@ class X86_64ABIInfo : public ABIInfo {
|
|||
/// required strict binary compatibility with older versions of GCC
|
||||
/// may need to exempt themselves.
|
||||
bool honorsRevision0_98() const {
|
||||
return !getContext().getTargetInfo().getTriple().isOSDarwin();
|
||||
return !getTarget().getTriple().isOSDarwin();
|
||||
}
|
||||
|
||||
bool HasAVX;
|
||||
|
@ -1369,8 +1371,7 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase,
|
|||
Current = Integer;
|
||||
} else if ((k == BuiltinType::Float || k == BuiltinType::Double) ||
|
||||
(k == BuiltinType::LongDouble &&
|
||||
getContext().getTargetInfo().getTriple().getOS() ==
|
||||
llvm::Triple::NaCl)) {
|
||||
getTarget().getTriple().getOS() == llvm::Triple::NaCl)) {
|
||||
Current = SSE;
|
||||
} else if (k == BuiltinType::LongDouble) {
|
||||
Lo = X87;
|
||||
|
@ -1458,8 +1459,7 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase,
|
|||
Current = SSE;
|
||||
else if (ET == getContext().DoubleTy ||
|
||||
(ET == getContext().LongDoubleTy &&
|
||||
getContext().getTargetInfo().getTriple().getOS() ==
|
||||
llvm::Triple::NaCl))
|
||||
getTarget().getTriple().getOS() == llvm::Triple::NaCl))
|
||||
Lo = Hi = SSE;
|
||||
else if (ET == getContext().LongDoubleTy)
|
||||
Current = ComplexX87;
|
||||
|
@ -2514,9 +2514,7 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty) const {
|
|||
return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
|
||||
|
||||
// FIXME: mingw-w64-gcc emits 128-bit struct as i128
|
||||
if (Size == 128 &&
|
||||
getContext().getTargetInfo().getTriple().getOS()
|
||||
== llvm::Triple::MinGW32)
|
||||
if (Size == 128 && getTarget().getTriple().getOS() == llvm::Triple::MinGW32)
|
||||
return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(),
|
||||
Size));
|
||||
|
||||
|
@ -2946,8 +2944,7 @@ public:
|
|||
}
|
||||
|
||||
bool isEABI() const {
|
||||
StringRef Env =
|
||||
getContext().getTargetInfo().getTriple().getEnvironmentName();
|
||||
StringRef Env = getTarget().getTriple().getEnvironmentName();
|
||||
return (Env == "gnueabi" || Env == "eabi" ||
|
||||
Env == "android" || Env == "androideabi");
|
||||
}
|
||||
|
@ -3046,7 +3043,7 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const {
|
|||
/// Return the default calling convention that LLVM will use.
|
||||
llvm::CallingConv::ID ARMABIInfo::getLLVMDefaultCC() const {
|
||||
// The default calling convention that LLVM will infer.
|
||||
if (getContext().getTargetInfo().getTriple().getEnvironmentName()=="gnueabihf")
|
||||
if (getTarget().getTriple().getEnvironmentName()=="gnueabihf")
|
||||
return llvm::CallingConv::ARM_AAPCS_VFP;
|
||||
else if (isEABI())
|
||||
return llvm::CallingConv::ARM_AAPCS;
|
||||
|
@ -4538,7 +4535,7 @@ llvm::Value* MipsABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
int64_t TypeAlign = getContext().getTypeAlign(Ty) / 8;
|
||||
llvm::Type *PTy = llvm::PointerType::getUnqual(CGF.ConvertType(Ty));
|
||||
llvm::Value *AddrTyped;
|
||||
unsigned PtrWidth = getContext().getTargetInfo().getPointerWidth(0);
|
||||
unsigned PtrWidth = getTarget().getPointerWidth(0);
|
||||
llvm::IntegerType *IntTy = (PtrWidth == 32) ? CGF.Int32Ty : CGF.Int64Ty;
|
||||
|
||||
if (TypeAlign > MinABIStackAlignInBytes) {
|
||||
|
@ -4799,7 +4796,7 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
|
|||
if (TheTargetCodeGenInfo)
|
||||
return *TheTargetCodeGenInfo;
|
||||
|
||||
const llvm::Triple &Triple = getContext().getTargetInfo().getTriple();
|
||||
const llvm::Triple &Triple = getTarget().getTriple();
|
||||
switch (Triple.getArch()) {
|
||||
default:
|
||||
return *(TheTargetCodeGenInfo = new DefaultTargetCodeGenInfo(Types));
|
||||
|
@ -4821,10 +4818,11 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
|
|||
case llvm::Triple::thumb:
|
||||
{
|
||||
ARMABIInfo::ABIKind Kind = ARMABIInfo::AAPCS;
|
||||
if (strcmp(getContext().getTargetInfo().getABI(), "apcs-gnu") == 0)
|
||||
if (strcmp(getTarget().getABI(), "apcs-gnu") == 0)
|
||||
Kind = ARMABIInfo::APCS;
|
||||
else if (CodeGenOpts.FloatABI == "hard" ||
|
||||
(CodeGenOpts.FloatABI != "soft" && Triple.getEnvironment()==llvm::Triple::GNUEABIHF))
|
||||
(CodeGenOpts.FloatABI != "soft" &&
|
||||
Triple.getEnvironment() == llvm::Triple::GNUEABIHF))
|
||||
Kind = ARMABIInfo::AAPCS_VFP;
|
||||
|
||||
switch (Triple.getOS()) {
|
||||
|
@ -4889,7 +4887,7 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
|
|||
}
|
||||
|
||||
case llvm::Triple::x86_64: {
|
||||
bool HasAVX = strcmp(getContext().getTargetInfo().getABI(), "avx") == 0;
|
||||
bool HasAVX = strcmp(getTarget().getABI(), "avx") == 0;
|
||||
|
||||
switch (Triple.getOS()) {
|
||||
case llvm::Triple::Win32:
|
||||
|
@ -4897,7 +4895,8 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
|
|||
case llvm::Triple::Cygwin:
|
||||
return *(TheTargetCodeGenInfo = new WinX86_64TargetCodeGenInfo(Types));
|
||||
case llvm::Triple::NaCl:
|
||||
return *(TheTargetCodeGenInfo = new NaClX86_64TargetCodeGenInfo(Types, HasAVX));
|
||||
return *(TheTargetCodeGenInfo = new NaClX86_64TargetCodeGenInfo(Types,
|
||||
HasAVX));
|
||||
default:
|
||||
return *(TheTargetCodeGenInfo = new X86_64TargetCodeGenInfo(Types,
|
||||
HasAVX));
|
||||
|
|
Loading…
Reference in New Issue