mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Remove some old experimental code that is no longer needed. Remove additional, speculative scheduling pass as its cost did not translate into significant performance improvement. Minor tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89471 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -40,18 +40,11 @@ namespace llvm {
|
|||||||
/// mobility.
|
/// mobility.
|
||||||
std::vector<unsigned> NumNodesSolelyBlocking;
|
std::vector<unsigned> NumNodesSolelyBlocking;
|
||||||
|
|
||||||
/// IgnoreAntiDep - Ignore anti-dependencies
|
|
||||||
bool IgnoreAntiDep;
|
|
||||||
|
|
||||||
/// Queue - The queue.
|
/// Queue - The queue.
|
||||||
PriorityQueue<SUnit*, std::vector<SUnit*>, latency_sort> Queue;
|
PriorityQueue<SUnit*, std::vector<SUnit*>, latency_sort> Queue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LatencyPriorityQueue() : IgnoreAntiDep(false), Queue(latency_sort(this)) {
|
LatencyPriorityQueue() : Queue(latency_sort(this)) {
|
||||||
}
|
|
||||||
|
|
||||||
void setIgnoreAntiDep(bool ignore) {
|
|
||||||
IgnoreAntiDep = ignore;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initNodes(std::vector<SUnit> &sunits) {
|
void initNodes(std::vector<SUnit> &sunits) {
|
||||||
@ -72,7 +65,7 @@ public:
|
|||||||
|
|
||||||
unsigned getLatency(unsigned NodeNum) const {
|
unsigned getLatency(unsigned NodeNum) const {
|
||||||
assert(NodeNum < (*SUnits).size());
|
assert(NodeNum < (*SUnits).size());
|
||||||
return (*SUnits)[NodeNum].getHeight(IgnoreAntiDep);
|
return (*SUnits)[NodeNum].getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getNumSolelyBlockNodes(unsigned NodeNum) const {
|
unsigned getNumSolelyBlockNodes(unsigned NodeNum) const {
|
||||||
|
@ -340,34 +340,30 @@ namespace llvm {
|
|||||||
void removePred(const SDep &D);
|
void removePred(const SDep &D);
|
||||||
|
|
||||||
/// getDepth - Return the depth of this node, which is the length of the
|
/// getDepth - Return the depth of this node, which is the length of the
|
||||||
/// maximum path up to any node with has no predecessors. If IgnoreAntiDep
|
/// maximum path up to any node with has no predecessors.
|
||||||
/// is true, ignore anti-dependence edges.
|
unsigned getDepth() const {
|
||||||
unsigned getDepth(bool IgnoreAntiDep=false) const {
|
|
||||||
if (!isDepthCurrent)
|
if (!isDepthCurrent)
|
||||||
const_cast<SUnit *>(this)->ComputeDepth(IgnoreAntiDep);
|
const_cast<SUnit *>(this)->ComputeDepth();
|
||||||
return Depth;
|
return Depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getHeight - Return the height of this node, which is the length of the
|
/// getHeight - Return the height of this node, which is the length of the
|
||||||
/// maximum path down to any node with has no successors. If IgnoreAntiDep
|
/// maximum path down to any node with has no successors.
|
||||||
/// is true, ignore anti-dependence edges.
|
unsigned getHeight() const {
|
||||||
unsigned getHeight(bool IgnoreAntiDep=false) const {
|
|
||||||
if (!isHeightCurrent)
|
if (!isHeightCurrent)
|
||||||
const_cast<SUnit *>(this)->ComputeHeight(IgnoreAntiDep);
|
const_cast<SUnit *>(this)->ComputeHeight();
|
||||||
return Height;
|
return Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setDepthToAtLeast - If NewDepth is greater than this node's
|
/// setDepthToAtLeast - If NewDepth is greater than this node's
|
||||||
/// depth value, set it to be the new depth value. This also
|
/// depth value, set it to be the new depth value. This also
|
||||||
/// recursively marks successor nodes dirty. If IgnoreAntiDep is
|
/// recursively marks successor nodes dirty.
|
||||||
/// true, ignore anti-dependence edges.
|
void setDepthToAtLeast(unsigned NewDepth);
|
||||||
void setDepthToAtLeast(unsigned NewDepth, bool IgnoreAntiDep=false);
|
|
||||||
|
|
||||||
/// setDepthToAtLeast - If NewDepth is greater than this node's
|
/// setDepthToAtLeast - If NewDepth is greater than this node's
|
||||||
/// depth value, set it to be the new height value. This also
|
/// depth value, set it to be the new height value. This also
|
||||||
/// recursively marks predecessor nodes dirty. If IgnoreAntiDep is
|
/// recursively marks predecessor nodes dirty.
|
||||||
/// true, ignore anti-dependence edges.
|
void setHeightToAtLeast(unsigned NewHeight);
|
||||||
void setHeightToAtLeast(unsigned NewHeight, bool IgnoreAntiDep=false);
|
|
||||||
|
|
||||||
/// setDepthDirty - Set a flag in this node to indicate that its
|
/// setDepthDirty - Set a flag in this node to indicate that its
|
||||||
/// stored Depth value will require recomputation the next time
|
/// stored Depth value will require recomputation the next time
|
||||||
@ -400,8 +396,8 @@ namespace llvm {
|
|||||||
void print(raw_ostream &O, const ScheduleDAG *G) const;
|
void print(raw_ostream &O, const ScheduleDAG *G) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ComputeDepth(bool IgnoreAntiDep);
|
void ComputeDepth();
|
||||||
void ComputeHeight(bool IgnoreAntiDep);
|
void ComputeHeight();
|
||||||
};
|
};
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
|
@ -28,11 +28,6 @@
|
|||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
static cl::opt<int>
|
|
||||||
AntiDepTrials("agg-antidep-trials",
|
|
||||||
cl::desc("Maximum number of anti-dependency breaking passes"),
|
|
||||||
cl::init(1), cl::Hidden);
|
|
||||||
|
|
||||||
// If DebugDiv > 0 then only break antidep with (ID % DebugDiv) == DebugMod
|
// If DebugDiv > 0 then only break antidep with (ID % DebugDiv) == DebugMod
|
||||||
static cl::opt<int>
|
static cl::opt<int>
|
||||||
DebugDiv("agg-antidep-debugdiv",
|
DebugDiv("agg-antidep-debugdiv",
|
||||||
@ -118,7 +113,7 @@ AggressiveAntiDepBreaker(MachineFunction& MFi,
|
|||||||
MRI(MF.getRegInfo()),
|
MRI(MF.getRegInfo()),
|
||||||
TRI(MF.getTarget().getRegisterInfo()),
|
TRI(MF.getTarget().getRegisterInfo()),
|
||||||
AllocatableSet(TRI->getAllocatableSet(MF)),
|
AllocatableSet(TRI->getAllocatableSet(MF)),
|
||||||
State(NULL), SavedState(NULL) {
|
State(NULL) {
|
||||||
/* Collect a bitset of all registers that are only broken if they
|
/* Collect a bitset of all registers that are only broken if they
|
||||||
are on the critical path. */
|
are on the critical path. */
|
||||||
for (unsigned i = 0, e = CriticalPathRCs.size(); i < e; ++i) {
|
for (unsigned i = 0, e = CriticalPathRCs.size(); i < e; ++i) {
|
||||||
@ -138,13 +133,6 @@ AggressiveAntiDepBreaker(MachineFunction& MFi,
|
|||||||
|
|
||||||
AggressiveAntiDepBreaker::~AggressiveAntiDepBreaker() {
|
AggressiveAntiDepBreaker::~AggressiveAntiDepBreaker() {
|
||||||
delete State;
|
delete State;
|
||||||
delete SavedState;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned AggressiveAntiDepBreaker::GetMaxTrials() {
|
|
||||||
if (AntiDepTrials <= 0)
|
|
||||||
return 1;
|
|
||||||
return AntiDepTrials;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AggressiveAntiDepBreaker::StartBlock(MachineBasicBlock *BB) {
|
void AggressiveAntiDepBreaker::StartBlock(MachineBasicBlock *BB) {
|
||||||
@ -216,8 +204,6 @@ void AggressiveAntiDepBreaker::StartBlock(MachineBasicBlock *BB) {
|
|||||||
void AggressiveAntiDepBreaker::FinishBlock() {
|
void AggressiveAntiDepBreaker::FinishBlock() {
|
||||||
delete State;
|
delete State;
|
||||||
State = NULL;
|
State = NULL;
|
||||||
delete SavedState;
|
|
||||||
SavedState = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AggressiveAntiDepBreaker::Observe(MachineInstr *MI, unsigned Count,
|
void AggressiveAntiDepBreaker::Observe(MachineInstr *MI, unsigned Count,
|
||||||
@ -251,10 +237,6 @@ void AggressiveAntiDepBreaker::Observe(MachineInstr *MI, unsigned Count,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DEBUG(errs() << '\n');
|
DEBUG(errs() << '\n');
|
||||||
|
|
||||||
// We're starting a new schedule region so forget any saved state.
|
|
||||||
delete SavedState;
|
|
||||||
SavedState = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AggressiveAntiDepBreaker::IsImplicitDefUse(MachineInstr *MI,
|
bool AggressiveAntiDepBreaker::IsImplicitDefUse(MachineInstr *MI,
|
||||||
@ -293,27 +275,20 @@ void AggressiveAntiDepBreaker::GetPassthruRegs(MachineInstr *MI,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// AntiDepEdges - Return in Edges the anti- and output-
|
/// AntiDepEdges - Return in Edges the anti- and output- dependencies
|
||||||
/// dependencies on Regs in SU that we want to consider for breaking.
|
/// in SU that we want to consider for breaking.
|
||||||
static void AntiDepEdges(SUnit *SU,
|
static void AntiDepEdges(SUnit *SU, std::vector<SDep*>& Edges) {
|
||||||
const AntiDepBreaker::AntiDepRegVector& Regs,
|
SmallSet<unsigned, 4> RegSet;
|
||||||
std::vector<SDep*>& Edges) {
|
|
||||||
AntiDepBreaker::AntiDepRegSet RegSet;
|
|
||||||
for (unsigned i = 0, e = Regs.size(); i < e; ++i)
|
|
||||||
RegSet.insert(Regs[i]);
|
|
||||||
|
|
||||||
for (SUnit::pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
|
for (SUnit::pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
|
||||||
P != PE; ++P) {
|
P != PE; ++P) {
|
||||||
if ((P->getKind() == SDep::Anti) || (P->getKind() == SDep::Output)) {
|
if ((P->getKind() == SDep::Anti) || (P->getKind() == SDep::Output)) {
|
||||||
unsigned Reg = P->getReg();
|
unsigned Reg = P->getReg();
|
||||||
if (RegSet.count(Reg) != 0) {
|
if (RegSet.count(Reg) == 0) {
|
||||||
Edges.push_back(&*P);
|
Edges.push_back(&*P);
|
||||||
RegSet.erase(Reg);
|
RegSet.insert(Reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(RegSet.empty() && "Expected all antidep registers to be found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CriticalPathStep - Return the next SUnit after SU on the bottom-up
|
/// CriticalPathStep - Return the next SUnit after SU on the bottom-up
|
||||||
@ -698,7 +673,6 @@ bool AggressiveAntiDepBreaker::FindSuitableFreeRegisters(
|
|||||||
///
|
///
|
||||||
unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
|
unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
|
||||||
std::vector<SUnit>& SUnits,
|
std::vector<SUnit>& SUnits,
|
||||||
CandidateMap& Candidates,
|
|
||||||
MachineBasicBlock::iterator& Begin,
|
MachineBasicBlock::iterator& Begin,
|
||||||
MachineBasicBlock::iterator& End,
|
MachineBasicBlock::iterator& End,
|
||||||
unsigned InsertPosIndex) {
|
unsigned InsertPosIndex) {
|
||||||
@ -711,16 +685,6 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
|
|||||||
// so just duck out immediately if the block is empty.
|
// so just duck out immediately if the block is empty.
|
||||||
if (SUnits.empty()) return 0;
|
if (SUnits.empty()) return 0;
|
||||||
|
|
||||||
// Manage saved state to enable multiple passes...
|
|
||||||
if (AntiDepTrials > 1) {
|
|
||||||
if (SavedState == NULL) {
|
|
||||||
SavedState = new AggressiveAntiDepState(*State);
|
|
||||||
} else {
|
|
||||||
delete State;
|
|
||||||
State = new AggressiveAntiDepState(*SavedState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// For each regclass the next register to use for renaming.
|
// For each regclass the next register to use for renaming.
|
||||||
RenameOrderType RenameOrder;
|
RenameOrderType RenameOrder;
|
||||||
|
|
||||||
@ -749,21 +713,14 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
|
|||||||
CriticalPathMI = CriticalPathSU->getInstr();
|
CriticalPathMI = CriticalPathSU->getInstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Even if there are no anti-dependencies we still need to go
|
|
||||||
// through the instructions to update Def, Kills, etc.
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (Candidates.empty()) {
|
DEBUG(errs() << "\n===== Aggressive anti-dependency breaking\n");
|
||||||
DEBUG(errs() << "\n===== No anti-dependency candidates\n");
|
DEBUG(errs() << "Available regs:");
|
||||||
} else {
|
for (unsigned Reg = 0; Reg < TRI->getNumRegs(); ++Reg) {
|
||||||
DEBUG(errs() << "\n===== Attempting to break " << Candidates.size() <<
|
if (!State->IsLive(Reg))
|
||||||
" anti-dependencies\n");
|
DEBUG(errs() << " " << TRI->getName(Reg));
|
||||||
DEBUG(errs() << "Available regs:");
|
|
||||||
for (unsigned Reg = 0; Reg < TRI->getNumRegs(); ++Reg) {
|
|
||||||
if (!State->IsLive(Reg))
|
|
||||||
DEBUG(errs() << " " << TRI->getName(Reg));
|
|
||||||
}
|
|
||||||
DEBUG(errs() << '\n');
|
|
||||||
}
|
}
|
||||||
|
DEBUG(errs() << '\n');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Attempt to break anti-dependence edges. Walk the instructions
|
// Attempt to break anti-dependence edges. Walk the instructions
|
||||||
@ -784,14 +741,11 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
|
|||||||
// Process the defs in MI...
|
// Process the defs in MI...
|
||||||
PrescanInstruction(MI, Count, PassthruRegs);
|
PrescanInstruction(MI, Count, PassthruRegs);
|
||||||
|
|
||||||
// The the dependence edges that represent anti- and output-
|
// The dependence edges that represent anti- and output-
|
||||||
// dependencies that are candidates for breaking.
|
// dependencies that are candidates for breaking.
|
||||||
std::vector<SDep*> Edges;
|
std::vector<SDep*> Edges;
|
||||||
SUnit *PathSU = MISUnitMap[MI];
|
SUnit *PathSU = MISUnitMap[MI];
|
||||||
AntiDepBreaker::CandidateMap::iterator
|
AntiDepEdges(PathSU, Edges);
|
||||||
citer = Candidates.find(PathSU);
|
|
||||||
if (citer != Candidates.end())
|
|
||||||
AntiDepEdges(PathSU, citer->second, Edges);
|
|
||||||
|
|
||||||
// If MI is not on the critical path, then we don't rename
|
// If MI is not on the critical path, then we don't rename
|
||||||
// registers in the CriticalPathSet.
|
// registers in the CriticalPathSet.
|
||||||
@ -847,12 +801,32 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
|
|||||||
// anti-dependency since those edges would prevent such
|
// anti-dependency since those edges would prevent such
|
||||||
// units from being scheduled past each other
|
// units from being scheduled past each other
|
||||||
// regardless.
|
// regardless.
|
||||||
|
//
|
||||||
|
// Also, if there are dependencies on other SUnits with the
|
||||||
|
// same register as the anti-dependency, don't attempt to
|
||||||
|
// break it.
|
||||||
for (SUnit::pred_iterator P = PathSU->Preds.begin(),
|
for (SUnit::pred_iterator P = PathSU->Preds.begin(),
|
||||||
PE = PathSU->Preds.end(); P != PE; ++P) {
|
PE = PathSU->Preds.end(); P != PE; ++P) {
|
||||||
if ((P->getSUnit() == NextSU) && (P->getKind() != SDep::Anti)) {
|
if (P->getSUnit() == NextSU ?
|
||||||
|
(P->getKind() != SDep::Anti || P->getReg() != AntiDepReg) :
|
||||||
|
(P->getKind() == SDep::Data && P->getReg() == AntiDepReg)) {
|
||||||
|
AntiDepReg = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SUnit::pred_iterator P = PathSU->Preds.begin(),
|
||||||
|
PE = PathSU->Preds.end(); P != PE; ++P) {
|
||||||
|
if ((P->getSUnit() == NextSU) && (P->getKind() != SDep::Anti) &&
|
||||||
|
(P->getKind() != SDep::Output)) {
|
||||||
DEBUG(errs() << " (real dependency)\n");
|
DEBUG(errs() << " (real dependency)\n");
|
||||||
AntiDepReg = 0;
|
AntiDepReg = 0;
|
||||||
break;
|
break;
|
||||||
|
} else if ((P->getSUnit() != NextSU) &&
|
||||||
|
(P->getKind() == SDep::Data) &&
|
||||||
|
(P->getReg() == AntiDepReg)) {
|
||||||
|
DEBUG(errs() << " (other dependency)\n");
|
||||||
|
AntiDepReg = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,11 @@
|
|||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/ADT/BitVector.h"
|
#include "llvm/ADT/BitVector.h"
|
||||||
#include "llvm/ADT/SmallSet.h"
|
#include "llvm/ADT/SmallSet.h"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
/// Class AggressiveAntiDepState
|
/// Class AggressiveAntiDepState
|
||||||
/// Contains all the state necessary for anti-dep breaking. We place
|
/// Contains all the state necessary for anti-dep breaking.
|
||||||
/// into a separate class so be can conveniently save/restore it to
|
|
||||||
/// enable multi-pass anti-dep breaking.
|
|
||||||
class AggressiveAntiDepState {
|
class AggressiveAntiDepState {
|
||||||
public:
|
public:
|
||||||
/// RegisterReference - Information about a register reference
|
/// RegisterReference - Information about a register reference
|
||||||
@ -126,23 +125,11 @@ namespace llvm {
|
|||||||
/// registers.
|
/// registers.
|
||||||
AggressiveAntiDepState *State;
|
AggressiveAntiDepState *State;
|
||||||
|
|
||||||
/// SavedState - The state for the start of an anti-dep
|
|
||||||
/// region. Used to restore the state at the beginning of each
|
|
||||||
/// pass
|
|
||||||
AggressiveAntiDepState *SavedState;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AggressiveAntiDepBreaker(MachineFunction& MFi,
|
AggressiveAntiDepBreaker(MachineFunction& MFi,
|
||||||
TargetSubtarget::RegClassVector& CriticalPathRCs);
|
TargetSubtarget::RegClassVector& CriticalPathRCs);
|
||||||
~AggressiveAntiDepBreaker();
|
~AggressiveAntiDepBreaker();
|
||||||
|
|
||||||
/// GetMaxTrials - As anti-dependencies are broken, additional
|
|
||||||
/// dependencies may be exposed, so multiple passes are required.
|
|
||||||
unsigned GetMaxTrials();
|
|
||||||
|
|
||||||
/// NeedCandidates - Candidates required.
|
|
||||||
bool NeedCandidates() { return true; }
|
|
||||||
|
|
||||||
/// Start - Initialize anti-dep breaking for a new basic block.
|
/// Start - Initialize anti-dep breaking for a new basic block.
|
||||||
void StartBlock(MachineBasicBlock *BB);
|
void StartBlock(MachineBasicBlock *BB);
|
||||||
|
|
||||||
@ -150,7 +137,6 @@ namespace llvm {
|
|||||||
/// of the ScheduleDAG and break them by renaming registers.
|
/// of the ScheduleDAG and break them by renaming registers.
|
||||||
///
|
///
|
||||||
unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
|
unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
|
||||||
CandidateMap& Candidates,
|
|
||||||
MachineBasicBlock::iterator& Begin,
|
MachineBasicBlock::iterator& Begin,
|
||||||
MachineBasicBlock::iterator& End,
|
MachineBasicBlock::iterator& End,
|
||||||
unsigned InsertPosIndex);
|
unsigned InsertPosIndex);
|
||||||
|
@ -21,9 +21,7 @@
|
|||||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||||
#include "llvm/CodeGen/ScheduleDAG.h"
|
#include "llvm/CodeGen/ScheduleDAG.h"
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/ADT/SmallSet.h"
|
#include <vector>
|
||||||
#include "llvm/ADT/SmallVector.h"
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
@ -32,20 +30,8 @@ namespace llvm {
|
|||||||
/// anti-dependencies.
|
/// anti-dependencies.
|
||||||
class AntiDepBreaker {
|
class AntiDepBreaker {
|
||||||
public:
|
public:
|
||||||
typedef SmallSet<unsigned, 4> AntiDepRegSet;
|
|
||||||
typedef SmallVector<unsigned, 4> AntiDepRegVector;
|
|
||||||
typedef std::map<SUnit *, AntiDepRegVector> CandidateMap;
|
|
||||||
|
|
||||||
virtual ~AntiDepBreaker();
|
virtual ~AntiDepBreaker();
|
||||||
|
|
||||||
/// GetMaxTrials - Return the maximum number of anti-dependence
|
|
||||||
/// breaking attempts that will be made for a block.
|
|
||||||
virtual unsigned GetMaxTrials() =0;
|
|
||||||
|
|
||||||
/// NeedCandidates - Return true if the schedule must provide
|
|
||||||
/// candidates with BreakAntiDependencies().
|
|
||||||
virtual bool NeedCandidates() =0;
|
|
||||||
|
|
||||||
/// Start - Initialize anti-dep breaking for a new basic block.
|
/// Start - Initialize anti-dep breaking for a new basic block.
|
||||||
virtual void StartBlock(MachineBasicBlock *BB) =0;
|
virtual void StartBlock(MachineBasicBlock *BB) =0;
|
||||||
|
|
||||||
@ -54,7 +40,6 @@ public:
|
|||||||
/// the number of anti-dependencies broken.
|
/// the number of anti-dependencies broken.
|
||||||
///
|
///
|
||||||
virtual unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
|
virtual unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
|
||||||
CandidateMap& Candidates,
|
|
||||||
MachineBasicBlock::iterator& Begin,
|
MachineBasicBlock::iterator& Begin,
|
||||||
MachineBasicBlock::iterator& End,
|
MachineBasicBlock::iterator& End,
|
||||||
unsigned InsertPosIndex) =0;
|
unsigned InsertPosIndex) =0;
|
||||||
|
@ -316,7 +316,6 @@ CriticalAntiDepBreaker::findSuitableFreeRegister(unsigned AntiDepReg,
|
|||||||
|
|
||||||
unsigned CriticalAntiDepBreaker::
|
unsigned CriticalAntiDepBreaker::
|
||||||
BreakAntiDependencies(std::vector<SUnit>& SUnits,
|
BreakAntiDependencies(std::vector<SUnit>& SUnits,
|
||||||
CandidateMap& Candidates,
|
|
||||||
MachineBasicBlock::iterator& Begin,
|
MachineBasicBlock::iterator& Begin,
|
||||||
MachineBasicBlock::iterator& End,
|
MachineBasicBlock::iterator& End,
|
||||||
unsigned InsertPosIndex) {
|
unsigned InsertPosIndex) {
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/ADT/BitVector.h"
|
#include "llvm/ADT/BitVector.h"
|
||||||
#include "llvm/ADT/SmallSet.h"
|
#include "llvm/ADT/SmallSet.h"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class CriticalAntiDepBreaker : public AntiDepBreaker {
|
class CriticalAntiDepBreaker : public AntiDepBreaker {
|
||||||
@ -64,13 +65,6 @@ namespace llvm {
|
|||||||
CriticalAntiDepBreaker(MachineFunction& MFi);
|
CriticalAntiDepBreaker(MachineFunction& MFi);
|
||||||
~CriticalAntiDepBreaker();
|
~CriticalAntiDepBreaker();
|
||||||
|
|
||||||
/// GetMaxTrials - Critical path anti-dependence breaking requires
|
|
||||||
/// only a single pass
|
|
||||||
unsigned GetMaxTrials() { return 1; }
|
|
||||||
|
|
||||||
/// NeedCandidates - Candidates not needed.
|
|
||||||
bool NeedCandidates() { return false; }
|
|
||||||
|
|
||||||
/// Start - Initialize anti-dep breaking for a new basic block.
|
/// Start - Initialize anti-dep breaking for a new basic block.
|
||||||
void StartBlock(MachineBasicBlock *BB);
|
void StartBlock(MachineBasicBlock *BB);
|
||||||
|
|
||||||
@ -78,7 +72,6 @@ namespace llvm {
|
|||||||
/// of the ScheduleDAG and break them by renaming registers.
|
/// of the ScheduleDAG and break them by renaming registers.
|
||||||
///
|
///
|
||||||
unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
|
unsigned BreakAntiDependencies(std::vector<SUnit>& SUnits,
|
||||||
CandidateMap& Candidates,
|
|
||||||
MachineBasicBlock::iterator& Begin,
|
MachineBasicBlock::iterator& Begin,
|
||||||
MachineBasicBlock::iterator& End,
|
MachineBasicBlock::iterator& End,
|
||||||
unsigned InsertPosIndex);
|
unsigned InsertPosIndex);
|
||||||
|
@ -55,10 +55,6 @@ SUnit *LatencyPriorityQueue::getSingleUnscheduledPred(SUnit *SU) {
|
|||||||
SUnit *OnlyAvailablePred = 0;
|
SUnit *OnlyAvailablePred = 0;
|
||||||
for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
|
for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
if (IgnoreAntiDep &&
|
|
||||||
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SUnit &Pred = *I->getSUnit();
|
SUnit &Pred = *I->getSUnit();
|
||||||
if (!Pred.isScheduled) {
|
if (!Pred.isScheduled) {
|
||||||
// We found an available, but not scheduled, predecessor. If it's the
|
// We found an available, but not scheduled, predecessor. If it's the
|
||||||
@ -78,10 +74,6 @@ void LatencyPriorityQueue::push_impl(SUnit *SU) {
|
|||||||
unsigned NumNodesBlocking = 0;
|
unsigned NumNodesBlocking = 0;
|
||||||
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
if (IgnoreAntiDep &&
|
|
||||||
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (getSingleUnscheduledPred(I->getSUnit()) == SU)
|
if (getSingleUnscheduledPred(I->getSUnit()) == SU)
|
||||||
++NumNodesBlocking;
|
++NumNodesBlocking;
|
||||||
}
|
}
|
||||||
@ -98,10 +90,6 @@ void LatencyPriorityQueue::push_impl(SUnit *SU) {
|
|||||||
void LatencyPriorityQueue::ScheduledNode(SUnit *SU) {
|
void LatencyPriorityQueue::ScheduledNode(SUnit *SU) {
|
||||||
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
if (IgnoreAntiDep &&
|
|
||||||
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
AdjustPriorityOfUnscheduledPreds(I->getSUnit());
|
AdjustPriorityOfUnscheduledPreds(I->getSUnit());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,11 +175,10 @@ namespace {
|
|||||||
void FixupKills(MachineBasicBlock *MBB);
|
void FixupKills(MachineBasicBlock *MBB);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ReleaseSucc(SUnit *SU, SDep *SuccEdge, bool IgnoreAntiDep);
|
void ReleaseSucc(SUnit *SU, SDep *SuccEdge);
|
||||||
void ReleaseSuccessors(SUnit *SU, bool IgnoreAntiDep);
|
void ReleaseSuccessors(SUnit *SU);
|
||||||
void ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle, bool IgnoreAntiDep);
|
void ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle);
|
||||||
void ListScheduleTopDown(
|
void ListScheduleTopDown();
|
||||||
AntiDepBreaker::CandidateMap *AntiDepCandidates);
|
|
||||||
void StartBlockForKills(MachineBasicBlock *BB);
|
void StartBlockForKills(MachineBasicBlock *BB);
|
||||||
|
|
||||||
// ToggleKillFlag - Toggle a register operand kill flag. Other
|
// ToggleKillFlag - Toggle a register operand kill flag. Other
|
||||||
@ -322,50 +321,24 @@ void SchedulePostRATDList::Schedule() {
|
|||||||
BuildSchedGraph(AA);
|
BuildSchedGraph(AA);
|
||||||
|
|
||||||
if (AntiDepBreak != NULL) {
|
if (AntiDepBreak != NULL) {
|
||||||
AntiDepBreaker::CandidateMap AntiDepCandidates;
|
unsigned Broken =
|
||||||
const bool NeedCandidates = AntiDepBreak->NeedCandidates();
|
AntiDepBreak->BreakAntiDependencies(SUnits, Begin, InsertPos,
|
||||||
|
InsertPosIndex);
|
||||||
|
|
||||||
for (unsigned i = 0, Trials = AntiDepBreak->GetMaxTrials();
|
if (Broken != 0) {
|
||||||
i < Trials; ++i) {
|
|
||||||
DEBUG(errs() << "\n********** Break Anti-Deps, Trial " <<
|
|
||||||
i << " **********\n");
|
|
||||||
|
|
||||||
// If candidates are required, then schedule forward ignoring
|
|
||||||
// anti-dependencies to collect the candidate operands for
|
|
||||||
// anti-dependence breaking. The candidates will be the def
|
|
||||||
// operands for the anti-dependencies that if broken would allow
|
|
||||||
// an improved schedule
|
|
||||||
if (NeedCandidates) {
|
|
||||||
DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
|
|
||||||
SUnits[su].dumpAll(this));
|
|
||||||
|
|
||||||
AntiDepCandidates.clear();
|
|
||||||
AvailableQueue.initNodes(SUnits);
|
|
||||||
ListScheduleTopDown(&AntiDepCandidates);
|
|
||||||
AvailableQueue.releaseState();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned Broken =
|
|
||||||
AntiDepBreak->BreakAntiDependencies(SUnits, AntiDepCandidates,
|
|
||||||
Begin, InsertPos, InsertPosIndex);
|
|
||||||
|
|
||||||
// We made changes. Update the dependency graph.
|
// We made changes. Update the dependency graph.
|
||||||
// Theoretically we could update the graph in place:
|
// Theoretically we could update the graph in place:
|
||||||
// When a live range is changed to use a different register, remove
|
// When a live range is changed to use a different register, remove
|
||||||
// the def's anti-dependence *and* output-dependence edges due to
|
// the def's anti-dependence *and* output-dependence edges due to
|
||||||
// that register, and add new anti-dependence and output-dependence
|
// that register, and add new anti-dependence and output-dependence
|
||||||
// edges based on the next live range of the register.
|
// edges based on the next live range of the register.
|
||||||
if ((Broken != 0) || NeedCandidates) {
|
SUnits.clear();
|
||||||
SUnits.clear();
|
Sequence.clear();
|
||||||
Sequence.clear();
|
EntrySU = SUnit();
|
||||||
EntrySU = SUnit();
|
ExitSU = SUnit();
|
||||||
ExitSU = SUnit();
|
BuildSchedGraph(AA);
|
||||||
BuildSchedGraph(AA);
|
|
||||||
}
|
|
||||||
|
|
||||||
NumFixedAnti += Broken;
|
NumFixedAnti += Broken;
|
||||||
if (Broken == 0)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +347,7 @@ void SchedulePostRATDList::Schedule() {
|
|||||||
SUnits[su].dumpAll(this));
|
SUnits[su].dumpAll(this));
|
||||||
|
|
||||||
AvailableQueue.initNodes(SUnits);
|
AvailableQueue.initNodes(SUnits);
|
||||||
ListScheduleTopDown(NULL);
|
ListScheduleTopDown();
|
||||||
AvailableQueue.releaseState();
|
AvailableQueue.releaseState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,8 +546,7 @@ void SchedulePostRATDList::FixupKills(MachineBasicBlock *MBB) {
|
|||||||
|
|
||||||
/// ReleaseSucc - Decrement the NumPredsLeft count of a successor. Add it to
|
/// ReleaseSucc - Decrement the NumPredsLeft count of a successor. Add it to
|
||||||
/// the PendingQueue if the count reaches zero. Also update its cycle bound.
|
/// the PendingQueue if the count reaches zero. Also update its cycle bound.
|
||||||
void SchedulePostRATDList::ReleaseSucc(SUnit *SU, SDep *SuccEdge,
|
void SchedulePostRATDList::ReleaseSucc(SUnit *SU, SDep *SuccEdge) {
|
||||||
bool IgnoreAntiDep) {
|
|
||||||
SUnit *SuccSU = SuccEdge->getSUnit();
|
SUnit *SuccSU = SuccEdge->getSUnit();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -590,8 +562,7 @@ void SchedulePostRATDList::ReleaseSucc(SUnit *SU, SDep *SuccEdge,
|
|||||||
// Compute how many cycles it will be before this actually becomes
|
// Compute how many cycles it will be before this actually becomes
|
||||||
// available. This is the max of the start time of all predecessors plus
|
// available. This is the max of the start time of all predecessors plus
|
||||||
// their latencies.
|
// their latencies.
|
||||||
SuccSU->setDepthToAtLeast(SU->getDepth(IgnoreAntiDep) +
|
SuccSU->setDepthToAtLeast(SU->getDepth() + SuccEdge->getLatency());
|
||||||
SuccEdge->getLatency(), IgnoreAntiDep);
|
|
||||||
|
|
||||||
// If all the node's predecessors are scheduled, this node is ready
|
// If all the node's predecessors are scheduled, this node is ready
|
||||||
// to be scheduled. Ignore the special ExitSU node.
|
// to be scheduled. Ignore the special ExitSU node.
|
||||||
@ -600,40 +571,34 @@ void SchedulePostRATDList::ReleaseSucc(SUnit *SU, SDep *SuccEdge,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ReleaseSuccessors - Call ReleaseSucc on each of SU's successors.
|
/// ReleaseSuccessors - Call ReleaseSucc on each of SU's successors.
|
||||||
void SchedulePostRATDList::ReleaseSuccessors(SUnit *SU, bool IgnoreAntiDep) {
|
void SchedulePostRATDList::ReleaseSuccessors(SUnit *SU) {
|
||||||
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
if (IgnoreAntiDep &&
|
ReleaseSucc(SU, &*I);
|
||||||
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
|
|
||||||
continue;
|
|
||||||
ReleaseSucc(SU, &*I, IgnoreAntiDep);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ScheduleNodeTopDown - Add the node to the schedule. Decrement the pending
|
/// ScheduleNodeTopDown - Add the node to the schedule. Decrement the pending
|
||||||
/// count of its successors. If a successor pending count is zero, add it to
|
/// count of its successors. If a successor pending count is zero, add it to
|
||||||
/// the Available queue.
|
/// the Available queue.
|
||||||
void SchedulePostRATDList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle,
|
void SchedulePostRATDList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
|
||||||
bool IgnoreAntiDep) {
|
|
||||||
DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
|
DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
|
||||||
DEBUG(SU->dump(this));
|
DEBUG(SU->dump(this));
|
||||||
|
|
||||||
Sequence.push_back(SU);
|
Sequence.push_back(SU);
|
||||||
assert(CurCycle >= SU->getDepth(IgnoreAntiDep) &&
|
assert(CurCycle >= SU->getDepth() &&
|
||||||
"Node scheduled above its depth!");
|
"Node scheduled above its depth!");
|
||||||
SU->setDepthToAtLeast(CurCycle, IgnoreAntiDep);
|
SU->setDepthToAtLeast(CurCycle);
|
||||||
|
|
||||||
ReleaseSuccessors(SU, IgnoreAntiDep);
|
ReleaseSuccessors(SU);
|
||||||
SU->isScheduled = true;
|
SU->isScheduled = true;
|
||||||
AvailableQueue.ScheduledNode(SU);
|
AvailableQueue.ScheduledNode(SU);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ListScheduleTopDown - The main loop of list scheduling for top-down
|
/// ListScheduleTopDown - The main loop of list scheduling for top-down
|
||||||
/// schedulers.
|
/// schedulers.
|
||||||
void SchedulePostRATDList::ListScheduleTopDown(
|
void SchedulePostRATDList::ListScheduleTopDown() {
|
||||||
AntiDepBreaker::CandidateMap *AntiDepCandidates) {
|
|
||||||
unsigned CurCycle = 0;
|
unsigned CurCycle = 0;
|
||||||
const bool IgnoreAntiDep = (AntiDepCandidates != NULL);
|
|
||||||
|
|
||||||
// We're scheduling top-down but we're visiting the regions in
|
// We're scheduling top-down but we're visiting the regions in
|
||||||
// bottom-up order, so we don't know the hazards at the start of a
|
// bottom-up order, so we don't know the hazards at the start of a
|
||||||
@ -641,33 +606,13 @@ void SchedulePostRATDList::ListScheduleTopDown(
|
|||||||
// blocks are a single region).
|
// blocks are a single region).
|
||||||
HazardRec->Reset();
|
HazardRec->Reset();
|
||||||
|
|
||||||
// If ignoring anti-dependencies, the Schedule DAG still has Anti
|
|
||||||
// dep edges, but we ignore them for scheduling purposes
|
|
||||||
AvailableQueue.setIgnoreAntiDep(IgnoreAntiDep);
|
|
||||||
|
|
||||||
// Release any successors of the special Entry node.
|
// Release any successors of the special Entry node.
|
||||||
ReleaseSuccessors(&EntrySU, IgnoreAntiDep);
|
ReleaseSuccessors(&EntrySU);
|
||||||
|
|
||||||
// Add all leaves to Available queue. If ignoring antideps we also
|
// Add all leaves to Available queue.
|
||||||
// adjust the predecessor count for each node to not include antidep
|
|
||||||
// edges.
|
|
||||||
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
|
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
|
||||||
// It is available if it has no predecessors.
|
// It is available if it has no predecessors.
|
||||||
bool available = SUnits[i].Preds.empty();
|
bool available = SUnits[i].Preds.empty();
|
||||||
// If we are ignoring anti-dependencies then a node that has only
|
|
||||||
// anti-dep predecessors is available.
|
|
||||||
if (!available && IgnoreAntiDep) {
|
|
||||||
available = true;
|
|
||||||
for (SUnit::const_pred_iterator I = SUnits[i].Preds.begin(),
|
|
||||||
E = SUnits[i].Preds.end(); I != E; ++I) {
|
|
||||||
if ((I->getKind() != SDep::Anti) && (I->getKind() != SDep::Output)) {
|
|
||||||
available = false;
|
|
||||||
} else {
|
|
||||||
SUnits[i].NumPredsLeft -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (available) {
|
if (available) {
|
||||||
AvailableQueue.push(&SUnits[i]);
|
AvailableQueue.push(&SUnits[i]);
|
||||||
SUnits[i].isAvailable = true;
|
SUnits[i].isAvailable = true;
|
||||||
@ -687,21 +632,21 @@ void SchedulePostRATDList::ListScheduleTopDown(
|
|||||||
// so, add them to the available queue.
|
// so, add them to the available queue.
|
||||||
unsigned MinDepth = ~0u;
|
unsigned MinDepth = ~0u;
|
||||||
for (unsigned i = 0, e = PendingQueue.size(); i != e; ++i) {
|
for (unsigned i = 0, e = PendingQueue.size(); i != e; ++i) {
|
||||||
if (PendingQueue[i]->getDepth(IgnoreAntiDep) <= CurCycle) {
|
if (PendingQueue[i]->getDepth() <= CurCycle) {
|
||||||
AvailableQueue.push(PendingQueue[i]);
|
AvailableQueue.push(PendingQueue[i]);
|
||||||
PendingQueue[i]->isAvailable = true;
|
PendingQueue[i]->isAvailable = true;
|
||||||
PendingQueue[i] = PendingQueue.back();
|
PendingQueue[i] = PendingQueue.back();
|
||||||
PendingQueue.pop_back();
|
PendingQueue.pop_back();
|
||||||
--i; --e;
|
--i; --e;
|
||||||
} else if (PendingQueue[i]->getDepth(IgnoreAntiDep) < MinDepth)
|
} else if (PendingQueue[i]->getDepth() < MinDepth)
|
||||||
MinDepth = PendingQueue[i]->getDepth(IgnoreAntiDep);
|
MinDepth = PendingQueue[i]->getDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(errs() << "\n*** Examining Available\n";
|
DEBUG(errs() << "\n*** Examining Available\n";
|
||||||
LatencyPriorityQueue q = AvailableQueue;
|
LatencyPriorityQueue q = AvailableQueue;
|
||||||
while (!q.empty()) {
|
while (!q.empty()) {
|
||||||
SUnit *su = q.pop();
|
SUnit *su = q.pop();
|
||||||
errs() << "Height " << su->getHeight(IgnoreAntiDep) << ": ";
|
errs() << "Height " << su->getHeight() << ": ";
|
||||||
su->dump(this);
|
su->dump(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -731,30 +676,8 @@ void SchedulePostRATDList::ListScheduleTopDown(
|
|||||||
|
|
||||||
// If we found a node to schedule...
|
// If we found a node to schedule...
|
||||||
if (FoundSUnit) {
|
if (FoundSUnit) {
|
||||||
// If we are ignoring anti-dependencies and the SUnit we are
|
|
||||||
// scheduling has an antidep predecessor that has not been
|
|
||||||
// scheduled, then we will need to break that antidep if we want
|
|
||||||
// to get this schedule when not ignoring anti-dependencies.
|
|
||||||
if (IgnoreAntiDep) {
|
|
||||||
AntiDepBreaker::AntiDepRegVector AntiDepRegs;
|
|
||||||
for (SUnit::const_pred_iterator I = FoundSUnit->Preds.begin(),
|
|
||||||
E = FoundSUnit->Preds.end(); I != E; ++I) {
|
|
||||||
if (((I->getKind() == SDep::Anti) ||
|
|
||||||
(I->getKind() == SDep::Output)) &&
|
|
||||||
!I->getSUnit()->isScheduled)
|
|
||||||
AntiDepRegs.push_back(I->getReg());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AntiDepRegs.size() > 0) {
|
|
||||||
DEBUG(errs() << "*** AntiDep Candidate: ");
|
|
||||||
DEBUG(FoundSUnit->dump(this));
|
|
||||||
AntiDepCandidates->insert(
|
|
||||||
AntiDepBreaker::CandidateMap::value_type(FoundSUnit, AntiDepRegs));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ... schedule the node...
|
// ... schedule the node...
|
||||||
ScheduleNodeTopDown(FoundSUnit, CurCycle, IgnoreAntiDep);
|
ScheduleNodeTopDown(FoundSUnit, CurCycle);
|
||||||
HazardRec->EmitInstruction(FoundSUnit);
|
HazardRec->EmitInstruction(FoundSUnit);
|
||||||
CycleHasInsts = true;
|
CycleHasInsts = true;
|
||||||
|
|
||||||
@ -775,8 +698,7 @@ void SchedulePostRATDList::ListScheduleTopDown(
|
|||||||
// just advance the current cycle and try again.
|
// just advance the current cycle and try again.
|
||||||
DEBUG(errs() << "*** Stall in cycle " << CurCycle << '\n');
|
DEBUG(errs() << "*** Stall in cycle " << CurCycle << '\n');
|
||||||
HazardRec->AdvanceCycle();
|
HazardRec->AdvanceCycle();
|
||||||
if (!IgnoreAntiDep)
|
++NumStalls;
|
||||||
++NumStalls;
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we have no instructions to issue and we have instructions
|
// Otherwise, we have no instructions to issue and we have instructions
|
||||||
// that will fault if we don't do this right. This is the case for
|
// that will fault if we don't do this right. This is the case for
|
||||||
@ -784,8 +706,7 @@ void SchedulePostRATDList::ListScheduleTopDown(
|
|||||||
DEBUG(errs() << "*** Emitting noop in cycle " << CurCycle << '\n');
|
DEBUG(errs() << "*** Emitting noop in cycle " << CurCycle << '\n');
|
||||||
HazardRec->EmitNoop();
|
HazardRec->EmitNoop();
|
||||||
Sequence.push_back(0); // NULL here means noop
|
Sequence.push_back(0); // NULL here means noop
|
||||||
if (!IgnoreAntiDep)
|
++NumNoops;
|
||||||
++NumNoops;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++CurCycle;
|
++CurCycle;
|
||||||
|
@ -183,8 +183,8 @@ void SUnit::setHeightDirty() {
|
|||||||
/// setDepthToAtLeast - Update this node's successors to reflect the
|
/// setDepthToAtLeast - Update this node's successors to reflect the
|
||||||
/// fact that this node's depth just increased.
|
/// fact that this node's depth just increased.
|
||||||
///
|
///
|
||||||
void SUnit::setDepthToAtLeast(unsigned NewDepth, bool IgnoreAntiDep) {
|
void SUnit::setDepthToAtLeast(unsigned NewDepth) {
|
||||||
if (NewDepth <= getDepth(IgnoreAntiDep))
|
if (NewDepth <= getDepth())
|
||||||
return;
|
return;
|
||||||
setDepthDirty();
|
setDepthDirty();
|
||||||
Depth = NewDepth;
|
Depth = NewDepth;
|
||||||
@ -194,8 +194,8 @@ void SUnit::setDepthToAtLeast(unsigned NewDepth, bool IgnoreAntiDep) {
|
|||||||
/// setHeightToAtLeast - Update this node's predecessors to reflect the
|
/// setHeightToAtLeast - Update this node's predecessors to reflect the
|
||||||
/// fact that this node's height just increased.
|
/// fact that this node's height just increased.
|
||||||
///
|
///
|
||||||
void SUnit::setHeightToAtLeast(unsigned NewHeight, bool IgnoreAntiDep) {
|
void SUnit::setHeightToAtLeast(unsigned NewHeight) {
|
||||||
if (NewHeight <= getHeight(IgnoreAntiDep))
|
if (NewHeight <= getHeight())
|
||||||
return;
|
return;
|
||||||
setHeightDirty();
|
setHeightDirty();
|
||||||
Height = NewHeight;
|
Height = NewHeight;
|
||||||
@ -204,7 +204,7 @@ void SUnit::setHeightToAtLeast(unsigned NewHeight, bool IgnoreAntiDep) {
|
|||||||
|
|
||||||
/// ComputeDepth - Calculate the maximal path from the node to the exit.
|
/// ComputeDepth - Calculate the maximal path from the node to the exit.
|
||||||
///
|
///
|
||||||
void SUnit::ComputeDepth(bool IgnoreAntiDep) {
|
void SUnit::ComputeDepth() {
|
||||||
SmallVector<SUnit*, 8> WorkList;
|
SmallVector<SUnit*, 8> WorkList;
|
||||||
WorkList.push_back(this);
|
WorkList.push_back(this);
|
||||||
do {
|
do {
|
||||||
@ -214,10 +214,6 @@ void SUnit::ComputeDepth(bool IgnoreAntiDep) {
|
|||||||
unsigned MaxPredDepth = 0;
|
unsigned MaxPredDepth = 0;
|
||||||
for (SUnit::const_pred_iterator I = Cur->Preds.begin(),
|
for (SUnit::const_pred_iterator I = Cur->Preds.begin(),
|
||||||
E = Cur->Preds.end(); I != E; ++I) {
|
E = Cur->Preds.end(); I != E; ++I) {
|
||||||
if (IgnoreAntiDep &&
|
|
||||||
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SUnit *PredSU = I->getSUnit();
|
SUnit *PredSU = I->getSUnit();
|
||||||
if (PredSU->isDepthCurrent)
|
if (PredSU->isDepthCurrent)
|
||||||
MaxPredDepth = std::max(MaxPredDepth,
|
MaxPredDepth = std::max(MaxPredDepth,
|
||||||
@ -241,7 +237,7 @@ void SUnit::ComputeDepth(bool IgnoreAntiDep) {
|
|||||||
|
|
||||||
/// ComputeHeight - Calculate the maximal path from the node to the entry.
|
/// ComputeHeight - Calculate the maximal path from the node to the entry.
|
||||||
///
|
///
|
||||||
void SUnit::ComputeHeight(bool IgnoreAntiDep) {
|
void SUnit::ComputeHeight() {
|
||||||
SmallVector<SUnit*, 8> WorkList;
|
SmallVector<SUnit*, 8> WorkList;
|
||||||
WorkList.push_back(this);
|
WorkList.push_back(this);
|
||||||
do {
|
do {
|
||||||
@ -251,10 +247,6 @@ void SUnit::ComputeHeight(bool IgnoreAntiDep) {
|
|||||||
unsigned MaxSuccHeight = 0;
|
unsigned MaxSuccHeight = 0;
|
||||||
for (SUnit::const_succ_iterator I = Cur->Succs.begin(),
|
for (SUnit::const_succ_iterator I = Cur->Succs.begin(),
|
||||||
E = Cur->Succs.end(); I != E; ++I) {
|
E = Cur->Succs.end(); I != E; ++I) {
|
||||||
if (IgnoreAntiDep &&
|
|
||||||
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SUnit *SuccSU = I->getSUnit();
|
SUnit *SuccSU = I->getSUnit();
|
||||||
if (SuccSU->isHeightCurrent)
|
if (SuccSU->isHeightCurrent)
|
||||||
MaxSuccHeight = std::max(MaxSuccHeight,
|
MaxSuccHeight = std::max(MaxSuccHeight,
|
||||||
|
Reference in New Issue
Block a user