31#define DEBUG_TYPE "wasm-reg-numbering"
36 return "WebAssembly Register Numbering";
52char WebAssemblyRegNumbering::ID = 0;
54 "Assigns WebAssembly register numbers for virtual registers",
58 return new WebAssemblyRegNumbering();
61bool WebAssemblyRegNumbering::runOnMachineFunction(
MachineFunction &MF) {
63 "********** Function: "
78 int64_t
Imm =
MI.getOperand(1).getImm();
80 <<
" -> WAReg " << Imm <<
"\n");
88 unsigned NumStackRegs = 0;
91 for (
unsigned VRegIdx = 0; VRegIdx < NumVRegs; ++VRegIdx) {
94 if (
MRI.use_empty(VReg))
99 << (INT32_MIN | NumStackRegs) <<
"\n");
100 MFI.
setWAReg(VReg, INT32_MIN | NumStackRegs++);
104 LLVM_DEBUG(
dbgs() <<
"VReg " << VReg <<
" -> WAReg " << CurReg <<
"\n");
unsigned const MachineRegisterInfo * MRI
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This builds on the llvm/ADT/GraphTraits.h file to find the strongly connected components (SCCs) of a ...
This file provides WebAssembly-specific target descriptions.
This file declares WebAssembly-specific per-machine-function information.
This file declares the WebAssembly-specific subclass of TargetSubtarget.
This file contains the declaration of the WebAssembly-specific utility functions.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end.
Represent the analysis usage information of a pass.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
FunctionPass class - This class is used to implement most global optimizations.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineBasicBlock & front() const
Representation of each machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Wrapper class representing virtual and physical registers.
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
StringRef - Represent a constant reference to a string, i.e.
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
bool isVRegStackified(unsigned VReg) const
static const unsigned UnusedReg
unsigned getWAReg(unsigned VReg) const
void initWARegs(MachineRegisterInfo &MRI)
void setWAReg(unsigned VReg, unsigned WAReg)
const std::vector< MVT > & getParams() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool isArgument(unsigned Opc)
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createWebAssemblyRegNumbering()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.