33 #define DEBUG_TYPE "wasm-replace-phys-regs" 43 return "WebAssembly Replace Physical Registers";
57 "Replace physical registers with virtual registers",
false,
61 return new WebAssemblyReplacePhysRegs();
64 bool WebAssemblyReplacePhysRegs::runOnMachineFunction(
MachineFunction &MF) {
66 dbgs() <<
"********** Replace Physical Registers **********\n" 67 <<
"********** Function: " << MF.
getName() <<
'\n';
75 "LiveIntervals shouldn't be active yet!");
78 MRI.invalidateLiveness();
80 for (
unsigned PReg = WebAssembly::NoRegister + 1;
81 PReg < WebAssembly::NUM_TARGET_REGS; ++PReg) {
83 if (PReg == WebAssembly::VALUE_STACK || PReg == WebAssembly::ARGUMENTS)
88 unsigned VReg = WebAssembly::NoRegister;
89 for (
auto I = MRI.reg_begin(PReg),
E = MRI.reg_end();
I !=
E;) {
92 if (VReg == WebAssembly::NoRegister)
93 VReg = MRI.createVirtualRegister(RC);
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
This class represents lattice values for constants.
unsigned const TargetRegisterInfo * TRI
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end...
INITIALIZE_PASS(WebAssemblyReplacePhysRegs, DEBUG_TYPE, "Replace physical registers with virtual registers", false, false) FunctionPass *llvm
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
char & LiveIntervalsID
LiveIntervals - This analysis keeps track of the live ranges of virtual and physical registers...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file provides WebAssembly-specific target descriptions.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
This file declares the WebAssembly-specific subclass of TargetSubtarget.
bool isDebugValue() const
MachineOperand class - Representation of each machine instruction operand.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
void setReg(unsigned Reg)
Change the register this operand corresponds to.
This file declares WebAssembly-specific per-machine-function information.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
void setIsDebug(bool Val=true)
FunctionPass * createWebAssemblyReplacePhysRegs()