Skip to content

Commit 680bcf6

Browse files
committed
fix some comment grammar
1 parent bdba8c4 commit 680bcf6

File tree

1 file changed

+32
-20
lines changed

1 file changed

+32
-20
lines changed

llvm/lib/Target/PowerPC/PPCInstrInfo.cpp

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5224,10 +5224,6 @@ void PPCInstrInfo::replaceInstrAfterElimExt32To64(const Register &Reg,
52245224
MachineRegisterInfo *MRI,
52255225
unsigned BinOpDepth,
52265226
LiveVariables *LV) const {
5227-
const TargetRegisterClass *RC = MRI->getRegClass(Reg);
5228-
if (RC == &PPC::G8RCRegClass || RC == &PPC::GPRC_and_GPRC_NOR0RegClass)
5229-
return;
5230-
52315227
MachineInstr *MI = MRI->getVRegDef(Reg);
52325228
if (!MI)
52335229
return;
@@ -5240,9 +5236,6 @@ void PPCInstrInfo::replaceInstrAfterElimExt32To64(const Register &Reg,
52405236
case PPC::PHI:
52415237
case PPC::ISEL:
52425238
if (BinOpDepth < MAX_BINOP_DEPTH) {
5243-
if (Opcode == PPC::OR || Opcode == PPC::ISEL)
5244-
// if (Opcode == PPC::OR)
5245-
IsRelplaceIntr = true;
52465239
unsigned OperandEnd = 3, OperandStride = 1;
52475240
if (Opcode == PPC::PHI) {
52485241
OperandEnd = MI->getNumOperands();
@@ -5254,24 +5247,30 @@ void PPCInstrInfo::replaceInstrAfterElimExt32To64(const Register &Reg,
52545247
Register SrcReg = MI->getOperand(I).getReg();
52555248
replaceInstrAfterElimExt32To64(SrcReg, MRI, BinOpDepth + 1, LV);
52565249
}
5250+
5251+
if (Opcode == PPC::OR || Opcode == PPC::ISEL)
5252+
IsRelplaceIntr = true;
5253+
else
5254+
return;
52575255
}
52585256
break;
52595257
case PPC::COPY: {
52605258
Register SrcReg = MI->getOperand(1).getReg();
52615259
const MachineFunction *MF = MI->getMF();
52625260
if (!MF->getSubtarget<PPCSubtarget>().isSVR4ABI()) {
52635261
replaceInstrAfterElimExt32To64(SrcReg, MRI, BinOpDepth, LV);
5264-
break;
5262+
return;
52655263
}
52665264
// From here on everything is SVR4ABI
52675265
if (MI->getParent()->getBasicBlock() == &MF->getFunction().getEntryBlock())
5268-
break;
5266+
return;
52695267

52705268
if (SrcReg != PPC::X3) {
52715269
replaceInstrAfterElimExt32To64(SrcReg, MRI, BinOpDepth, LV);
5272-
break;
5270+
return;
52735271
}
5274-
} break;
5272+
}
5273+
return;
52755274
case PPC::ORI:
52765275
case PPC::XORI:
52775276
case PPC::ORI8:
@@ -5280,22 +5279,27 @@ void PPCInstrInfo::replaceInstrAfterElimExt32To64(const Register &Reg,
52805279
case PPC::XORIS:
52815280
case PPC::ORIS8:
52825281
case PPC::XORIS8: {
5282+
Register SrcReg = MI->getOperand(1).getReg();
5283+
replaceInstrAfterElimExt32To64(SrcReg, MRI, BinOpDepth, LV);
5284+
52835285
if (Opcode == PPC::ORI || Opcode == PPC::XORI || Opcode == PPC::ORIS ||
52845286
Opcode == PPC::ORIS || Opcode == PPC::XORIS)
52855287
IsRelplaceIntr = true;
5286-
Register SrcReg = MI->getOperand(1).getReg();
5287-
replaceInstrAfterElimExt32To64(SrcReg, MRI, BinOpDepth, LV);
5288+
else
5289+
return;
52885290
break;
52895291
}
52905292
case PPC::AND:
52915293
case PPC::AND8: {
52925294
if (BinOpDepth < MAX_BINOP_DEPTH) {
5293-
if (Opcode == PPC::AND)
5294-
IsRelplaceIntr = true;
52955295
Register SrcReg1 = MI->getOperand(1).getReg();
52965296
replaceInstrAfterElimExt32To64(SrcReg1, MRI, BinOpDepth, LV);
52975297
Register SrcReg2 = MI->getOperand(2).getReg();
52985298
replaceInstrAfterElimExt32To64(SrcReg2, MRI, BinOpDepth, LV);
5299+
if (Opcode == PPC::AND)
5300+
IsRelplaceIntr = true;
5301+
else
5302+
return;
52995303
}
53005304
break;
53015305
}
@@ -5309,9 +5313,14 @@ void PPCInstrInfo::replaceInstrAfterElimExt32To64(const Register &Reg,
53095313
!isOpZeroOfSubwordPreincLoad(Opcode)) ||
53105314
IsRelplaceIntr) {
53115315

5312-
// Fix Me: Most of the opcode of 64-bit instruction equal to the opcode of
5313-
// 32-bit version of same instruction plus one. But there are some
5314-
// exception: PPC::ANDC_rec, PPC::ANDI_rec, PPC::ANDIS_rec.
5316+
const TargetRegisterClass *RC = MRI->getRegClass(Reg);
5317+
assert(RC != &PPC::G8RCRegClass && RC != &PPC::G8RC_and_G8RC_NOX0RegClass &&
5318+
"Must be 32-bit Register!");
5319+
5320+
// Fix Me: Most of the pseudo-opcode of 64-bit instruction are equal to
5321+
// the pseudo-opcode of the 32-bit version of the same instruction plus
5322+
// one. However, there are some exceptions: PPC::ANDC_rec,
5323+
// PPC::ANDI_rec, PPC::ANDIS_rec.
53155324
unsigned NewOpcode = Opcode + 1;
53165325

53175326
if (Opcode == PPC::ANDC_rec)
@@ -5335,8 +5344,11 @@ void PPCInstrInfo::replaceInstrAfterElimExt32To64(const Register &Reg,
53355344
DebugLoc DL = MI->getDebugLoc();
53365345
auto MBB = MI->getParent();
53375346

5338-
// If the oprand of the instruction is Register which isPPC::GRCRegClass, we
5339-
// need to promot the Oprande to PPC::G8RCRegClass.
5347+
// Since the pseudo-opcode of the instruction is promoted from 32-bit to
5348+
// 64-bit, if the operand of the original instruction belongs to
5349+
// PPC::GRCRegClass or PPC::GPRC_and_GPRC_NOR0RegClass, we need to promote
5350+
// the operand to PPC::G8CRegClass or PPC::G8RC_and_G8RC_NOR0RegClass,
5351+
// respectively.
53405352
DenseMap<unsigned, Register> PromoteRegs;
53415353
DenseMap<unsigned, Register> ReCalRegs;
53425354
for (unsigned i = 1; i < MI->getNumOperands(); i++) {

0 commit comments

Comments
 (0)