Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 64aa4b3

Browse files
committed
Standardize accesses to the TargetInfo in IR-gen.
Patch by Stephen Lin! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179638 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent d314abe commit 64aa4b3

24 files changed

+126
-120
lines changed

lib/CodeGen/ABIInfo.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace llvm {
2222

2323
namespace clang {
2424
class ASTContext;
25+
class TargetInfo;
2526

2627
namespace CodeGen {
2728
class CGFunctionInfo;
@@ -196,6 +197,7 @@ namespace clang {
196197
ASTContext &getContext() const;
197198
llvm::LLVMContext &getVMContext() const;
198199
const llvm::DataLayout &getDataLayout() const;
200+
const TargetInfo &getTarget() const;
199201

200202
/// Return the calling convention to use for system runtime
201203
/// functions.

lib/CodeGen/CGAtomic.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E, llvm::Value *Dest) {
327327
CharUnits alignChars = getContext().getTypeAlignInChars(AtomicTy);
328328
unsigned Align = alignChars.getQuantity();
329329
unsigned MaxInlineWidthInBits =
330-
getContext().getTargetInfo().getMaxAtomicInlineWidth();
330+
getTarget().getMaxAtomicInlineWidth();
331331
bool UseLibcall = (Size != Align ||
332332
getContext().toBits(sizeChars) > MaxInlineWidthInBits);
333333

lib/CodeGen/CGBlocks.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,8 @@ llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) {
20822082

20832083
bool Packed = false;
20842084
CharUnits Align = getContext().getDeclAlign(D);
2085-
if (Align > getContext().toCharUnitsFromBits(Target.getPointerAlign(0))) {
2085+
if (Align >
2086+
getContext().toCharUnitsFromBits(getTarget().getPointerAlign(0))) {
20862087
// We have to insert padding.
20872088

20882089
// The struct above has 2 32-bit integers.

lib/CodeGen/CGBuiltin.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
296296
Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType);
297297

298298
llvm::Type *ResultType = ConvertType(E->getType());
299-
Value *ZeroUndef = Builder.getInt1(Target.isCLZForZeroUndef());
299+
Value *ZeroUndef = Builder.getInt1(getTarget().isCLZForZeroUndef());
300300
Value *Result = Builder.CreateCall2(F, ArgValue, ZeroUndef);
301301
if (Result->getType() != ResultType)
302302
Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
@@ -313,7 +313,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
313313
Value *F = CGM.getIntrinsic(Intrinsic::ctlz, ArgType);
314314

315315
llvm::Type *ResultType = ConvertType(E->getType());
316-
Value *ZeroUndef = Builder.getInt1(Target.isCLZForZeroUndef());
316+
Value *ZeroUndef = Builder.getInt1(getTarget().isCLZForZeroUndef());
317317
Value *Result = Builder.CreateCall2(F, ArgValue, ZeroUndef);
318318
if (Result->getType() != ResultType)
319319
Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
@@ -1430,7 +1430,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
14301430
const char *Name = getContext().BuiltinInfo.GetName(BuiltinID);
14311431
Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
14321432
if (const char *Prefix =
1433-
llvm::Triple::getArchTypePrefix(Target.getTriple().getArch()))
1433+
llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch()))
14341434
IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix, Name);
14351435

14361436
if (IntrinsicID != Intrinsic::not_intrinsic) {
@@ -1501,7 +1501,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
15011501

15021502
Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
15031503
const CallExpr *E) {
1504-
switch (Target.getTriple().getArch()) {
1504+
switch (getTarget().getTriple().getArch()) {
15051505
case llvm::Triple::arm:
15061506
case llvm::Triple::thumb:
15071507
return EmitARMBuiltinExpr(BuiltinID, E);
@@ -1852,7 +1852,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
18521852
// Generate target-independent intrinsic; also need to add second argument
18531853
// for whether or not clz of zero is undefined; on ARM it isn't.
18541854
Function *F = CGM.getIntrinsic(Intrinsic::ctlz, Ty);
1855-
Ops.push_back(Builder.getInt1(Target.isCLZForZeroUndef()));
1855+
Ops.push_back(Builder.getInt1(getTarget().isCLZForZeroUndef()));
18561856
return EmitNeonCall(F, Ops, "vclz");
18571857
}
18581858
case ARM::BI__builtin_neon_vcnt_v:

lib/CodeGen/CGCall.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -837,12 +837,11 @@ bool CodeGenModule::ReturnTypeUsesFPRet(QualType ResultType) {
837837
default:
838838
return false;
839839
case BuiltinType::Float:
840-
return getContext().getTargetInfo().useObjCFPRetForRealType(TargetInfo::Float);
840+
return getTarget().useObjCFPRetForRealType(TargetInfo::Float);
841841
case BuiltinType::Double:
842-
return getContext().getTargetInfo().useObjCFPRetForRealType(TargetInfo::Double);
842+
return getTarget().useObjCFPRetForRealType(TargetInfo::Double);
843843
case BuiltinType::LongDouble:
844-
return getContext().getTargetInfo().useObjCFPRetForRealType(
845-
TargetInfo::LongDouble);
844+
return getTarget().useObjCFPRetForRealType(TargetInfo::LongDouble);
846845
}
847846
}
848847

@@ -853,7 +852,7 @@ bool CodeGenModule::ReturnTypeUsesFP2Ret(QualType ResultType) {
853852
if (const ComplexType *CT = ResultType->getAs<ComplexType>()) {
854853
if (const BuiltinType *BT = CT->getElementType()->getAs<BuiltinType>()) {
855854
if (BT->getKind() == BuiltinType::LongDouble)
856-
return getContext().getTargetInfo().useObjCFP2RetForComplexLongDouble();
855+
return getTarget().useObjCFP2RetForComplexLongDouble();
857856
}
858857
}
859858

lib/CodeGen/CGClass.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ void CodeGenFunction::EmitConstructorBody(FunctionArgList &Args) {
710710
// Before we go any further, try the complete->base constructor
711711
// delegation optimization.
712712
if (CtorType == Ctor_Complete && IsConstructorDelegationValid(Ctor) &&
713-
CGM.getContext().getTargetInfo().getCXXABI().hasConstructorVariants()) {
713+
CGM.getTarget().getCXXABI().hasConstructorVariants()) {
714714
if (CGDebugInfo *DI = getDebugInfo())
715715
DI->EmitLocation(Builder, Ctor->getLocEnd());
716716
EmitDelegateCXXConstructorCall(Ctor, Ctor_Base, Args);
@@ -1278,7 +1278,7 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) {
12781278
EnterDtorCleanups(Dtor, Dtor_Complete);
12791279

12801280
if (!isTryBody &&
1281-
CGM.getContext().getTargetInfo().getCXXABI().hasDestructorVariants()) {
1281+
CGM.getTarget().getCXXABI().hasDestructorVariants()) {
12821282
EmitCXXDestructorCall(Dtor, Dtor_Base, /*ForVirtualBase=*/false,
12831283
/*Delegating=*/false, LoadCXXThis());
12841284
break;

lib/CodeGen/CGDebugInfo.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ llvm::DIType CGDebugInfo::CreatePointerLikeType(unsigned Tag,
642642
// Size is always the size of a pointer. We can't use getTypeSize here
643643
// because that does not return the correct value for references.
644644
unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy);
645-
uint64_t Size = CGM.getContext().getTargetInfo().getPointerWidth(AS);
645+
uint64_t Size = CGM.getTarget().getPointerWidth(AS);
646646
uint64_t Align = CGM.getContext().getTypeAlign(Ty);
647647

648648
return DBuilder.createPointerType(CreatePointeeType(PointeeTy, Unit),
@@ -984,7 +984,7 @@ llvm::DIType CGDebugInfo::getOrCreateInstanceMethodType(
984984
const PointerType *ThisPtrTy = cast<PointerType>(ThisPtr);
985985
QualType PointeeTy = ThisPtrTy->getPointeeType();
986986
unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy);
987-
uint64_t Size = CGM.getContext().getTargetInfo().getPointerWidth(AS);
987+
uint64_t Size = CGM.getTarget().getPointerWidth(AS);
988988
uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy);
989989
llvm::DIType PointeeType = getOrCreateType(PointeeTy, Unit);
990990
llvm::DIType ThisPtrType = DBuilder.createPointerType(PointeeType, Size, Align);
@@ -2398,7 +2398,7 @@ llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
23982398

23992399
CharUnits Align = CGM.getContext().getDeclAlign(VD);
24002400
if (Align > CGM.getContext().toCharUnitsFromBits(
2401-
CGM.getContext().getTargetInfo().getPointerAlign(0))) {
2401+
CGM.getTarget().getPointerAlign(0))) {
24022402
CharUnits FieldOffsetInBytes
24032403
= CGM.getContext().toCharUnitsFromBits(FieldOffset);
24042404
CharUnits AlignedOffsetInBytes
@@ -2494,7 +2494,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
24942494
addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));
24952495
// offset of __forwarding field
24962496
offset = CGM.getContext().toCharUnitsFromBits(
2497-
CGM.getContext().getTargetInfo().getPointerWidth(0));
2497+
CGM.getTarget().getPointerWidth(0));
24982498
addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
24992499
addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpDeref));
25002500
addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));

lib/CodeGen/CGDecl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
900900
CharUnits allocaAlignment = alignment;
901901
if (isByRef)
902902
allocaAlignment = std::max(allocaAlignment,
903-
getContext().toCharUnitsFromBits(Target.getPointerAlign(0)));
903+
getContext().toCharUnitsFromBits(getTarget().getPointerAlign(0)));
904904
Alloc->setAlignment(allocaAlignment.getQuantity());
905905
DeclPtr = Alloc;
906906

lib/CodeGen/CGDeclCXX.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ CreateGlobalInitOrDestructFunction(CodeGenModule &CGM,
232232
if (!CGM.getLangOpts().AppleKext) {
233233
// Set the section if needed.
234234
if (const char *Section =
235-
CGM.getContext().getTargetInfo().getStaticInitSectionSpecifier())
235+
CGM.getTarget().getStaticInitSectionSpecifier())
236236
Fn->setSection(Section);
237237
}
238238

lib/CodeGen/CGExprAgg.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) {
13411341
// Reference values are always non-null and have the width of a pointer.
13421342
if (Field->getType()->isReferenceType())
13431343
NumNonZeroBytes += CGF.getContext().toCharUnitsFromBits(
1344-
CGF.getContext().getTargetInfo().getPointerWidth(0));
1344+
CGF.getTarget().getPointerWidth(0));
13451345
else
13461346
NumNonZeroBytes += GetNumNonZeroBytesInInit(E, CGF);
13471347
}

lib/CodeGen/CGExprScalar.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1634,8 +1634,8 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
16341634
else {
16351635
llvm::APFloat F(static_cast<float>(amount));
16361636
bool ignored;
1637-
F.convert(CGF.Target.getLongDoubleFormat(), llvm::APFloat::rmTowardZero,
1638-
&ignored);
1637+
F.convert(CGF.getTarget().getLongDoubleFormat(),
1638+
llvm::APFloat::rmTowardZero, &ignored);
16391639
amt = llvm::ConstantFP::get(VMContext, F);
16401640
}
16411641
value = Builder.CreateFAdd(value, amt, isInc ? "inc" : "dec");

lib/CodeGen/CGObjC.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM,
714714
}
715715

716716
llvm::Triple::ArchType arch =
717-
CGM.getContext().getTargetInfo().getTriple().getArch();
717+
CGM.getTarget().getTriple().getArch();
718718

719719
// Most architectures require memory to fit within a single cache
720720
// line, so the alignment has to be at least the size of the access.

lib/CodeGen/CGObjCMac.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -1949,8 +1949,8 @@ llvm::Constant *CGObjCCommonMac::BuildGCBlockLayout(CodeGenModule &CGM,
19491949
bool hasUnion = false;
19501950
SkipIvars.clear();
19511951
IvarsInfo.clear();
1952-
unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0);
1953-
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
1952+
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
1953+
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
19541954

19551955
// __isa is the first field in block descriptor and must assume by runtime's
19561956
// convention that it is GC'able.
@@ -2077,7 +2077,7 @@ void CGObjCCommonMac::BuildRCRecordLayout(const llvm::StructLayout *RecLayout,
20772077

20782078
if (RecFields.empty())
20792079
return;
2080-
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
2080+
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
20812081

20822082
for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
20832083
const FieldDecl *Field = RecFields[i];
@@ -2316,8 +2316,8 @@ llvm::Constant *CGObjCCommonMac::getBitmapBlockLayout(bool ComputeByrefLayout) {
23162316
llvm::Constant *nullPtr = llvm::Constant::getNullValue(CGM.Int8PtrTy);
23172317
if (RunSkipBlockVars.empty())
23182318
return nullPtr;
2319-
unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0);
2320-
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
2319+
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
2320+
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
23212321
unsigned WordSizeInBytes = WordSizeInBits/ByteSizeInBits;
23222322

23232323
// Sort on byte position; captures might not be allocated in order,
@@ -2468,8 +2468,8 @@ llvm::Constant *CGObjCCommonMac::BuildRCBlockLayout(CodeGenModule &CGM,
24682468
RunSkipBlockVars.clear();
24692469
bool hasUnion = false;
24702470

2471-
unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0);
2472-
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
2471+
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
2472+
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
24732473
unsigned WordSizeInBytes = WordSizeInBits/ByteSizeInBits;
24742474

24752475
const BlockDecl *blockDecl = blockInfo.getBlockDecl();
@@ -4537,8 +4537,8 @@ void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI,
45374537

45384538
if (RecFields.empty())
45394539
return;
4540-
unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0);
4541-
unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth();
4540+
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
4541+
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
45424542
if (!RD && CGM.getLangOpts().ObjCAutoRefCount) {
45434543
const FieldDecl *FirstField = RecFields[0];
45444544
FirstFieldDelta =

lib/CodeGen/CGObjCRuntime.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF,
117117
// a synthesized ivar can never be a bit-field, so this is safe.
118118
uint64_t FieldBitOffset = LookupFieldBitOffset(CGF.CGM, OID, 0, Ivar);
119119
uint64_t BitOffset = FieldBitOffset % CGF.CGM.getContext().getCharWidth();
120-
uint64_t AlignmentBits = CGF.CGM.getContext().getTargetInfo().getCharAlign();
120+
uint64_t AlignmentBits = CGF.CGM.getTarget().getCharAlign();
121121
uint64_t BitFieldSize = Ivar->getBitWidthValue(CGF.getContext());
122122
CharUnits StorageSize =
123123
CGF.CGM.getContext().toCharUnitsFromBits(

lib/CodeGen/CGRecordLayoutBuilder.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ bool CGRecordLayoutBuilder::LayoutBitfields(const ASTRecordLayout &Layout,
276276
uint64_t FirstFieldOffset = Layout.getFieldOffset(FirstFieldNo);
277277
uint64_t NextFieldOffsetInBits = Types.getContext().toBits(NextFieldOffset);
278278

279-
unsigned CharAlign = Types.getContext().getTargetInfo().getCharAlign();
279+
unsigned CharAlign = Types.getTarget().getCharAlign();
280280
assert(FirstFieldOffset % CharAlign == 0 &&
281281
"First field offset is misaligned");
282282
CharUnits FirstFieldOffsetInBytes
@@ -352,7 +352,7 @@ bool CGRecordLayoutBuilder::LayoutBitfields(const ASTRecordLayout &Layout,
352352
assert(EndOffset >= (FirstFieldOffset + TotalBits) &&
353353
"End offset is not past the end of the known storage bits.");
354354
uint64_t SpaceBits = EndOffset - FirstFieldOffset;
355-
uint64_t LongBits = Types.getContext().getTargetInfo().getLongWidth();
355+
uint64_t LongBits = Types.getTarget().getLongWidth();
356356
uint64_t WidenedBits = (StorageBits / LongBits) * LongBits +
357357
llvm::NextPowerOf2(StorageBits % LongBits - 1);
358358
assert(WidenedBits >= StorageBits && "Widening shrunk the bits!");
@@ -455,7 +455,7 @@ CGRecordLayoutBuilder::LayoutUnionField(const FieldDecl *Field,
455455
return 0;
456456

457457
unsigned StorageBits = llvm::RoundUpToAlignment(
458-
FieldSize, Types.getContext().getTargetInfo().getCharAlign());
458+
FieldSize, Types.getTarget().getCharAlign());
459459
CharUnits NumBytesToAppend
460460
= Types.getContext().toCharUnitsFromBits(StorageBits);
461461

@@ -814,7 +814,7 @@ bool CGRecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
814814

815815
// Lay out the virtual bases. The MS ABI uses a different
816816
// algorithm here due to the lack of primary virtual bases.
817-
if (Types.getContext().getTargetInfo().getCXXABI().hasPrimaryVBases()) {
817+
if (Types.getTarget().getCXXABI().hasPrimaryVBases()) {
818818
RD->getIndirectPrimaryBases(IndirectPrimaryBases);
819819
if (Layout.isPrimaryBaseVirtual())
820820
IndirectPrimaryBases.insert(Layout.getPrimaryBase());

lib/CodeGen/CGStmt.cpp

+12-10
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str,
14511451
for (unsigned i = 0, e = StrVal.size()-1; i != e; ++i) {
14521452
if (StrVal[i] != '\n') continue;
14531453
SourceLocation LineLoc = Str->getLocationOfByte(i+1, SM, LangOpts,
1454-
CGF.Target);
1454+
CGF.getTarget());
14551455
Locs.push_back(llvm::ConstantInt::get(CGF.Int32Ty,
14561456
LineLoc.getRawEncoding()));
14571457
}
@@ -1471,16 +1471,17 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
14711471
for (unsigned i = 0, e = S.getNumOutputs(); i != e; i++) {
14721472
TargetInfo::ConstraintInfo Info(S.getOutputConstraint(i),
14731473
S.getOutputName(i));
1474-
bool IsValid = Target.validateOutputConstraint(Info); (void)IsValid;
1474+
bool IsValid = getTarget().validateOutputConstraint(Info); (void)IsValid;
14751475
assert(IsValid && "Failed to parse output constraint");
14761476
OutputConstraintInfos.push_back(Info);
14771477
}
14781478

14791479
for (unsigned i = 0, e = S.getNumInputs(); i != e; i++) {
14801480
TargetInfo::ConstraintInfo Info(S.getInputConstraint(i),
14811481
S.getInputName(i));
1482-
bool IsValid = Target.validateInputConstraint(OutputConstraintInfos.data(),
1483-
S.getNumOutputs(), Info);
1482+
bool IsValid =
1483+
getTarget().validateInputConstraint(OutputConstraintInfos.data(),
1484+
S.getNumOutputs(), Info);
14841485
assert(IsValid && "Failed to parse input constraint"); (void)IsValid;
14851486
InputConstraintInfos.push_back(Info);
14861487
}
@@ -1504,13 +1505,14 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
15041505

15051506
// Simplify the output constraint.
15061507
std::string OutputConstraint(S.getOutputConstraint(i));
1507-
OutputConstraint = SimplifyConstraint(OutputConstraint.c_str() + 1, Target);
1508+
OutputConstraint = SimplifyConstraint(OutputConstraint.c_str() + 1,
1509+
getTarget());
15081510

15091511
const Expr *OutExpr = S.getOutputExpr(i);
15101512
OutExpr = OutExpr->IgnoreParenNoopCasts(getContext());
15111513

15121514
OutputConstraint = AddVariableConstraints(OutputConstraint, *OutExpr,
1513-
Target, CGM, S);
1515+
getTarget(), CGM, S);
15141516

15151517
LValue Dest = EmitLValue(OutExpr);
15161518
if (!Constraints.empty())
@@ -1591,13 +1593,13 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
15911593

15921594
// Simplify the input constraint.
15931595
std::string InputConstraint(S.getInputConstraint(i));
1594-
InputConstraint = SimplifyConstraint(InputConstraint.c_str(), Target,
1596+
InputConstraint = SimplifyConstraint(InputConstraint.c_str(), getTarget(),
15951597
&OutputConstraintInfos);
15961598

15971599
InputConstraint =
15981600
AddVariableConstraints(InputConstraint,
15991601
*InputExpr->IgnoreParenNoopCasts(getContext()),
1600-
Target, CGM, S);
1602+
getTarget(), CGM, S);
16011603

16021604
llvm::Value *Arg = EmitAsmInput(Info, InputExpr, Constraints);
16031605

@@ -1649,7 +1651,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
16491651
StringRef Clobber = S.getClobber(i);
16501652

16511653
if (Clobber != "memory" && Clobber != "cc")
1652-
Clobber = Target.getNormalizedGCCRegisterName(Clobber);
1654+
Clobber = getTarget().getNormalizedGCCRegisterName(Clobber);
16531655

16541656
if (i != 0 || NumConstraints != 0)
16551657
Constraints += ',';
@@ -1660,7 +1662,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
16601662
}
16611663

16621664
// Add machine specific clobbers
1663-
std::string MachineClobbers = Target.getClobbers();
1665+
std::string MachineClobbers = getTarget().getClobbers();
16641666
if (!MachineClobbers.empty()) {
16651667
if (!Constraints.empty())
16661668
Constraints += ',';

0 commit comments

Comments
 (0)