From ecb3f5791175bd1b460a85ef11f5fc8e3e39c2d1 Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Mon, 5 Aug 2019 21:34:45 +0000 Subject: [PATCH] Revert Register/MCRegister: Add conversion operators to avoid use of implicit convert to unsigned. NFC MSVC finds ambiguity where clang doesn't and it looks like it's not going to be an easy fix Reverting while I figure out how to fix it This reverts r367916 (git commit aa15ec3c231717826e3c262b5ef9813d2fb5cadb) This reverts r367920 (git commit 5d14efe279b5db9f4746ff834ab5c70e249d3871) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367932 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/Register.h | 13 ------------- include/llvm/MC/MCRegister.h | 13 ------------- lib/CodeGen/MachineBasicBlock.cpp | 2 +- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/include/llvm/CodeGen/Register.h b/include/llvm/CodeGen/Register.h index 73bca60ffcb..640bd82bde2 100644 --- a/include/llvm/CodeGen/Register.h +++ b/include/llvm/CodeGen/Register.h @@ -113,19 +113,6 @@ public: bool isValid() const { return Reg != 0; } - - /// Comparisons between register objects - bool operator==(const Register &Other) const { return Reg == Other.Reg; } - bool operator!=(const Register &Other) const { return Reg != Other.Reg; } - - /// Comparisons against register constants. E.g. - /// * R == AArch64::WZR - /// * R == 0 - /// * R == VirtRegMap::NO_PHYS_REG - bool operator==(unsigned Other) const { return Reg == Other; } - bool operator!=(unsigned Other) const { return Reg != Other; } - bool operator==(int Other) const { return Reg == unsigned(Other); } - bool operator!=(int Other) const { return Reg != unsigned(Other); } }; // Provide DenseMapInfo for Register diff --git a/include/llvm/MC/MCRegister.h b/include/llvm/MC/MCRegister.h index 2d4ac211f09..0e889c7adf7 100644 --- a/include/llvm/MC/MCRegister.h +++ b/include/llvm/MC/MCRegister.h @@ -63,19 +63,6 @@ public: bool isValid() const { return Reg != 0; } - - /// Comparisons between register objects - bool operator==(const MCRegister &Other) const { return Reg == Other.Reg; } - bool operator!=(const MCRegister &Other) const { return Reg != Other.Reg; } - - /// Comparisons against register constants. E.g. - /// * R == AArch64::WZR - /// * R == 0 - /// * R == VirtRegMap::NO_PHYS_REG - bool operator==(unsigned Other) const { return Reg == Other; } - bool operator!=(unsigned Other) const { return Reg != Other; } - bool operator==(int Other) const { return Reg == unsigned(Other); } - bool operator!=(int Other) const { return Reg != unsigned(Other); } }; // Provide DenseMapInfo for MCRegister diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp index 46146bcfaad..d7e83286b59 100644 --- a/lib/CodeGen/MachineBasicBlock.cpp +++ b/lib/CodeGen/MachineBasicBlock.cpp @@ -499,7 +499,7 @@ MachineBasicBlock::addLiveIn(MCPhysReg PhysReg, const TargetRegisterClass *RC) { // Look for an existing copy. if (LiveIn) for (;I != E && I->isCopy(); ++I) - if (I->getOperand(1).getReg() == Register(PhysReg)) { + if (I->getOperand(1).getReg() == PhysReg) { unsigned VirtReg = I->getOperand(0).getReg(); if (!MRI.constrainRegClass(VirtReg, RC)) llvm_unreachable("Incompatible live-in register class."); -- 2.50.1