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.");
79 if (static_cast<uint64_t>(Offset) <= std::numeric_limits<uint32_t>::max()) {
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;
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
static const unsigned LoadAddressOperandNo
The operand number of the load or store address in load/store instructions.
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 createVirtualRegister(const TargetRegisterClass *RegClass)
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
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
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const HexagonInstrInfo * TII
const TargetRegisterInfo * getTargetRegisterInfo() const
WebAssemblyRegisterInfo(const Triple &TT)
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.
Reg
All possible values of the reg field in the ModR/M byte.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
bool isArch64Bit() const
Test whether the architecture is 64-bit.
BitVector getReservedRegs(const MachineFunction &MF) const override
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
unsigned const MachineRegisterInfo * MRI
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const MachineOperand & getOperand(unsigned i) const
This file provides WebAssembly-specific target descriptions.
void setImm(int64_t immVal)
Triple - Helper class for working with autoconf configuration names.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
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.
unsigned getFrameRegister(const MachineFunction &MF) const override
static const unsigned StoreAddressOperandNo
MachineInstr * getUniqueVRegDef(unsigned Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
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.
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 hasOneNonDBGUse(unsigned RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug instruction using the specified regis...
This file declares WebAssembly-specific per-machine-function information.
unsigned getReg() const
getReg - Returns the register number.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
virtual const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const
Returns a TargetRegisterClass used for pointer values.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.