31 #define DEBUG_TYPE "wasm-reg-info" 33 #define GET_REGINFO_TARGET_DESC 34 #include "WebAssemblyGenRegisterInfo.inc" 41 static const MCPhysReg CalleeSavedRegs[] = {0};
42 return CalleeSavedRegs;
48 for (
auto Reg : {WebAssembly::SP32, WebAssembly::SP64, WebAssembly::FP32,
68 "We assume that variable-sized objects have already been lowered, " 69 "and don't use FrameIndex operands.");
89 if (MI.
getOpcode() == WebAssembly::ADD_I32) {
91 if (OtherMO.
isReg()) {
92 unsigned OtherMOReg = OtherMO.
getReg();
98 if (Def && Def->
getOpcode() == WebAssembly::CONST_I32 &&
113 unsigned FIRegOperand = FrameRegister;
119 BuildMI(MBB, *II, II->getDebugLoc(),
TII->get(WebAssembly::CONST_I32),
121 .addImm(FrameOffset);
123 BuildMI(MBB, *II, II->getDebugLoc(),
TII->get(WebAssembly::ADD_I32),
125 .addReg(FrameRegister)
133 static const unsigned Regs[2][2] = {
135 {WebAssembly::SP32, WebAssembly::SP64},
136 {WebAssembly::FP32, WebAssembly::FP64}};
143 unsigned Kind)
const {
144 assert(Kind == 0 &&
"Only one kind of pointer on WebAssembly");
146 return &WebAssembly::I64RegClass;
147 return &WebAssembly::I32RegClass;
static const unsigned LoadAddressOperandNo
The operand number of the load or store address in load/store instructions.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
void ChangeToRegister(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value...
unsigned getReg() const
getReg - Returns the register number.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
bool hasFP(const MachineFunction &MF) const override
Return true if the specified function should have a dedicated frame pointer register.
void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
const HexagonInstrInfo * TII
WebAssemblyRegisterInfo(const Triple &TT)
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
BitVector getReservedRegs(const MachineFunction &MF) const override
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
const TargetRegisterInfo * getTargetRegisterInfo() const
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
This file provides WebAssembly-specific target descriptions.
void setImm(int64_t immVal)
Triple - Helper class for working with autoconf configuration names.
This file contains the WebAssembly implementation of the WebAssemblyRegisterInfo class.
This file declares the WebAssembly-specific subclass of TargetSubtarget.
MachineOperand class - Representation of each machine instruction operand.
This file contains the WebAssembly implementation of the TargetInstrInfo class.
MachineInstr * getUniqueVRegDef(unsigned Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
unsigned getFrameRegister(const MachineFunction &MF) const override
static const unsigned StoreAddressOperandNo
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
This class implements WebAssembly-specific bits of TargetFrameLowering class.
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const override
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool isArch64Bit() const
Test whether the architecture is 64-bit.
This file declares WebAssembly-specific per-machine-function information.
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
bool hasOneNonDBGUse(unsigned RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug instruction using the specified regis...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineOperand & getOperand(unsigned i) const
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
virtual const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const
Returns a TargetRegisterClass used for pointer values.