Skip to content

Commit 6ca2a9f

Browse files
authored
[CodeGen] Use Register in SDep interface. NFC (#129734)
1 parent 423862f commit 6ca2a9f

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

llvm/include/llvm/CodeGen/ScheduleDAG.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,18 @@ class TargetRegisterInfo;
101101
SDep() : Dep(nullptr, Data) {}
102102

103103
/// Constructs an SDep with the specified values.
104-
SDep(SUnit *S, Kind kind, unsigned Reg)
105-
: Dep(S, kind), Contents() {
104+
SDep(SUnit *S, Kind kind, Register Reg) : Dep(S, kind), Contents() {
106105
switch (kind) {
107106
default:
108107
llvm_unreachable("Reg given for non-register dependence!");
109108
case Anti:
110109
case Output:
111-
assert(Reg != 0 &&
112-
"SDep::Anti and SDep::Output must use a non-zero Reg!");
113-
Contents.Reg = Reg;
110+
assert(Reg && "SDep::Anti and SDep::Output must use a non-zero Reg!");
111+
Contents.Reg = Reg.id();
114112
Latency = 0;
115113
break;
116114
case Data:
117-
Contents.Reg = Reg;
115+
Contents.Reg = Reg.id();
118116
Latency = 1;
119117
break;
120118
}
@@ -208,14 +206,12 @@ class TargetRegisterInfo;
208206
}
209207

210208
/// Tests if this is a Data dependence that is associated with a register.
211-
bool isAssignedRegDep() const {
212-
return getKind() == Data && Contents.Reg != 0;
213-
}
209+
bool isAssignedRegDep() const { return getKind() == Data && Contents.Reg; }
214210

215211
/// Returns the register associated with this edge. This is only valid on
216212
/// Data, Anti, and Output edges. On Data edges, this value may be zero,
217213
/// meaning there is no associated register.
218-
unsigned getReg() const {
214+
Register getReg() const {
219215
assert((getKind() == Data || getKind() == Anti || getKind() == Output) &&
220216
"getReg called on non-register dependence edge!");
221217
return Contents.Reg;
@@ -225,14 +221,14 @@ class TargetRegisterInfo;
225221
/// Data, Anti, and Output edges. On Anti and Output edges, this value must
226222
/// not be zero. On Data edges, the value may be zero, which would mean that
227223
/// no specific register is associated with this edge.
228-
void setReg(unsigned Reg) {
224+
void setReg(Register Reg) {
229225
assert((getKind() == Data || getKind() == Anti || getKind() == Output) &&
230226
"setReg called on non-register dependence edge!");
231-
assert((getKind() != Anti || Reg != 0) &&
227+
assert((getKind() != Anti || Reg) &&
232228
"SDep::Anti edge cannot use the zero register!");
233-
assert((getKind() != Output || Reg != 0) &&
229+
assert((getKind() != Output || Reg) &&
234230
"SDep::Output edge cannot use the zero register!");
235-
Contents.Reg = Reg;
231+
Contents.Reg = Reg.id();
236232
}
237233

238234
void dump(const TargetRegisterInfo *TRI = nullptr) const;

llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
829829
if ((Edge->getKind() != SDep::Anti) &&
830830
(Edge->getKind() != SDep::Output)) continue;
831831

832-
MCRegister AntiDepReg = MCRegister::from(Edge->getReg());
832+
MCRegister AntiDepReg = Edge->getReg().asMCReg();
833833
LLVM_DEBUG(dbgs() << "\tAntidep reg: " << printReg(AntiDepReg, TRI));
834834
assert(AntiDepReg && "Anti-dependence on reg0?");
835835

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,8 +3968,7 @@ void GenericScheduler::reschedulePhysReg(SUnit *SU, bool isTop) {
39683968
// Find already scheduled copies with a single physreg dependence and move
39693969
// them just above the scheduled instruction.
39703970
for (SDep &Dep : Deps) {
3971-
if (Dep.getKind() != SDep::Data ||
3972-
!Register::isPhysicalRegister(Dep.getReg()))
3971+
if (Dep.getKind() != SDep::Data || !Dep.getReg().isPhysical())
39733972
continue;
39743973
SUnit *DepSU = Dep.getSUnit();
39753974
if (isTop ? DepSU->Succs.size() > 1 : DepSU->Preds.size() > 1)

0 commit comments

Comments
 (0)