Skip to content

Commit 37fdde6

Browse files
committed
[CodeGen] Remove implict conversions from Register to unsigned from MachineOperand. NFC
1 parent 753028b commit 37fdde6

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

llvm/include/llvm/CodeGen/MachineOperand.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ class MachineOperand {
854854
Op.IsEarlyClobber = isEarlyClobber;
855855
Op.TiedTo = 0;
856856
Op.IsDebug = isDebug;
857-
Op.SmallContents.RegNo = Reg;
857+
Op.SmallContents.RegNo = Reg.id();
858858
Op.Contents.Reg.Prev = nullptr;
859859
Op.Contents.Reg.Next = nullptr;
860860
Op.setSubReg(SubReg);

llvm/lib/CodeGen/MachineOperand.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ void MachineOperand::setReg(Register Reg) {
7171
if (MachineFunction *MF = getMFIfAvailable(*this)) {
7272
MachineRegisterInfo &MRI = MF->getRegInfo();
7373
MRI.removeRegOperandFromUseList(this);
74-
SmallContents.RegNo = Reg;
74+
SmallContents.RegNo = Reg.id();
7575
MRI.addRegOperandToUseList(this);
7676
return;
7777
}
7878

7979
// Otherwise, just change the register, no problem. :)
80-
SmallContents.RegNo = Reg;
80+
SmallContents.RegNo = Reg.id();
8181
}
8282

8383
void MachineOperand::substVirtReg(Register Reg, unsigned SubIdx,
@@ -291,7 +291,7 @@ void MachineOperand::ChangeToRegister(Register Reg, bool isDef, bool isImp,
291291
assert(!(isDead && !isDef) && "Dead flag on non-def");
292292
assert(!(isKill && isDef) && "Kill flag on def");
293293
OpKind = MO_Register;
294-
SmallContents.RegNo = Reg;
294+
SmallContents.RegNo = Reg.id();
295295
SubReg_TargetFlags = 0;
296296
IsDef = isDef;
297297
IsImp = isImp;
@@ -390,7 +390,8 @@ hash_code llvm::hash_value(const MachineOperand &MO) {
390390
switch (MO.getType()) {
391391
case MachineOperand::MO_Register:
392392
// Register operands don't have target flags.
393-
return hash_combine(MO.getType(), (unsigned)MO.getReg(), MO.getSubReg(), MO.isDef());
393+
return hash_combine(MO.getType(), MO.getReg().id(), MO.getSubReg(),
394+
MO.isDef());
394395
case MachineOperand::MO_Immediate:
395396
return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getImm());
396397
case MachineOperand::MO_CImmediate:

0 commit comments

Comments
 (0)