Go to the documentation of this file.
33 #ifndef TTA_DATA_DEPENDENCE_GRAPH_HH
34 #define TTA_DATA_DEPENDENCE_GRAPH_HH
48 typedef std::vector<ProgramOperationPtr>
POList;
52 class DataGraphBuilder;
58 class BaseRegisterFile;
68 public BoostGraph<MoveNode, DataDependenceEdge> {
98 std::set<TCEString> allParamRegs,
102 bool containsProcedure=
false,
bool noLoopEdges=
false);
139 const MoveNode& moveNode,
unsigned int ii = UINT_MAX,
140 bool ignoreRegWaRs =
false,
141 bool ignoreRegWaWs =
false,
bool ignoreGuards =
false,
142 bool ignoreFUDeps =
false,
143 bool ignoreSameOperationEdges =
false,
144 bool assumeBypassing =
false)
const;
147 const MoveNode& moveNode,
unsigned int ii = UINT_MAX,
148 bool ignoreRegAntideps =
false,
149 bool ignoreUnscheduledSuccessors =
true,
150 bool ignoreGuards =
false,
151 bool ignoreFUDeps =
false,
152 bool ignoreSameOperationEdges =
false)
const;
173 int lastCycleToTest = INT_MAX)
const;
191 int firstCycleToTest = 0)
const;
267 NodeSet& nodes,
bool includeLoops =
false);
273 std::list<TTAProgram::CodeSnippet*>& codeSnippets,
274 bool includeLoops =
false);
277 bool removeMemAntideps=
true,
bool ignoreMemDeps=
false);
291 bool moveOverLoopEdge =
true);
300 const MoveNode& mn,
int allowGuardEdges = 2,
int backEdges = 0)
const;
304 bool allowGuardEdges =
false,
305 bool allowBackEdges =
false)
const;
307 std::map<DataDependenceEdge*, MoveNode*, DataDependenceEdge::Comparator>
309 const MoveNode& mn,
bool allowBackEdges)
const;
327 bool loopBypass =
false);
350 MoveNode& lrNode,
bool writingNode,
bool guardUseNode)
const;
409 void undo(UndoData& undoData);
417 NodeSet& predFinalDest,
bool guard)
const;
EdgeSet registerAndRAInEdges(const MoveNode &node) const
bool predecessorsReady(MoveNode &node) const
MoveNode * lastScheduledRegisterRead(const TTAMachine::BaseRegisterFile &rf, int registerIndex, int lastCycleToTest=INT_MAX) const
std::map< DataDependenceEdge *, MoveNode *, DataDependenceEdge::Comparator > onlyRegisterRawDestinationsWithEdges(const MoveNode &mn, bool allowBackEdges) const
@ SINGLE_BB_LOOP_ANTIDEPS
bool isLoopBypass(MoveNode &sourceNode, MoveNode &userNode)
void removeIncomingGuardEdges(MoveNode &node)
int firstRegisterCycle(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
NodeSet lastScheduledRegisterWrites(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
bool dotProgramOperationNodes_
The moves belonging to the same program operation are merged to a single node. Reduces the complexity...
NodeSet regRawSuccessors(const MoveNode &node) const
const TTAMachine::Machine & machine() const
virtual Node & tailNode(const Edge &edge) const
int scheduledNodeCount() const
ProgramOperation & programOperation(int index)
int edgeLatency(const DataDependenceEdge &edge, int ii, const MoveNode *tail, const MoveNode *head) const
MoveNode * firstScheduledRegisterWrite(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
void renamedSimpleLiveRange(MoveNode &src, MoveNode &dest, MoveNode &antidepPoint, DataDependenceEdge &lrEdge, const TCEString &oldReg, const TCEString &newReg)
virtual Node & headNode(const Edge &edge) const
AntidependenceLevel registerAntidependenceLevel_
Node & node(const int index) const
int edgeWeight(DataDependenceEdge &e, const MoveNode &hNode) const
void fixInterBBAntiEdges(BasicBlockNode &bbn1, BasicBlockNode &bbn2, bool loopEdges)
bool resultUsed(MoveNode &resultNode)
void setBasicBlockNode(const MoveNode &mn, BasicBlockNode &bbn)
void copyIncomingRawEdges(const MoveNode &src, MoveNode &dst)
MoveNode * findLimitingAntidependenceSource(MoveNode &mn)
bool sameGuards(const MoveNode &mn1, const MoveNode &mn2) const
std::pair< MoveNode *, MoveNode * > findLoopLimitAndIndex(MoveNode &jumpMove)
std::set< MoveNode *, typename MoveNode ::Comparator > NodeSet
bool rWawRawEdgesOutUncond(MoveNode &mn)
void addProgramOperation(ProgramOperationPtr po)
const MoveNode * onlyRegisterRawAncestor(const MoveNode &node, const std::string &sp) const
DataDependenceGraph::UndoData guardRenamed(MoveNode &mn)
virtual ~DataDependenceGraph()
NodeSet scheduledMoves() const
NodeSet lastScheduledRegisterGuardReads(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
std::set< RemovedEdgeDatum > RemovedEdgeMap
void createRegisterAntiDependenciesBetweenNodes(NodeSet &nodes)
void setMachine(const TTAMachine::Machine &machine)
NodeSet regRawPredecessors(const MoveNode &node, int backedges=0) const
LiveRange * findLiveRange(MoveNode &lrNode, bool writingNode, bool guardUseNode) const
std::map< const TTAProgram::Move *, MoveNode * > nodesOfMoves_
int rWarEdgesOut(MoveNode &mn)
MoveNode * onlyRegisterRawSource(const MoveNode &mn, int allowGuardEdges=2, int backEdges=0) const
void moveFUDependenciesToTrigger(MoveNode &trigger)
MoveNode * lastScheduledRegisterKill(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
NodeSet guardDefMoves(const MoveNode &moveNode)
@ EWH_HEURISTIC
Weights memory dependencies more, etc.
NodeSet guardRawPredecessors(const MoveNode &node) const
std::shared_ptr< ProgramOperation > ProgramOperationPtr
NodeSet onlyRegisterRawDestinations(const MoveNode &mn, bool allowGuardEdges=false, bool allowBackEdges=false) const
bool mergeAndKeepUser(MoveNode &resultNode, MoveNode &userNode, bool force=false)
virtual void setCycleGrouping(bool flag)
void combineNodes(MoveNode &node1, MoveNode &node2, MoveNode &destination)
NodeSet regWarSuccessors(const MoveNode &node) const
NodeSet regDepSiblings(const MoveNode &mn) const
void deleteNode(MoveNode &node)
void setNodeBB(MoveNode &mn, BasicBlockNode &bblock, DataDependenceGraph *updater)
bool queueRawPredecessors(NodeSet &queue, NodeSet &finalDest, NodeSet &predQueue, NodeSet &predFinalDest, bool guard) const
DataDependenceGraph * createSubgraph(NodeSet &nodes, bool includeLoops=false)
void undo(UndoData &undoData)
NodeSet regWawSuccessors(const MoveNode &node) const
void writeToXMLFile(std::string fileName) const
POList programOperations_
virtual void setProgramOperationNodes(bool flag)
EdgeSet operationInEdges(const MoveNode &node) const
virtual TCEString dotString() const
Dot printing related methods.
std::set< DataDependenceEdge *, typename DataDependenceEdge ::Comparator > EdgeSet
std::map< DataDependenceEdge *, TCEString, DataDependenceEdge::Comparator > changedDataEdges
bool hasSingleBBLoopRegisterAntidependencies()
void copyExternalOutEdges(MoveNode &nodeCopy, const MoveNode &source)
void updateRegUse(const MoveNodeUse &mnd, const TCEString ®, TTAProgram::BasicBlock &bb)
RemovedEdgeMap removedEdges
MoveNode * firstScheduledRegisterRead(const TTAMachine::BaseRegisterFile &rf, int registerIndex, int firstCycleToTest=0) const
MoveNode & nodeOfMove(const TTAProgram::Move &move)
const TTAMachine::Machine * machine_
bool otherSuccessorsScheduled(MoveNode &node, const NodeSet &ignoredNodes) const
void removeNode(MoveNode &node)
bool hasUnscheduledPredecessors(const MoveNode &mn) const
MoveNode * onlyGuardDefOfMove(MoveNode &moveNode)
std::vector< ProgramOperationPtr > POList
bool hasOtherRegWawSources(const MoveNode &mn) const
std::pair< MoveNode *, int > findLoopIndexUpdate(MoveNode *indexMove)
bool connectOrDeleteEdge(const MoveNode &tailNode, const MoveNode &headNode, DataDependenceEdge *edge)
int smallestCycle() const
void copyIncomingGuardEdges(const MoveNode &src, MoveNode &dst)
int programOperationCount() const
void unMergeUser(MoveNode &resultNode, MoveNode &mergedNode, bool loopBypass=false)
BasicBlockNode * ownedBBN_
void fixAntidepsAfterLoopUnmergeUser(MoveNode &sourceNode, MoveNode &mergedNode, const TCEString ®)
MoveNode * findLimitingAntidependenceDestination(MoveNode &mn)
bool cycleGrouping_
Dot printing related variables. Group the printed MoveNodes according to their cycles.
bool hasEqualEdge(const MoveNode &tailNode, const MoveNode &headNode, const DataDependenceEdge &edge) const
DataDependenceEdge * onlyIncomingGuard(const MoveNode &mn) const
void guardRestored(MoveNode &guardSrc, MoveNode &dst)
bool isLoopInvariant(const MoveNode &mn) const
int earliestCycle(const MoveNode &moveNode, unsigned int ii=UINT_MAX, bool ignoreRegWaRs=false, bool ignoreRegWaWs=false, bool ignoreGuards=false, bool ignoreFUDeps=false, bool ignoreSameOperationEdges=false, bool assumeBypassing=false) const
NodeSet movesAtCycle(int cycle) const
bool isRootGraphProcedureDDG()
virtual Edge & edge(const int index) const
MoveNode * lastGuardDefMove(MoveNode &moveNode)
void addNode(MoveNode &moveNode)
int lastRegisterCycle(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
DataDependenceGraph * trueDependenceGraph(bool removeMemAntideps=true, bool ignoreMemDeps=false)
DataDependenceGraph::UndoData destRenamed(MoveNode &mn)
void guardConverted(MoveNode &guardSrc, MoveNode &dst)
DataDependenceGraph(std::set< TCEString > allParamRegs, const TCEString &name="", AntidependenceLevel antidependenceLevel=ALL_ANTIDEPS, BasicBlockNode *ownedBBN=NULL, bool containsProcedure=false, bool noLoopEdges=false)
bool isNotAvoidable(const DataDependenceEdge &edge) const
DataDependenceEdge * onlyRegisterEdgeOut(MoveNode &mn) const
bool exclusingGuards(const MoveNode &mn1, const MoveNode &mn2) const
bool guardsAllowBypass(const MoveNode &defNode, const MoveNode &useNode, bool loopBypass=false)
ProgramOperationPtr programOperationPtr(int index)
MoveNode * firstScheduledRegisterKill(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
void copyOutgoingGuardWarEdges(const MoveNode &src, MoveNode &dst)
DataDependenceGraph * criticalPathGraph()
DataDependenceGraph * memoryDependenceGraph()
NodeSet firstScheduledRegisterWrites(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
@ EWH_REAL
Height returns the minimum cycle count for the schedule given enough resources.
std::map< TCEString, int > operationLatencies_
MoveNode * findLoopIndexInit(MoveNode &updateMove)
void removeOutgoingGuardWarEdges(MoveNode &node)
std::set< TCEString > allParamRegs_
int rAntiEdgesIn(MoveNode &mn)
DataDependenceEdge * onlyRegisterEdgeIn(MoveNode &mn) const
NodeSet firstScheduledRegisterReads(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
virtual const TCEString & name() const
NodeSet lastScheduledRegisterReads(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
EdgeSet copyDepsOver(MoveNode &node, bool anti, bool raw)
void copyExternalInEdges(MoveNode &nodeCopy, const MoveNode &source)
DataDependenceGraph::EdgeSet updateRegWrite(const MoveNodeUse &mnd, const TCEString ®, TTAProgram::BasicBlock &bb)
int regRawSuccessorCount(const MoveNode &mn, bool onlyScheduled)
bool successorsReady(MoveNode &node) const
NodeSet unscheduledMoves() const
std::map< const MoveNode *, BasicBlockNode * > moveNodeBlocks_
void copyDependencies(const MoveNode &src, MoveNode &dst, bool ignoreSameBBBackedges, bool moveOverLoopEdge=true)
EdgeWeightHeuristics edgeWeightHeuristics_
The heuristics to use to weight edges in the longest path computation.
bool hasAllRegisterAntidependencies()
TCEString removeRAWEdges(MoveNode &sourceNode, MoveNode &userNode)
MoveNode * findBypassSource(const MoveNode &mn)
const BasicBlockNode & getBasicBlockNode(const MoveNode &mn) const
bool writesJumpGuard(const MoveNode &moveNode)
int getOperationLatency(const TCEString &name) const
bool hasRegWaw(const MoveNodeUse &mnu, std::set< MoveNodeUse > targets) const
bool mergeAndKeepSource(MoveNode &resultNode, MoveNode &userNode, bool force=false)
DataDependenceGraph::UndoData sourceRenamed(MoveNode &mn)
bool hasUnscheduledSuccessors(const MoveNode &mn) const
void setEdgeWeightHeuristics(EdgeWeightHeuristics ewh)
void dropProgramOperation(ProgramOperationPtr po)
bool hasIntraBBRegisterAntidependencies()
int latestCycle(const MoveNode &moveNode, unsigned int ii=UINT_MAX, bool ignoreRegAntideps=false, bool ignoreUnscheduledSuccessors=true, bool ignoreGuards=false, bool ignoreFUDeps=false, bool ignoreSameOperationEdges=false) const
bool mergeAndKeepAllowed(MoveNode &sourceNode, MoveNode &userNode)