Alkis Evlogimenos
1cae25921d
Use reverse iterators when updating the vector, since scanning from
...
the end will reduce erase() runtimes.
llvm-svn: 15093
2004-07-22 02:16:53 +00:00
Chris Lattner
25dd6b0a24
That funny 2-address lowering pass can also cause multiple definitions,
...
fortunately, they are easy to handle if we know about them. This patch fixes
some serious pessimization of code produced by the linscan register allocator.
llvm-svn: 15092
2004-07-22 00:04:14 +00:00
Chris Lattner
eb21652fba
Minor cleanups
...
llvm-svn: 15091
2004-07-21 23:17:57 +00:00
Brian Gaeke
f18cdca667
These files don't need to include <iostream> since they include "Support/Debug.h".
...
llvm-svn: 15089
2004-07-21 20:50:33 +00:00
Alkis Evlogimenos
40d8d044fe
Fix analysis name.
...
llvm-svn: 15078
2004-07-21 17:23:44 +00:00
Alkis Evlogimenos
183f8af791
Clear spilled list at once. Remove unused vector.
...
llvm-svn: 15073
2004-07-21 12:00:10 +00:00
Alkis Evlogimenos
c767432a26
Change std::list into a std::vector for IntervalSets. This reduces
...
compile time for 176.gcc from 5.6 secs to 4.7 secs.
llvm-svn: 15072
2004-07-21 09:46:55 +00:00
Alkis Evlogimenos
8a162136e1
Improve file comment.
...
llvm-svn: 15069
2004-07-21 08:28:39 +00:00
Alkis Evlogimenos
b5f60641f4
Add Iterative scan register allocator.
...
llvm-svn: 15068
2004-07-21 08:24:35 +00:00
Alkis Evlogimenos
75dbcf6d06
Linearscan is no longer experimental.
...
llvm-svn: 15067
2004-07-21 08:18:50 +00:00
Alkis Evlogimenos
cb3b2fc439
Add function to clear all virtual->physical mappings but not assigned
...
stack slots. This is in preparation for the iterative linear scan.
llvm-svn: 15032
2004-07-20 13:28:17 +00:00
Alkis Evlogimenos
89ae43ca19
Remove unneeded functor. LiveInterval has a < operator.
...
llvm-svn: 15031
2004-07-20 10:20:03 +00:00
Alkis Evlogimenos
25fb592aa6
Remove dead code.
...
llvm-svn: 15011
2004-07-19 23:35:55 +00:00
Chris Lattner
c07b7fff45
Fix a bug that occurs when the last instruction in a range is dead
...
llvm-svn: 15005
2004-07-19 15:16:53 +00:00
Chris Lattner
bc53c119ac
When joining intervals, join intervals in deeply nested loops first. This
...
is a simple change, but seems to improve code a little. For example, on
256.bzip2, we went from 75.0s -> 73.33s (2% speedup).
llvm-svn: 15004
2004-07-19 14:40:29 +00:00
Chris Lattner
997f36e53f
Split joinIntervals into two methods
...
llvm-svn: 15003
2004-07-19 14:08:10 +00:00
Chris Lattner
22728e2f27
There is no need to store the MBB along with the MI any more, we can now
...
ask instructions for their parent.
llvm-svn: 14998
2004-07-19 07:04:55 +00:00
Chris Lattner
6c34920110
Simplify the interface to LiveVariables::addVirtualRegister(Killed|Dead)
...
llvm-svn: 14997
2004-07-19 06:55:21 +00:00
Chris Lattner
53fa752649
Remove the DefBlock element of VarInfo. DefBlock is always DefInst->getParent()
...
llvm-svn: 14996
2004-07-19 06:26:50 +00:00
Chris Lattner
e7104f6f7b
Two changes, both very significant:
...
* vreg <-> vreg joining now works, enable it unconditionally when joining
is enabled (which is the default).
* Fix a serious pessimization of spill code where we were saying that a
spilled DEF operand was live into the subsequent instruction. This allows
for substantially better code when spilling starts to happen.
llvm-svn: 14993
2004-07-19 05:55:50 +00:00
Chris Lattner
70d06b5c25
See comments. The live intervals were not coming out of the spiller in sorted
...
order, causing the inactive list in the linearscan list to get unsorted, which
basically fuxored everything up severely.
These seems to fix the joiner, so with more testing I will enable it by default.
llvm-svn: 14992
2004-07-19 05:15:10 +00:00
Chris Lattner
f5bdaf62f8
Fix assertion to not dereference end!
...
llvm-svn: 14991
2004-07-19 05:02:09 +00:00
Chris Lattner
42b44d3d1c
Add some asserts that the list of intervals returned by addIntervalsForSpills
...
is sorted. This is not the case currently, which is causing no end of
problems.
llvm-svn: 14990
2004-07-19 04:47:36 +00:00
Chris Lattner
10caeead75
remove the mbbi2mbbMap_, which was just keeping track of mbb order anyway.
...
Heavily refactor handleVirtualRegisterDef, adding comments and making it more
efficient. It is also much easier to follow and convince ones self that it is
correct :)
Add -debug output to the joine, showing the result of joining the intervals.
llvm-svn: 14989
2004-07-19 02:15:56 +00:00
Chris Lattner
caba8651cd
fill comment to 80 cols
...
remove map that is not needed
llvm-svn: 14988
2004-07-19 02:13:59 +00:00
Chris Lattner
a2b1dbead8
It looks like physref->virtreg joining is working fine. Enable it by default
...
but make virtreg->virtreg joining stay off by default
llvm-svn: 14916
2004-07-17 21:51:25 +00:00
Chris Lattner
c014005d53
Fix IA64 compatibility
...
llvm-svn: 14866
2004-07-16 00:06:01 +00:00
Chris Lattner
53c9460cde
Use new macro
...
llvm-svn: 14865
2004-07-16 00:04:54 +00:00
Chris Lattner
47c6a06211
Fix for PR341
...
llvm-svn: 14845
2004-07-15 02:40:04 +00:00
Chris Lattner
456583c52c
Add checks to ensure that there are no unreachable blocks in the function
...
llvm-svn: 14725
2004-07-09 16:44:37 +00:00
Misha Brukman
abbe59490b
* Doxygenify comments
...
* Fix spacing, grammar in comment
* Make code layout consistent
* Wrap code at 80 cols
* Delete spurious blank lines
No functional changes.
llvm-svn: 14721
2004-07-09 14:45:17 +00:00
Alkis Evlogimenos
d8e8396e33
Fix typo.
...
llvm-svn: 14720
2004-07-09 11:25:27 +00:00
Alkis Evlogimenos
57839c592a
Improve code comments.
...
llvm-svn: 14719
2004-07-09 11:10:00 +00:00
Alkis Evlogimenos
e7e19f771f
Add viewCFG() and viewCFGOnly() APIs.
...
llvm-svn: 14679
2004-07-08 00:47:58 +00:00
Alkis Evlogimenos
51dda289a7
Disable coalescing.
...
llvm-svn: 14655
2004-07-07 02:03:12 +00:00
Alkis Evlogimenos
e0c8d140a9
Do not crash when joining two intervals of registers of different
...
classes: just ignore that move. Thanks to Vladimir Prus who found the
bug!
llvm-svn: 14644
2004-07-06 16:03:21 +00:00
Chris Lattner
d450ccbc91
Fix a bug in the unreachable block elim pass. Dropping all references on a
...
basic block clear()'s all of the operands lists, including phis. This
caused removePredecessor to get confused later. Because of this, we just
nuke (without prejudice) PHI nodes in unreachable blocks.
llvm-svn: 14635
2004-07-06 06:36:11 +00:00
Alkis Evlogimenos
69ea68d4b6
Correctly compute the ration of iterations/#intervals.
...
llvm-svn: 14626
2004-07-04 17:23:35 +00:00
Reid Spencer
50ec3f9325
Add #include <iostream> since Value.h does not #include it any more.
...
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Alkis Evlogimenos
8ff35c1ce8
Add efficiency statistic.
...
llvm-svn: 14590
2004-07-04 07:59:06 +00:00
Chris Lattner
5b96ed7d1b
Revert patches 1.79 and 1.80 which had to do with dead MBB's. Now that they
...
don't exist, we don't have to pretend to handle them.
llvm-svn: 14567
2004-07-02 05:52:23 +00:00
Chris Lattner
1e20aefbcb
Add a trivially simple pass to delete unreachable blocks from the CFG. This
...
pass is required to paper over problems in the code generator (primarily
live variables and its clients) which doesn't really have any well defined
semantics for unreachable code.
The proper solution to this problem is to have instruction selectors not
select blocks that are unreachable. Until we have a instruction selection
framework available for use, however, we can't expect all instruction
selector writers to do this. Until then, this pass should be used.
llvm-svn: 14563
2004-07-02 05:46:10 +00:00
Chris Lattner
91662f48b8
Make sure that we destroy the MBB's, with all of their instructions, before
...
any other data structures
llvm-svn: 14524
2004-07-01 06:29:07 +00:00
Chris Lattner
93bf3a5985
Now that MachineFunction/MachineBasicBlock keep a mapping of blocks to ID #'s
...
use them instead of a local LiveVariables numbering
llvm-svn: 14523
2004-07-01 06:15:32 +00:00
Chris Lattner
43e765d61c
Change MBB autonumber a bit to get the reverse mapping as well as a forward
...
mapping
llvm-svn: 14521
2004-07-01 06:02:27 +00:00
Chris Lattner
a2481b7e82
Instance var no longer exists
...
llvm-svn: 14520
2004-07-01 06:02:07 +00:00
Chris Lattner
ae4f21e30a
Start using MBB numbers directly instead of going through the live variables
...
map.
llvm-svn: 14518
2004-07-01 04:29:47 +00:00
Chris Lattner
0bb956cda7
Instead of building a private numbering of MBB's use brg's nifty auto-numbering.
...
Also convert df_iterator -> df_ext_iterator for subsequent stuff I'm doing.
llvm-svn: 14517
2004-07-01 04:24:29 +00:00
Chris Lattner
41c3157c70
In line with the previous patch, do not assert out if analyzing a dead basic block.
...
llvm-svn: 14475
2004-06-29 07:16:23 +00:00
Chris Lattner
27c176234c
Do not dereference end iterators. It hurts when you do that.
...
llvm-svn: 14474
2004-06-29 06:56:51 +00:00
Chris Lattner
fd25f66f50
Do not find these ugly sparc-specific objects by using the annotation API on
...
instructions. Instead, keep a map of instructions -> MCFI objects in the
already sparc-specific class MachineFunctionInfo. This will slow down the
sparc backend a bit, but it does not penalize the rest of LLVM!
llvm-svn: 14438
2004-06-27 18:52:17 +00:00
Tanya Lattner
da38dc5180
Made a fix so that you can print out MachineInstrs that belong to a MachineBasicBlock that is not yet attached to a MachineFunction. This change includes changing the third operand (TargetMachine) to a pointer for the MachineInstr::print function.
...
llvm-svn: 14389
2004-06-25 00:13:11 +00:00
Misha Brukman
0a98455ab9
Convert tabs to spaces.
...
llvm-svn: 14373
2004-06-24 21:31:16 +00:00
Misha Brukman
f1da4cac4b
Making an archive version of the CodeGen library is unnecessary if we just
...
move InstructionLowering itself.
llvm-svn: 14324
2004-06-22 17:52:30 +00:00
Misha Brukman
261c779bd6
Provide archive version of CodeGen library (for those tools that only need
...
IntrinsicLowering, for instance).
llvm-svn: 14323
2004-06-22 17:28:43 +00:00
Chris Lattner
6be1c456a8
Rename Interval class to LiveInterval to avoid conflicting with the already
...
existing llvm::Interval class.
Patch contributed by Vladimir Prus!
http://mail.cs.uiuc.edu/pipermail/llvmbugs/2004-June/000710.html
llvm-svn: 14281
2004-06-21 13:10:56 +00:00
Chris Lattner
cc465361d9
Move the IntrinsicLowering header into the CodeGen directory, as per PR346
...
llvm-svn: 14266
2004-06-20 07:49:54 +00:00
Brian Gaeke
6f6eb93de3
Make debugging dumps w/ multiple MachineBBs for a given LLVM BB readable.
...
llvm-svn: 14205
2004-06-17 22:26:53 +00:00
Chris Lattner
0cd29ae2cd
Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
...
llvm-svn: 14201
2004-06-17 18:19:28 +00:00
Chris Lattner
1b8f37597d
Fix a recent regression in Applications/sgefa that Alkis pointed out to me.
...
The vector may actually be empty if the register that we are marking as
recently used is not actually allocatable. This happens for physical registers
that are not allocatable, like the ST(x) registers on X86.
llvm-svn: 14195
2004-06-16 06:57:29 +00:00
Chris Lattner
84269aa91e
Fix fallout from getOffsetOfLocalArea() being negated. Debugging dumps were being
...
printed incorrectly, and we were reserving 8 extra bytes of stack space for functions
on X86.
llvm-svn: 14152
2004-06-11 06:37:11 +00:00
Chris Lattner
71f351ddf9
Fix the prolog epilog code inserter to match the documentation and support
...
targets whose stack grows up.
Patch contributed by Vladimir Prus
llvm-svn: 14111
2004-06-10 06:23:35 +00:00
Chris Lattner
a764d77ed3
Oops, this was not to go in
...
llvm-svn: 13958
2004-06-02 06:06:45 +00:00
Chris Lattner
ee2687a351
Adjust to the new TargetMachine interface
...
llvm-svn: 13957
2004-06-02 06:06:20 +00:00
Chris Lattner
0046ea7105
Adjust to new TargetMachine interface
...
llvm-svn: 13956
2004-06-02 05:57:12 +00:00
Chris Lattner
1dbe919e91
Inline findOptimalStorageSize into it's caller, both of which are sparc specific
...
llvm-svn: 13955
2004-06-02 05:56:52 +00:00
Chris Lattner
7d6b37af05
Finegrainify namespacification
...
llvm-svn: 13948
2004-06-02 04:28:06 +00:00
Chris Lattner
98a6bb89cf
Fix a trivial but blatant bug
...
llvm-svn: 13947
2004-06-02 03:57:43 +00:00
Alkis Evlogimenos
f410424283
Pull Interval class out of LiveIntervals.
...
llvm-svn: 13910
2004-05-30 07:46:27 +00:00
Alkis Evlogimenos
2598a63586
When spilling an register, introduce a new temporary for each of its
...
spills. This allows for more flexibility when allocating registers for
spill code.
llvm-svn: 13907
2004-05-30 07:24:39 +00:00
Brian Gaeke
2281858cf6
Fix typo in head-of-file comment.
...
llvm-svn: 13903
2004-05-30 03:33:48 +00:00
Alkis Evlogimenos
516e16441b
Add method to assign stack slot to virtual register without creating a
...
new one.
llvm-svn: 13895
2004-05-29 20:38:05 +00:00
Alkis Evlogimenos
c5923ac8b1
Add grow() member that grows the maps when the number of virtual
...
registers in the function has changed.
llvm-svn: 13893
2004-05-29 19:03:29 +00:00
Alkis Evlogimenos
d50a5109ff
Remove defs vector from live intervals.
...
llvm-svn: 13892
2004-05-29 16:18:57 +00:00
Tanya Lattner
a275dfcce4
updates to ModuloSched
...
llvm-svn: 13881
2004-05-28 20:14:12 +00:00
Tanya Lattner
8c5d9dcc42
Adding scheduling class.
...
llvm-svn: 13783
2004-05-26 06:27:36 +00:00
Tanya Lattner
bd1298d574
Updating my cvs versions. THis is still in progress and much will be changed.
...
llvm-svn: 13782
2004-05-26 06:27:18 +00:00
Tanya Lattner
7cf16701f7
Moved MachineBasicBlock deconstructor to cpp file and removed it from LeakDetector to fix memory leak bug.
...
llvm-svn: 13718
2004-05-24 07:14:35 +00:00
Tanya Lattner
aabaaec037
Added MachineFunction parent* to MachineBasicBlock. Customized ilist template
...
to set the parent when a MachineBasicBlock is added to a MachineFunction.
llvm-svn: 13716
2004-05-24 06:11:51 +00:00
Chris Lattner
f38d51ea42
Eliminate an explicit use of the LLVM basic block, using getParent instead,
...
which simplifies the code
llvm-svn: 13707
2004-05-24 03:44:52 +00:00
Tanya Lattner
55477a5af1
Changed clone to be const.
...
Changed copy constructor to set parent, prev, and next pointers to null.
llvm-svn: 13706
2004-05-24 03:14:18 +00:00
Tanya Lattner
e755fc6689
Fixed up my changes to add support for cloning Machine Instructions.
...
llvm-svn: 13665
2004-05-23 20:58:02 +00:00
Tanya Lattner
2848065a29
Adding support to clone MachineInstr
...
llvm-svn: 13661
2004-05-23 19:35:12 +00:00
Chris Lattner
f29acd5214
Fix a really nasty bug from my changes on Monday to PHIElim. These changes
...
broke obsequi and a lot of other things. It all boiled down to MBB being
overloaded in an inner scope and me confusing it with the one in the outer
scope. Ugh!
llvm-svn: 13517
2004-05-12 21:47:57 +00:00
Brian Gaeke
79c7de0723
Start NextMBBNumber out at zero.
...
llvm-svn: 13515
2004-05-12 21:35:23 +00:00
Brian Gaeke
6009468edd
Add non-const MachineBasicBlock::getParent() accessor method.
...
MBBs start out as #-1. When a MBB is added to a MachineFunction, it
gets the next available unique MBB number. If it is removed from a
MachineFunction, it goes back to being #-1.
llvm-svn: 13514
2004-05-12 21:35:22 +00:00
Chris Lattner
279d8e8e2d
Switch this from using an std::map to using a DenseMap. This speeds up
...
phi-elimination from 0.6 to 0.54s on kc++.
llvm-svn: 13454
2004-05-10 19:17:36 +00:00
Chris Lattner
3fb5488b5e
Use a new VRegPHIUseCount to compute uses of PHI values by other phi values
...
in the basic block being processed. This fixes PhiElimination on kimwitu++
from taking 105s to taking a much more reasonable 0.6s (in a debug build).
llvm-svn: 13453
2004-05-10 19:06:37 +00:00
Chris Lattner
8b57a31ff4
Now that we use an ilist of machine instructions, iterators are more robust
...
than before. Because this is the case, we can compute the first non-phi
instruction once when de-phi'ing a block. This shaves ~4s off of
phielimination of _Z7yyparsev in kimwitu++ from 109s -> 105s. There are
still much more important gains to come.
llvm-svn: 13452
2004-05-10 18:47:18 +00:00
Chris Lattner
b37490a331
Patch to fix PR337. Make sure to mark all aliased physical registers as used
...
when we see a read of a register. This is important in cases like:
AL = ...
AH = ...
= AX
The read of AX must make both the AL and AH defs live until the use.
llvm-svn: 13444
2004-05-10 05:12:43 +00:00
Tanya Lattner
57339f67d6
Updating my versions of ModuloScheduling in cvs. Still not complete.
...
llvm-svn: 13424
2004-05-08 16:12:10 +00:00
Alkis Evlogimenos
76be543a64
Add required header
...
llvm-svn: 13417
2004-05-08 03:50:03 +00:00
Alkis Evlogimenos
6022169db7
Remove unneeded header
...
llvm-svn: 13416
2004-05-08 03:49:35 +00:00
Chris Lattner
5f18bec9e6
numeric_limits::infinity() apparently does not work on all systems. As a
...
workaround, use the C HUGE_VAL macro instead.
llvm-svn: 13377
2004-05-06 16:25:59 +00:00
Chris Lattner
c09a94de9e
Operate on the Machine CFG instead of on the LLVM CFG
...
llvm-svn: 13302
2004-05-01 21:24:39 +00:00
Chris Lattner
769668c09a
Stop LiveVariables from using BasicBlocks as part of the mapping, instead
...
use MachineBasicBlocks. To do this, we traverse the Machine CFG instead of
the LLVM CFG, which is also *MUCH* more efficient by having fewer levels of
indirections and mappings.
llvm-svn: 13301
2004-05-01 21:24:24 +00:00
Brian Gaeke
1b07a2282a
Include SparcV9RegInfo.h instead of TargetRegInfo.h. This serves as a bit of
...
documentation that this module needs to be made independent of the
register file description of the current target.
llvm-svn: 13125
2004-04-23 18:15:46 +00:00
Brian Gaeke
bc25b3b28a
Implement emitWordAt() for the debug emitter and the file printer emitter. (I
...
am not so sure about the file printer emitter, but the debug emitter change
should be harmless.)
llvm-svn: 13117
2004-04-23 17:11:13 +00:00
Alkis Evlogimenos
40d8a6802b
Fix bug introduced in previous commit.
...
llvm-svn: 12872
2004-04-12 20:26:39 +00:00
Alkis Evlogimenos
38984637d9
Correctly compute spill weights
...
llvm-svn: 12869
2004-04-12 17:39:20 +00:00
Alkis Evlogimenos
bb422833e4
Print def lists a bit more compactly
...
llvm-svn: 12866
2004-04-12 15:57:58 +00:00
Alkis Evlogimenos
f66a23d573
Add definition list to each live interval.
...
llvm-svn: 12791
2004-04-09 18:07:57 +00:00
Chris Lattner
bfe4dd0f90
MBB::remove should not modify the iterator passed in
...
llvm-svn: 12572
2004-03-31 21:59:59 +00:00
Chris Lattner
2cc4a29665
MachineBasicBlock::remove should not modify the iterator passed in
...
llvm-svn: 12571
2004-03-31 21:59:29 +00:00
Alkis Evlogimenos
45cb0b871d
Correctly update LiveVariables when an instruction changes
...
llvm-svn: 12561
2004-03-30 22:44:39 +00:00
Brian Gaeke
27be9eb265
Change how the beginnings and ends of MachineFunctions are printed. Get
...
rid of the funny cast.
llvm-svn: 12537
2004-03-29 21:58:31 +00:00
Alkis Evlogimenos
81c6957eab
Make the set of fixed (preallocated) intervals be a fixed superset of
...
unhandled + handled. So unhandled is now including all fixed intervals
and fixed intervals never changes when processing a function.
llvm-svn: 12462
2004-03-17 00:48:59 +00:00
Chris Lattner
5541c82383
Fix PR294
...
llvm-svn: 12425
2004-03-16 01:45:55 +00:00
Alkis Evlogimenos
ff9482b664
Change MRegisterInfo::foldMemoryOperand to return the folded
...
instruction to make the API more flexible.
llvm-svn: 12386
2004-03-14 07:19:51 +00:00
Alkis Evlogimenos
0e0433a791
Spill explicit physical register defs as well.
...
llvm-svn: 12260
2004-03-09 08:35:13 +00:00
Alkis Evlogimenos
02e8f14c6a
As I wrote in the docs, simple is the default spiller :-)
...
llvm-svn: 12189
2004-03-06 23:08:44 +00:00
Alkis Evlogimenos
467364b706
Add simple spiller.
...
llvm-svn: 12188
2004-03-06 22:38:29 +00:00
Brian Gaeke
aa96ff7926
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
c4ad8080f7
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
64e76a0d43
Add the long awaited memory operand folding support for linear scan
...
llvm-svn: 12058
2004-03-01 20:05:10 +00:00
Brian Gaeke
b78f8498f0
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
27c08f11bf
Adding new Modulo Scheduling graph files.
...
llvm-svn: 12031
2004-03-01 02:50:57 +00:00
Tanya Lattner
55de04447c
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
33b5dd0463
Add an assert
...
llvm-svn: 12010
2004-02-29 22:01:51 +00:00
Chris Lattner
37418d74a1
Add back #include I messed up
...
llvm-svn: 12009
2004-02-29 21:40:53 +00:00
Chris Lattner
b82a16f3a5
Urg, forgot to check this in.
...
llvm-svn: 12007
2004-02-29 21:03:08 +00:00
Chris Lattner
fe38629411
Move the private MachineInstrAnnot.h into a private directory.
...
llvm-svn: 12003
2004-02-29 19:12:51 +00:00
Chris Lattner
b73a182845
Remove use of an ugly header
...
llvm-svn: 12002
2004-02-29 19:04:31 +00:00
Chris Lattner
0acd73e11f
Move methods out of .h file
...
llvm-svn: 12001
2004-02-29 19:02:39 +00:00
Chris Lattner
b5f0e162c7
Eliminate the distinction between "real" and "unreal" instructions
...
llvm-svn: 11986
2004-02-29 06:31:16 +00:00
Chris Lattner
8b7ac81d2e
int64_t -> int
...
llvm-svn: 11977
2004-02-29 05:07:02 +00:00
Alkis Evlogimenos
ddfd27ff97
Rename member function to be consistent with the rest.
...
llvm-svn: 11898
2004-02-27 06:11:15 +00:00
Alkis Evlogimenos
63fda9c474
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
3093de5bfb
Fix crash caused by passing register 0 to
...
MRegisterInfo::isPhysicalRegister().
llvm-svn: 11894
2004-02-27 01:52:34 +00:00
Alkis Evlogimenos
cff0fc180c
Clear maps right after basic block is processed.
...
llvm-svn: 11892
2004-02-26 23:22:23 +00:00
Alkis Evlogimenos
b15631fcfa
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
ac94c441b6
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
af42cbf42f
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
4f0a829a68
Great sparc renaming fallout IV: Sparc --> SparcV9.
...
llvm-svn: 11844
2004-02-25 22:09:36 +00:00
Alkis Evlogimenos
2caa729f02
Remove asssert since it is breaking cases that it shouldn't.
...
llvm-svn: 11841
2004-02-25 22:01:06 +00:00
Alkis Evlogimenos
f1516015af
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
ccae3f6d60
Add an assertion
...
llvm-svn: 11830
2004-02-25 19:37:44 +00:00
Brian Gaeke
eae0364189
FunctionLiveVarInfo.h moved: include/llvm/CodeGen -> lib/Target/Sparc/LiveVar
...
llvm-svn: 11804
2004-02-24 19:46:00 +00:00
Alkis Evlogimenos
6d7150e9bb
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
042f01039b
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
0d0db88889
Make enum private as it is an implementation detail.
...
llvm-svn: 11782
2004-02-23 23:49:40 +00:00
Alkis Evlogimenos
9344a740be
Remove '4Virt' from member function names as it is obvious.
...
llvm-svn: 11781
2004-02-23 23:47:10 +00:00
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
Alkis Evlogimenos
e8f9647831
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
1130fb28d9
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
a31a767307
Use newly added next() and prior() utility functions.
...
llvm-svn: 11430
2004-02-14 01:18:34 +00:00
Alkis Evlogimenos
3eeb600093
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
6d6ab846af
Remove getAllocatedRegNum(). Use getReg() instead.
...
llvm-svn: 11393
2004-02-13 21:01:20 +00:00
Alkis Evlogimenos
c1ef192d44
Use getNumVirtualRegs().
...
Whitespace cleanups.
llvm-svn: 11389
2004-02-13 18:20:47 +00:00
Brian Gaeke
4f4348e113
Refactor MachineFunction::print() into MachineBasicBlock::print().
...
Add MachineBasicBlock::dump().
llvm-svn: 11364
2004-02-13 04:39:55 +00:00
Brian Gaeke
44cc73b6f2
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
3ecdcd18c5
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
ef375052c6
Rename the opCode instance variable to Opcode
...
llvm-svn: 11348
2004-02-12 16:09:53 +00:00
Chris Lattner
bda81f88b7
This field is never read
...
llvm-svn: 11346
2004-02-12 16:04:49 +00:00
Alkis Evlogimenos
b755d35fd2
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
4d67c9770d
getOpCode() --> getOpcode().
...
llvm-svn: 11339
2004-02-12 01:34:05 +00:00
Chris Lattner
db2c8941a5
Add #include
...
llvm-svn: 11285
2004-02-10 21:18:55 +00:00
Chris Lattner
37e040ee03
Do not use MachineOperand::isVirtualRegister either!
...
llvm-svn: 11283
2004-02-10 21:12:22 +00:00
Chris Lattner
9d0a4e63b1
Eliminate users of MachineOperand::isPhysicalRegister
...
llvm-svn: 11278
2004-02-10 20:41:10 +00:00
Brian Gaeke
c86ce8b134
Move InstrSchedule's iterator begin/end methods inline.
...
llvm-svn: 11239
2004-02-09 18:42:46 +00:00
Brian Gaeke
60268b265f
Make SchedGraph::dump() use SchedGraphNodeCommon's const_iterator
...
instead of randomly groping about inside its outEdges array.
Make SchedGraph::addDummyEdges() use getNumOutEdges() instead of
outEdges.size().
Get rid of ifdefed-out code in SchedGraph::buildGraph().
llvm-svn: 11238
2004-02-09 18:42:05 +00:00
Chris Lattner
95c21b04da
Another nice speedup for the register allocator. This time, we replace
...
the Virt2PhysRegMap std::map with an std::vector. This speeds up the
register allocator another (almost) 40%, from .72->.45s in a release build
of LLC on 253.perlbmk.
llvm-svn: 11219
2004-02-09 02:12:04 +00:00
Chris Lattner
9fb6056f1f
Ugh, perform an optimization that GCC should be able to do itself. This
...
speeds up livevar from .48/.32s -> .45/.31s in LLC on perlbmk
llvm-svn: 11217
2004-02-09 01:43:23 +00:00
Chris Lattner
b665065e6d
Only do stuff for the REAL number of physical registers we have, not 1024.
...
This speeds up live variables a lot, from .60/.39s -> .47/.26s in LLC, for
the first/second pass respectively.
llvm-svn: 11216
2004-02-09 01:35:21 +00:00
Chris Lattner
c49e77cecd
Change the PhysRegsUsed map into a dense array. Seeing that this is a mapping
...
from physical registers, and they are always dense, it makes sense to not have
a ton of RBtree overhead. This change speeds up regalloclocal about ~30% on
253.perlbmk, from .35s -> .27s in the JIT (in LLC, it goes from .74 -> .55).
Now live variable analysis is the slowest codegen pass. Of course it doesn't
help that we have to run it twice, because regalloclocal doesn't update it,
but even if it did it would be the slowest pass (now it's just the 2x slowest
pass :(
llvm-svn: 11215
2004-02-09 01:26:13 +00:00
Alkis Evlogimenos
59bb9d69c7
Increase code clarity.
...
llvm-svn: 11151
2004-02-06 18:08:18 +00:00
Alkis Evlogimenos
2aa7703205
Eliminate uneeded lookups by passing a Virt2PhysMap::iterator instead
...
of the virtual register to certain functions.
llvm-svn: 11143
2004-02-06 03:15:40 +00:00
Alkis Evlogimenos
f01a26ceaa
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
3dd0f57349
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
0221566368
Added missing include.
...
llvm-svn: 11129
2004-02-05 05:04:39 +00:00
Alkis Evlogimenos
676e5b8997
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
5e78d4bd75
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
e128cb3295
Revert changes. Will implement this using a different set of primitives
...
llvm-svn: 11091
2004-02-02 23:08:58 +00:00
Alkis Evlogimenos
a4fab12df8
Fix debugging output.
...
llvm-svn: 11088
2004-02-02 22:00:32 +00:00
Alkis Evlogimenos
3f268a9996
Correctly update def/use information for modified machine operands.
...
llvm-svn: 11087
2004-02-02 21:56:40 +00:00
Alkis Evlogimenos
dfef24298e
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
1825f30a3a
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
586dc51262
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
b2ea4389ca
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
eabb1b1bfa
Change string for joined intervals.
...
llvm-svn: 11057
2004-02-01 16:13:05 +00:00
Alkis Evlogimenos
e9d1aa31fc
Change xor to ^.
...
llvm-svn: 11054
2004-02-01 08:19:25 +00:00
Chris Lattner
2e497b5e42
Fix a bug in a recent checkin
...
llvm-svn: 11050
2004-02-01 05:25:07 +00:00
Alkis Evlogimenos
107cf3892c
Missed one silly assert :-)
...
llvm-svn: 11048
2004-02-01 02:21:31 +00:00
Alkis Evlogimenos
a7459c76aa
Simplify joinIntervals() code.
...
llvm-svn: 11047
2004-02-01 02:18:31 +00:00
Alkis Evlogimenos
612a35f2a4
Use MRegisterInfo::isPhysicalRegister and
...
MRegisterInfo::isVirtualRegister.
llvm-svn: 11045
2004-02-01 01:27:01 +00:00
Alkis Evlogimenos
9559cebebf
Apply final part of Chris' patch.
...
llvm-svn: 11040
2004-01-31 23:48:47 +00:00
Alkis Evlogimenos
656870703f
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
0ea56952d4
Finegrainify namespacification, use new MRegisterInfo::isVirtualRegister
...
method
llvm-svn: 11037
2004-01-31 21:27:19 +00:00
Chris Lattner
bff56dc518
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
05b7fef02f
* 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
b0addcc1b0
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
d1ec5f36ee
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
ef63827238
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
b9df133d67
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
c0db519832
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
32ec75c4ef
Finegrainify namespacification
...
Implement LiveVariables::getIndexMachineBasicBlock
llvm-svn: 11018
2004-01-30 22:08:53 +00:00
Brian Gaeke
9cf840250b
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
2a8df1739b
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
b4745bda05
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
8d8c76a064
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
abdbf4a288
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
a1bb8618c3
Revert previous change. The code was correct...
...
llvm-svn: 10957
2004-01-22 19:17:52 +00:00
Alkis Evlogimenos
448e6f3353
Fix incorrect negatives in LiveIntervals::Interval::liveAt().
...
llvm-svn: 10956
2004-01-22 18:33:50 +00:00
Tanya Lattner
291f28ee4e
Moved iterators around.
...
llvm-svn: 10926
2004-01-20 17:51:13 +00:00
Tanya Lattner
33079fad04
Moved iterators to common file.
...
llvm-svn: 10925
2004-01-20 17:49:42 +00:00
Alkis Evlogimenos
7f300c9ea6
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
e03ef29452
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
38f0f867b3
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
ed3c0a91b0
Add asserts to previous change.
...
llvm-svn: 10893
2004-01-16 16:23:23 +00:00
Alkis Evlogimenos
61db3621bd
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
52d1db4841
Properly update #intervals statistic.
...
llvm-svn: 10847
2004-01-14 10:44:29 +00:00
Alkis Evlogimenos
c4225e2f09
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
9a9f749eec
Improve debugging output.
...
llvm-svn: 10834
2004-01-14 00:09:36 +00:00
Alkis Evlogimenos
34a4e7b161
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
c73c31a496
Remove allocatable registers vector. It is already provided by
...
LiveVariables.
llvm-svn: 10830
2004-01-13 22:10:43 +00:00
Alkis Evlogimenos
e1afcec06f
Cleanup debugging output.
...
llvm-svn: 10824
2004-01-13 21:53:20 +00:00
Alkis Evlogimenos
a2965727e3
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
Alkis Evlogimenos
060861d7eb
Remove unneeded check (with the recent change in live variables a use
...
of a physical register is always dominated by a def).
llvm-svn: 10821
2004-01-13 21:16:25 +00:00
Alkis Evlogimenos
7ffa2a50f3
Indentation and whitespace cleanups.
...
llvm-svn: 10820
2004-01-13 20:42:08 +00:00
Alkis Evlogimenos
767111188a
Fix bug introduced by previous commit: check if fixed intervals
...
overlap before adding their spill weight.
llvm-svn: 10819
2004-01-13 20:37:01 +00:00
Alkis Evlogimenos
1a7b3c80d7
Correctly compute live variable information for physical registers
...
when an implicitely defined register is later used by an alias. For example:
call foo
%reg1024 = mov %AL
The call implicitely defines EAX but only AL is used. Before this fix
no information was available on AL. Now EAX and all its aliases except
AL get defined and die at the call instruction whereas AL lives to be
killed by the assignment.
llvm-svn: 10813
2004-01-13 06:24:30 +00:00
Alkis Evlogimenos
ef7c077e63
Make LiveVariables::HandlePhysRegUse and
...
LiveVariables::HandlePhysRegDef private they use information that is
not in memory when LiveVariables finishes the analysis.
Also update the TwoAddressInstructionPass to not use this interface.
llvm-svn: 10755
2004-01-11 09:18:45 +00:00
Chris Lattner
4771545c89
Remove use of llvm/CodeGen/InstrSelection.h
...
llvm-svn: 10749
2004-01-10 19:16:26 +00:00
Chris Lattner
1eeb1b1c04
Finegrainify namespacification.
...
This should get hunked over to the Sparc backend, along with
MachineCodeForInstruction and a bunch of files in include/llvm/Codegen,
but those battles will have to wait for a later time.
llvm-svn: 10731
2004-01-09 06:30:18 +00:00
Chris Lattner
ebe5eeb151
Move InstrSelection into lib/Target/Sparc, as it's sparc specific
...
llvm-svn: 10730
2004-01-09 06:24:06 +00:00
Chris Lattner
9bd7a783b9
Move lib/Codegen/RegAlloc into lib/Target/Sparc, as it is sparc specific
...
llvm-svn: 10728
2004-01-09 06:17:12 +00:00
Alkis Evlogimenos
cbe72d0381
Add a separate list of fixed intervals. This improves the running time
...
of the register allocator as follows:
before after
mesa 2.3790 1.5994
vpr 2.6008 1.2078
gcc 1.9840 0.5273
mcf 0.2569 0.0470
eon 1.8468 1.4359
twolf 0.9475 0.2004
burg 1.6807 1.3300
lambda 1.2191 0.3764
Speedups range anyware from 30% to over 400% :-)
llvm-svn: 10712
2004-01-07 09:20:58 +00:00
Alkis Evlogimenos
7bba96c90b
Minor cleanups.
...
llvm-svn: 10711
2004-01-07 05:31:12 +00:00
Alkis Evlogimenos
752173bede
Remove declared but undefined method.
...
llvm-svn: 10710
2004-01-07 02:29:33 +00:00
Alkis Evlogimenos
8aea74016b
Change implementation of LiveIntervals::overlap(). This results in a
...
30-50% decrease in running time of the linear scan register allocator.
llvm-svn: 10707
2004-01-07 01:45:58 +00:00
Alkis Evlogimenos
63f378bb39
Remove simple coalescing.
...
llvm-svn: 10695
2004-01-05 08:24:57 +00:00
Chris Lattner
bd827343af
fix warning
...
llvm-svn: 10692
2004-01-05 05:42:17 +00:00
Alkis Evlogimenos
496be157cc
Currently we cannot handle two-address instructions of the form:
...
A = B op C where A == C, but this cannot really occur in practice
because of SSA form. Add an assert to check that just to be safe.
llvm-svn: 10682
2004-01-05 02:25:45 +00:00
Alkis Evlogimenos
e74dd531f7
Update description.
...
llvm-svn: 10681
2004-01-04 23:09:24 +00:00
Chris Lattner
c37577eb9f
Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
...
implementation from the TargetMachine directly.
llvm-svn: 10636
2003-12-28 21:23:38 +00:00
Alkis Evlogimenos
8157eb7140
Reserve ECX and EDI instead of EBX and EDI. Since EBX is a callee
...
saved register it has a longer free range than ECX (which is defined
every time there is a fnuction call) which makes ECX a better register
to reserve.
llvm-svn: 10635
2003-12-28 18:03:52 +00:00
Alkis Evlogimenos
fc01aac4d8
Add coalescing to register allocator. A hint is added to each interval
...
which denotes the register we would like to be assigned to (virtual or
physical). In register allocation, if this hint exists and we can map
it to a physical register (it is either a physical register or it is a
virtual register that already got assigned to a physical one) we use
that register if it is available instead of a random one in the free
pool.
llvm-svn: 10634
2003-12-28 17:58:18 +00:00
Chris Lattner
c487970d6b
Whoops, don't try to lower non intrinsic calls
...
llvm-svn: 10632
2003-12-28 09:53:23 +00:00
Chris Lattner
66fb20d2d3
Use the intrinsic lowering functionality
...
llvm-svn: 10626
2003-12-28 09:43:35 +00:00
Chris Lattner
068ac4236d
Move into the VMCore library
...
llvm-svn: 10623
2003-12-28 08:30:20 +00:00
Chris Lattner
57ff7c242c
Implement the default implementation of the intrinsic lowering class
...
llvm-svn: 10621
2003-12-28 08:19:41 +00:00
Chris Lattner
a8c942c188
finegrainify namespacification
...
minor cleanups
llvm-svn: 10619
2003-12-28 07:59:53 +00:00
Alkis Evlogimenos
597e2f3501
Improve debugging output when choosing a register to spill.
...
llvm-svn: 10604
2003-12-24 18:53:31 +00:00
Alkis Evlogimenos
2c947a4fa0
Do a separate pass to compute spill weights because doing it inline
...
with live intervals was missing registers that were used before they
were defined (in the arbitrary order live intervals numbers
instructions).
llvm-svn: 10603
2003-12-24 15:44:53 +00:00
Alkis Evlogimenos
ca57dd1089
Change the way free regusters are computed and perform better
...
allocation in the presence of preallocated intervals.
llvm-svn: 10595
2003-12-23 18:00:33 +00:00
Alkis Evlogimenos
10de430568
Fix crash when compiling twolf.
...
llvm-svn: 10584
2003-12-22 13:54:29 +00:00
Alkis Evlogimenos
7062ccbc85
Remove verifyIntervals() since it doesn't actually work right now.
...
llvm-svn: 10570
2003-12-21 20:41:26 +00:00
Alkis Evlogimenos
4401d0a7a3
Change weight into a float so that we can take into account the
...
nesting level when computing it. Right now the allocator uses:
w = sum_over_defs_uses( 10 ^ nesting level );
llvm-svn: 10569
2003-12-21 20:19:10 +00:00
Alkis Evlogimenos
4f98b79ef0
Add support for inactive intervals. This effectively reuses registers
...
for live ranges that fall into assigned registers' holes.
llvm-svn: 10566
2003-12-21 05:43:40 +00:00
Chris Lattner
461a62626a
Add a new target-independent machine code freeing pass
...
llvm-svn: 10560
2003-12-20 10:20:58 +00:00
Chris Lattner
d476049d19
* Finegrainify namespacification
...
* Move sparc specific code out of generic code
* Eliminate the getOffset() method which made INVALID_FRAME_OFFSET
necessary, which made pulling in MAX_INT as a sentinal necessary.
llvm-svn: 10553
2003-12-20 09:17:07 +00:00