Skip to content

Commit 9d3ab1c

Browse files
committed
[SelectionDAGBuilder] Use Register in more places. NFC"
1 parent fe012bd commit 9d3ab1c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -845,13 +845,13 @@ static void getCopyToPartsVector(SelectionDAG &DAG, const SDLoc &DL,
845845
}
846846
}
847847

848-
RegsForValue::RegsForValue(const SmallVector<unsigned, 4> &regs, MVT regvt,
848+
RegsForValue::RegsForValue(const SmallVector<Register, 4> &regs, MVT regvt,
849849
EVT valuevt, std::optional<CallingConv::ID> CC)
850850
: ValueVTs(1, valuevt), RegVTs(1, regvt), Regs(regs),
851851
RegCount(1, regs.size()), CallConv(CC) {}
852852

853853
RegsForValue::RegsForValue(LLVMContext &Context, const TargetLowering &TLI,
854-
const DataLayout &DL, unsigned Reg, Type *Ty,
854+
const DataLayout &DL, Register Reg, Type *Ty,
855855
std::optional<CallingConv::ID> CC) {
856856
ComputeValueVTs(TLI, DL, Ty, ValueVTs);
857857

@@ -870,7 +870,7 @@ RegsForValue::RegsForValue(LLVMContext &Context, const TargetLowering &TLI,
870870
Regs.push_back(Reg + i);
871871
RegVTs.push_back(RegisterVT);
872872
RegCount.push_back(NumRegs);
873-
Reg += NumRegs;
873+
Reg = Reg.id() + NumRegs;
874874
}
875875
}
876876

@@ -1070,9 +1070,9 @@ void RegsForValue::AddInlineAsmOperands(InlineAsm::Kind Code, bool HasMatching,
10701070
}
10711071
}
10721072

1073-
SmallVector<std::pair<unsigned, TypeSize>, 4>
1073+
SmallVector<std::pair<Register, TypeSize>, 4>
10741074
RegsForValue::getRegsAndSizes() const {
1075-
SmallVector<std::pair<unsigned, TypeSize>, 4> OutVec;
1075+
SmallVector<std::pair<Register, TypeSize>, 4> OutVec;
10761076
unsigned I = 0;
10771077
for (auto CountAndVT : zip_first(RegCount, RegVTs)) {
10781078
unsigned RegCount = std::get<0>(CountAndVT);
@@ -5956,7 +5956,7 @@ static SDValue expandDivFix(unsigned Opcode, const SDLoc &DL,
59565956
// getUnderlyingArgRegs - Find underlying registers used for a truncated,
59575957
// bitcasted, or split argument. Returns a list of <Register, size in bits>
59585958
static void
5959-
getUnderlyingArgRegs(SmallVectorImpl<std::pair<unsigned, TypeSize>> &Regs,
5959+
getUnderlyingArgRegs(SmallVectorImpl<std::pair<Register, TypeSize>> &Regs,
59605960
const SDValue &N) {
59615961
switch (N.getOpcode()) {
59625962
case ISD::CopyFromReg: {
@@ -6101,7 +6101,7 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
61016101
if (FI != std::numeric_limits<int>::max())
61026102
Op = MachineOperand::CreateFI(FI);
61036103

6104-
SmallVector<std::pair<unsigned, TypeSize>, 8> ArgRegsAndSizes;
6104+
SmallVector<std::pair<Register, TypeSize>, 8> ArgRegsAndSizes;
61056105
if (!Op && N.getNode()) {
61066106
getUnderlyingArgRegs(ArgRegsAndSizes, N);
61076107
Register Reg;
@@ -6131,7 +6131,7 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
61316131

61326132
if (!Op) {
61336133
// Create a DBG_VALUE for each decomposed value in ArgRegs to cover Reg
6134-
auto splitMultiRegDbgValue = [&](ArrayRef<std::pair<unsigned, TypeSize>>
6134+
auto splitMultiRegDbgValue = [&](ArrayRef<std::pair<Register, TypeSize>>
61356135
SplitRegs) {
61366136
unsigned Offset = 0;
61376137
for (const auto &RegAndSize : SplitRegs) {
@@ -9653,7 +9653,7 @@ getRegistersForValue(SelectionDAG &DAG, const SDLoc &DL,
96539653
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
96549654

96559655
MachineFunction &MF = DAG.getMachineFunction();
9656-
SmallVector<unsigned, 4> Regs;
9656+
SmallVector<Register, 4> Regs;
96579657
const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
96589658

96599659
// No work to do for memory/address operands.
@@ -10078,7 +10078,7 @@ void SelectionDAGBuilder::visitInlineAsm(const CallBase &Call,
1007810078
return;
1007910079
}
1008010080

10081-
SmallVector<unsigned, 4> Regs;
10081+
SmallVector<Register, 4> Regs;
1008210082
MachineFunction &MF = DAG.getMachineFunction();
1008310083
MachineRegisterInfo &MRI = MF.getRegInfo();
1008410084
const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
@@ -12654,7 +12654,7 @@ void SelectionDAGBuilder::visitCallBrLandingPad(const CallInst &I) {
1265412654

1265512655
// getRegistersForValue may produce 1 to many registers based on whether
1265612656
// the OpInfo.ConstraintVT is legal on the target or not.
12657-
for (unsigned &Reg : OpInfo.AssignedRegs.Regs) {
12657+
for (Register &Reg : OpInfo.AssignedRegs.Regs) {
1265812658
Register OriginalDef = FollowCopyChain(MRI, InitialDef++);
1265912659
if (Register::isPhysicalRegister(OriginalDef))
1266012660
FuncInfo.MBB->addLiveIn(OriginalDef);

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ struct RegsForValue {
740740
/// This list holds the registers assigned to the values.
741741
/// Each legal or promoted value requires one register, and each
742742
/// expanded value requires multiple registers.
743-
SmallVector<unsigned, 4> Regs;
743+
SmallVector<Register, 4> Regs;
744744

745745
/// This list holds the number of registers for each value.
746746
SmallVector<unsigned, 4> RegCount;
@@ -750,10 +750,10 @@ struct RegsForValue {
750750
std::optional<CallingConv::ID> CallConv;
751751

752752
RegsForValue() = default;
753-
RegsForValue(const SmallVector<unsigned, 4> &regs, MVT regvt, EVT valuevt,
753+
RegsForValue(const SmallVector<Register, 4> &regs, MVT regvt, EVT valuevt,
754754
std::optional<CallingConv::ID> CC = std::nullopt);
755755
RegsForValue(LLVMContext &Context, const TargetLowering &TLI,
756-
const DataLayout &DL, unsigned Reg, Type *Ty,
756+
const DataLayout &DL, Register Reg, Type *Ty,
757757
std::optional<CallingConv::ID> CC);
758758

759759
bool isABIMangled() const { return CallConv.has_value(); }
@@ -796,7 +796,7 @@ struct RegsForValue {
796796
}
797797

798798
/// Return a list of registers and their sizes.
799-
SmallVector<std::pair<unsigned, TypeSize>, 4> getRegsAndSizes() const;
799+
SmallVector<std::pair<Register, TypeSize>, 4> getRegsAndSizes() const;
800800
};
801801

802802
} // end namespace llvm

0 commit comments

Comments
 (0)