Skip to content

Commit dd54b8e

Browse files
authored
Clang-Tidy issues in fixed in file SystemZISelLowering.cpp (#147251)
Corrected variable names corrections according to the clang-tidy standards. --------- Signed-off-by: MangalaPG <mangala.P.G@ibm.com>
1 parent 85cc4af commit dd54b8e

File tree

1 file changed

+77
-78
lines changed

1 file changed

+77
-78
lines changed

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 77 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ bool SystemZVectorConstantInfo::isVectorConstantLegal(
895895
if (SplatBitSize > 64)
896896
return false;
897897

898-
auto tryValue = [&](uint64_t Value) -> bool {
898+
auto TryValue = [&](uint64_t Value) -> bool {
899899
// Try VECTOR REPLICATE IMMEDIATE
900900
int64_t SignedValue = SignExtend64(Value, SplatBitSize);
901901
if (isInt<16>(SignedValue)) {
@@ -931,14 +931,14 @@ bool SystemZVectorConstantInfo::isVectorConstantLegal(
931931
unsigned UpperBits = llvm::countl_zero(SplatBitsZ);
932932
uint64_t Lower = SplatUndefZ & maskTrailingOnes<uint64_t>(LowerBits);
933933
uint64_t Upper = SplatUndefZ & maskLeadingOnes<uint64_t>(UpperBits);
934-
if (tryValue(SplatBitsZ | Upper | Lower))
934+
if (TryValue(SplatBitsZ | Upper | Lower))
935935
return true;
936936

937937
// Now try assuming that any undefined bits between the first and
938938
// last defined set bits are set. This increases the chances of
939939
// using a non-wraparound mask.
940940
uint64_t Middle = SplatUndefZ & ~Upper & ~Lower;
941-
return tryValue(SplatBitsZ | Middle);
941+
return TryValue(SplatBitsZ | Middle);
942942
}
943943

944944
SystemZVectorConstantInfo::SystemZVectorConstantInfo(APInt IntImm) {
@@ -1007,8 +1007,8 @@ SystemZTargetLowering::emitEHSjLjSetJmp(MachineInstr &MI,
10071007
const TargetRegisterClass *RC = MRI.getRegClass(DstReg);
10081008
assert(TRI->isTypeLegalForClass(*RC, MVT::i32) && "Invalid destination!");
10091009
(void)TRI;
1010-
Register mainDstReg = MRI.createVirtualRegister(RC);
1011-
Register restoreDstReg = MRI.createVirtualRegister(RC);
1010+
Register MainDstReg = MRI.createVirtualRegister(RC);
1011+
Register RestoreDstReg = MRI.createVirtualRegister(RC);
10121012

10131013
MVT PVT = getPointerTy(MF->getDataLayout());
10141014
assert((PVT == MVT::i64 || PVT == MVT::i32) && "Invalid Pointer Size!");
@@ -1046,22 +1046,22 @@ SystemZTargetLowering::emitEHSjLjSetJmp(MachineInstr &MI,
10461046
// restoreMBB:
10471047
// v_restore = 1
10481048

1049-
MachineBasicBlock *thisMBB = MBB;
1050-
MachineBasicBlock *mainMBB = MF->CreateMachineBasicBlock(BB);
1051-
MachineBasicBlock *sinkMBB = MF->CreateMachineBasicBlock(BB);
1052-
MachineBasicBlock *restoreMBB = MF->CreateMachineBasicBlock(BB);
1049+
MachineBasicBlock *ThisMBB = MBB;
1050+
MachineBasicBlock *MainMBB = MF->CreateMachineBasicBlock(BB);
1051+
MachineBasicBlock *SinkMBB = MF->CreateMachineBasicBlock(BB);
1052+
MachineBasicBlock *RestoreMBB = MF->CreateMachineBasicBlock(BB);
10531053

1054-
MF->insert(I, mainMBB);
1055-
MF->insert(I, sinkMBB);
1056-
MF->push_back(restoreMBB);
1057-
restoreMBB->setMachineBlockAddressTaken();
1054+
MF->insert(I, MainMBB);
1055+
MF->insert(I, SinkMBB);
1056+
MF->push_back(RestoreMBB);
1057+
RestoreMBB->setMachineBlockAddressTaken();
10581058

10591059
MachineInstrBuilder MIB;
10601060

10611061
// Transfer the remainder of BB and its successor edges to sinkMBB.
1062-
sinkMBB->splice(sinkMBB->begin(), MBB,
1062+
SinkMBB->splice(SinkMBB->begin(), MBB,
10631063
std::next(MachineBasicBlock::iterator(MI)), MBB->end());
1064-
sinkMBB->transferSuccessorsAndUpdatePHIs(MBB);
1064+
SinkMBB->transferSuccessorsAndUpdatePHIs(MBB);
10651065

10661066
// thisMBB:
10671067
const int64_t FPOffset = 0; // Slot 1.
@@ -1073,13 +1073,13 @@ SystemZTargetLowering::emitEHSjLjSetJmp(MachineInstr &MI,
10731073
Register BufReg = MI.getOperand(1).getReg();
10741074

10751075
const TargetRegisterClass *PtrRC = getRegClassFor(PVT);
1076-
unsigned LabelReg = MRI.createVirtualRegister(PtrRC);
1076+
Register LabelReg = MRI.createVirtualRegister(PtrRC);
10771077

10781078
// Prepare IP for longjmp.
1079-
BuildMI(*thisMBB, MI, DL, TII->get(SystemZ::LARL), LabelReg)
1080-
.addMBB(restoreMBB);
1079+
BuildMI(*ThisMBB, MI, DL, TII->get(SystemZ::LARL), LabelReg)
1080+
.addMBB(RestoreMBB);
10811081
// Store IP for return from jmp, slot 2, offset = 1.
1082-
BuildMI(*thisMBB, MI, DL, TII->get(SystemZ::STG))
1082+
BuildMI(*ThisMBB, MI, DL, TII->get(SystemZ::STG))
10831083
.addReg(LabelReg)
10841084
.addReg(BufReg)
10851085
.addImm(LabelOffset)
@@ -1088,15 +1088,15 @@ SystemZTargetLowering::emitEHSjLjSetJmp(MachineInstr &MI,
10881088
auto *SpecialRegs = Subtarget.getSpecialRegisters();
10891089
bool HasFP = Subtarget.getFrameLowering()->hasFP(*MF);
10901090
if (HasFP) {
1091-
BuildMI(*thisMBB, MI, DL, TII->get(SystemZ::STG))
1091+
BuildMI(*ThisMBB, MI, DL, TII->get(SystemZ::STG))
10921092
.addReg(SpecialRegs->getFramePointerRegister())
10931093
.addReg(BufReg)
10941094
.addImm(FPOffset)
10951095
.addReg(0);
10961096
}
10971097

10981098
// Store SP.
1099-
BuildMI(*thisMBB, MI, DL, TII->get(SystemZ::STG))
1099+
BuildMI(*ThisMBB, MI, DL, TII->get(SystemZ::STG))
11001100
.addReg(SpecialRegs->getStackPointerRegister())
11011101
.addReg(BufReg)
11021102
.addImm(SPOffset)
@@ -1107,47 +1107,47 @@ SystemZTargetLowering::emitEHSjLjSetJmp(MachineInstr &MI,
11071107
if (BackChain) {
11081108
Register BCReg = MRI.createVirtualRegister(PtrRC);
11091109
auto *TFL = Subtarget.getFrameLowering<SystemZFrameLowering>();
1110-
MIB = BuildMI(*thisMBB, MI, DL, TII->get(SystemZ::LG), BCReg)
1110+
MIB = BuildMI(*ThisMBB, MI, DL, TII->get(SystemZ::LG), BCReg)
11111111
.addReg(SpecialRegs->getStackPointerRegister())
11121112
.addImm(TFL->getBackchainOffset(*MF))
11131113
.addReg(0);
11141114

1115-
BuildMI(*thisMBB, MI, DL, TII->get(SystemZ::STG))
1115+
BuildMI(*ThisMBB, MI, DL, TII->get(SystemZ::STG))
11161116
.addReg(BCReg)
11171117
.addReg(BufReg)
11181118
.addImm(BCOffset)
11191119
.addReg(0);
11201120
}
11211121

11221122
// Setup.
1123-
MIB = BuildMI(*thisMBB, MI, DL, TII->get(SystemZ::EH_SjLj_Setup))
1124-
.addMBB(restoreMBB);
1123+
MIB = BuildMI(*ThisMBB, MI, DL, TII->get(SystemZ::EH_SjLj_Setup))
1124+
.addMBB(RestoreMBB);
11251125

11261126
const SystemZRegisterInfo *RegInfo = Subtarget.getRegisterInfo();
11271127
MIB.addRegMask(RegInfo->getNoPreservedMask());
11281128

1129-
thisMBB->addSuccessor(mainMBB);
1130-
thisMBB->addSuccessor(restoreMBB);
1129+
ThisMBB->addSuccessor(MainMBB);
1130+
ThisMBB->addSuccessor(RestoreMBB);
11311131

11321132
// mainMBB:
1133-
BuildMI(mainMBB, DL, TII->get(SystemZ::LHI), mainDstReg).addImm(0);
1134-
mainMBB->addSuccessor(sinkMBB);
1133+
BuildMI(MainMBB, DL, TII->get(SystemZ::LHI), MainDstReg).addImm(0);
1134+
MainMBB->addSuccessor(SinkMBB);
11351135

11361136
// sinkMBB:
1137-
BuildMI(*sinkMBB, sinkMBB->begin(), DL, TII->get(SystemZ::PHI), DstReg)
1138-
.addReg(mainDstReg)
1139-
.addMBB(mainMBB)
1140-
.addReg(restoreDstReg)
1141-
.addMBB(restoreMBB);
1137+
BuildMI(*SinkMBB, SinkMBB->begin(), DL, TII->get(SystemZ::PHI), DstReg)
1138+
.addReg(MainDstReg)
1139+
.addMBB(MainMBB)
1140+
.addReg(RestoreDstReg)
1141+
.addMBB(RestoreMBB);
11421142

11431143
// restoreMBB.
1144-
BuildMI(restoreMBB, DL, TII->get(SystemZ::LHI), restoreDstReg).addImm(1);
1145-
BuildMI(restoreMBB, DL, TII->get(SystemZ::J)).addMBB(sinkMBB);
1146-
restoreMBB->addSuccessor(sinkMBB);
1144+
BuildMI(RestoreMBB, DL, TII->get(SystemZ::LHI), RestoreDstReg).addImm(1);
1145+
BuildMI(RestoreMBB, DL, TII->get(SystemZ::J)).addMBB(SinkMBB);
1146+
RestoreMBB->addSuccessor(SinkMBB);
11471147

11481148
MI.eraseFromParent();
11491149

1150-
return sinkMBB;
1150+
return SinkMBB;
11511151
}
11521152

11531153
MachineBasicBlock *
@@ -1510,71 +1510,72 @@ SystemZTargetLowering::getConstraintType(StringRef Constraint) const {
15101510
return TargetLowering::getConstraintType(Constraint);
15111511
}
15121512

1513-
TargetLowering::ConstraintWeight SystemZTargetLowering::
1514-
getSingleConstraintMatchWeight(AsmOperandInfo &info,
1515-
const char *constraint) const {
1516-
ConstraintWeight weight = CW_Invalid;
1517-
Value *CallOperandVal = info.CallOperandVal;
1513+
TargetLowering::ConstraintWeight
1514+
SystemZTargetLowering::getSingleConstraintMatchWeight(
1515+
AsmOperandInfo &Info, const char *Constraint) const {
1516+
ConstraintWeight Weight = CW_Invalid;
1517+
Value *CallOperandVal = Info.CallOperandVal;
15181518
// If we don't have a value, we can't do a match,
15191519
// but allow it at the lowest weight.
15201520
if (!CallOperandVal)
15211521
return CW_Default;
15221522
Type *type = CallOperandVal->getType();
15231523
// Look at the constraint type.
1524-
switch (*constraint) {
1524+
switch (*Constraint) {
15251525
default:
1526-
weight = TargetLowering::getSingleConstraintMatchWeight(info, constraint);
1526+
Weight = TargetLowering::getSingleConstraintMatchWeight(Info, Constraint);
15271527
break;
15281528

15291529
case 'a': // Address register
15301530
case 'd': // Data register (equivalent to 'r')
15311531
case 'h': // High-part register
15321532
case 'r': // General-purpose register
1533-
weight = CallOperandVal->getType()->isIntegerTy() ? CW_Register : CW_Default;
1533+
Weight =
1534+
CallOperandVal->getType()->isIntegerTy() ? CW_Register : CW_Default;
15341535
break;
15351536

15361537
case 'f': // Floating-point register
15371538
if (!useSoftFloat())
1538-
weight = type->isFloatingPointTy() ? CW_Register : CW_Default;
1539+
Weight = type->isFloatingPointTy() ? CW_Register : CW_Default;
15391540
break;
15401541

15411542
case 'v': // Vector register
15421543
if (Subtarget.hasVector())
1543-
weight = (type->isVectorTy() || type->isFloatingPointTy()) ? CW_Register
1544+
Weight = (type->isVectorTy() || type->isFloatingPointTy()) ? CW_Register
15441545
: CW_Default;
15451546
break;
15461547

15471548
case 'I': // Unsigned 8-bit constant
15481549
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
15491550
if (isUInt<8>(C->getZExtValue()))
1550-
weight = CW_Constant;
1551+
Weight = CW_Constant;
15511552
break;
15521553

15531554
case 'J': // Unsigned 12-bit constant
15541555
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
15551556
if (isUInt<12>(C->getZExtValue()))
1556-
weight = CW_Constant;
1557+
Weight = CW_Constant;
15571558
break;
15581559

15591560
case 'K': // Signed 16-bit constant
15601561
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
15611562
if (isInt<16>(C->getSExtValue()))
1562-
weight = CW_Constant;
1563+
Weight = CW_Constant;
15631564
break;
15641565

15651566
case 'L': // Signed 20-bit displacement (on all targets we support)
15661567
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
15671568
if (isInt<20>(C->getSExtValue()))
1568-
weight = CW_Constant;
1569+
Weight = CW_Constant;
15691570
break;
15701571

15711572
case 'M': // 0x7fffffff
15721573
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
15731574
if (C->getZExtValue() == 0x7fffffff)
1574-
weight = CW_Constant;
1575+
Weight = CW_Constant;
15751576
break;
15761577
}
1577-
return weight;
1578+
return Weight;
15781579
}
15791580

15801581
// Parse a "{tNNN}" register constraint for which the register type "t"
@@ -2137,7 +2138,7 @@ static SDValue getADAEntry(SelectionDAG &DAG, SDValue Val, SDLoc DL,
21372138
unsigned Offset, bool LoadAdr = false) {
21382139
MachineFunction &MF = DAG.getMachineFunction();
21392140
SystemZMachineFunctionInfo *MFI = MF.getInfo<SystemZMachineFunctionInfo>();
2140-
unsigned ADAvReg = MFI->getADAVirtualRegister();
2141+
Register ADAvReg = MFI->getADAVirtualRegister();
21412142
EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout());
21422143

21432144
SDValue Reg = DAG.getRegister(ADAvReg, PtrVT);
@@ -2191,7 +2192,7 @@ static bool getzOSCalleeAndADA(SelectionDAG &DAG, SDValue &Callee, SDValue &ADA,
21912192
if (IsInternal) {
21922193
SystemZMachineFunctionInfo *MFI =
21932194
MF.getInfo<SystemZMachineFunctionInfo>();
2194-
unsigned ADAvReg = MFI->getADAVirtualRegister();
2195+
Register ADAvReg = MFI->getADAVirtualRegister();
21952196
ADA = DAG.getCopyFromReg(Chain, DL, ADAvReg, PtrVT);
21962197
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), DL, PtrVT);
21972198
Callee = DAG.getNode(SystemZISD::PCREL_WRAPPER, DL, PtrVT, Callee);
@@ -2482,20 +2483,18 @@ std::pair<SDValue, SDValue> SystemZTargetLowering::makeExternalCall(
24822483
return LowerCallTo(CLI);
24832484
}
24842485

2485-
bool SystemZTargetLowering::
2486-
CanLowerReturn(CallingConv::ID CallConv,
2487-
MachineFunction &MF, bool isVarArg,
2488-
const SmallVectorImpl<ISD::OutputArg> &Outs,
2489-
LLVMContext &Context,
2490-
const Type *RetTy) const {
2486+
bool SystemZTargetLowering::CanLowerReturn(
2487+
CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
2488+
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context,
2489+
const Type *RetTy) const {
24912490
// Special case that we cannot easily detect in RetCC_SystemZ since
24922491
// i128 may not be a legal type.
24932492
for (auto &Out : Outs)
24942493
if (Out.ArgVT == MVT::i128)
24952494
return false;
24962495

24972496
SmallVector<CCValAssign, 16> RetLocs;
2498-
CCState RetCCInfo(CallConv, isVarArg, MF, RetLocs, Context);
2497+
CCState RetCCInfo(CallConv, IsVarArg, MF, RetLocs, Context);
24992498
return RetCCInfo.CheckReturn(Outs, RetCC_SystemZ);
25002499
}
25012500

@@ -6051,8 +6050,8 @@ SDValue GeneralShuffle::getNode(SelectionDAG &DAG, const SDLoc &DL) {
60516050
#ifndef NDEBUG
60526051
static void dumpBytes(const SmallVectorImpl<int> &Bytes, std::string Msg) {
60536052
dbgs() << Msg.c_str() << " { ";
6054-
for (unsigned i = 0; i < Bytes.size(); i++)
6055-
dbgs() << Bytes[i] << " ";
6053+
for (unsigned I = 0; I < Bytes.size(); I++)
6054+
dbgs() << Bytes[I] << " ";
60566055
dbgs() << "}\n";
60576056
}
60586057
#endif
@@ -6767,7 +6766,7 @@ SDValue SystemZTargetLowering::lowerFSHR(SDValue Op, SelectionDAG &DAG) const {
67676766
}
67686767

67696768
static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) {
6770-
SDLoc dl(Op);
6769+
SDLoc DL(Op);
67716770
SDValue Src = Op.getOperand(0);
67726771
MVT DstVT = Op.getSimpleValueType();
67736772

@@ -6780,14 +6779,14 @@ static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) {
67806779
// addrspacecast [0 <- 1] : Assinging a ptr32 value to a 64-bit pointer.
67816780
// addrspacecast [1 <- 0] : Assigining a 64-bit pointer to a ptr32 value.
67826781
if (SrcAS == SYSTEMZAS::PTR32 && DstVT == MVT::i64) {
6783-
Op = DAG.getNode(ISD::AND, dl, MVT::i32, Src,
6784-
DAG.getConstant(0x7fffffff, dl, MVT::i32));
6785-
Op = DAG.getNode(ISD::ZERO_EXTEND, dl, DstVT, Op);
6782+
Op = DAG.getNode(ISD::AND, DL, MVT::i32, Src,
6783+
DAG.getConstant(0x7fffffff, DL, MVT::i32));
6784+
Op = DAG.getNode(ISD::ZERO_EXTEND, DL, DstVT, Op);
67866785
} else if (DstVT == MVT::i32) {
6787-
Op = DAG.getNode(ISD::TRUNCATE, dl, DstVT, Src);
6788-
Op = DAG.getNode(ISD::AND, dl, MVT::i32, Op,
6789-
DAG.getConstant(0x7fffffff, dl, MVT::i32));
6790-
Op = DAG.getNode(ISD::ZERO_EXTEND, dl, DstVT, Op);
6786+
Op = DAG.getNode(ISD::TRUNCATE, DL, DstVT, Src);
6787+
Op = DAG.getNode(ISD::AND, DL, MVT::i32, Op,
6788+
DAG.getConstant(0x7fffffff, DL, MVT::i32));
6789+
Op = DAG.getNode(ISD::ZERO_EXTEND, DL, DstVT, Op);
67916790
} else {
67926791
report_fatal_error("Bad address space in addrspacecast");
67936792
}
@@ -9285,8 +9284,8 @@ SystemZTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
92859284
Known.resetAll();
92869285

92879286
// Intrinsic CC result is returned in the two low bits.
9288-
unsigned tmp0, tmp1; // not used
9289-
if (Op.getResNo() == 1 && isIntrinsicWithCC(Op, tmp0, tmp1)) {
9287+
unsigned Tmp0, Tmp1; // not used
9288+
if (Op.getResNo() == 1 && isIntrinsicWithCC(Op, Tmp0, Tmp1)) {
92909289
Known.Zero.setBitsFrom(2);
92919290
return;
92929291
}
@@ -9511,10 +9510,10 @@ static bool checkCCKill(MachineInstr &MI, MachineBasicBlock *MBB) {
95119510
// Scan forward through BB for a use/def of CC.
95129511
MachineBasicBlock::iterator miI(std::next(MachineBasicBlock::iterator(MI)));
95139512
for (MachineBasicBlock::iterator miE = MBB->end(); miI != miE; ++miI) {
9514-
const MachineInstr& mi = *miI;
9515-
if (mi.readsRegister(SystemZ::CC, /*TRI=*/nullptr))
9513+
const MachineInstr &MI = *miI;
9514+
if (MI.readsRegister(SystemZ::CC, /*TRI=*/nullptr))
95169515
return false;
9517-
if (mi.definesRegister(SystemZ::CC, /*TRI=*/nullptr))
9516+
if (MI.definesRegister(SystemZ::CC, /*TRI=*/nullptr))
95189517
break; // Should have kill-flag - update below.
95199518
}
95209519

0 commit comments

Comments
 (0)