Alkis Evlogimenos
6623cd78f9
Spill explicit physical register defs as well.
...
llvm-svn: 12260
2004-03-09 08:35:13 +00:00
Alkis Evlogimenos
cb98644e9b
As I wrote in the docs, simple is the default spiller :-)
...
llvm-svn: 12189
2004-03-06 23:08:44 +00:00
Alkis Evlogimenos
79850121ad
Add simple spiller.
...
llvm-svn: 12188
2004-03-06 22:38:29 +00:00
Brian Gaeke
015972103d
Make MachineOperand's value named 'contents'. Make really, really sure
...
it is always completely initialized and copied.
Also, fix up many comments and asserts.
llvm-svn: 12100
2004-03-03 19:07:27 +00:00
Alkis Evlogimenos
31953c7a10
Add a spiller option to llc. A simple spiller will come soon. When we get CFG in the machine code represenation a global spiller will also be possible. Also document the linear scan register allocator but mark it as experimental for now.
...
llvm-svn: 12062
2004-03-01 23:18:15 +00:00
Alkis Evlogimenos
b76d234ee9
Add the long awaited memory operand folding support for linear scan
...
llvm-svn: 12058
2004-03-01 20:05:10 +00:00
Brian Gaeke
427cec1395
TargetCacheInfo has been removed; its only uses were to propagate a constant
...
(16) into certain areas of the SPARC V9 back-end. I'm fairly sure the US IIIi's
dcache has 32-byte lines, so I'm not sure where the 16 came from. However, in
the interest of not breaking things any more than they already are, I'm going
to leave the constant alone.
llvm-svn: 12043
2004-03-01 06:43:29 +00:00
Tanya Lattner
48a503be04
Adding new Modulo Scheduling graph files.
...
llvm-svn: 12031
2004-03-01 02:50:57 +00:00
Tanya Lattner
dd10fbe775
Removing old graph files with new graph files that I wrote. Updated ModuloScheduling pass, but still in progress.
...
llvm-svn: 12030
2004-03-01 02:50:01 +00:00
Chris Lattner
604cc83933
Add an assert
...
llvm-svn: 12010
2004-02-29 22:01:51 +00:00
Chris Lattner
e0c3c18802
Add back #include I messed up
...
llvm-svn: 12009
2004-02-29 21:40:53 +00:00
Chris Lattner
90ecb92838
Urg, forgot to check this in.
...
llvm-svn: 12007
2004-02-29 21:03:08 +00:00
Chris Lattner
3859031b9b
Move the private MachineInstrAnnot.h into a private directory.
...
llvm-svn: 12003
2004-02-29 19:12:51 +00:00
Chris Lattner
d5a49c477d
Remove use of an ugly header
...
llvm-svn: 12002
2004-02-29 19:04:31 +00:00
Chris Lattner
6194ee84ba
Move methods out of .h file
...
llvm-svn: 12001
2004-02-29 19:02:39 +00:00
Chris Lattner
f20abac9bc
Eliminate the distinction between "real" and "unreal" instructions
...
llvm-svn: 11986
2004-02-29 06:31:16 +00:00
Chris Lattner
44b1b22a2d
int64_t -> int
...
llvm-svn: 11977
2004-02-29 05:07:02 +00:00
Alkis Evlogimenos
e669caafe0
Rename member function to be consistent with the rest.
...
llvm-svn: 11898
2004-02-27 06:11:15 +00:00
Alkis Evlogimenos
941f9310bb
Make spiller push stores right after the definition of a register so
...
that they are as far away from the loads as possible.
llvm-svn: 11895
2004-02-27 04:51:35 +00:00
Alkis Evlogimenos
519e1e8c92
Fix crash caused by passing register 0 to
...
MRegisterInfo::isPhysicalRegister().
llvm-svn: 11894
2004-02-27 01:52:34 +00:00
Alkis Evlogimenos
5a3bab9402
Clear maps right after basic block is processed.
...
llvm-svn: 11892
2004-02-26 23:22:23 +00:00
Alkis Evlogimenos
61719d48d2
Uncomment assertions that register# != 0 on calls to
...
MRegisterInfo::is{Physical,Virtual}Register. Apply appropriate fixes
to relevant files.
llvm-svn: 11882
2004-02-26 22:00:20 +00:00
Chris Lattner
28a0885929
No need to clear the map here, it will always be empty
...
llvm-svn: 11868
2004-02-26 05:21:21 +00:00
Alkis Evlogimenos
e62ddd405d
Fix bugs found with recent addition of assertions in
...
MRegisterInfo::is{Physical,Virtual}Register.
llvm-svn: 11849
2004-02-25 23:21:52 +00:00
Brian Gaeke
84b76c9be0
Great sparc renaming fallout IV: Sparc --> SparcV9.
...
llvm-svn: 11844
2004-02-25 22:09:36 +00:00
Alkis Evlogimenos
a9f03fba9d
Remove asssert since it is breaking cases that it shouldn't.
...
llvm-svn: 11841
2004-02-25 22:01:06 +00:00
Alkis Evlogimenos
d8bace7f60
Add DenseMap template and actually use it for for mapping virtual regs
...
to objects.
llvm-svn: 11840
2004-02-25 21:55:45 +00:00
Chris Lattner
f5a393a133
Add an assertion
...
llvm-svn: 11830
2004-02-25 19:37:44 +00:00
Brian Gaeke
10a32da382
FunctionLiveVarInfo.h moved: include/llvm/CodeGen -> lib/Target/Sparc/LiveVar
...
llvm-svn: 11804
2004-02-24 19:46:00 +00:00
Alkis Evlogimenos
1dd872ce94
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.
llvm-svn: 11798
2004-02-24 08:58:30 +00:00
Alkis Evlogimenos
63aea0b6a5
Add predicates for checking if a virtual register has a physical
...
register mapping or a stack slot mapping.
llvm-svn: 11795
2004-02-24 06:30:36 +00:00
Alkis Evlogimenos
8b571a64ac
Make enum private as it is an implementation detail.
...
llvm-svn: 11782
2004-02-23 23:49:40 +00:00
Alkis Evlogimenos
ab77b05d8c
Remove '4Virt' from member function names as it is obvious.
...
llvm-svn: 11781
2004-02-23 23:47:10 +00:00
Alkis Evlogimenos
c794a9060f
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
52de9e214c
Add number of spilled registers statistic.
...
llvm-svn: 11759
2004-02-23 18:45:32 +00:00
Chris Lattner
91a7dc0a6e
Fix bugs in finegrainification
...
llvm-svn: 11758
2004-02-23 18:40:08 +00:00
Chris Lattner
43df6c268b
Finegrainify namespacification
...
llvm-svn: 11757
2004-02-23 18:38:20 +00:00
Alkis Evlogimenos
b525d54045
Use MachineBasicBlock::getParent().
...
llvm-svn: 11756
2004-02-23 18:36:38 +00:00
Alkis Evlogimenos
d780ce6462
Remove implementation of default constructor as it is useless now.
...
llvm-svn: 11755
2004-02-23 18:28:35 +00:00
Alkis Evlogimenos
af2de4848e
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
f83cb74b57
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
c31ff795d5
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
887b941fbb
Some code cleanups from Chris
...
llvm-svn: 11724
2004-02-23 01:57:39 +00:00
Alkis Evlogimenos
d42c2f24ec
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
4d7ad6713d
Move LiveIntervals.h up to be the first included header
...
llvm-svn: 11721
2004-02-23 01:01:21 +00:00
Alkis Evlogimenos
1410859484
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
486b12b71a
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
19aef9e757
Another bug fix for empty MBB's
...
llvm-svn: 11716
2004-02-22 19:37:31 +00:00
Chris Lattner
84b406650e
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
cb352300c9
Print basic block boundaries in machine instruction debug output.
...
llvm-svn: 11704
2004-02-22 05:46:04 +00:00
Alkis Evlogimenos
d890f59f19
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
334114bdf1
Make 'fold' statistic's description the same in both allocators.
...
llvm-svn: 11687
2004-02-21 18:07:33 +00:00
Alkis Evlogimenos
6ad63f8da2
Some more statistics improvements.
...
llvm-svn: 11676
2004-02-20 20:53:26 +00:00
Alkis Evlogimenos
71751de25c
Disambiguate statistic descriptions.
...
llvm-svn: 11675
2004-02-20 20:46:49 +00:00
Alkis Evlogimenos
f3e77fb7a7
Rename statistic and add another one.
...
llvm-svn: 11674
2004-02-20 20:43:08 +00:00
Alkis Evlogimenos
22de21ea80
Fix crash in debug output.
...
llvm-svn: 11659
2004-02-20 06:41:12 +00:00
Alkis Evlogimenos
bcc99a83ee
Fix instruction numbering in debug output.
...
llvm-svn: 11655
2004-02-20 06:29:51 +00:00
Alkis Evlogimenos
76eca062ea
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
3cf546037e
Fix RA::verifyAssignment()
...
llvm-svn: 11629
2004-02-19 19:24:17 +00:00
Chris Lattner
f5c5e1f458
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
4c988391e1
Fix an iterator invalidation problem. :(
...
llvm-svn: 11627
2004-02-19 18:32:29 +00:00
Chris Lattner
afa9d7eb85
Add method to update livevar when an instruction moves
...
llvm-svn: 11625
2004-02-19 18:28:02 +00:00
Chris Lattner
63f41abfe6
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
d23a882f2f
Add a MachineBasicBlock::getParent() method
...
llvm-svn: 11622
2004-02-19 16:13:54 +00:00
Alkis Evlogimenos
d0a60b71fc
Rename reloads/spills to loads/stores.
...
llvm-svn: 11619
2004-02-19 06:19:09 +00:00
Alkis Evlogimenos
b490a12501
Implement assignment correctness verification.
...
llvm-svn: 11609
2004-02-18 23:15:23 +00:00
Chris Lattner
83398e5574
Eliminate operator[] is deprecated warnings
...
llvm-svn: 11578
2004-02-18 16:43:51 +00:00
Chris Lattner
e99a833c20
Fix deprecated operator[] warnings
...
llvm-svn: 11577
2004-02-18 16:38:18 +00:00
Alkis Evlogimenos
7bef0eafc0
Be more agressive when joining ranges.
...
llvm-svn: 11575
2004-02-18 04:38:37 +00:00
Alkis Evlogimenos
739e5e33d7
Fix overly conservative spill interval computation.
...
llvm-svn: 11574
2004-02-18 03:35:38 +00:00
Alkis Evlogimenos
26583db8b6
Beautify debug output.
...
llvm-svn: 11573
2004-02-18 00:35:06 +00:00
Chris Lattner
3d894dd3ab
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
4e21b2352c
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
d1289d0fcd
Fix a bug in my previous refactoring change... arg!
...
llvm-svn: 11535
2004-02-17 07:02:17 +00:00
Chris Lattner
ba9e3e2fb1
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
4f7c2d9e5e
Fix spilled interval update. It was too conservative.
...
llvm-svn: 11516
2004-02-17 04:04:20 +00:00
Chris Lattner
ddedac59fe
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
14f3fe81c6
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
e27f33f00e
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
a8d97e4e74
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
bbf53937a4
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
2c5ddd20ba
Eliminate the use of spill (reserved) registers.
...
llvm-svn: 11476
2004-02-15 10:24:21 +00:00
Chris Lattner
1dfa97034d
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
Alkis Evlogimenos
6a35516dcc
Add back machine code deleter pass until we get a MachineCode pass
...
that will be responsible for the creation of MachineFunctions and will
be required by all MachineFunctionPass passes.
llvm-svn: 11453
2004-02-15 00:03:15 +00:00
Chris Lattner
612ce0c47c
There is no reason to align the stack pointer if there are no callees of this function!
...
llvm-svn: 11449
2004-02-14 20:10:59 +00:00
Alkis Evlogimenos
5a92240270
Use newly added next() and prior() utility functions.
...
llvm-svn: 11430
2004-02-14 01:18:34 +00:00
Alkis Evlogimenos
ddcb4ad53e
Use std::numeric_limits<float>::infinity() instead of
...
std::numeric_limits<float>::max() for weighting preallocated
intervals.
llvm-svn: 11427
2004-02-14 00:44:07 +00:00
Alkis Evlogimenos
8cdd0215bf
Remove getAllocatedRegNum(). Use getReg() instead.
...
llvm-svn: 11393
2004-02-13 21:01:20 +00:00
Alkis Evlogimenos
de6a381691
Use getNumVirtualRegs().
...
Whitespace cleanups.
llvm-svn: 11389
2004-02-13 18:20:47 +00:00
Brian Gaeke
52440fd481
Refactor MachineFunction::print() into MachineBasicBlock::print().
...
Add MachineBasicBlock::dump().
llvm-svn: 11364
2004-02-13 04:39:55 +00:00
Brian Gaeke
e8f7c2f863
Add head-of-file comments and Doxygen comments. Tighten up a lot of whitespace.
...
Rename SetMachineOperandConst's formal parameters to match other methods here.
Mark some methods as being used only by the SPARC back-end.
Fix a missing-paren bug in OutputValue().
llvm-svn: 11363
2004-02-13 04:39:32 +00:00
Alkis Evlogimenos
de8ac749fe
Add parent pointer to MachineInstr that points to owning
...
MachineBasicBlock. Also change opcode to a short and numImplicitRefs
to an unsigned char so that overall MachineInstr's size stays the
same.
llvm-svn: 11357
2004-02-12 18:49:07 +00:00
Chris Lattner
6a597d6057
Rename the opCode instance variable to Opcode
...
llvm-svn: 11348
2004-02-12 16:09:53 +00:00
Chris Lattner
6108d9d5ee
This field is never read
...
llvm-svn: 11346
2004-02-12 16:04:49 +00:00
Alkis Evlogimenos
80da865f77
Change MachineBasicBlock's vector of MachineInstr pointers into an
...
ilist of MachineInstr objects. This allows constant time removal and
insertion of MachineInstr instances from anywhere in each
MachineBasicBlock. It also allows for constant time splicing of
MachineInstrs into or out of MachineBasicBlocks.
llvm-svn: 11340
2004-02-12 02:27:10 +00:00
Brian Gaeke
0c3de446f6
getOpCode() --> getOpcode().
...
llvm-svn: 11339
2004-02-12 01:34:05 +00:00
Chris Lattner
b21ec54e61
Add #include
...
llvm-svn: 11285
2004-02-10 21:18:55 +00:00
Chris Lattner
5dd5be3ec3
Do not use MachineOperand::isVirtualRegister either!
...
llvm-svn: 11283
2004-02-10 21:12:22 +00:00
Chris Lattner
373fba5c1d
Eliminate users of MachineOperand::isPhysicalRegister
...
llvm-svn: 11278
2004-02-10 20:41:10 +00:00
Brian Gaeke
2e1cbb735d
Move InstrSchedule's iterator begin/end methods inline.
...
llvm-svn: 11239
2004-02-09 18:42:46 +00:00