Commit Graph

943 Commits

Author SHA1 Message Date
Brian Gaeke
748fba141f FunctionLiveVarInfo.h moved: include/llvm/CodeGen -> lib/Target/Sparc/LiveVar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11804 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 19:46:00 +00:00
Alkis Evlogimenos
0d6c5b6489 Move machine code rewriter and spiller outside the register
allocator.

The implementation is completely rewritten and now employs several
optimizations not exercised before. For example for 164.gzip we have
997 loads and 699 stores vs the 1221 loads and 880 stores we have
before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11798 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 08:58:30 +00:00
Alkis Evlogimenos
ec8b8bb9ab Add predicates for checking if a virtual register has a physical
register mapping or a stack slot mapping.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11795 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 06:30:36 +00:00
Alkis Evlogimenos
e8124b9ddb Make enum private as it is an implementation detail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11782 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 23:49:40 +00:00
Alkis Evlogimenos
797428719f Remove '4Virt' from member function names as it is obvious.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11781 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 23:47:10 +00:00
Alkis Evlogimenos
34d9bc9f16 Refactor VirtRegMap out of RegAllocLinearScan as the first part of bug
251 (providing a generic machine code rewriter/spiller).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11780 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 23:08:11 +00:00
Alkis Evlogimenos
575649322f Add number of spilled registers statistic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11759 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:45:32 +00:00
Chris Lattner
11d1f21e1d Fix bugs in finegrainification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11758 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:40:08 +00:00
Chris Lattner
0742b59913 Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11757 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:38:20 +00:00
Alkis Evlogimenos
e699b16a76 Use MachineBasicBlock::getParent().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11756 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:36:38 +00:00
Alkis Evlogimenos
e6394e2b62 Remove implementation of default constructor as it is useless now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11755 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:28:35 +00:00
Alkis Evlogimenos
743d0a1f83 Refactor rewinding code for finding the first terminator of a basic
block into MachineBasicBlock::getFirstTerminator().

This also fixes a bug in the implementation of the above in both
RegAllocLocal and InstrSched, where instructions where added after the
terminator if the basic block's only instruction was a terminator (it
shouldn't matter for RegAllocLocal since this case never occurs in
practice).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11748 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:14:48 +00:00
Alkis Evlogimenos
12edc7ef3d Improved PhysRegTracker interface. RegAlloc lazily allocates the register tracker using a std::auto_ptr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11738 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 06:10:13 +00:00
Alkis Evlogimenos
fc2b449a17 Simplify iterator usage now that we have next(). Also don't pass iterators by reference now that MachineInstr* are in an ilist
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11732 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 04:12:30 +00:00
Alkis Evlogimenos
25d9d5800c Some code cleanups from Chris
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11724 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 01:57:39 +00:00
Alkis Evlogimenos
534f545ef1 Fix comments in PhysRegTracker and rename isPhysRegAvail to isRegAvail to be consistent with the other two
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11723 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 01:25:05 +00:00
Alkis Evlogimenos
98e17cf543 Move LiveIntervals.h up to be the first included header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11721 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 01:01:21 +00:00
Alkis Evlogimenos
888b1a6ccd Pull PhysRegTracker out of RegAllocLinearScan as it can be used by other allocators as well
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11720 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 00:53:31 +00:00
Alkis Evlogimenos
a2f6a408dc Move LiveIntervals.h to lib/CodeGen since it shouldn't be exposed to other parts of the compiler
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11719 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 00:50:15 +00:00
Chris Lattner
d0d1c8f830 Another bug fix for empty MBB's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11716 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 19:37:31 +00:00
Chris Lattner
688c8252d2 Fix a bug where we were implicitly assuming that there would be at least
one terminator instruction in each basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11714 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 19:08:15 +00:00
Alkis Evlogimenos
0f338a1e8c Print basic block boundaries in machine instruction debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11704 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 05:46:04 +00:00
Alkis Evlogimenos
7200c6b82a Abstract merging of ranges away from number of slots per instruction.
Also make it less aggressive as the current implementation breaks in
some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11696 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 04:05:13 +00:00
Alkis Evlogimenos
d6f6d1a80d Make 'fold' statistic's description the same in both allocators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11687 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-21 18:07:33 +00:00
Alkis Evlogimenos
007726ca6f Some more statistics improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11676 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 20:53:26 +00:00
Alkis Evlogimenos
df158c7e3f Disambiguate statistic descriptions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11675 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 20:46:49 +00:00
Alkis Evlogimenos
cea4471120 Rename statistic and add another one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11674 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 20:43:08 +00:00
Alkis Evlogimenos
fa510c4af5 Fix crash in debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11659 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 06:41:12 +00:00
Alkis Evlogimenos
537fa9838d Fix instruction numbering in debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11655 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 06:29:51 +00:00
Alkis Evlogimenos
39a0d5c112 Too many changes in one commit:
1. LiveIntervals now implement a 4 slot per instruction model. Load,
   Use, Def and a Store slot. This is required in order to correctly
   represent caller saved register clobbering on function calls,
   register reuse in the same instruction (def resues last use) and
   also spill code added later by the allocator. The previous
   representation (2 slots per instruction) was insufficient and as a
   result was causing subtle bugs.

2. Fixes in spill code generation. This was the major cause of
   failures in the test suite.

3. Linear scan now has core support for folding memory operands. This
   is untested and not enabled (the live interval update function does
   not attempt to fold loads/stores in instructions).

4. Lots of improvements in the debugging output of both live intervals
   and linear scan. Give it a try... it is beautiful :-)

In summary the above fixes all the issues with the recent reserved
register elimination changes and get the allocator very close to the
next big step: folding memory operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11654 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 06:15:40 +00:00
Alkis Evlogimenos
d195e99bc8 Fix RA::verifyAssignment()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11629 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 19:24:17 +00:00
Chris Lattner
d368c6163a Fix problem fusing spill code into instructions: we didn't update the live
variable information to take into account the change of instruction
address.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11628 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 18:34:02 +00:00
Chris Lattner
a96478d7d6 Fix an iterator invalidation problem. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11627 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 18:32:29 +00:00
Chris Lattner
5ed001b6af Add method to update livevar when an instruction moves
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11625 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 18:28:02 +00:00
Chris Lattner
8517e1f0be Fix a __LONG__ term annoyance of mine: symbolic registers weren't being printed
by operator<< on MachineInstr's, and looking up what register "24" is all of the
time was greatly annoying.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11623 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 16:17:08 +00:00
Chris Lattner
5e61fa9519 Add a MachineBasicBlock::getParent() method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11622 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 16:13:54 +00:00
Alkis Evlogimenos
2acef2da06 Rename reloads/spills to loads/stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11619 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 06:19:09 +00:00
Alkis Evlogimenos
779e640657 Implement assignment correctness verification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11609 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 23:15:23 +00:00
Alkis Evlogimenos
52f8f56ef4 Move unused typedefs in private section. Add method to return interval
given a register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11608 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 23:14:52 +00:00
Chris Lattner
e6d04f1a99 Eliminate operator[] is deprecated warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11578 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 16:43:51 +00:00
Chris Lattner
fdc01cedd4 Fix deprecated operator[] warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11577 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 16:38:18 +00:00
Alkis Evlogimenos
23c114fd3b Be more agressive when joining ranges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11575 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 04:38:37 +00:00
Alkis Evlogimenos
99d9923608 Fix overly conservative spill interval computation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11574 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 03:35:38 +00:00
Alkis Evlogimenos
3a9986f5d8 Beautify debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11573 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 00:35:06 +00:00
Chris Lattner
56ddada278 Remove the -disable-kill option. The register allocator is buggy with it,
and it was only for debugging in the first place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11557 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 17:49:10 +00:00
Chris Lattner
11390e76e7 Add support to the local allocator for fusing spill code into the instructions
that need them.  This is very useful on CISCy targets like the X86 because it
reduces the total spill pressure, and makes better use of it's (large)
instruction set.  Though the X86 backend doesn't know how to rewrite many
instructions yet, this already makes a substantial difference on 176.gcc for
example:

Before:
Time:
   8.0099 ( 31.2%)   0.0100 ( 12.5%)   8.0199 ( 31.2%)   7.7186 ( 30.0%)  Local Register Allocator

Code quality:
734559 asm-printer           - Number of machine instrs printed
111395 ra-local              - Number of registers reloaded
 79902 ra-local              - Number of registers spilled
231554 x86-peephole          - Number of peephole optimization performed

After:
Time:
   7.8700 ( 30.6%)   0.0099 ( 19.9%)   7.8800 ( 30.6%)   7.7892 ( 30.2%)  Local Register Allocator
Code quality:
733083 asm-printer           - Number of machine instrs printed
  2379 ra-local              - Number of reloads fused into instructions
109046 ra-local              - Number of registers reloaded
 79881 ra-local              - Number of registers spilled
230658 x86-peephole          - Number of peephole optimization performed

So by fusing 2300 instructions, we reduced the  static number of instructions
by 1500, and reduces the number of peepholes (and thus the work) by about 900.
This also clearly reduces the number of reload/spill instructions that are
emitted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11542 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:09:40 +00:00
Chris Lattner
cdee28724e Fix a bug in my previous refactoring change... arg!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11535 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:02:17 +00:00
Alkis Evlogimenos
7093d37304 Add LiveIntervals::Interval::empty() member function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11520 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 05:14:37 +00:00
Chris Lattner
1e3812c1c5 Once we have a way to fold spill code reloads into instructions, we have a way to use it. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11517 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 04:08:37 +00:00
Alkis Evlogimenos
355a724bd8 Fix spilled interval update. It was too conservative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11516 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 04:04:20 +00:00