[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.
This commit is contained in:
Puyan Lotfi 2019-12-12 03:27:47 -05:00
parent 75c11c7169
commit 42ff8f509a
2 changed files with 9 additions and 13 deletions

View File

@ -95,7 +95,7 @@ unsigned VRegRenamer::createVirtualRegister(unsigned VReg) {
bool VRegRenamer::renameInstsInMBB(MachineBasicBlock *MBB) { bool VRegRenamer::renameInstsInMBB(MachineBasicBlock *MBB) {
std::vector<NamedVReg> VRegs; std::vector<NamedVReg> VRegs;
std::string Prefix = "bb" + std::to_string(getCurrentBBNumber()) + "_"; std::string Prefix = "bb" + std::to_string(CurrentBBNumber) + "_";
for (MachineInstr &Candidate : *MBB) { for (MachineInstr &Candidate : *MBB) {
// Don't rename stores/branches. // Don't rename stores/branches.
if (Candidate.mayStore() || Candidate.isBranch()) if (Candidate.mayStore() || Candidate.isBranch())
@ -114,11 +114,6 @@ bool VRegRenamer::renameInstsInMBB(MachineBasicBlock *MBB) {
return VRegs.size() ? doVRegRenaming(getVRegRenameMap(VRegs)) : false; return VRegs.size() ? doVRegRenaming(getVRegRenameMap(VRegs)) : false;
} }
bool VRegRenamer::renameVRegs(MachineBasicBlock *MBB, unsigned BBNum) {
CurrentBBNumber = BBNum;
return renameInstsInMBB(MBB);
}
unsigned VRegRenamer::createVirtualRegisterWithLowerName(unsigned VReg, unsigned VRegRenamer::createVirtualRegisterWithLowerName(unsigned VReg,
StringRef Name) { StringRef Name) {
std::string LowerName = Name.lower(); std::string LowerName = Name.lower();

View File

@ -64,10 +64,6 @@ class VRegRenamer {
/// Perform replacing of registers based on the <old,new> vreg map. /// Perform replacing of registers based on the <old,new> vreg map.
bool doVRegRenaming(const std::map<unsigned, unsigned> &VRegRenameMap); bool doVRegRenaming(const std::map<unsigned, unsigned> &VRegRenameMap);
public:
VRegRenamer() = delete;
VRegRenamer(MachineRegisterInfo &MRI) : MRI(MRI) {}
/// createVirtualRegister - Given an existing vreg, create a named vreg to /// createVirtualRegister - Given an existing vreg, create a named vreg to
/// take its place. The name is determined by calling /// take its place. The name is determined by calling
/// getInstructionOpcodeHash. /// getInstructionOpcodeHash.
@ -80,11 +76,16 @@ public:
/// Names are as follows bb<BBNum>_hash_[0-9]+ /// Names are as follows bb<BBNum>_hash_[0-9]+
bool renameInstsInMBB(MachineBasicBlock *MBB); 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 /// Same as the above, but sets a BBNum depending on BB traversal that
/// will be used as prefix for the vreg names. /// will be used as prefix for the vreg names.
bool renameVRegs(MachineBasicBlock *MBB, unsigned BBNum); bool renameVRegs(MachineBasicBlock *MBB, unsigned BBNum) {
CurrentBBNumber = BBNum;
unsigned getCurrentBBNumber() const { return CurrentBBNumber; } return renameInstsInMBB(MBB);
}
}; };
} // namespace llvm } // namespace llvm