1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[AntidepBreaker] Move AntiDepBreaker to include folder.

This allows AntiDepBreaker to be used in target specific postRA
scheduler.

Differential Revision: https://reviews.llvm.org/D78047
This commit is contained in:
Thomas Raoux 2020-04-13 12:26:44 -07:00
parent a98d25eefc
commit ef05535c1e
6 changed files with 31 additions and 11 deletions

View File

@ -19,6 +19,7 @@
#include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h" #include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/ScheduleDAG.h" #include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
#include <cassert> #include <cassert>
#include <utility> #include <utility>
@ -26,9 +27,11 @@
namespace llvm { namespace llvm {
class RegisterClassInfo;
/// This class works in conjunction with the post-RA scheduler to rename /// This class works in conjunction with the post-RA scheduler to rename
/// registers to break register anti-dependencies (WAR hazards). /// registers to break register anti-dependencies (WAR hazards).
class LLVM_LIBRARY_VISIBILITY AntiDepBreaker { class AntiDepBreaker {
public: public:
using DbgValueVector = using DbgValueVector =
std::vector<std::pair<MachineInstr *, MachineInstr *>>; std::vector<std::pair<MachineInstr *, MachineInstr *>>;
@ -82,6 +85,13 @@ public:
} }
}; };
AntiDepBreaker *createAggressiveAntiDepBreaker(
MachineFunction &MFi, const RegisterClassInfo &RCI,
TargetSubtargetInfo::RegClassVector &CriticalPathRCs);
AntiDepBreaker *createCriticalAntiDepBreaker(MachineFunction &MFi,
const RegisterClassInfo &RCI);
} // end namespace llvm } // end namespace llvm
#endif // LLVM_LIB_CODEGEN_ANTIDEPBREAKER_H #endif // LLVM_LIB_CODEGEN_ANTIDEPBREAKER_H

View File

@ -1011,3 +1011,9 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
return Broken; return Broken;
} }
AntiDepBreaker *llvm::createAggressiveAntiDepBreaker(
MachineFunction &MFi, const RegisterClassInfo &RCI,
TargetSubtargetInfo::RegClassVector &CriticalPathRCs) {
return new AggressiveAntiDepBreaker(MFi, RCI, CriticalPathRCs);
}

View File

@ -16,8 +16,8 @@
#ifndef LLVM_LIB_CODEGEN_AGGRESSIVEANTIDEPBREAKER_H #ifndef LLVM_LIB_CODEGEN_AGGRESSIVEANTIDEPBREAKER_H
#define LLVM_LIB_CODEGEN_AGGRESSIVEANTIDEPBREAKER_H #define LLVM_LIB_CODEGEN_AGGRESSIVEANTIDEPBREAKER_H
#include "AntiDepBreaker.h"
#include "llvm/ADT/BitVector.h" #include "llvm/ADT/BitVector.h"
#include "llvm/CodeGen/AntiDepBreaker.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
#include <map> #include <map>

View File

@ -702,3 +702,9 @@ BreakAntiDependencies(const std::vector<SUnit> &SUnits,
return Broken; return Broken;
} }
AntiDepBreaker *
llvm::createCriticalAntiDepBreaker(MachineFunction &MFi,
const RegisterClassInfo &RCI) {
return new CriticalAntiDepBreaker(MFi, RCI);
}

View File

@ -15,8 +15,8 @@
#ifndef LLVM_LIB_CODEGEN_CRITICALANTIDEPBREAKER_H #ifndef LLVM_LIB_CODEGEN_CRITICALANTIDEPBREAKER_H
#define LLVM_LIB_CODEGEN_CRITICALANTIDEPBREAKER_H #define LLVM_LIB_CODEGEN_CRITICALANTIDEPBREAKER_H
#include "AntiDepBreaker.h"
#include "llvm/ADT/BitVector.h" #include "llvm/ADT/BitVector.h"
#include "llvm/CodeGen/AntiDepBreaker.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
#include <map> #include <map>
#include <vector> #include <vector>

View File

@ -17,11 +17,9 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "AggressiveAntiDepBreaker.h"
#include "AntiDepBreaker.h"
#include "CriticalAntiDepBreaker.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/AntiDepBreaker.h"
#include "llvm/CodeGen/LatencyPriorityQueue.h" #include "llvm/CodeGen/LatencyPriorityQueue.h"
#include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
@ -220,11 +218,11 @@ SchedulePostRATDList::SchedulePostRATDList(
assert((AntiDepMode == TargetSubtargetInfo::ANTIDEP_NONE || assert((AntiDepMode == TargetSubtargetInfo::ANTIDEP_NONE ||
MRI.tracksLiveness()) && MRI.tracksLiveness()) &&
"Live-ins must be accurate for anti-dependency breaking"); "Live-ins must be accurate for anti-dependency breaking");
AntiDepBreak = AntiDepBreak = ((AntiDepMode == TargetSubtargetInfo::ANTIDEP_ALL)
((AntiDepMode == TargetSubtargetInfo::ANTIDEP_ALL) ? ? createAggressiveAntiDepBreaker(MF, RCI, CriticalPathRCs)
(AntiDepBreaker *)new AggressiveAntiDepBreaker(MF, RCI, CriticalPathRCs) : : ((AntiDepMode == TargetSubtargetInfo::ANTIDEP_CRITICAL)
((AntiDepMode == TargetSubtargetInfo::ANTIDEP_CRITICAL) ? ? createCriticalAntiDepBreaker(MF, RCI)
(AntiDepBreaker *)new CriticalAntiDepBreaker(MF, RCI) : nullptr)); : nullptr));
} }
SchedulePostRATDList::~SchedulePostRATDList() { SchedulePostRATDList::~SchedulePostRATDList() {