Don't cache the instruction and register info from the TargetMachine, because

the internals of TargetMachine could change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183491 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2013-06-07 06:26:43 +00:00
parent 54a56fad36
commit 637eab6a3b
4 changed files with 6 additions and 10 deletions

View File

@ -37,13 +37,11 @@ static cl::opt<bool> MBDisableDelaySlotFiller(
namespace { namespace {
struct Filler : public MachineFunctionPass { struct Filler : public MachineFunctionPass {
TargetMachine &TM; TargetMachine &TM;
const TargetInstrInfo *TII;
static char ID; static char ID;
Filler(TargetMachine &tm) Filler(TargetMachine &tm)
: MachineFunctionPass(ID), TM(tm), TII(tm.getInstrInfo()) { } : MachineFunctionPass(ID), TM(tm) { }
virtual const char *getPassName() const { virtual const char *getPassName() const {
return "MBlaze Delay Slot Filler"; return "MBlaze Delay Slot Filler";
@ -239,7 +237,7 @@ bool Filler::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
Changed = true; Changed = true;
if (D == MBB.end()) if (D == MBB.end())
BuildMI(MBB, ++J, I->getDebugLoc(), TII->get(MBlaze::NOP)); BuildMI(MBB, ++J, I->getDebugLoc(),TM.getInstrInfo()->get(MBlaze::NOP));
else else
MBB.splice(++J, &MBB, D); MBB.splice(++J, &MBB, D);
} }

View File

@ -29,7 +29,7 @@ using namespace llvm;
MBlazeInstrInfo::MBlazeInstrInfo(MBlazeTargetMachine &tm) MBlazeInstrInfo::MBlazeInstrInfo(MBlazeTargetMachine &tm)
: MBlazeGenInstrInfo(MBlaze::ADJCALLSTACKDOWN, MBlaze::ADJCALLSTACKUP), : MBlazeGenInstrInfo(MBlaze::ADJCALLSTACKDOWN, MBlaze::ADJCALLSTACKUP),
TM(tm), RI(*TM.getSubtargetImpl(), *this) {} TM(tm), RI(*TM.getSubtargetImpl()) {}
static bool isZeroImm(const MachineOperand &op) { static bool isZeroImm(const MachineOperand &op) {
return op.isImm() && op.getImm() == 0; return op.isImm() && op.getImm() == 0;

View File

@ -42,8 +42,8 @@
using namespace llvm; using namespace llvm;
MBlazeRegisterInfo:: MBlazeRegisterInfo::
MBlazeRegisterInfo(const MBlazeSubtarget &ST, const TargetInstrInfo &tii) MBlazeRegisterInfo(const MBlazeSubtarget &ST)
: MBlazeGenRegisterInfo(MBlaze::R15), Subtarget(ST), TII(tii) {} : MBlazeGenRegisterInfo(MBlaze::R15), Subtarget(ST) {}
unsigned MBlazeRegisterInfo::getPICCallReg() { unsigned MBlazeRegisterInfo::getPICCallReg() {
return MBlaze::R20; return MBlaze::R20;

View File

@ -37,10 +37,8 @@ namespace MBlaze {
struct MBlazeRegisterInfo : public MBlazeGenRegisterInfo { struct MBlazeRegisterInfo : public MBlazeGenRegisterInfo {
const MBlazeSubtarget &Subtarget; const MBlazeSubtarget &Subtarget;
const TargetInstrInfo &TII;
MBlazeRegisterInfo(const MBlazeSubtarget &Subtarget, MBlazeRegisterInfo(const MBlazeSubtarget &Subtarget);
const TargetInstrInfo &tii);
/// Get PIC indirect call register /// Get PIC indirect call register
static unsigned getPICCallReg(); static unsigned getPICCallReg();