mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Next step in Mips16 prologue/epilogue cleanup.
Save S2(reg 18) only when we are calling floating point stubs that have a return value of float or complex. Some more work to make this better but this is the first step. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196921 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "MCTargetDesc/MipsBaseInfo.h"
|
||||
#include "Mips16InstrInfo.h"
|
||||
#include "MipsInstrInfo.h"
|
||||
#include "MipsRegisterInfo.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
@@ -56,17 +57,31 @@ void Mips16FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
MCSymbol *CSLabel = MMI.getContext().CreateTempSymbol();
|
||||
BuildMI(MBB, MBBI, dl,
|
||||
TII.get(TargetOpcode::PROLOG_LABEL)).addSym(CSLabel);
|
||||
unsigned S2 = MRI->getDwarfRegNum(Mips::S2, true);
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(CSLabel, S2, -8));
|
||||
|
||||
|
||||
const MipsRegisterInfo &RI = TII.getRegisterInfo();
|
||||
const BitVector Reserved = RI.getReservedRegs(MF);
|
||||
bool SaveS2 = Reserved[Mips::S2];
|
||||
int Offset=-4;
|
||||
unsigned RA = MRI->getDwarfRegNum(Mips::RA, true);
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(CSLabel, RA, Offset));
|
||||
Offset -= 4;
|
||||
|
||||
if (SaveS2) {
|
||||
unsigned S2 = MRI->getDwarfRegNum(Mips::S2, true);
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(CSLabel, S2, Offset));
|
||||
Offset -= 4;
|
||||
}
|
||||
|
||||
|
||||
unsigned S1 = MRI->getDwarfRegNum(Mips::S1, true);
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(CSLabel, S1, -12));
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(CSLabel, S1, Offset));
|
||||
Offset -= 4;
|
||||
|
||||
unsigned S0 = MRI->getDwarfRegNum(Mips::S0, true);
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(CSLabel, S0, -16));
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(CSLabel, S0, Offset));
|
||||
|
||||
|
||||
unsigned RA = MRI->getDwarfRegNum(Mips::RA, true);
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(CSLabel, RA, -4));
|
||||
|
||||
if (hasFP(MF))
|
||||
BuildMI(MBB, MBBI, dl, TII.get(Mips::MoveR3216), Mips::S0)
|
||||
|
||||
Reference in New Issue
Block a user