Skip to content

Commit

Permalink
Grab the subtarget and subtarget dependent variables off of
Browse files Browse the repository at this point in the history
MachineFunction rather than TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219671 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Oct 14, 2014
1 parent eb271ec commit 1dd55ba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
7 changes: 2 additions & 5 deletions lib/CodeGen/RegAllocFast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <algorithm>
using namespace llvm;
Expand All @@ -54,7 +53,6 @@ namespace {
RAFast() : MachineFunctionPass(ID), StackSlotForVirtReg(-1),
isBulkSpilling(false) {}
private:
const TargetMachine *TM;
MachineFunction *MF;
MachineRegisterInfo *MRI;
const TargetRegisterInfo *TRI;
Expand Down Expand Up @@ -1078,9 +1076,8 @@ bool RAFast::runOnMachineFunction(MachineFunction &Fn) {
<< "********** Function: " << Fn.getName() << '\n');
MF = &Fn;
MRI = &MF->getRegInfo();
TM = &Fn.getTarget();
TRI = TM->getSubtargetImpl()->getRegisterInfo();
TII = TM->getSubtargetImpl()->getInstrInfo();
TRI = MF->getSubtarget().getRegisterInfo();
TII = MF->getSubtarget().getInstrInfo();
MRI->freezeReservedRegs(Fn);
RegClassInfo.runOnMachineFunction(Fn);
UsedInInstr.clear();
Expand Down
8 changes: 4 additions & 4 deletions lib/CodeGen/RegAllocGreedy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2317,13 +2317,13 @@ bool RAGreedy::runOnMachineFunction(MachineFunction &mf) {
<< "********** Function: " << mf.getName() << '\n');

MF = &mf;
const TargetMachine &TM = MF->getTarget();
TRI = TM.getSubtargetImpl()->getRegisterInfo();
TII = TM.getSubtargetImpl()->getInstrInfo();
TRI = MF->getSubtarget().getRegisterInfo();
TII = MF->getSubtarget().getInstrInfo();
RCI.runOnMachineFunction(mf);

EnableLocalReassign = EnableLocalReassignment ||
TM.getSubtargetImpl()->enableRALocalReassignment(TM.getOptLevel());
MF->getSubtarget().enableRALocalReassignment(
MF->getTarget().getOptLevel());

if (VerifyEnabled)
MF->verify(this, "Before greedy register allocator");
Expand Down
6 changes: 2 additions & 4 deletions lib/CodeGen/RegisterScavenging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
using namespace llvm;
Expand Down Expand Up @@ -63,9 +62,8 @@ void RegScavenger::initRegState() {

void RegScavenger::enterBasicBlock(MachineBasicBlock *mbb) {
MachineFunction &MF = *mbb->getParent();
const TargetMachine &TM = MF.getTarget();
TII = TM.getSubtargetImpl()->getInstrInfo();
TRI = TM.getSubtargetImpl()->getRegisterInfo();
TII = MF.getSubtarget().getInstrInfo();
TRI = MF.getSubtarget().getRegisterInfo();
MRI = &MF.getRegInfo();

assert((NumRegUnits == 0 || NumRegUnits == TRI->getNumRegUnits()) &&
Expand Down
10 changes: 2 additions & 8 deletions lib/CodeGen/SplitKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,8 @@ SplitEditor::SplitEditor(SplitAnalysis &sa, LiveIntervals &lis, VirtRegMap &vrm,
MachineDominatorTree &mdt,
MachineBlockFrequencyInfo &mbfi)
: SA(sa), LIS(lis), VRM(vrm), MRI(vrm.getMachineFunction().getRegInfo()),
MDT(mdt), TII(*vrm.getMachineFunction()
.getTarget()
.getSubtargetImpl()
->getInstrInfo()),
TRI(*vrm.getMachineFunction()
.getTarget()
.getSubtargetImpl()
->getRegisterInfo()),
MDT(mdt), TII(*vrm.getMachineFunction().getSubtarget().getInstrInfo()),
TRI(*vrm.getMachineFunction().getSubtarget().getRegisterInfo()),
MBFI(mbfi), Edit(nullptr), OpenIdx(0), SpillMode(SM_Partition),
RegAssign(Allocator) {}

Expand Down

0 comments on commit 1dd55ba

Please sign in to comment.