[PATCH] D31587: MachineScheduler/ScheduleDAG: Add support for getSUTopoIndex
Axel Davy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 3 14:14:17 PDT 2017
axeldavy updated this revision to Diff 93947.
axeldavy added a comment.
I made the input const.
Should the result be const as well ?
Repository:
rL LLVM
https://reviews.llvm.org/D31587
Files:
include/llvm/CodeGen/ScheduleDAG.h
lib/CodeGen/ScheduleDAG.cpp
Index: lib/CodeGen/ScheduleDAG.cpp
===================================================================
--- lib/CodeGen/ScheduleDAG.cpp
+++ lib/CodeGen/ScheduleDAG.cpp
@@ -682,6 +682,12 @@
return HasLoop;
}
+int ScheduleDAGTopologicalSort::getSUTopoIndex(const SUnit &SU)
+{
+ assert(!SU.isBoundaryNode());
+ return Node2Index[SU.NodeNum];
+}
+
void ScheduleDAGTopologicalSort::Allocate(int n, int index) {
Node2Index[n] = index;
Index2Node[index] = n;
Index: include/llvm/CodeGen/ScheduleDAG.h
===================================================================
--- include/llvm/CodeGen/ScheduleDAG.h
+++ include/llvm/CodeGen/ScheduleDAG.h
@@ -738,6 +738,11 @@
/// current node \p M.
void RemovePred(SUnit *M, SUnit *N);
+ /// Maps SUnits to indexes of a topological ordering.
+ /// The index is between 0 and SUnits.count()-1.
+ /// Boundary SUnits are not mapped.
+ int getSUTopoIndex(const SUnit &SU);
+
typedef std::vector<int>::iterator iterator;
typedef std::vector<int>::const_iterator const_iterator;
iterator begin() { return Index2Node.begin(); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31587.93947.patch
Type: text/x-patch
Size: 1111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170403/b9cc4c26/attachment.bin>
More information about the llvm-commits
mailing list