35#define DEBUG_TYPE "mips-reg-info"
53 return &Mips::GPR32RegClass;
56 return &Mips::GPR64RegClass;
100 case Mips::INLINEASM: {
102 switch (
F.getMemoryConstraintID()) {
143 unsigned OpNo,
int FrameIndex,
145 int64_t SPOffset)
const {
146 MachineInstr &
MI = *
II;
147 MachineFunction &MF = *
MI.getParent()->getParent();
149 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
152 static_cast<const MipsTargetMachine &
>(MF.
getTarget()).getABI();
161 MinCSFI = CSI[0].getFrameIdx();
162 MaxCSFI = CSI[CSI.size() - 1].getFrameIdx();
166 bool IsISRRegFI = MipsFI->
isISRRegFI(FrameIndex);
177 if ((FrameIndex >= MinCSFI && FrameIndex <= MaxCSFI) || EhDataRegFI ||
179 FrameReg =
ABI.GetStackPtr();
180 else if (RegInfo->hasStackRealignment(MF)) {
182 FrameReg =
ABI.GetBasePtr();
186 FrameReg =
ABI.GetStackPtr();
200 Offset = SPOffset + (int64_t)StackSize;
201 Offset +=
MI.getOperand(OpNo + 1).getImm();
206 if (!
MI.isDebugValue()) {
210 unsigned OffsetBitSize =
217 MachineBasicBlock &
MBB = *
MI.getParent();
219 const TargetRegisterClass *PtrRC =
220 ABI.ArePtrs64bit() ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
223 const MipsSEInstrInfo &
TII =
224 *
static_cast<const MipsSEInstrInfo *
>(
236 MachineBasicBlock &
MBB = *
MI.getParent();
239 const MipsSEInstrInfo &
TII =
240 *
static_cast<const MipsSEInstrInfo *
>(
243 OffsetBitSize == 16 ? &NewImm :
nullptr);
253 MI.getOperand(OpNo).ChangeToRegister(FrameReg,
false,
false, IsKill);
254 MI.getOperand(OpNo + 1).ChangeToImmediate(
Offset);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const HexagonInstrInfo * TII
Promote Memory to Register
static unsigned getLoadStoreOffsetAlign(const unsigned Opcode)
Get the scale factor applied to the immediate in the given load/store.
static unsigned getLoadStoreOffsetSizeInBits(const unsigned Opcode, MachineOperand MO)
Get the size of the offset supported by the given load/store/inline asm.
uint64_t IntrinsicInst * II
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
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.
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 TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineBasicBlock * getParent() const
MachineOperand class - Representation of each machine instruction operand.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
bool isISRRegFI(int FI) const
bool isEhDataRegFI(int FI) const
Register getFrameRegister(const MachineFunction &MF) const override
Debug information queries.
MipsRegisterInfo(const MipsSubtarget &STI)
const TargetRegisterClass * intRegClass(unsigned Size) const override
Return GPR register class.
bool requiresRegisterScavenging(const MachineFunction &MF) const override
bool requiresFrameIndexScavenging(const MachineFunction &MF) const override
MipsSERegisterInfo(const MipsSubtarget &STI)
bool inMicroMipsMode() const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
@ Kill
The last use of a register.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
bool isAligned(Align Lhs, uint64_t SizeInBytes)
Checks that SizeInBytes is a multiple of the alignment.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.