From 756db63af9642f56138e2ab6ac26627205c1992e Mon Sep 17 00:00:00 2001 From: Puyan Lotfi Date: Thu, 12 Dec 2019 03:27:47 -0500 Subject: [PATCH] [NFC][llvm][MIRVRegNamerUtils] Moving methods around. Making some private. Making all externally unused methods private in MIRVRegNamerUtils.h. Moving or deleting a couple other methods around. --- llvm/lib/CodeGen/MIRVRegNamerUtils.cpp | 7 +------ llvm/lib/CodeGen/MIRVRegNamerUtils.h | 15 ++++++++------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp index 898efd14d996..8b17f78e0bcf 100644 --- a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp +++ b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp @@ -95,7 +95,7 @@ unsigned VRegRenamer::createVirtualRegister(unsigned VReg) { bool VRegRenamer::renameInstsInMBB(MachineBasicBlock *MBB) { std::vector VRegs; - std::string Prefix = "bb" + std::to_string(getCurrentBBNumber()) + "_"; + std::string Prefix = "bb" + std::to_string(CurrentBBNumber) + "_"; for (MachineInstr &Candidate : *MBB) { // Don't rename stores/branches. if (Candidate.mayStore() || Candidate.isBranch()) @@ -114,11 +114,6 @@ bool VRegRenamer::renameInstsInMBB(MachineBasicBlock *MBB) { return VRegs.size() ? doVRegRenaming(getVRegRenameMap(VRegs)) : false; } -bool VRegRenamer::renameVRegs(MachineBasicBlock *MBB, unsigned BBNum) { - CurrentBBNumber = BBNum; - return renameInstsInMBB(MBB); -} - unsigned VRegRenamer::createVirtualRegisterWithLowerName(unsigned VReg, StringRef Name) { std::string LowerName = Name.lower(); diff --git a/llvm/lib/CodeGen/MIRVRegNamerUtils.h b/llvm/lib/CodeGen/MIRVRegNamerUtils.h index 98b0aeac3b24..0c0a71a13248 100644 --- a/llvm/lib/CodeGen/MIRVRegNamerUtils.h +++ b/llvm/lib/CodeGen/MIRVRegNamerUtils.h @@ -64,10 +64,6 @@ class VRegRenamer { /// Perform replacing of registers based on the vreg map. bool doVRegRenaming(const std::map &VRegRenameMap); -public: - VRegRenamer() = delete; - VRegRenamer(MachineRegisterInfo &MRI) : MRI(MRI) {} - /// createVirtualRegister - Given an existing vreg, create a named vreg to /// take its place. The name is determined by calling /// getInstructionOpcodeHash. @@ -80,11 +76,16 @@ public: /// Names are as follows bb_hash_[0-9]+ bool renameInstsInMBB(MachineBasicBlock *MBB); +public: + VRegRenamer() = delete; + VRegRenamer(MachineRegisterInfo &MRI) : MRI(MRI) {} + /// Same as the above, but sets a BBNum depending on BB traversal that /// will be used as prefix for the vreg names. - bool renameVRegs(MachineBasicBlock *MBB, unsigned BBNum); - - unsigned getCurrentBBNumber() const { return CurrentBBNumber; } + bool renameVRegs(MachineBasicBlock *MBB, unsigned BBNum) { + CurrentBBNumber = BBNum; + return renameInstsInMBB(MBB); + } }; } // namespace llvm