Commit Graph

854 Commits

Author SHA1 Message Date
Alkis Evlogimenos a97abeb342 Change live interval representation. Machine instructions now have two
slots each. As a concequence they get numbered as 0, 2, 4 and so
on. The first slot is used for operand uses and the second for
defs. Here's an example:

0: A = ...
2: B = ...
4: C = A + B ;; last use of A

The live intervals should look like:

A = [1, 5)
B = [3, x)
C = [5, y)

llvm-svn: 11141
2004-02-05 22:55:25 +00:00
Alkis Evlogimenos 1165c1081e We don't need to scan the blocks that we are live-in on every
access. Rather we only have to do it on the creation of the interval.

llvm-svn: 11135
2004-02-05 20:45:40 +00:00
Tanya Lattner dd0c255d14 Added missing include.
llvm-svn: 11129
2004-02-05 05:04:39 +00:00
Alkis Evlogimenos 327426411e Modify the two address instruction pass to remove the duplicate
operand of the instruction and thus simplify the register allocation.

llvm-svn: 11124
2004-02-04 22:17:40 +00:00
Alkis Evlogimenos 3d100ef0ca When an instruction like: A += B had both A and B virtual registers
spilled, A was loaded from its stack location twice. This fixes the bug.

llvm-svn: 11093
2004-02-03 01:13:07 +00:00
Alkis Evlogimenos 74b26f77a3 Revert changes. Will implement this using a different set of primitives
llvm-svn: 11091
2004-02-02 23:08:58 +00:00
Alkis Evlogimenos 6e34205653 Fix debugging output.
llvm-svn: 11088
2004-02-02 22:00:32 +00:00
Alkis Evlogimenos 6471e66fbb Correctly update def/use information for modified machine operands.
llvm-svn: 11087
2004-02-02 21:56:40 +00:00
Alkis Evlogimenos 86ff30deab Should be more careful. The previously applied change made all counts
outside of loops = 0.

llvm-svn: 11085
2004-02-02 20:29:57 +00:00
Alkis Evlogimenos 2cecace9b2 Create an object for tracking physical register usage. This will look
much better when I get rid of the reserved registers.

llvm-svn: 11066
2004-02-02 07:30:36 +00:00
Alkis Evlogimenos 9b9c0485fd Change weight array into a vector and make it as big as the number of
registers (not as the max number of registers).

Change toSpill from a std::set into a std::vector<bool>.

Use the reverse iterator adapter to do a reverse scan of allocatable
registers.

llvm-svn: 11061
2004-02-01 20:13:26 +00:00
Alkis Evlogimenos 5e05a59bf8 Use std::map::count() instead of std::map::find() != std::map::end()
where appropriate.

llvm-svn: 11060
2004-02-01 18:39:53 +00:00
Alkis Evlogimenos a3a56fa041 Change string for joined intervals.
llvm-svn: 11057
2004-02-01 16:13:05 +00:00
Alkis Evlogimenos 84a84c38b7 Change xor to ^.
llvm-svn: 11054
2004-02-01 08:19:25 +00:00
Chris Lattner cae054f59f Fix a bug in a recent checkin
llvm-svn: 11050
2004-02-01 05:25:07 +00:00
Alkis Evlogimenos 8d4f06ed84 Missed one silly assert :-)
llvm-svn: 11048
2004-02-01 02:21:31 +00:00
Alkis Evlogimenos 69deb4d236 Simplify joinIntervals() code.
llvm-svn: 11047
2004-02-01 02:18:31 +00:00
Alkis Evlogimenos 91dcc03c39 Use MRegisterInfo::isPhysicalRegister and
MRegisterInfo::isVirtualRegister.

llvm-svn: 11045
2004-02-01 01:27:01 +00:00
Alkis Evlogimenos 662bb3f495 Apply final part of Chris' patch.
llvm-svn: 11040
2004-01-31 23:48:47 +00:00
Alkis Evlogimenos 459a67c309 Be a little smarter on the way we handle physical register defs.
llvm-svn: 11038
2004-01-31 23:13:30 +00:00
Chris Lattner c330b98c1c Finegrainify namespacification, use new MRegisterInfo::isVirtualRegister
method

llvm-svn: 11037
2004-01-31 21:27:19 +00:00
Chris Lattner a2ef296994 Fix, correctly this time, the computation of the return value
Fix a spello
Tighten up the assertion checking

No functionality changes.

llvm-svn: 11036
2004-01-31 21:21:43 +00:00
Chris Lattner 626f431165 * Fix incorrect computation of the runOnMachineFunction return value
* Turn a bunch of instance variables into automatic variables

llvm-svn: 11035
2004-01-31 21:14:04 +00:00
Chris Lattner d835aa6711 Remove unneeded #includes
Move Passes.h (which defines the interface to this file) to the top.
Move statistics to the top of the file.
Add a comment

llvm-svn: 11034
2004-01-31 21:07:15 +00:00
Alkis Evlogimenos 50d97e33b7 Merge safe parts from last night's buggy commit. These do not break
any test cases :-)

llvm-svn: 11032
2004-01-31 19:59:32 +00:00
Alkis Evlogimenos cdf48ab294 Optimize liveAt() and overlaps(). We now use a binary search instead
of a linear search to find the first range for comparisons. This cuts
down the linear scan register allocator running time by a factor of 3
in 254.perlbmk and by a factor of 2.2 in 176.gcc.

llvm-svn: 11030
2004-01-31 16:54:54 +00:00
Alkis Evlogimenos 26665e2636 Revert last night's changes as they broke some tests. Will remerge parts of the patch.
llvm-svn: 11029
2004-01-31 14:37:41 +00:00
Alkis Evlogimenos f2fb0fb486 Several performance enhancements and cleanups from Chris.
Simplification of LiveIntervals::Interval::overlaps() and addition of
examples to overlaps() and liveAt() to make them clearer.

llvm-svn: 11028
2004-01-31 04:56:07 +00:00
Chris Lattner 0770862334 Finegrainify namespacification
Implement LiveVariables::getIndexMachineBasicBlock

llvm-svn: 11018
2004-01-30 22:08:53 +00:00
Brian Gaeke 845c0dd196 Give clients of MachineFunctionPrinter the ability to specify a banner and
choose an ostream.

llvm-svn: 11016
2004-01-30 21:53:46 +00:00
Alkis Evlogimenos 59e3325c26 Fix failing test cases with joined live intervals. It turns out that
when joining we need to check if we overlap with the second interval
or any of its aliases.

Also make joining intervals the default.

llvm-svn: 10973
2004-01-23 13:37:51 +00:00
Alkis Evlogimenos 73df113676 Add option to join live intervals. Two intervals are joined if there
is a move between two registers, at least one of the registers is
virtual and the two live intervals do not overlap.

This results in about 40% reduction in intervals, 30% decrease in the
register allocators running time and a 20% increase in peephole
optimizations (mainly move eliminations).

The option can be enabled by passing -join-liveintervals where
appropriate.

llvm-svn: 10965
2004-01-22 23:08:45 +00:00
Alkis Evlogimenos e1c24c06f9 Remove unneeded check. An interval in active, by definition overlaps
with the current one.

llvm-svn: 10959
2004-01-22 20:07:18 +00:00
Alkis Evlogimenos 4716d76d22 Improve debugging output. Remove unneeded virtReg->0 mapping when
virtReg lives on the stack. Now a virtual register has an entry in the
virtual->physical map or the virtual->stack slot map but never in
both.

llvm-svn: 10958
2004-01-22 19:24:43 +00:00
Alkis Evlogimenos 19638ab2bd Revert previous change. The code was correct...
llvm-svn: 10957
2004-01-22 19:17:52 +00:00
Alkis Evlogimenos 0aa9d0278d Fix incorrect negatives in LiveIntervals::Interval::liveAt().
llvm-svn: 10956
2004-01-22 18:33:50 +00:00
Tanya Lattner 7117b9751d Moved iterators around.
llvm-svn: 10926
2004-01-20 17:51:13 +00:00
Tanya Lattner 72494e04be Moved iterators to common file.
llvm-svn: 10925
2004-01-20 17:49:42 +00:00
Alkis Evlogimenos d844972574 Handle printing of intervals that are not assign to any physical
register yet (2nd try).

llvm-svn: 10896
2004-01-16 20:33:13 +00:00
Alkis Evlogimenos 8672af1cc8 Handle printing of intervals that are not assign to any physical
register yet.

llvm-svn: 10895
2004-01-16 20:29:42 +00:00
Alkis Evlogimenos d86933d21d Fold open interval ends handling into
LiveIntervals::Interval::expiredAt() and simplify regalloc code.

llvm-svn: 10894
2004-01-16 20:17:05 +00:00
Alkis Evlogimenos e9c6ba891e Add asserts to previous change.
llvm-svn: 10893
2004-01-16 16:23:23 +00:00
Alkis Evlogimenos 3010b3e38e Use a list instead of a vector to store intervals. This will be needed
when we join intervals and one of the two will need to be removed.

llvm-svn: 10892
2004-01-16 16:06:59 +00:00
Alkis Evlogimenos 0680572553 Properly update #intervals statistic.
llvm-svn: 10847
2004-01-14 10:44:29 +00:00
Alkis Evlogimenos 2615c98042 Fix bug in LiveIntervals::Interval::overlaps and
LiveIntervals::Interval::liveAt. Both were considering the live ranges
closed in the end, when they are actually open.

llvm-svn: 10835
2004-01-14 00:20:09 +00:00
Alkis Evlogimenos a0865cec3f Improve debugging output.
llvm-svn: 10834
2004-01-14 00:09:36 +00:00
Alkis Evlogimenos 0431621429 Fix miscomputation of live intervals. The catch is that registers can
be dead at the defining instruction but can only be killed in
subsequent ones.

llvm-svn: 10833
2004-01-13 22:26:14 +00:00
Alkis Evlogimenos 1a01c80f1b Remove allocatable registers vector. It is already provided by
LiveVariables.

llvm-svn: 10830
2004-01-13 22:10:43 +00:00
Alkis Evlogimenos 13e8623a3f Cleanup debugging output.
llvm-svn: 10824
2004-01-13 21:53:20 +00:00
Alkis Evlogimenos 33f9cb1da7 Fix output of live intervals to show correctly its closed, open
ranges, i.e. [a,b)

llvm-svn: 10822
2004-01-13 21:17:47 +00:00