From 1438de8b6ae8b0f83f4e633826e977493e1d1421 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Mon, 2 Feb 2015 18:46:31 +0000 Subject: [PATCH] Get TargetRegisterInfo and TargetInstrInfo off of the MachineFunction and remove unnecessary class variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227832 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Hexagon/Hexagon.h | 3 +-- .../Hexagon/HexagonExpandPredSpillCode.cpp | 27 +++++++------------ lib/Target/Hexagon/HexagonTargetMachine.cpp | 2 +- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/lib/Target/Hexagon/Hexagon.h b/lib/Target/Hexagon/Hexagon.h index 3e150a98966..d9cabcdedcb 100644 --- a/lib/Target/Hexagon/Hexagon.h +++ b/lib/Target/Hexagon/Hexagon.h @@ -39,8 +39,7 @@ namespace llvm { FunctionPass *createHexagonSplitTFRCondSets(const HexagonTargetMachine &TM); FunctionPass *createHexagonSplitConst32AndConst64( const HexagonTargetMachine &TM); - FunctionPass *createHexagonExpandPredSpillCode( - const HexagonTargetMachine &TM); + FunctionPass *createHexagonExpandPredSpillCode(); FunctionPass *createHexagonHardwareLoops(); FunctionPass *createHexagonPeephole(); FunctionPass *createHexagonFixupHwLoops(); diff --git a/lib/Target/Hexagon/HexagonExpandPredSpillCode.cpp b/lib/Target/Hexagon/HexagonExpandPredSpillCode.cpp index a2a847c47a2..ae9ba7d8afa 100644 --- a/lib/Target/Hexagon/HexagonExpandPredSpillCode.cpp +++ b/lib/Target/Hexagon/HexagonExpandPredSpillCode.cpp @@ -20,7 +20,6 @@ #include "Hexagon.h" #include "HexagonMachineFunctionInfo.h" #include "HexagonSubtarget.h" -#include "HexagonTargetMachine.h" #include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/LatencyPriorityQueue.h" #include "llvm/CodeGen/MachineDominators.h" @@ -49,13 +48,9 @@ namespace llvm { namespace { class HexagonExpandPredSpillCode : public MachineFunctionPass { - const HexagonTargetMachine& QTM; - const HexagonSubtarget &QST; - public: static char ID; - HexagonExpandPredSpillCode(const HexagonTargetMachine& TM) : - MachineFunctionPass(ID), QTM(TM), QST(*TM.getSubtargetImpl()) { + HexagonExpandPredSpillCode() : MachineFunctionPass(ID) { PassRegistry &Registry = *PassRegistry::getPassRegistry(); initializeHexagonExpandPredSpillCodePass(Registry); } @@ -72,7 +67,9 @@ char HexagonExpandPredSpillCode::ID = 0; bool HexagonExpandPredSpillCode::runOnMachineFunction(MachineFunction &Fn) { - const HexagonInstrInfo *TII = QTM.getSubtargetImpl()->getInstrInfo(); + const HexagonSubtarget &QST = Fn.getSubtarget(); + const HexagonRegisterInfo *TRI = QST.getRegisterInfo(); + const HexagonInstrInfo *TII = QST.getInstrInfo(); // Loop over all of the basic blocks. for (MachineFunction::iterator MBBb = Fn.begin(), MBBe = Fn.end(); @@ -86,10 +83,8 @@ bool HexagonExpandPredSpillCode::runOnMachineFunction(MachineFunction &Fn) { if (Opc == Hexagon::STriw_pred) { // STriw_pred [R30], ofst, SrcReg; unsigned FP = MI->getOperand(0).getReg(); - assert( - FP == - QTM.getSubtargetImpl()->getRegisterInfo()->getFrameRegister() && - "Not a Frame Pointer, Nor a Spill Slot"); + assert(FP == TRI->getFrameRegister() && + "Not a Frame Pointer, Nor a Spill Slot"); assert(MI->getOperand(1).isImm() && "Not an offset"); int Offset = MI->getOperand(1).getImm(); int SrcReg = MI->getOperand(2).getReg(); @@ -135,10 +130,8 @@ bool HexagonExpandPredSpillCode::runOnMachineFunction(MachineFunction &Fn) { assert(Hexagon::PredRegsRegClass.contains(DstReg) && "Not a predicate register"); unsigned FP = MI->getOperand(1).getReg(); - assert( - FP == - QTM.getSubtargetImpl()->getRegisterInfo()->getFrameRegister() && - "Not a Frame Pointer, Nor a Spill Slot"); + assert(FP == TRI->getFrameRegister() && + "Not a Frame Pointer, Nor a Spill Slot"); assert(MI->getOperand(2).isImm() && "Not an offset"); int Offset = MI->getOperand(2).getImm(); if (!TII->isValidOffset(Hexagon::L2_loadri_io, Offset)) { @@ -200,6 +193,6 @@ void llvm::initializeHexagonExpandPredSpillCodePass(PassRegistry &Registry) { } FunctionPass* -llvm::createHexagonExpandPredSpillCode(const HexagonTargetMachine &TM) { - return new HexagonExpandPredSpillCode(TM); +llvm::createHexagonExpandPredSpillCode() { + return new HexagonExpandPredSpillCode(); } diff --git a/lib/Target/Hexagon/HexagonTargetMachine.cpp b/lib/Target/Hexagon/HexagonTargetMachine.cpp index dc8ae70c590..c18729022d9 100644 --- a/lib/Target/Hexagon/HexagonTargetMachine.cpp +++ b/lib/Target/Hexagon/HexagonTargetMachine.cpp @@ -160,7 +160,7 @@ void HexagonPassConfig::addPreEmitPass() { addPass(createHexagonNewValueJump(), false); // Expand Spill code for predicate registers. - addPass(createHexagonExpandPredSpillCode(TM), false); + addPass(createHexagonExpandPredSpillCode(), false); // Split up TFRcondsets into conditional transfers. addPass(createHexagonSplitTFRCondSets(TM), false); -- 2.34.1