mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
Only safe to use a call-clobbered or spilled callee-saved register as scratch register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35010 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c32a7f98ab
commit
603b83ebcd
@ -15,6 +15,7 @@
|
|||||||
#define DEBUG_TYPE "arm-ldst-opt"
|
#define DEBUG_TYPE "arm-ldst-opt"
|
||||||
#include "ARM.h"
|
#include "ARM.h"
|
||||||
#include "ARMAddressingModes.h"
|
#include "ARMAddressingModes.h"
|
||||||
|
#include "ARMMachineFunctionInfo.h"
|
||||||
#include "ARMRegisterInfo.h"
|
#include "ARMRegisterInfo.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
@ -39,6 +40,7 @@ namespace {
|
|||||||
struct VISIBILITY_HIDDEN ARMLoadStoreOpt : public MachineFunctionPass {
|
struct VISIBILITY_HIDDEN ARMLoadStoreOpt : public MachineFunctionPass {
|
||||||
const TargetInstrInfo *TII;
|
const TargetInstrInfo *TII;
|
||||||
const MRegisterInfo *MRI;
|
const MRegisterInfo *MRI;
|
||||||
|
ARMFunctionInfo *AFI;
|
||||||
RegScavenger *RS;
|
RegScavenger *RS;
|
||||||
MachineBasicBlock::iterator RSI;
|
MachineBasicBlock::iterator RSI;
|
||||||
|
|
||||||
@ -587,8 +589,11 @@ bool ARMLoadStoreOpt::LoadStoreMultipleOpti(MachineBasicBlock &MBB) {
|
|||||||
// First advance to the instruction just before the start of the chain.
|
// First advance to the instruction just before the start of the chain.
|
||||||
if (RSI != MBB.begin())
|
if (RSI != MBB.begin())
|
||||||
RS->forward(prior(RSI));
|
RS->forward(prior(RSI));
|
||||||
// Find a scratch register.
|
// Find a scratch register. Make sure it's a call clobbered register or
|
||||||
Scratch = RS->FindUnusedReg(&ARM::GPRRegClass);
|
// a spilled callee-saved register.
|
||||||
|
Scratch = RS->FindUnusedReg(&ARM::GPRRegClass, true);
|
||||||
|
if (!Scratch)
|
||||||
|
RS->FindUnusedReg(&ARM::GPRRegClass, AFI->getSpilledCSRegisters());
|
||||||
// Process the load / store instructions.
|
// Process the load / store instructions.
|
||||||
RS->forward(prior(MBBI));
|
RS->forward(prior(MBBI));
|
||||||
|
|
||||||
@ -661,6 +666,7 @@ bool ARMLoadStoreOpt::MergeReturnIntoLDM(MachineBasicBlock &MBB) {
|
|||||||
|
|
||||||
bool ARMLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) {
|
bool ARMLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) {
|
||||||
const TargetMachine &TM = Fn.getTarget();
|
const TargetMachine &TM = Fn.getTarget();
|
||||||
|
AFI = Fn.getInfo<ARMFunctionInfo>();
|
||||||
TII = TM.getInstrInfo();
|
TII = TM.getInstrInfo();
|
||||||
MRI = TM.getRegisterInfo();
|
MRI = TM.getRegisterInfo();
|
||||||
RS = new RegScavenger();
|
RS = new RegScavenger();
|
||||||
|
Loading…
Reference in New Issue
Block a user