32 cl::desc(
"Disable Sparc leaf procedure optimization."),
49 unsigned SAVEri = SP::SAVEri;
50 unsigned SAVErr = SP::SAVErr;
59 if (NumBytes >= -4096) {
60 BuildMI(MBB, MBBI, dl, TII.get(SAVEri), SP::O6)
61 .addReg(SP::O6).
addImm(NumBytes);
65 unsigned OffHi = (
unsigned)NumBytes >> 10U;
66 BuildMI(MBB, MBBI, dl, TII.get(SP::SETHIi), SP::G1).addImm(OffHi);
68 BuildMI(MBB, MBBI, dl, TII.get(SP::ORri), SP::G1)
69 .addReg(SP::G1).
addImm(NumBytes & ((1 << 10)-1));
70 BuildMI(MBB, MBBI, dl, TII.get(SAVErr), SP::O6)
71 .addReg(SP::O6).
addReg(SP::G1);
101 if (MI.
getOpcode() == SP::ADJCALLSTACKDOWN)
106 BuildMI(MBB, I, DL, TII.get(SP::ADDri), SP::O6).addReg(SP::O6)
120 assert(MBBI->getOpcode() == SP::RETL &&
121 "Can only put epilog before 'retl' instruction!");
123 BuildMI(MBB, MBBI, dl, TII.get(SP::RESTORErr), SP::G0).addReg(SP::G0)
135 if (NumBytes < 4096) {
136 BuildMI(MBB, MBBI, dl, TII.get(SP::ADDri), SP::O6)
137 .addReg(SP::O6).
addImm(NumBytes);
141 unsigned OffHi = (
unsigned)NumBytes >> 10U;
142 BuildMI(MBB, MBBI, dl, TII.get(SP::SETHIi), SP::G1).addImm(OffHi);
144 BuildMI(MBB, MBBI, dl, TII.get(SP::ORri), SP::G1)
145 .addReg(SP::G1).
addImm(NumBytes & ((1 << 10)-1));
146 BuildMI(MBB, MBBI, dl, TII.get(SP::ADDrr), SP::O6)
147 .addReg(SP::O6).
addReg(SP::G1);
169 for (
unsigned reg = SP::I0; reg <= SP::I7; ++reg)
173 for (
unsigned reg = SP::L0; reg <= SP::L7; ++reg)
192 void SparcFrameLowering::remapRegsForLeafProc(
MachineFunction &MF)
const {
197 for (
unsigned reg = SP::I0; reg <= SP::I7; ++reg) {
200 unsigned mapped_reg = (reg - SP::I0 + SP::O0);
213 for (
unsigned reg = SP::I0; reg <= SP::I7; ++reg) {
214 if (!MBB->isLiveIn(reg))
216 MBB->removeLiveIn(reg);
217 MBB->addLiveIn(reg - SP::I0 + SP::O0);
223 MF.
verify(0,
"After LeafProc Remapping");
234 remapRegsForLeafProc(MF);
instr_iterator erase(instr_iterator I)
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number. Returns -1 if there is no equivalent va...
void verify(Pass *p=NULL, const char *Banner=NULL) const
void eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const
void setLeafProc(bool rhs)
uint64_t getStackSize() const
MCSymbol * CreateTempSymbol()
const HexagonInstrInfo * TII
bool DisableFramePointerElim(const MachineFunction &MF) const
Abstract Stack Frame Information.
bool isFrameAddressTaken() const
const MachineInstrBuilder & addImm(int64_t Val) const
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, RegScavenger *RS=NULL) const
const MachineBasicBlock & front() const
iterator getLastNonDebugInstr()
bundle_iterator< MachineInstr, instr_iterator > iterator
initializer< Ty > init(const Ty &Val)
void emitPrologue(MachineFunction &MF) const
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA. From now on Register will be used instead of...
static MCCFIInstruction createWindowSave(MCSymbol *L)
.cfi_window_save SPARC register window is saved.
const MachineOperand & getOperand(unsigned i) const
static cl::opt< bool > DisableLeafProc("disable-sparc-leaf-proc", cl::init(false), cl::desc("Disable Sparc leaf procedure optimization."), cl::Hidden)
#define LLVM_ATTRIBUTE_UNUSED
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
bool hasCalls() const
hasCalls - Return true if the current function has any function calls.
static bool LLVM_ATTRIBUTE_UNUSED verifyLeafProcRegUse(MachineRegisterInfo *MRI)
virtual const TargetInstrInfo * getInstrInfo() const
const MCContext & getContext() const
void setPhysRegUnused(unsigned Reg)
MachineFrameInfo * getFrameInfo()
bool hasFP(const MachineFunction &MF) const
void replaceRegWith(unsigned FromReg, unsigned ToReg)
const MCRegisterInfo * getRegisterInfo() const
int getAdjustedFrameSize(int stackSize) const
MachineRegisterInfo & getRegInfo()
void addFrameInst(const MCCFIInstruction &Inst)
const TargetMachine & getTarget() const
bool hasVarSizedObjects() const
bool isPhysRegUsed(unsigned Reg) const
BasicBlockListType::iterator iterator
MachineModuleInfo & getMMI() const
const MCRegisterInfo & MRI
bool hasReservedCallFrame(const MachineFunction &MF) const
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2)
.cfi_register Previous value of Register1 is saved in register Register2.
DebugLoc getDebugLoc() const