1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

928 Commits

Author SHA1 Message Date
Alkis Evlogimenos
d192266264 Refactor VirtRegMap out of RegAllocLinearScan as the first part of bug
251 (providing a generic machine code rewriter/spiller).

llvm-svn: 11780
2004-02-23 23:08:11 +00:00
Alkis Evlogimenos
34f28e5d3f Add number of spilled registers statistic.
llvm-svn: 11759
2004-02-23 18:45:32 +00:00
Chris Lattner
82e1a3657d Fix bugs in finegrainification
llvm-svn: 11758
2004-02-23 18:40:08 +00:00
Chris Lattner
1bf9dde4a1 Finegrainify namespacification
llvm-svn: 11757
2004-02-23 18:38:20 +00:00
Alkis Evlogimenos
82a1d7d30e Use MachineBasicBlock::getParent().
llvm-svn: 11756
2004-02-23 18:36:38 +00:00
Alkis Evlogimenos
2863fbd178 Remove implementation of default constructor as it is useless now.
llvm-svn: 11755
2004-02-23 18:28:35 +00:00
Alkis Evlogimenos
9b103024ef 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).

llvm-svn: 11748
2004-02-23 18:14:48 +00:00
Alkis Evlogimenos
50598d1135 Improved PhysRegTracker interface. RegAlloc lazily allocates the register tracker using a std::auto_ptr
llvm-svn: 11738
2004-02-23 06:10:13 +00:00
Alkis Evlogimenos
99af6ca36b Simplify iterator usage now that we have next(). Also don't pass iterators by reference now that MachineInstr* are in an ilist
llvm-svn: 11732
2004-02-23 04:12:30 +00:00
Alkis Evlogimenos
976f485826 Some code cleanups from Chris
llvm-svn: 11724
2004-02-23 01:57:39 +00:00
Alkis Evlogimenos
1525e120a6 Fix comments in PhysRegTracker and rename isPhysRegAvail to isRegAvail to be consistent with the other two
llvm-svn: 11723
2004-02-23 01:25:05 +00:00
Alkis Evlogimenos
ee3ef42726 Move LiveIntervals.h up to be the first included header
llvm-svn: 11721
2004-02-23 01:01:21 +00:00
Alkis Evlogimenos
ba2b9aec71 Pull PhysRegTracker out of RegAllocLinearScan as it can be used by other allocators as well
llvm-svn: 11720
2004-02-23 00:53:31 +00:00
Alkis Evlogimenos
850bd0819f Move LiveIntervals.h to lib/CodeGen since it shouldn't be exposed to other parts of the compiler
llvm-svn: 11719
2004-02-23 00:50:15 +00:00
Chris Lattner
5485375e5d Another bug fix for empty MBB's
llvm-svn: 11716
2004-02-22 19:37:31 +00:00
Chris Lattner
56a7886c8a Fix a bug where we were implicitly assuming that there would be at least
one terminator instruction in each basic block.

llvm-svn: 11714
2004-02-22 19:08:15 +00:00
Alkis Evlogimenos
ba33a0ab9b Print basic block boundaries in machine instruction debug output.
llvm-svn: 11704
2004-02-22 05:46:04 +00:00
Alkis Evlogimenos
32d12d31ae Abstract merging of ranges away from number of slots per instruction.
Also make it less aggressive as the current implementation breaks in
some cases.

llvm-svn: 11696
2004-02-22 04:05:13 +00:00
Alkis Evlogimenos
e39c21cc93 Make 'fold' statistic's description the same in both allocators.
llvm-svn: 11687
2004-02-21 18:07:33 +00:00
Alkis Evlogimenos
43431e117e Some more statistics improvements.
llvm-svn: 11676
2004-02-20 20:53:26 +00:00
Alkis Evlogimenos
6d57ed784f Disambiguate statistic descriptions.
llvm-svn: 11675
2004-02-20 20:46:49 +00:00
Alkis Evlogimenos
70f547d06e Rename statistic and add another one.
llvm-svn: 11674
2004-02-20 20:43:08 +00:00
Alkis Evlogimenos
168e4bf455 Fix crash in debug output.
llvm-svn: 11659
2004-02-20 06:41:12 +00:00
Alkis Evlogimenos
16744f2860 Fix instruction numbering in debug output.
llvm-svn: 11655
2004-02-20 06:29:51 +00:00
Alkis Evlogimenos
f32239a5c6 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.

llvm-svn: 11654
2004-02-20 06:15:40 +00:00
Alkis Evlogimenos
eed4727191 Fix RA::verifyAssignment()
llvm-svn: 11629
2004-02-19 19:24:17 +00:00
Chris Lattner
c37073f249 Fix problem fusing spill code into instructions: we didn't update the live
variable information to take into account the change of instruction
address.

llvm-svn: 11628
2004-02-19 18:34:02 +00:00
Chris Lattner
266206caed Fix an iterator invalidation problem. :(
llvm-svn: 11627
2004-02-19 18:32:29 +00:00
Chris Lattner
6b0030105e Add method to update livevar when an instruction moves
llvm-svn: 11625
2004-02-19 18:28:02 +00:00
Chris Lattner
8a9be6b652 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.

llvm-svn: 11623
2004-02-19 16:17:08 +00:00
Chris Lattner
436ab13009 Add a MachineBasicBlock::getParent() method
llvm-svn: 11622
2004-02-19 16:13:54 +00:00
Alkis Evlogimenos
68f40cbfd3 Rename reloads/spills to loads/stores.
llvm-svn: 11619
2004-02-19 06:19:09 +00:00
Alkis Evlogimenos
310f641c9c Implement assignment correctness verification.
llvm-svn: 11609
2004-02-18 23:15:23 +00:00
Chris Lattner
e672426e5d Eliminate operator[] is deprecated warnings
llvm-svn: 11578
2004-02-18 16:43:51 +00:00
Chris Lattner
8acab89631 Fix deprecated operator[] warnings
llvm-svn: 11577
2004-02-18 16:38:18 +00:00
Alkis Evlogimenos
c394f7803b Be more agressive when joining ranges.
llvm-svn: 11575
2004-02-18 04:38:37 +00:00
Alkis Evlogimenos
5c90efed55 Fix overly conservative spill interval computation.
llvm-svn: 11574
2004-02-18 03:35:38 +00:00
Alkis Evlogimenos
7290ef1f5c Beautify debug output.
llvm-svn: 11573
2004-02-18 00:35:06 +00:00
Chris Lattner
ea22a3de13 Remove the -disable-kill option. The register allocator is buggy with it,
and it was only for debugging in the first place.

llvm-svn: 11557
2004-02-17 17:49:10 +00:00
Chris Lattner
a4e0020e54 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.

llvm-svn: 11542
2004-02-17 08:09:40 +00:00
Chris Lattner
f93308ec17 Fix a bug in my previous refactoring change... arg!
llvm-svn: 11535
2004-02-17 07:02:17 +00:00
Chris Lattner
bb0cfb0429 Once we have a way to fold spill code reloads into instructions, we have a way to use it. :)
llvm-svn: 11517
2004-02-17 04:08:37 +00:00
Alkis Evlogimenos
c6ea9a6b65 Fix spilled interval update. It was too conservative.
llvm-svn: 11516
2004-02-17 04:04:20 +00:00
Chris Lattner
7b3342d814 Refactor code a bit. No functionality changes, though the comment hints at things to come.
llvm-svn: 11515
2004-02-17 03:57:19 +00:00
Alkis Evlogimenos
790b000aa7 Add LeakDetection to MachineInstr.
Move out of line member functions of MachineBasicBlock to
MachineBasicBlock.cpp.

llvm-svn: 11497
2004-02-16 07:17:43 +00:00
Alkis Evlogimenos
4a2e2b54f6 This pass should not require phi elimination or live variable
analysis. It should only preserve them and update LiveVariables if it
already ran.

llvm-svn: 11479
2004-02-15 21:50:32 +00:00
Chris Lattner
787d6b86e3 Finegrainify namespacification
Remove one of the operands of a two operand instruction

llvm-svn: 11478
2004-02-15 21:38:28 +00:00
Alkis Evlogimenos
84318d7bb6 Make dense maps keyed on physical registers smallerusing
MRegisterInfo::getNumRegs() instead of
MRegisterInfo::FirstVirtualRegister.

Also use MRegisterInfo::is{Physical,Virtual}Register where
appropriate.

llvm-svn: 11477
2004-02-15 21:37:17 +00:00
Alkis Evlogimenos
1026a01d5a Eliminate the use of spill (reserved) registers.
llvm-svn: 11476
2004-02-15 10:24:21 +00:00
Chris Lattner
18c5e0065f Allow for fixed objects to reside in the local area, and if they don't to not
clobber them by allocating other objects in the same space!

llvm-svn: 11454
2004-02-15 00:14:20 +00:00