Commit Graph

60 Commits

Author SHA1 Message Date
Benjamin Kramer
be441c0f34 It's a bool, so treat it like one. Fixes a MSVC warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 12:10:17 +00:00
David Goodwin
5e41178a6e Create our own block initializer for kill fixups as the scheduling one wasn't doing the right thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80958 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 22:15:25 +00:00
David Goodwin
1f15228398 Add hidden flags to allow binary search of post-RA scheduling errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 18:34:03 +00:00
David Goodwin
a3251db21a Don't mark a register live at an undef use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 20:47:02 +00:00
David Goodwin
7886cd85b2 Another stab at fixing up register kill flags after post-RA scheduling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 00:11:13 +00:00
David Goodwin
88a589c4b3 Fixup register kills after scheduling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 17:03:05 +00:00
Chris Lattner
103289e938 convert LoopInfo.h and GraphWriter.h to use raw_ostream
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79836 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 07:19:13 +00:00
David Goodwin
2ffb0ce7dc Fix counting of Post-RA scheduling stalls. Improve debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 21:47:46 +00:00
Dan Gohman
da2775767b This logic was accidentally inverted in r78767.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78773 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 01:44:20 +00:00
Dan Gohman
26255adcaa Factor out the code for finding an available register for use
in breaking an anti-dependence into a separate function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 01:33:27 +00:00
David Goodwin
7cd0118c36 Use DEBUG macro for debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:56:42 +00:00
David Goodwin
c93d8373c9 Add some debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78687 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:35:23 +00:00
David Goodwin
3a5f0d444c Replace DOUT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 01:44:26 +00:00
David Goodwin
d94a4e5d8d Post RA scheduler changes. Introduce a hazard recognizer that uses the target schedule information to accurately model the pipeline. Update the scheduler to correctly handle multi-issue targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78563 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 15:55:25 +00:00
Dan Gohman
845012e6d3 Use setPreservesAll and setPreservesCFG in CodeGen passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 23:37:33 +00:00
Chris Lattner
2a38688494 inline the global 'getInstrOperandRegClass' function into its callers
now that TargetOperandInfo does the heavy lifting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77508 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 21:36:49 +00:00
Torok Edwin
c23197a26f llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 16:55:14 +00:00
Torok Edwin
c25e7581b9 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 20:10:48 +00:00
Evan Cheng
d923fc621f Move getInstrOperandRegClass from the scheduler to TargetInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 00:30:09 +00:00
Bob Wilson
d9df501704 Fix pr3954. The register scavenger asserts for inline assembly with
register destinations that are tied to source operands.  The
TargetInstrDescr::findTiedToSrcOperand method silently fails for inline
assembly.  The existing MachineInstr::isRegReDefinedByTwoAddr was very
close to doing what is needed, so this revision makes a few changes to
that method and also renames it to isRegTiedToUseOperand (for consistency
with the very similar isRegTiedToDefOperand and because it handles both
two-address instructions and inline assembly with tied registers).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68714 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 17:16:43 +00:00
Duncan Sands
9e8bd0b362 Add parentheses to pacify gcc-4.3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 09:04:34 +00:00
Dan Gohman
1274ced8a3 Fix a post-RA scheduling liveness bug. When a basic block is being
scheduled in multiple regions, liveness data used by the
anti-dependence breaker is carried from one region to the next, however
the information reflects the state of the instructions before scheduling.
After scheduling, there may be new live range overlaps. Handle this by
pessimizing the liveness data carried between regions to the point where
it will be conservatively correct now matter how the earlier region is
scheduled. This fixes a miscompilation in 176.gcc with the post-RA
scheduler enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:10:43 +00:00
Dan Gohman
47ac0f0c7c When scheduling a block in parts, keep track of the overall
instruction index across each part. Instruction indices are used
to make live range queries, and live ranges can extend beyond
scheduling region boundaries.

Refactor the ScheduleDAGSDNodes class some more so that it
doesn't have to worry about this additional information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-11 04:27:20 +00:00
Dan Gohman
bed353d016 Consider any instruction that modifies the stack pointer to be
a scheduling region boundary.  This isn't necessary for
correctness; it helps with compile time, as it avoids the need
for data- and anti-dependencies from all spills and reloads on
the stack-pointer modification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 23:29:38 +00:00
Dan Gohman
9e64bbb322 Factor out more code for computing register live-range informationfor
scheduling, and generalize is so that preserves state across
scheduling regions. This fixes incorrect live-range information around
terminators and labels, which are effective region boundaries.

In place of looking for terminators to anchor inter-block dependencies,
introduce special entry and exit scheduling units for this purpose.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 23:27:53 +00:00
Evan Cheng
770bcc7b15 Move getPointerRegClass from TargetInstrInfo to TargetRegisterInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63938 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 17:43:24 +00:00
Dan Gohman
6dc75fe527 Move ScheduleDAGInstrs.h to be a private header. Front-ends
that used this header to select a scheduling policy should
use SchedulerRegistry.h instead (llvm-gcc and clang were
updated a while ago).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 17:12:10 +00:00
Dan Gohman
43f07fb6c3 Change the post-RA scheduler to iterate through the
basic-block segments bottom-up instead of top down. This
is the first step in a general restructuring of the way
register liveness is tracked in the post-RA scheduler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 18:57:45 +00:00
Dan Gohman
f7119393a9 Instead of adding dependence edges between terminator instructions
and every other instruction in their blocks to keep the terminator
instructions at the end, teach the post-RA scheduler how to operate
on ranges of instructions, and exclude terminators from the range
of instructions that get scheduled.

Also, exclude mid-block labels, such as EH_LABEL instructions, and
schedule code before them separately from code after them. This
fixes problems with the post-RA scheduler moving code past
EH_LABELs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 22:10:20 +00:00
Dan Gohman
49bb50e0b6 If an anti-dependence uses a non-allocatable register, set AntiDepReg
to 0, to ensure that the subsequent code doesn't try to break the
dependence.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 21:57:43 +00:00
Dan Gohman
8554449e31 Fix the check for an empty basic block to check for an empty SUnits
array instead, since this is what the scheduler actually cares about.
And remove a check that is unnecessary, since it can assume that
SUnits isn't empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 21:37:14 +00:00
Dan Gohman
79ce4cea47 Fix a "comparison between signed and unsigned integer expressions"
warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 17:55:08 +00:00
Dan Gohman
2836c283bb Initial hazard recognizer support in post-pass scheduling. This includes
a new toy hazard recognizier heuristic which attempts to direct the
scheduler to avoid clumping large groups of loads or stores too densely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62291 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 01:33:36 +00:00
Dan Gohman
79ce276083 Move a few containers out of ScheduleDAGInstrs::BuildSchedGraph
and into the ScheduleDAGInstrs class, so that they don't get
destructed and re-constructed for each block. This fixes a
compile-time hot spot in the post-pass scheduler.

To help facilitate this, tidy and do some minor reorganization
in the scheduler constructor functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 19:20:50 +00:00
Dan Gohman
d68a07650c Tidy up #includes, deleting a bunch of unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 17:59:02 +00:00
Dan Gohman
c9a5b9e38b Rename BuildSchedUnits to BuildSchedGraph, and refactor the
code in ScheduleDAGSDNodes' BuildSchedGraph into separate functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61376 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 18:36:58 +00:00
Dan Gohman
6c3643c41b Use ~0u instead of -1u as the special value, to hopefully avoid
warnings on compilers that warn about such things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 22:23:43 +00:00
Dan Gohman
00dc84a2ca Eliminate the loop that walks the critical path. Instead, just track the
position in the critical path during the main instruction walk.  This
eliminates the need for the CritialAntiDep DenseMap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 19:27:52 +00:00
Dan Gohman
812d7506d0 Enable anti-dependence breaking by default when post-RA scheduling is enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61078 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 06:21:45 +00:00
Dan Gohman
fde221fa0a When breaking an anti-dependency, don't use a register which has seen
one of its aliases defined. This is conservative, but tricky subreg
corner cases are outside the primary aim of this pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61077 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 06:20:58 +00:00
Dan Gohman
3f23744df4 Fix some register-alias-related bugs in the post-RA scheduler liveness
computation code. Also, avoid adding output-depenency edges when both
defs are dead, which frequently happens with EFLAGS defs.

Compute Depth and Height lazily, and always in terms of edge latency
values. For the schedulers that don't care about latency, edge latencies
are set to 1.

Eliminate Cycle and CycleBound, and LatencyPriorityQueue's Latencies array.
These are all subsumed by the Depth and Height fields.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61073 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 03:25:46 +00:00
Dan Gohman
54e4c36a73 Rewrite the SDep class, and simplify some of the related code.
The Cost field is removed. It was only being used in a very limited way,
to indicate when the scheduler should attempt to protect a live register,
and it isn't really needed to do that. If we ever want the scheduler to
start inserting copies in non-prohibitive situations, we'll have to
rethink some things anyway.

A Latency field is added. Instead of giving each node a single
fixed latency, each edge can have its own latency. This will eventually
be used to model various micro-architecture properties more accurately.

The PointerIntPair class and an internal union are now used, which
reduce the overall size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:54:47 +00:00
Dan Gohman
2ce7f2068f Drop the reg argument to isRegReDefinedByTwoAddr, which was redundant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:45:42 +00:00
Dan Gohman
490b1833a9 Ignore IMPLICIT_DEF instructions when computing physreg liveness.
While they appear to provide a normal clobbering def, they don't
in the case of the awkward IMPLICIT_DEF+INSERT_SUBREG idiom. It
would be good to change INSERT_SUBREG; until then, this change
allows post-regalloc scheduling to cope in a mildly conservative
way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60583 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:30:02 +00:00
Dan Gohman
80e201b8db Use register names instead of numbers in debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 02:15:26 +00:00
Dan Gohman
cef874ae2b Rewrite the liveness bookkeeping code to fix a bunch of
issues with subreg operands and tied operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60510 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 23:07:27 +00:00
Dan Gohman
e96cc775e4 Fix an inconsistency in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:38:38 +00:00
Dan Gohman
e561751e98 Don't charge the full latency for anti and output dependencies. This is
an area where eventually it would be good to use target-dependent
information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:37:34 +00:00
Dan Gohman
0dba0e5408 When looking for anti-dependences on the critical path, don't bother
examining non-anti-dependence edges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60496 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:32:26 +00:00
Dan Gohman
ebb0a31103 Add a comment about callee-saved registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60495 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:30:13 +00:00