class VRegRenamer
Declaration
class VRegRenamer { /* full declaration omitted */ };
Description
VRegRenamer - This class is used for renaming vregs in a machine basic block according to semantics of the instruction.
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:34
Member Variables
- private llvm::MachineRegisterInfo& MRI
- private unsigned int CurrentBBNumber = 0
Method Overview
- public VRegRenamer()
- public VRegRenamer(llvm::MachineRegisterInfo & MRI)
- private unsigned int createVirtualRegister(unsigned int VReg)
- private unsigned int createVirtualRegisterWithLowerName(unsigned int VReg, llvm::StringRef Name)
- private bool doVRegRenaming(const std::map<unsigned int, unsigned int> & VRegRenameMap)
- private std::string getInstructionOpcodeHash(llvm::MachineInstr & MI)
- private std::map<unsigned int, unsigned int> getVRegRenameMap(const std::vector<NamedVReg> & VRegs)
- private bool renameInstsInMBB(llvm::MachineBasicBlock * MBB)
- public bool renameVRegs(llvm::MachineBasicBlock * MBB, unsigned int BBNum)
Methods
¶VRegRenamer()
VRegRenamer()
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:84
¶VRegRenamer(llvm::MachineRegisterInfo& MRI)
VRegRenamer(llvm::MachineRegisterInfo& MRI)
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:85
Parameters
¶unsigned int createVirtualRegister(
unsigned int VReg)
unsigned int createVirtualRegister(
unsigned int VReg)
Description
createVirtualRegister - Given an existing vreg, create a named vreg to take its place. The name is determined by calling getInstructionOpcodeHash.
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:73
Parameters
- unsigned int VReg
¶unsigned int createVirtualRegisterWithLowerName(
unsigned int VReg,
llvm::StringRef Name)
unsigned int createVirtualRegisterWithLowerName(
unsigned int VReg,
llvm::StringRef Name)
Description
Create a vreg with name and return it.
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:76
Parameters
- unsigned int VReg
- llvm::StringRef Name
¶bool doVRegRenaming(
const std::map<unsigned int, unsigned int>&
VRegRenameMap)
bool doVRegRenaming(
const std::map<unsigned int, unsigned int>&
VRegRenameMap)
Description
Perform replacing of registers based on the <old ,new> vreg map.
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:68
Parameters
- const std::map<unsigned int, unsigned int>& VRegRenameMap
¶std::string getInstructionOpcodeHash(
llvm::MachineInstr& MI)
std::string getInstructionOpcodeHash(
llvm::MachineInstr& MI)
Description
Given an Instruction, construct a hash of the operands of the instructions along with the opcode. When dealing with virtual registers, just hash the opcode of the instruction defining that vreg. Handle immediates, registers (physical and virtual) explicitly, and return a common value for the other cases. Instruction will be named in the following scheme bb <block _no>_hash_ <collission _count>.
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:60
Parameters
¶std::map<unsigned int, unsigned int>
getVRegRenameMap(
const std::vector<NamedVReg>& VRegs)
std::map<unsigned int, unsigned int>
getVRegRenameMap(
const std::vector<NamedVReg>& VRegs)
Description
For all the VRegs that are candidates for renaming, return a mapping from old vregs to new vregs with names.
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:65
Parameters
- const std::vector<NamedVReg>& VRegs
¶bool renameInstsInMBB(
llvm::MachineBasicBlock* MBB)
bool renameInstsInMBB(
llvm::MachineBasicBlock* MBB)
Description
Linearly traverse the MachineBasicBlock and rename each instruction's vreg definition based on the semantics of the instruction. Names are as follows bb <BBNum >_hash_[0-9]+
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:81
Parameters
¶bool renameVRegs(llvm::MachineBasicBlock* MBB,
unsigned int BBNum)
bool renameVRegs(llvm::MachineBasicBlock* MBB,
unsigned int BBNum)
Description
Same as the above, but sets a BBNum depending on BB traversal that will be used as prefix for the vreg names.
Declared at: llvm/lib/CodeGen/MIRVRegNamerUtils.h:89
Parameters
- llvm::MachineBasicBlock* MBB
- unsigned int BBNum