From: Eric Christopher Date: Tue, 12 Aug 2014 08:00:56 +0000 (+0000) Subject: Have MachineRegisterInfo take and store the MachineFunction it X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=99cd10fe111560b9921e731a89109972a149dfab;p=oota-llvm.git Have MachineRegisterInfo take and store the MachineFunction it was created for rather than the TargetMachine since we only needed the TM for the subtarget and we can get that from the MF. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215432 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h index 0b9f8d150cf..356e882cdd0 100644 --- a/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/include/llvm/CodeGen/MachineRegisterInfo.h @@ -17,8 +17,8 @@ #include "llvm/ADT/BitVector.h" #include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/iterator_range.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBundle.h" -#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSubtargetInfo.h" #include @@ -40,7 +40,7 @@ public: }; private: - const TargetMachine &TM; + const MachineFunction *MF; Delegate *TheDelegate; /// IsSSA - True when the machine function is in SSA form and virtual @@ -123,11 +123,11 @@ private: MachineRegisterInfo(const MachineRegisterInfo&) LLVM_DELETED_FUNCTION; void operator=(const MachineRegisterInfo&) LLVM_DELETED_FUNCTION; public: - explicit MachineRegisterInfo(const TargetMachine &TM); + explicit MachineRegisterInfo(const MachineFunction *MF); ~MachineRegisterInfo(); const TargetRegisterInfo *getTargetRegisterInfo() const { - return TM.getSubtargetImpl()->getRegisterInfo(); + return MF->getSubtarget().getRegisterInfo(); } void resetDelegate(Delegate *delegate) { diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 212928815cb..7b73df0466a 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -58,7 +58,7 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM, : Fn(F), Target(TM), STI(TM.getSubtargetImpl()), Ctx(mmi.getContext()), MMI(mmi), GMI(gmi) { if (TM.getSubtargetImpl()->getRegisterInfo()) - RegInfo = new (Allocator) MachineRegisterInfo(TM); + RegInfo = new (Allocator) MachineRegisterInfo(this); else RegInfo = nullptr; diff --git a/lib/CodeGen/MachineRegisterInfo.cpp b/lib/CodeGen/MachineRegisterInfo.cpp index 6da1b685a91..1b95b40b6b2 100644 --- a/lib/CodeGen/MachineRegisterInfo.cpp +++ b/lib/CodeGen/MachineRegisterInfo.cpp @@ -23,8 +23,8 @@ using namespace llvm; // Pin the vtable to this file. void MachineRegisterInfo::Delegate::anchor() {} -MachineRegisterInfo::MachineRegisterInfo(const TargetMachine &TM) - : TM(TM), TheDelegate(nullptr), IsSSA(true), TracksLiveness(true) { +MachineRegisterInfo::MachineRegisterInfo(const MachineFunction *MF) + : MF(MF), TheDelegate(nullptr), IsSSA(true), TracksLiveness(true) { VRegInfo.reserve(256); RegAllocHints.reserve(256); UsedRegUnits.resize(getTargetRegisterInfo()->getNumRegUnits());