32 #define DEBUG_TYPE "wasm-replace-phys-regs" 42 return "WebAssembly Replace Physical Registers";
56 "Replace physical registers with virtual registers",
false,
60 return new WebAssemblyReplacePhysRegs();
63 bool WebAssemblyReplacePhysRegs::runOnMachineFunction(
MachineFunction &MF) {
65 dbgs() <<
"********** Replace Physical Registers **********\n" 66 <<
"********** Function: " << MF.
getName() <<
'\n';
74 "LiveIntervals shouldn't be active yet!");
77 MRI.invalidateLiveness();
79 for (
unsigned PReg = WebAssembly::NoRegister + 1;
80 PReg < WebAssembly::NUM_TARGET_REGS; ++PReg) {
82 if (PReg == WebAssembly::VALUE_STACK || PReg == WebAssembly::ARGUMENTS)
87 unsigned VReg = WebAssembly::NoRegister;
88 for (
auto I = MRI.reg_begin(PReg),
E = MRI.reg_end();
I !=
E;) {
91 if (VReg == WebAssembly::NoRegister)
92 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...
void setReg(Register Reg)
Change the register this operand corresponds to.
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.
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()