1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
Commit Graph

299 Commits

Author SHA1 Message Date
Owen Anderson
c9a628af26 Add an option to enable StrongPHIElimination, for ease of testing.
llvm-svn: 57259
2008-10-07 20:22:28 +00:00
Evan Cheng
1c8ff02eeb Re-apply 56835 along with header file changes.
llvm-svn: 56848
2008-09-30 15:44:16 +00:00
Duncan Sands
a2c8482495 Revert commit 56835 since it breaks the build.
"If a re-materializable instruction has a register
operand, the spiller will change the register operand's
spill weight to HUGE_VAL to avoid it being spilled.
However, if the operand is already in the queue ready
to be spilled, avoid re-materializing it".

llvm-svn: 56837
2008-09-30 10:00:30 +00:00
Evan Cheng
4eee17f4fb If a re-materializable instruction has a register operand, the spiller will change the register operand's spill weight to HUGE_VAL to avoid it being spilled. However, if the operand is already in the queue ready to be spilled, avoid re-materializing it.
llvm-svn: 56835
2008-09-30 06:36:58 +00:00
Dale Johannesen
bc29bec7f8 Next round of earlyclobber handling. Approach the
RA problem by expanding the live interval of an
earlyclobber def back one slot.  Remove
overlap-earlyclobber throughout.  Remove 
earlyclobber bits and their handling from
live internals.

llvm-svn: 56539
2008-09-24 01:07:17 +00:00
Dale Johannesen
4a0054dc9a Teach coalescer about earlyclobber bits.
Check bits for preferred register.

llvm-svn: 56384
2008-09-20 02:03:04 +00:00
Evan Cheng
270178bdda Fix PR2808. When regalloc runs out of register, it spill a physical register around the live interval being allocated. Do not continue to try to spill another register, just grab the physical register and move on.
llvm-svn: 56381
2008-09-20 01:28:05 +00:00
Dale Johannesen
312df3aa6d Make earlyclobber stuff work when virtual regs
have previously been assigned conflicting physreg.

llvm-svn: 56364
2008-09-19 18:52:31 +00:00
Dale Johannesen
214ddc92d0 Remove AsmThatEarlyClobber etc. from LiveIntervalAnalysis
and redo as linked list walk.  Logic moved into RA.
Per review feedback.

llvm-svn: 56326
2008-09-19 01:02:35 +00:00
Evan Cheng
bcd694a1b4 Somehow RegAllocLinearScan is keeping two pointers to MachineRegisterInfo.
llvm-svn: 56314
2008-09-18 22:38:47 +00:00
Dale Johannesen
99091ed94f Add a bit to mark operands of asm's that conflict
with an earlyclobber operand elsewhere.  Propagate
this bit and the earlyclobber bit through SDISel.
Change linear-scan RA not to allocate regs in a way 
that conflicts with an earlyclobber.  See also comments.

llvm-svn: 56290
2008-09-17 21:13:11 +00:00
Evan Cheng
304fba81c9 Fix PR2757. Ignore liveinterval register allocation preference if the preference register is not in the right register class. This can happen due to sub-register coalescing.
llvm-svn: 56006
2008-09-09 20:22:01 +00:00
Dan Gohman
e1f9be27bc Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Owen Anderson
426c49472d Convert several std::vectors over to SmallVector, and use reserve() as appropriate for cases where std::vector is still used.
llvm-svn: 54820
2008-08-15 18:49:41 +00:00
Owen Anderson
34aee11210 Get rid of a use of std::map.
llvm-svn: 54770
2008-08-13 23:36:23 +00:00
Owen Anderson
28f2e658f1 Make the allocation of LiveIntervals explicit, rather than holding them in the r2iMap_ by value. This will prevent references to them from being invalidated
if the map is changed.

llvm-svn: 54763
2008-08-13 21:49:13 +00:00
Owen Anderson
58d9213c3a Fix a compile-time regression introduced by my heuristic-changing patch. I forgot
to multiply the instruction count by a constant factor in a few places, which
caused the register allocator to require many more iterations.

llvm-svn: 53959
2008-07-23 19:47:27 +00:00
Owen Anderson
7b8947cc31 Change the heuristics used in the coalescer, register allocator, and within
live intervals itself to use an instruction count approximation that is 
not affected by inserting empty indices.

llvm-svn: 53937
2008-07-22 22:46:49 +00:00
Dan Gohman
0e992740a0 A brief survey of priority_queue usage in the tree turned this up
as a questionable case, but the code isn't actually needed.

llvm-svn: 52657
2008-06-23 23:51:16 +00:00
Evan Cheng
c1f551b43e Enhanced heuristic to determine the *best* register to spill. Instead of picking the register with the lowest spill weight. Consider (up to) 2 additional registers with spill weights that are close to the lowest spill weight. The one with fewest defs and uses that conflicts with the current interval (weighted by loop depth) is the spill candidate.
This is not always a win, but there are much more wins than loses and wins tend to be more noticeable.

llvm-svn: 52554
2008-06-20 21:45:16 +00:00
Evan Cheng
fe06a1fd5b Refine stack slot interval weight computation.
llvm-svn: 52040
2008-06-06 07:54:39 +00:00
Evan Cheng
2fc7954878 Add a stack slot coloring pass. Not yet enabled.
llvm-svn: 51934
2008-06-04 09:18:41 +00:00
Evan Cheng
27262ddcf3 Do not add empty live intervals to handled_. They should never be undone for backtracking.
llvm-svn: 49544
2008-04-11 17:55:47 +00:00
Evan Cheng
ff9c1655de Special handling of zero-sized live intervals.
llvm-svn: 49167
2008-04-03 16:40:27 +00:00
Evan Cheng
475368bc97 Add an assertion to catch register of illegal class.
llvm-svn: 48751
2008-03-24 23:28:21 +00:00
Evan Cheng
b479bf0d0c Undo tweak. It had no obvious benefit.
llvm-svn: 48341
2008-03-13 17:42:48 +00:00
Evan Cheng
af1c76846d When the register allocator runs out of registers, spill a physical register around the def's and use's of the interval being allocated to make it possible for the interval to target a register and spill it right away and restore a register for uses. This likely generates terrible code but is before than aborting.
llvm-svn: 48218
2008-03-11 07:19:34 +00:00
Evan Cheng
77df19cb8c Temporarily revert 48175.
llvm-svn: 48204
2008-03-11 00:27:34 +00:00
Evan Cheng
863da1c28c If the register allocator ran out of registers, just abort for now.
llvm-svn: 48175
2008-03-10 21:27:20 +00:00
Chris Lattner
6318b4aee9 Use a smallvector for inactiveCounts and initialize it lazily
instead of init'ing it maximally to zeros on entry.  getFreePhysReg
is pretty hot and only a few elements are typically used.  This speeds
up linscan by 5% on 176.gcc.

llvm-svn: 47631
2008-02-26 22:08:41 +00:00
Bill Wendling
8fb166bf6c Rename PrintableName to Name.
llvm-svn: 47629
2008-02-26 21:47:57 +00:00
Bill Wendling
50f5c4be14 Change "Name" to "AsmName" in the target register info. Gee, a refactoring tool
would have been a Godsend here!

llvm-svn: 47625
2008-02-26 21:11:01 +00:00
Anton Korobeynikov
c41f5b6af4 Fix newly-introduced 4.3 warnings
llvm-svn: 47375
2008-02-20 12:07:57 +00:00
Dan Gohman
cabaec582f Rename MRegisterInfo to TargetRegisterInfo.
llvm-svn: 46930
2008-02-10 18:45:23 +00:00
Bill Wendling
93556af6c4 Don't recalculate the loop info and loop dominators analyses if they're
preserved.

llvm-svn: 45596
2008-01-04 20:54:55 +00:00
Chris Lattner
96167aa93c Rename SSARegMap -> MachineRegisterInfo in keeping with the idea
that "machine" classes are used to represent the current state of
the code being compiled.  Given this expanded name, we can start 
moving other stuff into it.  For now, move the UsedPhysRegs and
LiveIn/LoveOuts vectors from MachineFunction into it.

Update all the clients to match.

This also reduces some needless #includes, such as MachineModuleInfo
from MachineFunction.

llvm-svn: 45467
2007-12-31 04:13:23 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Evan Cheng
45c08c8337 Switch over to MachineLoopInfo.
llvm-svn: 44838
2007-12-11 02:09:15 +00:00
Evan Cheng
5c96771102 Live interval splitting:
When a live interval is being spilled, rather than creating short, non-spillable
intervals for every def / use, split the interval at BB boundaries. That is, for
every BB where the live interval is defined or used, create a new interval that
covers all the defs and uses in the BB.

This is designed to eliminate one common problem: multiple reloads of the same
value in a single basic block. Note, it does *not* decrease the number of spills
since no copies are inserted so the split intervals are *connected* through
spill and reloads (or rematerialization). The newly created intervals can be
spilled again, in that case, since it does not span multiple basic blocks, it's
spilled in the usual manner. However, it can reuse the same stack slot as the
previously split interval.

This is currently controlled by -split-intervals-at-bb.

llvm-svn: 44198
2007-11-17 00:40:40 +00:00
Bill Wendling
f16da54ae2 Adding debug output during coalescing.
llvm-svn: 44154
2007-11-15 02:06:30 +00:00
Bill Wendling
3a908f7dca Need to increment the iterator.
llvm-svn: 44153
2007-11-15 00:40:48 +00:00
Evan Cheng
d887bfa88e Refactor some code.
llvm-svn: 44010
2007-11-12 06:35:08 +00:00
Evan Cheng
9a5c2f1169 If an interval is being undone clear its preference as well since the source interval may have been undone as well.
llvm-svn: 43670
2007-11-04 08:32:21 +00:00
Evan Cheng
1771f6da9c There are times when the coalescer would not coalesce away a copy but the copy
can be eliminated by the allocator is the destination and source targets the
same register. The most common case is when the source and destination registers
are in different class. For example, on x86 mov32to32_ targets GR32_ which
contains a subset of the registers in GR32.

The allocator can do 2 things:
1. Set the preferred allocation for the destination of a copy to that of its source.
2. After allocation is done, change the allocation of a copy destination (if
   legal) so the copy can be eliminated.

This eliminates 443 extra moves from 403.gcc.

llvm-svn: 43662
2007-11-03 07:20:12 +00:00
Evan Cheng
4bba09dc4e Apply Chris' suggestions.
llvm-svn: 43069
2007-10-17 06:53:44 +00:00
Evan Cheng
d292b1c096 Clean up code that calculate MBB live-in's.
llvm-svn: 43061
2007-10-17 02:12:22 +00:00
Evan Cheng
97ada80b22 Some clean up.
llvm-svn: 43043
2007-10-16 21:09:14 +00:00
Evan Cheng
8af3000e93 Some clean up.
llvm-svn: 42898
2007-10-12 08:45:27 +00:00
David Greene
2ca4b270db Pluggable coalescers inplementation.
llvm-svn: 41743
2007-09-06 16:18:45 +00:00
Evan Cheng
215f802b75 Re-implement trivial rematerialization. This allows def MIs whose live intervals that are coalesced to be rematerialized.
llvm-svn: 41060
2007-08-13 23:45:17 +00:00
David Greene
6b14050d1e Factor live variable analysis so it does not do register coalescing
simultaneously.  Move that pass to SimpleRegisterCoalescing.

This makes it easier to implement alternative register allocation and
coalescing strategies while maintaining reuse of the existing live
interval analysis.

llvm-svn: 37520
2007-06-08 17:18:56 +00:00
Bill Wendling
a5f8cb0805 Change names from RA to something unique to get rid of naming conflicts with
certain linkers...

llvm-svn: 36944
2007-05-08 19:02:46 +00:00
Devang Patel
cd45427a87 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
8ee9065162 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel
38a66bc82e Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Evan Cheng
7f44e880dc Match MachineFunction::UsedPhysRegs changes.
llvm-svn: 36452
2007-04-25 22:13:27 +00:00
Evan Cheng
4f48ec6738 Clean up.
llvm-svn: 36431
2007-04-25 07:18:20 +00:00
Evan Cheng
48352d7a71 Copy coalescing change to prevent a physical register from being pin to a
long live interval that has low usage density.
1. Change order of coalescing to join physical registers with virtual
   registers first before virtual register intervals become too long.
2. Check size and usage density to determine if it's worthwhile to join.
3. If joining is aborted, assign virtual register live interval allocation
   preference field to the physical register.
4. Register allocator should try to allocate to the preferred register
   first (if available) to create identify moves that can be eliminated.

llvm-svn: 36218
2007-04-17 20:32:26 +00:00
Evan Cheng
0176b9859d First cut trivial re-materialization support.
llvm-svn: 35208
2007-03-20 08:13:50 +00:00
Evan Cheng
9968353d64 Only add liveinterval to livein set if it isn't assigned a stack slot.
llvm-svn: 34593
2007-02-25 09:39:02 +00:00
Evan Cheng
e4ab9c032b Re-apply my liveintervalanalysis changes. Now with PR1207 fixes.
llvm-svn: 34428
2007-02-19 21:49:54 +00:00
Reid Spencer
b27fcf3482 For PR1207:
Revert patches that caused the problem. Evan, please investigate and reapply
when you've discovered the problem.

llvm-svn: 34399
2007-02-19 03:20:00 +00:00
Evan Cheng
259a05c582 Do not add livein's to entry MBB twice.
llvm-svn: 34382
2007-02-17 11:11:27 +00:00
Evan Cheng
64185104f1 Add live-ins to every BB.
llvm-svn: 34342
2007-02-16 09:05:02 +00:00
Chris Lattner
a975b95adb Eliminate static ctors from Statistics
llvm-svn: 32698
2006-12-19 22:41:21 +00:00
Chris Lattner
a531ce882e Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.

llvm-svn: 32279
2006-12-06 17:46:33 +00:00
Chris Lattner
a7baddddcc eliminate fp statistic
llvm-svn: 32251
2006-12-06 01:48:55 +00:00
Jeff Cohen
f99052befb Unbreak VC++ build.
llvm-svn: 32113
2006-12-02 02:22:01 +00:00
Bill Wendling
0ae0a45ebe Replace std::cerr uses of the "DEBUG" macro with "DOUT" instead. Removes
a #include of iostream.

llvm-svn: 31800
2006-11-17 00:50:36 +00:00
Jim Laskey
28fec74f1b Remove redundant <cmath>.
llvm-svn: 31561
2006-11-08 19:16:44 +00:00
Jim Laskey
4b1aff4aec Use correct value for float HUGH_VAL.
llvm-svn: 31500
2006-11-07 12:25:45 +00:00
Jim Laskey
47b2dcf17f LinearScanner hotspot.
llvm-svn: 31153
2006-10-24 14:35:25 +00:00
Chris Lattner
33bd5dcfb7 s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|
llvm-svn: 29911
2006-08-27 12:54:02 +00:00
Jim Laskey
6d121090d3 Final polish on machine pass registries.
llvm-svn: 29471
2006-08-02 12:30:23 +00:00
Jim Laskey
b92b14f422 Introducing plugable register allocators and instruction schedulers.
llvm-svn: 29434
2006-08-01 14:21:23 +00:00
Andrew Lenharth
c1074954fb Reduce number of exported symbols
llvm-svn: 29220
2006-07-20 17:28:38 +00:00
Chris Lattner
de706b3e3e Shave another 27K off libllvmgcc.dylib with visibility hidden
llvm-svn: 28973
2006-06-28 22:17:39 +00:00
Evan Cheng
772647518f If the register allocator cannot find a register to spill, try the aliases. If
that still fails (because all the register spill weights are inf), just grab
one.

llvm-svn: 28262
2006-05-12 19:07:46 +00:00
Evan Cheng
da04c3aab4 Backing out previous check-in.
llvm-svn: 28219
2006-05-11 07:28:16 +00:00
Evan Cheng
03fa9eb65e If the live interval legnth is essentially zero, i.e. in every live range
the use follows def immediately, it doesn't make sense to spill it and
hope it will be easier to allocate for this LI.

llvm-svn: 28217
2006-05-10 22:30:41 +00:00
Chris Lattner
8b6f0daaae Add some comments.
llvm-svn: 27133
2006-03-25 23:00:56 +00:00
Chris Lattner
b74e255d8b Code cleanups, no functionality change
llvm-svn: 26328
2006-02-23 06:44:17 +00:00
Chris Lattner
aafc339b4e Add explicit #includes of <iostream>
llvm-svn: 25515
2006-01-22 23:41:00 +00:00
Duraid Madina
f8a342aa4f HB is *the* code janitor.
llvm-svn: 25031
2005-12-28 04:55:42 +00:00
Duraid Madina
04be8e167c I think I know what you meant here, but just to be safe I'll let you
do it. :)

    <_sabre_> excuses excuses

llvm-svn: 24471
2005-11-21 14:09:40 +00:00
Chris Lattner
f78eca1416 Add section switching to common code generator code. Add a couple of
asserts.

llvm-svn: 24445
2005-11-21 07:06:27 +00:00
Chris Lattner
288e5b0a7d Expose the LiveInterval interfaces as public headers.
llvm-svn: 23400
2005-09-21 04:19:09 +00:00
Chris Lattner
36461b2e37 When checking the fixed intervals, don't forget to check for register aliases.
This fixes PR621 and Regression/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll

llvm-svn: 23158
2005-08-30 21:03:36 +00:00
Chris Lattner
610eeca969 Keep track of which registers are related to which other registers.
Use this information to avoid doing expensive interval intersections for
registers that could not possible be interesting.  This speeds up linscan
on ia64 compiling kc++ in release mode from taking 7.82s to 4.8s(!), total
itanium llc time on this program is 27.3s now.  This marginally speeds up
PPC and X86, but they appear to be limited by other parts of linscan, not
this code.

On this program, on itanium, live intervals now takes 41% of llc time.

llvm-svn: 22986
2005-08-23 22:27:31 +00:00
Chris Lattner
2c5f36d938 Try to avoid scanning the fixed list. On architectures with a non-stupid
number of regs (e.g. most riscs), many functions won't need to use callee
clobbered registers.  Do a speculative check to see if we can get a free
register without processing the fixed list (which has all of these).  This
saves a lot of time on machines with lots of callee clobbered regs (e.g.
ppc and itanium, also x86).

This reduces ppc llc compile time from 184s -> 172s on kc++.  This is probably
worth FAR FAR more on itanium though.

llvm-svn: 22972
2005-08-22 20:59:30 +00:00
Chris Lattner
9b0058b424 Move some code in the register assignment case that only needs to happen if
we spill out of the fast path.  The scan of active_ and the calls to
updateSpillWeights don't need to happen unless a spill occurs.  This reduces
debug llc time of kc++ with ppc from 187.3s to 183.2s.

llvm-svn: 22971
2005-08-22 20:20:42 +00:00
Chris Lattner
a9710ba54f Speed up this loop a bit, based on some observations that Nate made, and
add some comments.  This loop really needs to be reevaluated!

llvm-svn: 22966
2005-08-22 16:55:22 +00:00
Misha Brukman
774e55c446 Remove trailing whitespace
llvm-svn: 21420
2005-04-21 22:36:52 +00:00
Chris Lattner
964297fc32 Update these register allocators to set the PhysRegUsed info in MachineFunction.
llvm-svn: 19791
2005-01-23 22:45:13 +00:00
Chris Lattner
104064bf2c Silence VS warnings
llvm-svn: 19385
2005-01-08 19:53:50 +00:00
Chris Lattner
558a640b3c Move virtual method call out of loop
llvm-svn: 18955
2004-12-15 07:04:32 +00:00
Nate Begeman
85a2e38a56 Move virtual function call out of loop to speed up getFreePhysReg by about
20%, shaving 0.1s off hbd compile time on my g5.  Yay.

llvm-svn: 18592
2004-12-07 05:25:53 +00:00
Chris Lattner
ccd7bfb561 * There is no reason for SpillWeights to be an instance var
* Do not put fixed registers into the unhandled set.  This means they will
  never find their way into the inactive, active, or handled sets, so we
  can simplify a bunch of code.

llvm-svn: 17945
2004-11-18 06:01:45 +00:00
Chris Lattner
e9ab36314d Fix a couple of bugs where we considered physregs past their range as possibly
intersecting an interval.

llvm-svn: 17939
2004-11-18 04:33:31 +00:00
Chris Lattner
3a6991f745 Start using the iterators in the fixed_ intervals to avoid having to binary
search physreg intervals every time we access it.  This takes another
half second off of linscan.

llvm-svn: 17937
2004-11-18 04:13:02 +00:00
Chris Lattner
a52650a18a Add a counter for the number of times linscan has to backtrack. Start using
the iterator hints we have to speed up overlaps().  This speeds linscan up
by about .2s (out of 8.7) on 175.vpr for PPC.

llvm-svn: 17935
2004-11-18 03:49:30 +00:00
Chris Lattner
18ced80110 * Improve comments/documentation substantially
* Eliminate the releaseMemory method, this is not an analysis
* Change the fixed, active, and inactive lists of intervals to maintain an
  iterator for the current position in the interval.  This allows us to do
  constant time increments of the iterator instead of having to do a binary
  search to find our liverange in our liveinterval all of the time, which
  substantially speeds up cases where LiveIntervals have many LiveRanges
  - which is very common for physical registers.  On targets with many
  physregs, this can make a noticable difference.

  With a release build of LLC for PPC, this halves the time in
  processInactiveIntervals and processActiveIntervals, from 1.5s to .75s.

  This also lays the ground for more to come.

llvm-svn: 17933
2004-11-18 02:42:27 +00:00
Chris Lattner
ddc898639f Rename some methods, use 'begin' instead of 'start', add new LiveInterval
iterator/begin/end members.

llvm-svn: 17930
2004-11-18 01:29:39 +00:00
Chris Lattner
bde92f3c03 Do not make i have bigger scope that we need
llvm-svn: 17483
2004-11-05 04:47:37 +00:00
Chris Lattner
962d398430 Free the VirtRegMap at the end of MachineFunction processing instead of at
the beginning of processing the next one.

llvm-svn: 16605
2004-09-30 02:02:33 +00:00
Alkis Evlogimenos
0c50e0f211 Fixes to make LLVM compile with vc7.1.
Patch contributed by Paolo Invernizzi!

llvm-svn: 16152
2004-09-03 18:19:51 +00:00
Alkis Evlogimenos
999a10318f Change the way we choose a free register: instead of picking the first
free allocatable register, we prefer the a free one with the most uses
of inactive intervals. This causes less spills and performes a bit
better compared to gcc:

Program                 | GCC/LLC (Before)| GCC/LLC (After)
164.gzip/164.gzip       | 0.59            | 0.60
175.vpr/175.vpr         | 0.57            | 0.58
176.gcc/176.gcc         | 0.59            | 0.61
181.mcf/181.mcf         | 0.94            | 0.95
186.crafty/186.crafty   | 0.62            | 0.62
197.parser/197.parser   | 0.89            | 0.88
252.eon/252.eon         | 0.61            | 0.66
253.perlbmk/253.perlbmk | 0.79            | 0.84
254.gap/254.gap         | 0.81            | 0.81
255.vortex/255.vortex   | 0.92            | 0.93
256.bzip2/256.bzip2     | 0.69            | 0.69
300.twolf/300.twolf     | 0.91            | 0.90

llvm-svn: 16147
2004-09-02 21:23:32 +00:00
Alkis Evlogimenos
7a287da6cd We don't need to sort the added vector as unhandled intervals are
stored in a binary heap.

llvm-svn: 16143
2004-09-02 18:00:38 +00:00
Reid Spencer
c4abcbefb1 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.

llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Alkis Evlogimenos
e7e63c8da4 Be a bit more efficient when processing the active and inactive
lists. Instead of scanning the vector backwards, scan it forward and
swap each element we want to erase. Then at the end erase all removed
intervals at once. This doesn't save much: 0.08s out of 4s when
compiling 176.gcc.

llvm-svn: 16136
2004-09-01 22:52:29 +00:00
Alkis Evlogimenos
8ae92113d6 Now that LiveIntervals::addIntervalsForSpills is fixed, do not require
LiveVariables.

llvm-svn: 16076
2004-08-27 19:00:29 +00:00
Alkis Evlogimenos
7c06c0aeee Back out this change as it broke the build last night. This should be
investicated further as the linearscan variants don't really need
LiveVariables...

llvm-svn: 16074
2004-08-27 18:01:21 +00:00
Alkis Evlogimenos
f18ee1fc99 The linear scan variants do not require the LiveVariables analysis.
llvm-svn: 16071
2004-08-27 04:51:13 +00:00
Alkis Evlogimenos
db3b503b6f Convert indentation to 2 spaces.
llvm-svn: 15489
2004-08-04 09:46:26 +00:00
Alkis Evlogimenos
3e3fe9ff5a Add some comments to the backtracking code.
llvm-svn: 15200
2004-07-25 08:10:33 +00:00
Alkis Evlogimenos
0618429149 Change std::map<unsigned, LiveInterval*> into a std::map<unsigned,
LiveInterval>. This saves some space and removes the pointer
indirection caused by following the pointer.

llvm-svn: 15167
2004-07-24 11:44:15 +00:00
Chris Lattner
c71a9684f8 Completely eliminate the intervals_ list. instead, the r2iMap_ maintains
ownership of the intervals.

llvm-svn: 15155
2004-07-24 03:32:06 +00:00
Chris Lattner
a1bce98d7f Rename LiveIntervals.(cpp|h) -> LiveIntervalAnalysis.(cpp|h)
llvm-svn: 15135
2004-07-23 17:56:30 +00:00
Alkis Evlogimenos
0292045897 Some compile time improvements resulting in a 1sec speedup in the 5sec
compilation of gcc:

* Use vectors instead of lists for the intervals sets
* Use a heap for the unhandled set to keep intervals always sorted and
  makes insertions back to the heap very fast (compared to scanning a
  list)

llvm-svn: 15103
2004-07-22 08:14:44 +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
25fb592aa6 Remove dead code.
llvm-svn: 15011
2004-07-19 23:35:55 +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
Alkis Evlogimenos
69ea68d4b6 Correctly compute the ration of iterations/#intervals.
llvm-svn: 14626
2004-07-04 17:23:35 +00:00
Alkis Evlogimenos
8ff35c1ce8 Add efficiency statistic.
llvm-svn: 14590
2004-07-04 07:59:06 +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
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
Alkis Evlogimenos
76be543a64 Add required header
llvm-svn: 13417
2004-05-08 03:50:03 +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
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
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
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
2caa729f02 Remove asssert since it is breaking cases that it shouldn't.
llvm-svn: 11841
2004-02-25 22:01:06 +00:00
Chris Lattner
ccae3f6d60 Add an assertion
llvm-svn: 11830
2004-02-25 19:37:44 +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
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
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
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
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
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
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
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