From: Krzysztof Parzyszek Date: Mon, 14 Dec 2015 20:35:13 +0000 (+0000) Subject: [Packetizer] Add AliasAnalysis as a parameter to the packetizer X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e0d5233e365fe138f0afd9860ca11e0dd5bf0039;p=oota-llvm.git [Packetizer] Add AliasAnalysis as a parameter to the packetizer This will make the depedence graph more accurate if an alias analysis is provided. If nullptr is specified in its place, the behavior will remain as it is currently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255540 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/DFAPacketizer.h b/include/llvm/CodeGen/DFAPacketizer.h index 9daec9859ed..11d959b2e7f 100644 --- a/include/llvm/CodeGen/DFAPacketizer.h +++ b/include/llvm/CodeGen/DFAPacketizer.h @@ -128,6 +128,7 @@ class VLIWPacketizerList { protected: MachineFunction &MF; const TargetInstrInfo *TII; + AliasAnalysis *AA; // The VLIW Scheduler. DefaultVLIWScheduler *VLIWScheduler; @@ -141,7 +142,9 @@ protected: std::map MIToSUnit; public: - VLIWPacketizerList(MachineFunction &MF, MachineLoopInfo &MLI); + // The AliasAnalysis parameter can be nullptr. + VLIWPacketizerList(MachineFunction &MF, MachineLoopInfo &MLI, + AliasAnalysis *AA); virtual ~VLIWPacketizerList(); diff --git a/lib/CodeGen/DFAPacketizer.cpp b/lib/CodeGen/DFAPacketizer.cpp index 0970812c04f..80e03d985d5 100644 --- a/lib/CodeGen/DFAPacketizer.cpp +++ b/lib/CodeGen/DFAPacketizer.cpp @@ -149,31 +149,35 @@ namespace llvm { // DefaultVLIWScheduler - This class extends ScheduleDAGInstrs and overrides // Schedule method to build the dependence graph. class DefaultVLIWScheduler : public ScheduleDAGInstrs { +private: + AliasAnalysis *AA; public: - DefaultVLIWScheduler(MachineFunction &MF, MachineLoopInfo &MLI); + DefaultVLIWScheduler(MachineFunction &MF, MachineLoopInfo &MLI, + AliasAnalysis *AA); // Schedule - Actual scheduling work. void schedule() override; }; } DefaultVLIWScheduler::DefaultVLIWScheduler(MachineFunction &MF, - MachineLoopInfo &MLI) - : ScheduleDAGInstrs(MF, &MLI) { + MachineLoopInfo &MLI, + AliasAnalysis *AA) + : ScheduleDAGInstrs(MF, &MLI), AA(AA) { CanHandleTerminators = true; } void DefaultVLIWScheduler::schedule() { // Build the scheduling graph. - buildSchedGraph(nullptr); + buildSchedGraph(AA); } // VLIWPacketizerList Ctor VLIWPacketizerList::VLIWPacketizerList(MachineFunction &MF, - MachineLoopInfo &MLI) - : MF(MF) { + MachineLoopInfo &MLI, AliasAnalysis *AA) + : MF(MF), AA(AA) { TII = MF.getSubtarget().getInstrInfo(); ResourceTracker = TII->CreateTargetScheduleState(MF.getSubtarget()); - VLIWScheduler = new DefaultVLIWScheduler(MF, MLI); + VLIWScheduler = new DefaultVLIWScheduler(MF, MLI, AA); } // VLIWPacketizerList Dtor diff --git a/lib/Target/AMDGPU/R600Packetizer.cpp b/lib/Target/AMDGPU/R600Packetizer.cpp index b007ab9ce09..21269613a30 100644 --- a/lib/Target/AMDGPU/R600Packetizer.cpp +++ b/lib/Target/AMDGPU/R600Packetizer.cpp @@ -149,7 +149,8 @@ private: public: // Ctor. R600PacketizerList(MachineFunction &MF, MachineLoopInfo &MLI) - : VLIWPacketizerList(MF, MLI), TII(static_cast( + : VLIWPacketizerList(MF, MLI, nullptr), + TII(static_cast( MF.getSubtarget().getInstrInfo())), TRI(TII->getRegisterInfo()) { VLIW5 = !MF.getSubtarget().hasCaymanISA(); diff --git a/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp b/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp index 71dc362d517..123ba124808 100644 --- a/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp +++ b/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp @@ -186,7 +186,7 @@ INITIALIZE_PASS_END(HexagonPacketizer, "packets", "Hexagon Packetizer", HexagonPacketizerList::HexagonPacketizerList( MachineFunction &MF, MachineLoopInfo &MLI, const MachineBranchProbabilityInfo *MBPI) - : VLIWPacketizerList(MF, MLI) { + : VLIWPacketizerList(MF, MLI, nullptr) { this->MBPI = MBPI; }