34 #define DEBUG_TYPE "arc-reg-info" 36 #define GET_REGINFO_TARGET_DESC 37 #include "ARCGenRegisterInfo.inc" 41 unsigned FrameReg,
int Offset,
int StackSize,
43 assert(RS &&
"Need register scavenger.");
47 unsigned BaseReg = FrameReg;
48 unsigned KillState = 0;
49 if (MI.
getOpcode() == ARC::LD_rs9 && (Offset >= 256 || Offset < -256)) {
51 BuildMI(MBB, II, dl, TII.get(ARC::LD_rlimm),
Reg)
59 if (MI.
getOpcode() != ARC::GETFI && (Offset >= 256 || Offset < -256)) {
68 assert(BaseReg &&
"Register scavenging failed.");
70 <<
" for FrameReg=" <<
printReg(FrameReg, TRI)
71 <<
"+Offset=" << Offset <<
"\n");
75 unsigned AddOpc = isUInt<6>(
Offset) ? ARC::ADD_rru6 : ARC::ADD_rrlimm;
76 BuildMI(MBB, II, dl, TII.get(AddOpc))
85 assert((Offset % 4 == 0) &&
"LD needs 4 byte alignment.");
88 assert((Offset % 2 == 0) &&
"LDH needs 2 byte alignment.");
93 .
addReg(BaseReg, KillState)
98 assert((Offset % 4 == 0) &&
"ST needs 4 byte alignment.");
100 assert((Offset % 2 == 0) &&
"STH needs 2 byte alignment.");
105 .
addReg(BaseReg, KillState)
112 TII.get(isUInt<6>(Offset) ? ARC::ADD_rru6 : ARC::ADD_rrlimm))
133 return CSR_ARC_SaveList;
139 Reserved.
set(ARC::ILINK);
140 Reserved.
set(ARC::SP);
141 Reserved.
set(ARC::GP);
142 Reserved.
set(ARC::R25);
143 Reserved.
set(ARC::BLINK);
163 int SPAdj,
unsigned FIOperandNum,
165 assert(SPAdj == 0 &&
"Unexpected");
185 LLVM_DEBUG(
dbgs() <<
"LocalFrameSize : " << LocalFrameSize <<
"\n");
186 (void)LocalFrameSize;
207 assert(ARC::GPR32RegClass.
contains(Reg) &&
"Unexpected register operand");
209 if (!TFI->
hasFP(MF)) {
210 Offset = StackSize +
Offset;
212 assert((Offset >= 0 && Offset < StackSize) &&
"SP Offset not in bounds.");
214 if (FrameIndex >= 0) {
215 assert((Offset < 0 && -Offset <= StackSize) &&
216 "FP Offset not in bounds.");
231 return CSR_ARC_RegMask;
bool hasDebugInfo() const
Returns true if valid debug info is present.
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...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
unsigned getReg() const
getReg - Returns the register number.
int64_t getLocalFrameSize() const
Get the size of the local object blob.
bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override
unsigned const TargetRegisterInfo * TRI
MachineModuleInfo & getMMI() const
return AArch64::GPR64RegClass contains(Reg)
unsigned getFrameRegister(const MachineFunction &MF) const override
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
const HexagonInstrInfo * TII
Printable printReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
BitVector getReservedRegs(const MachineFunction &MF) const override
unsigned FindUnusedReg(const TargetRegisterClass *RC) const
Find an unused register of the specified register class.
bool useFPForScavengingIndex(const MachineFunction &MF) const override
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
unsigned getKillRegState(bool B)
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
void ChangeToImmediate(int64_t ImmVal)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
This file declares the machine register scavenger class.
static bool needsFrameMoves(const MachineFunction &MF)
Return whether to emit frame moves.
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.
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
bool isDebugValue() const
MachineOperand class - Representation of each machine instruction operand.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID CC) const override
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
const MachineBasicBlock * getParent() const
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
unsigned scavengeRegister(const TargetRegisterClass *RC, MachineBasicBlock::iterator I, int SPAdj)
Make a register of the specific register class available and do the appropriate bookkeeping.
bool requiresRegisterScavenging(const MachineFunction &MF) const override
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void setRegUsed(unsigned Reg, LaneBitmask LaneMask=LaneBitmask::getAll())
Tell the scavenger a register is used.
static void ReplaceFrameIndex(MachineBasicBlock::iterator II, const ARCInstrInfo &TII, unsigned Reg, unsigned FrameReg, int Offset, int StackSize, int ObjSize, RegScavenger *RS, int SPAdj)
const MachineOperand & getOperand(unsigned i) const
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...