Go to the documentation of this file.
30 #define DEBUG_TYPE "wasm-reg-info"
32 #define GET_REGINFO_TARGET_DESC
33 #include "WebAssemblyGenRegisterInfo.inc"
40 static const MCPhysReg CalleeSavedRegs[] = {0};
41 return CalleeSavedRegs;
47 for (
auto Reg : {WebAssembly::SP32, WebAssembly::SP64, WebAssembly::FP32,
67 "We assume that variable-sized objects have already been lowered, "
68 "and don't use FrameIndex operands.");
74 MI.getOpcode(), WebAssembly::OpName::addr);
75 if (AddrOperandNum == FIOperandNum) {
77 MI.getOpcode(), WebAssembly::OpName::off);
78 assert(FrameOffset >= 0 &&
MI.getOperand(OffsetOperandNum).getImm() >= 0);
79 int64_t
Offset =
MI.getOperand(OffsetOperandNum).getImm() + FrameOffset;
82 MI.getOperand(OffsetOperandNum).setImm(
Offset);
83 MI.getOperand(FIOperandNum)
84 .ChangeToRegister(FrameRegister,
false);
93 if (OtherMO.
isReg()) {
100 if (
Def &&
Def->getOpcode() ==
106 MI.getOperand(FIOperandNum)
107 .ChangeToRegister(FrameRegister,
false);
118 unsigned FIRegOperand = FrameRegister;
135 MI.getOperand(FIOperandNum).ChangeToRegister(FIRegOperand,
false);
142 if (MFI->isFrameBaseVirtual())
144 static const unsigned Regs[2][2] = {
146 {WebAssembly::SP32, WebAssembly::SP64},
147 {WebAssembly::FP32, WebAssembly::FP64}};
154 unsigned Kind)
const {
155 assert(
Kind == 0 &&
"Only one kind of pointer on WebAssembly");
157 return &WebAssembly::I64RegClass;
158 return &WebAssembly::I32RegClass;
static unsigned getOpcAdd(const MachineFunction &MF)
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
const TargetRegisterInfo * getTargetRegisterInfo() const
MachineInstr * getUniqueVRegDef(Register Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
Triple - Helper class for working with autoconf configuration names.
void setImm(int64_t immVal)
void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
WebAssemblyRegisterInfo(const Triple &TT)
bool isArch64Bit() const
Test whether the architecture is 64-bit.
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...
static unsigned getOpcConst(const MachineFunction &MF)
const HexagonInstrInfo * TII
MachineOperand class - Representation of each machine instruction operand.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const override
Register getFrameRegister(const MachineFunction &MF) const override
virtual const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const
Returns a TargetRegisterClass used for pointer values.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Representation of each machine instruction.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Register getReg() const
getReg - Returns the register number.
bool hasOneNonDBGUse(Register RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register.
unsigned const MachineRegisterInfo * MRI
Wrapper class representing virtual and physical registers.
bool hasFP(const MachineFunction &MF) const override
Return true if the specified function should have a dedicated frame pointer register.
BitVector getReservedRegs(const MachineFunction &MF) const override
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
Align max(MaybeAlign Lhs, Align Rhs)
unsigned getFrameBaseVreg() const
int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIndex)