@@ -87,6 +87,7 @@ class PPCFastISel final : public FastISel {
87
87
88
88
const TargetMachine &TM;
89
89
const PPCSubtarget *PPCSubTarget;
90
+ const PPCSubtarget *Subtarget;
90
91
PPCFunctionInfo *PPCFuncInfo;
91
92
const TargetInstrInfo &TII;
92
93
const TargetLowering &TLI;
@@ -97,12 +98,12 @@ class PPCFastISel final : public FastISel {
97
98
const TargetLibraryInfo *LibInfo)
98
99
: FastISel(FuncInfo, LibInfo), TM(FuncInfo.MF->getTarget ()),
99
100
PPCSubTarget(&FuncInfo.MF->getSubtarget<PPCSubtarget>()),
101
+ Subtarget(&FuncInfo.MF->getSubtarget<PPCSubtarget>()),
100
102
PPCFuncInfo(FuncInfo.MF->getInfo<PPCFunctionInfo>()),
101
- TII(*PPCSubTarget->getInstrInfo ()),
102
- TLI(*PPCSubTarget->getTargetLowering ()),
103
+ TII(*Subtarget->getInstrInfo ()), TLI(*Subtarget->getTargetLowering ()),
103
104
Context(&FuncInfo.Fn->getContext ()) {}
104
105
105
- // Backend specific FastISel code.
106
+ // Backend specific FastISel code.
106
107
private:
107
108
bool fastSelectInstruction (const Instruction *I) override ;
108
109
unsigned fastMaterializeConstant (const Constant *C) override ;
@@ -456,7 +457,7 @@ bool PPCFastISel::PPCEmitLoad(MVT VT, Register &ResultReg, Address &Addr,
456
457
bool IsZExt, unsigned FP64LoadOpc) {
457
458
unsigned Opc;
458
459
bool UseOffset = true ;
459
- bool HasSPE = PPCSubTarget ->hasSPE ();
460
+ bool HasSPE = Subtarget ->hasSPE ();
460
461
461
462
// If ResultReg is given, it determines the register class of the load.
462
463
// Otherwise, RC is the register class to use. If the result of the
@@ -498,7 +499,7 @@ bool PPCFastISel::PPCEmitLoad(MVT VT, Register &ResultReg, Address &Addr,
498
499
UseOffset = ((Addr.Offset & 3 ) == 0 );
499
500
break ;
500
501
case MVT::f32 :
501
- Opc = PPCSubTarget ->hasSPE () ? PPC::SPELWZ : PPC::LFS;
502
+ Opc = Subtarget ->hasSPE () ? PPC::SPELWZ : PPC::LFS;
502
503
break ;
503
504
case MVT::f64 :
504
505
Opc = FP64LoadOpc;
@@ -614,7 +615,7 @@ bool PPCFastISel::SelectLoad(const Instruction *I) {
614
615
615
616
Register ResultReg = 0 ;
616
617
if (!PPCEmitLoad (VT, ResultReg, Addr, RC, true ,
617
- PPCSubTarget ->hasSPE () ? PPC::EVLDD : PPC::LFD))
618
+ Subtarget ->hasSPE () ? PPC::EVLDD : PPC::LFD))
618
619
return false ;
619
620
updateValueMap (I, ResultReg);
620
621
return true ;
@@ -647,10 +648,10 @@ bool PPCFastISel::PPCEmitStore(MVT VT, unsigned SrcReg, Address &Addr) {
647
648
UseOffset = ((Addr.Offset & 3 ) == 0 );
648
649
break ;
649
650
case MVT::f32 :
650
- Opc = PPCSubTarget ->hasSPE () ? PPC::SPESTW : PPC::STFS;
651
+ Opc = Subtarget ->hasSPE () ? PPC::SPESTW : PPC::STFS;
651
652
break ;
652
653
case MVT::f64 :
653
- Opc = PPCSubTarget ->hasSPE () ? PPC::EVSTDD : PPC::STFD;
654
+ Opc = Subtarget ->hasSPE () ? PPC::EVSTDD : PPC::STFD;
654
655
break ;
655
656
}
656
657
@@ -794,8 +795,9 @@ bool PPCFastISel::SelectBranch(const Instruction *I) {
794
795
return false ;
795
796
796
797
BuildMI (*BrBB, FuncInfo.InsertPt , DbgLoc, TII.get (PPC::BCC))
797
- .addImm (PPCSubTarget->hasSPE () ? PPC::PRED_SPE : PPCPred)
798
- .addReg (CondReg).addMBB (TBB);
798
+ .addImm (Subtarget->hasSPE () ? PPC::PRED_SPE : PPCPred)
799
+ .addReg (CondReg)
800
+ .addMBB (TBB);
799
801
finishCondBranch (BI->getParent (), TBB, FBB);
800
802
return true ;
801
803
}
@@ -827,7 +829,7 @@ bool PPCFastISel::PPCEmitCmp(const Value *SrcValue1, const Value *SrcValue2,
827
829
return false ;
828
830
MVT SrcVT = SrcEVT.getSimpleVT ();
829
831
830
- if (SrcVT == MVT::i1 && PPCSubTarget ->useCRBits ())
832
+ if (SrcVT == MVT::i1 && Subtarget ->useCRBits ())
831
833
return false ;
832
834
833
835
// See if operand 2 is an immediate encodeable in the compare.
@@ -836,7 +838,7 @@ bool PPCFastISel::PPCEmitCmp(const Value *SrcValue1, const Value *SrcValue2,
836
838
// similar to ARM in this regard.
837
839
long Imm = 0 ;
838
840
bool UseImm = false ;
839
- const bool HasSPE = PPCSubTarget ->hasSPE ();
841
+ const bool HasSPE = Subtarget ->hasSPE ();
840
842
841
843
// Only 16-bit integer constants can be represented in compares for
842
844
// PowerPC. Others will be materialized into a register.
@@ -988,7 +990,7 @@ bool PPCFastISel::SelectFPTrunc(const Instruction *I) {
988
990
// Round the result to single precision.
989
991
unsigned DestReg;
990
992
auto RC = MRI.getRegClass (SrcReg);
991
- if (PPCSubTarget ->hasSPE ()) {
993
+ if (Subtarget ->hasSPE ()) {
992
994
DestReg = createResultReg (&PPC::GPRCRegClass);
993
995
BuildMI (*FuncInfo.MBB , FuncInfo.InsertPt , DbgLoc,
994
996
TII.get (PPC::EFSCFD), DestReg)
@@ -1043,10 +1045,10 @@ unsigned PPCFastISel::PPCMoveToFPReg(MVT SrcVT, unsigned SrcReg,
1043
1045
if (SrcVT == MVT::i32 ) {
1044
1046
if (!IsSigned) {
1045
1047
LoadOpc = PPC::LFIWZX;
1046
- Addr.Offset = (PPCSubTarget ->isLittleEndian ()) ? 0 : 4 ;
1047
- } else if (PPCSubTarget ->hasLFIWAX ()) {
1048
+ Addr.Offset = (Subtarget ->isLittleEndian ()) ? 0 : 4 ;
1049
+ } else if (Subtarget ->hasLFIWAX ()) {
1048
1050
LoadOpc = PPC::LFIWAX;
1049
- Addr.Offset = (PPCSubTarget ->isLittleEndian ()) ? 0 : 4 ;
1051
+ Addr.Offset = (Subtarget ->isLittleEndian ()) ? 0 : 4 ;
1050
1052
}
1051
1053
}
1052
1054
@@ -1086,7 +1088,7 @@ bool PPCFastISel::SelectIToFP(const Instruction *I, bool IsSigned) {
1086
1088
return false ;
1087
1089
1088
1090
// Shortcut for SPE. Doesn't need to store/load, since it's all in the GPRs
1089
- if (PPCSubTarget ->hasSPE ()) {
1091
+ if (Subtarget ->hasSPE ()) {
1090
1092
unsigned Opc;
1091
1093
if (DstVT == MVT::f32 )
1092
1094
Opc = IsSigned ? PPC::EFSCFSI : PPC::EFSCFUI;
@@ -1103,15 +1105,15 @@ bool PPCFastISel::SelectIToFP(const Instruction *I, bool IsSigned) {
1103
1105
1104
1106
// We can only lower an unsigned convert if we have the newer
1105
1107
// floating-point conversion operations.
1106
- if (!IsSigned && !PPCSubTarget ->hasFPCVT ())
1108
+ if (!IsSigned && !Subtarget ->hasFPCVT ())
1107
1109
return false ;
1108
1110
1109
1111
// FIXME: For now we require the newer floating-point conversion operations
1110
1112
// (which are present only on P7 and A2 server models) when converting
1111
1113
// to single-precision float. Otherwise we have to generate a lot of
1112
1114
// fiddly code to avoid double rounding. If necessary, the fiddly code
1113
1115
// can be found in PPCTargetLowering::LowerINT_TO_FP().
1114
- if (DstVT == MVT::f32 && !PPCSubTarget ->hasFPCVT ())
1116
+ if (DstVT == MVT::f32 && !Subtarget ->hasFPCVT ())
1115
1117
return false ;
1116
1118
1117
1119
// Extend the input if necessary.
@@ -1168,7 +1170,7 @@ unsigned PPCFastISel::PPCMoveToIntReg(const Instruction *I, MVT VT,
1168
1170
// Reload it into a GPR. If we want an i32 on big endian, modify the
1169
1171
// address to have a 4-byte offset so we load from the right place.
1170
1172
if (VT == MVT::i32 )
1171
- Addr.Offset = (PPCSubTarget ->isLittleEndian ()) ? 0 : 4 ;
1173
+ Addr.Offset = (Subtarget ->isLittleEndian ()) ? 0 : 4 ;
1172
1174
1173
1175
// Look at the currently assigned register for this instruction
1174
1176
// to determine the required register class.
@@ -1196,8 +1198,8 @@ bool PPCFastISel::SelectFPToI(const Instruction *I, bool IsSigned) {
1196
1198
return false ;
1197
1199
1198
1200
// If we don't have FCTIDUZ, or SPE, and we need it, punt to SelectionDAG.
1199
- if (DstVT == MVT::i64 && !IsSigned &&
1200
- !PPCSubTarget-> hasFPCVT () && !PPCSubTarget ->hasSPE ())
1201
+ if (DstVT == MVT::i64 && !IsSigned && !Subtarget-> hasFPCVT () &&
1202
+ !Subtarget ->hasSPE ())
1201
1203
return false ;
1202
1204
1203
1205
Value *Src = I->getOperand (0 );
@@ -1226,15 +1228,15 @@ bool PPCFastISel::SelectFPToI(const Instruction *I, bool IsSigned) {
1226
1228
unsigned Opc;
1227
1229
auto RC = MRI.getRegClass (SrcReg);
1228
1230
1229
- if (PPCSubTarget ->hasSPE ()) {
1231
+ if (Subtarget ->hasSPE ()) {
1230
1232
DestReg = createResultReg (&PPC::GPRCRegClass);
1231
1233
if (IsSigned)
1232
1234
Opc = InRC == &PPC::GPRCRegClass ? PPC::EFSCTSIZ : PPC::EFDCTSIZ;
1233
1235
else
1234
1236
Opc = InRC == &PPC::GPRCRegClass ? PPC::EFSCTUIZ : PPC::EFDCTUIZ;
1235
1237
} else if (isVSFRCRegClass (RC)) {
1236
1238
DestReg = createResultReg (&PPC::VSFRCRegClass);
1237
- if (DstVT == MVT::i32 )
1239
+ if (DstVT == MVT::i32 )
1238
1240
Opc = IsSigned ? PPC::XSCVDPSXWS : PPC::XSCVDPUXWS;
1239
1241
else
1240
1242
Opc = IsSigned ? PPC::XSCVDPSXDS : PPC::XSCVDPUXDS;
@@ -1244,7 +1246,7 @@ bool PPCFastISel::SelectFPToI(const Instruction *I, bool IsSigned) {
1244
1246
if (IsSigned)
1245
1247
Opc = PPC::FCTIWZ;
1246
1248
else
1247
- Opc = PPCSubTarget ->hasFPCVT () ? PPC::FCTIWUZ : PPC::FCTIDZ;
1249
+ Opc = Subtarget ->hasFPCVT () ? PPC::FCTIWUZ : PPC::FCTIDZ;
1248
1250
else
1249
1251
Opc = IsSigned ? PPC::FCTIDZ : PPC::FCTIDUZ;
1250
1252
}
@@ -1254,8 +1256,9 @@ bool PPCFastISel::SelectFPToI(const Instruction *I, bool IsSigned) {
1254
1256
.addReg (SrcReg);
1255
1257
1256
1258
// Now move the integer value from a float register to an integer register.
1257
- unsigned IntReg = PPCSubTarget->hasSPE () ? DestReg :
1258
- PPCMoveToIntReg (I, DstVT, DestReg, IsSigned);
1259
+ unsigned IntReg = Subtarget->hasSPE ()
1260
+ ? DestReg
1261
+ : PPCMoveToIntReg (I, DstVT, DestReg, IsSigned);
1259
1262
1260
1263
if (IntReg == 0 )
1261
1264
return false ;
@@ -1383,7 +1386,7 @@ bool PPCFastISel::processCallArgs(SmallVectorImpl<Value*> &Args,
1383
1386
CCState CCInfo (CC, IsVarArg, *FuncInfo.MF , ArgLocs, *Context);
1384
1387
1385
1388
// Reserve space for the linkage area on the stack.
1386
- unsigned LinkageSize = PPCSubTarget ->getFrameLowering ()->getLinkageSize ();
1389
+ unsigned LinkageSize = Subtarget ->getFrameLowering ()->getLinkageSize ();
1387
1390
CCInfo.AllocateStack (LinkageSize, Align (8 ));
1388
1391
1389
1392
CCInfo.AnalyzeCallOperands (ArgVTs, ArgFlags, CC_PPC64_ELF_FIS);
@@ -1573,7 +1576,7 @@ bool PPCFastISel::fastLowerCall(CallLoweringInfo &CLI) {
1573
1576
else if (!isTypeLegal (RetTy, RetVT) && RetVT != MVT::i16 &&
1574
1577
RetVT != MVT::i8 )
1575
1578
return false ;
1576
- else if (RetVT == MVT::i1 && PPCSubTarget ->useCRBits ())
1579
+ else if (RetVT == MVT::i1 && Subtarget ->useCRBits ())
1577
1580
// We can't handle boolean returns when CR bits are in use.
1578
1581
return false ;
1579
1582
@@ -1995,7 +1998,7 @@ unsigned PPCFastISel::PPCMaterializeFP(const ConstantFP *CFP, MVT VT) {
1995
1998
// All FP constants are loaded from the constant pool.
1996
1999
Align Alignment = DL.getPrefTypeAlign (CFP->getType ());
1997
2000
unsigned Idx = MCP.getConstantPoolIndex (cast<Constant>(CFP), Alignment);
1998
- const bool HasSPE = PPCSubTarget ->hasSPE ();
2001
+ const bool HasSPE = Subtarget ->hasSPE ();
1999
2002
const TargetRegisterClass *RC;
2000
2003
if (HasSPE)
2001
2004
RC = ((VT == MVT::f32 ) ? &PPC::GPRCRegClass : &PPC::SPERCRegClass);
@@ -2089,7 +2092,7 @@ unsigned PPCFastISel::PPCMaterializeGV(const GlobalValue *GV, MVT VT) {
2089
2092
BuildMI (*FuncInfo.MBB , FuncInfo.InsertPt , DbgLoc, TII.get (PPC::ADDIStocHA8),
2090
2093
HighPartReg).addReg (PPC::X2).addGlobalAddress (GV);
2091
2094
2092
- if (PPCSubTarget ->isGVIndirectSymbol (GV)) {
2095
+ if (Subtarget ->isGVIndirectSymbol (GV)) {
2093
2096
BuildMI (*FuncInfo.MBB , FuncInfo.InsertPt , DbgLoc, TII.get (PPC::LDtocL),
2094
2097
DestReg).addGlobalAddress (GV).addReg (HighPartReg);
2095
2098
} else {
@@ -2196,7 +2199,7 @@ unsigned PPCFastISel::PPCMaterializeInt(const ConstantInt *CI, MVT VT,
2196
2199
bool UseSExt) {
2197
2200
// If we're using CR bit registers for i1 values, handle that as a special
2198
2201
// case first.
2199
- if (VT == MVT::i1 && PPCSubTarget ->useCRBits ()) {
2202
+ if (VT == MVT::i1 && Subtarget ->useCRBits ()) {
2200
2203
unsigned ImmReg = createResultReg (&PPC::CRBITRCRegClass);
2201
2204
BuildMI (*FuncInfo.MBB , FuncInfo.InsertPt , DbgLoc,
2202
2205
TII.get (CI->isZero () ? PPC::CRUNSET : PPC::CRSET), ImmReg);
@@ -2351,7 +2354,7 @@ bool PPCFastISel::tryToFoldLoadIntoMI(MachineInstr *MI, unsigned OpNo,
2351
2354
Register ResultReg = MI->getOperand (0 ).getReg ();
2352
2355
2353
2356
if (!PPCEmitLoad (VT, ResultReg, Addr, nullptr , IsZExt,
2354
- PPCSubTarget ->hasSPE () ? PPC::EVLDD : PPC::LFD))
2357
+ Subtarget ->hasSPE () ? PPC::EVLDD : PPC::LFD))
2355
2358
return false ;
2356
2359
2357
2360
MachineBasicBlock::iterator I (MI);
@@ -2378,7 +2381,7 @@ unsigned PPCFastISel::fastEmit_i(MVT Ty, MVT VT, unsigned Opc, uint64_t Imm) {
2378
2381
2379
2382
// If we're using CR bit registers for i1 values, handle that as a special
2380
2383
// case first.
2381
- if (VT == MVT::i1 && PPCSubTarget ->useCRBits ()) {
2384
+ if (VT == MVT::i1 && Subtarget ->useCRBits ()) {
2382
2385
unsigned ImmReg = createResultReg (&PPC::CRBITRCRegClass);
2383
2386
BuildMI (*FuncInfo.MBB , FuncInfo.InsertPt , DbgLoc,
2384
2387
TII.get (Imm == 0 ? PPC::CRUNSET : PPC::CRSET), ImmReg);
0 commit comments