Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
95dafd8b
Commit
95dafd8b
authored
12 years ago
by
Andrew Trick
Browse files
Options
Downloads
Patches
Plain Diff
misched: Added ReadyQ container wrapper for Top and Bottom Queues.
llvm-svn: 156572
parent
4add42f4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/lib/CodeGen/MachineScheduler.cpp
+44
-11
44 additions, 11 deletions
llvm/lib/CodeGen/MachineScheduler.cpp
with
44 additions
and
11 deletions
llvm/lib/CodeGen/MachineScheduler.cpp
+
44
−
11
View file @
95dafd8b
...
@@ -629,15 +629,46 @@ void ScheduleDAGMI::placeDebugValues() {
...
@@ -629,15 +629,46 @@ void ScheduleDAGMI::placeDebugValues() {
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
namespace
{
namespace
{
struct
ReadyQ
{
typedef
std
::
vector
<
SUnit
*>::
iterator
iterator
;
unsigned
ID
;
std
::
vector
<
SUnit
*>
Queue
;
ReadyQ
(
unsigned
id
)
:
ID
(
id
)
{}
bool
isInQueue
(
SUnit
*
SU
)
const
{
return
SU
->
NodeQueueId
&
ID
;
}
bool
empty
()
const
{
return
Queue
.
empty
();
}
iterator
find
(
SUnit
*
SU
)
{
return
std
::
find
(
Queue
.
begin
(),
Queue
.
end
(),
SU
);
}
void
push
(
SUnit
*
SU
)
{
Queue
.
push_back
(
SU
);
}
void
remove
(
iterator
I
)
{
*
I
=
Queue
.
back
();
Queue
.
pop_back
();
}
};
/// ConvergingScheduler shrinks the unscheduled zone using heuristics to balance
/// ConvergingScheduler shrinks the unscheduled zone using heuristics to balance
/// the schedule.
/// the schedule.
class
ConvergingScheduler
:
public
MachineSchedStrategy
{
class
ConvergingScheduler
:
public
MachineSchedStrategy
{
ScheduleDAGMI
*
DAG
;
ScheduleDAGMI
*
DAG
;
unsigned
NumTopReady
;
ReadyQ
TopQueue
;
unsigned
NumBottomReady
;
ReadyQ
BotQueue
;
public:
public:
// NodeQueueId = 0 (none), = 1 (top), = 2 (bottom), = 3 (both)
ConvergingScheduler
()
:
TopQueue
(
1
),
BotQueue
(
2
)
{}
virtual
void
initialize
(
ScheduleDAGMI
*
dag
)
{
virtual
void
initialize
(
ScheduleDAGMI
*
dag
)
{
DAG
=
dag
;
DAG
=
dag
;
...
@@ -646,13 +677,15 @@ public:
...
@@ -646,13 +677,15 @@ public:
}
}
virtual
SUnit
*
pickNode
(
bool
&
IsTopNode
)
{
virtual
SUnit
*
pickNode
(
bool
&
IsTopNode
)
{
if
(
DAG
->
top
()
==
DAG
->
bottom
())
if
(
DAG
->
top
()
==
DAG
->
bottom
())
{
assert
(
TopQueue
.
empty
()
&&
BotQueue
.
empty
()
&&
"ReadyQ garbage"
);
return
NULL
;
return
NULL
;
}
// As an initial placeholder heuristic, schedule in the direction that has
// As an initial placeholder heuristic, schedule in the direction that has
// the fewest choices.
// the fewest choices.
SUnit
*
SU
;
SUnit
*
SU
;
if
(
ForceTopDown
||
(
!
ForceBottomUp
&&
NumTopReady
<=
NumBottomReady
))
{
if
(
ForceTopDown
||
(
!
ForceBottomUp
&&
TopQueue
.
Queue
.
size
()
<=
BotQueue
.
Queue
.
size
()))
{
SU
=
DAG
->
getSUnit
(
DAG
->
top
());
SU
=
DAG
->
getSUnit
(
DAG
->
top
());
IsTopNode
=
true
;
IsTopNode
=
true
;
}
}
...
@@ -661,21 +694,21 @@ public:
...
@@ -661,21 +694,21 @@ public:
IsTopNode
=
false
;
IsTopNode
=
false
;
}
}
if
(
SU
->
isTopReady
())
{
if
(
SU
->
isTopReady
())
{
assert
(
NumTopReady
>
0
&&
"bad ready count"
);
assert
(
!
TopQueue
.
empty
()
&&
"bad ready count"
);
--
NumTopReady
;
TopQueue
.
remove
(
TopQueue
.
find
(
SU
))
;
}
}
if
(
SU
->
isBottomReady
())
{
if
(
SU
->
isBottomReady
())
{
assert
(
NumBottomReady
>
0
&&
"bad ready count"
);
assert
(
!
BotQueue
.
empty
()
&&
"bad ready count"
);
--
NumBottomReady
;
BotQueue
.
remove
(
BotQueue
.
find
(
SU
))
;
}
}
return
SU
;
return
SU
;
}
}
virtual
void
releaseTopNode
(
SUnit
*
SU
)
{
virtual
void
releaseTopNode
(
SUnit
*
SU
)
{
++
NumTopReady
;
TopQueue
.
push
(
SU
)
;
}
}
virtual
void
releaseBottomNode
(
SUnit
*
SU
)
{
virtual
void
releaseBottomNode
(
SUnit
*
SU
)
{
++
NumBottomReady
;
BotQueue
.
push
(
SU
)
;
}
}
};
};
}
// namespace
}
// namespace
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment