Commit Graph

796 Commits

Author SHA1 Message Date
Alkis Evlogimenos
7d629b50a5 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% :-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10712 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-07 09:20:58 +00:00
Alkis Evlogimenos
1283d86b63 Minor cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10711 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-07 05:31:12 +00:00
Alkis Evlogimenos
75ca6a3e82 Remove declared but undefined method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10710 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-07 02:29:33 +00:00
Alkis Evlogimenos
80b378cf7c Change implementation of LiveIntervals::overlap(). This results in a
30-50% decrease in running time of the linear scan register allocator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10707 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-07 01:45:58 +00:00
Alkis Evlogimenos
63caedf046 Remove simple coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10695 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-05 08:24:57 +00:00
Chris Lattner
8c2403631b fix warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10692 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-05 05:42:17 +00:00
Chris Lattner
77b1330ece Add VMCore and code generator support for debugging intrinsics. By default
code generators completely ignore them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10691 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-05 05:36:30 +00:00
Alkis Evlogimenos
271bd2d7f1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10682 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-05 02:25:45 +00:00
Alkis Evlogimenos
50c047d159 Update description.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10681 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-04 23:09:24 +00:00
Chris Lattner
f70e0c216c Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
implementation from the TargetMachine directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10636 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 21:23:38 +00:00
Alkis Evlogimenos
27490a6fcc 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10635 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 18:03:52 +00:00
Alkis Evlogimenos
26bfc08b80 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10634 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 17:58:18 +00:00
Chris Lattner
aed386e6b0 Whoops, don't try to lower non intrinsic calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10632 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 09:53:23 +00:00
Chris Lattner
f8742b3e03 Use the intrinsic lowering functionality
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10626 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 09:43:35 +00:00
Chris Lattner
42450d8a5f Move into the VMCore library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10623 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 08:30:20 +00:00
Chris Lattner
3b66ecb05f Implement the default implementation of the intrinsic lowering class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10621 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 08:19:41 +00:00
Chris Lattner
aa4c91ff96 finegrainify namespacification
minor cleanups


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10619 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 07:59:53 +00:00
Alkis Evlogimenos
843397c237 Improve debugging output when choosing a register to spill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10604 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-24 18:53:31 +00:00
Alkis Evlogimenos
7a40eaacee 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10603 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-24 15:44:53 +00:00
Alkis Evlogimenos
3bf564a95f Change the way free regusters are computed and perform better
allocation in the presence of preallocated intervals.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10595 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-23 18:00:33 +00:00
Alkis Evlogimenos
056063e264 Fix crash when compiling twolf.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10584 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-22 13:54:29 +00:00
Alkis Evlogimenos
4de1fefd7c Remove verifyIntervals() since it doesn't actually work right now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10570 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-21 20:41:26 +00:00
Alkis Evlogimenos
6b4edbaaf9 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 );


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10569 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-21 20:19:10 +00:00
Alkis Evlogimenos
169cfd0196 Add support for inactive intervals. This effectively reuses registers
for live ranges that fall into assigned registers' holes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10566 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-21 05:43:40 +00:00
Chris Lattner
16c45e9de8 Add a new target-independent machine code freeing pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10560 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 10:20:58 +00:00
Chris Lattner
07f32d48f1 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10553 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 09:17:07 +00:00
Alkis Evlogimenos
4c080863de Remove TwoAddressInstruction from the public headers and add an ID
instead, since this pass doesn't expose any state to its users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10520 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 22:40:24 +00:00
Chris Lattner
5e46b513f3 Prune some #includes
Add a statistic for # reloads


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10518 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 20:25:31 +00:00
Alkis Evlogimenos
a71e05acdd Modify linear scan register allocator to use the two-address
instruction pass. This also fixes all remaining bugs for this new
allocator to pass all tests under test/Programs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10515 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 13:15:02 +00:00
Alkis Evlogimenos
a3d0e5c2b2 Fix bug in reserved registers. DH actually aliases DX and EDX which
are not reserved registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10514 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 13:12:18 +00:00
Alkis Evlogimenos
9af9dbde7d Modify local register allocator to use the two-address instruction pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10513 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 13:08:52 +00:00
Alkis Evlogimenos
71499ded4d Add TwoAddressInstructionPass to handle instructions that have two or
more operands and the two first operands are constrained to be the
same. The pass takes an instruction of the form:

        a = b op c

and transforms it into:

        a = b
        a = a op c

and also preserves live variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10512 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 13:06:04 +00:00
Alkis Evlogimenos
485ec3c21e Rename LiveIntervals::expired() to LiveIntervals::expiredAt().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10511 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 08:56:11 +00:00
Alkis Evlogimenos
43f692f90f When a variable is killed and redifined in a basic block only one
killing instruction is tracked. This causes the LiveIntervals to
create bogus intervals. The workaound is to add a range to the
interval from the redefinition to the end of the basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10510 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 08:53:43 +00:00
Alkis Evlogimenos
dd2cc65f34 Handle multiple virtual register definitions gracefully.
Move some of the longer LiveIntervals::Interval method out of the
header and add debug information to them. Fix bug and simplify range
merging code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10509 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-18 08:48:48 +00:00
Alkis Evlogimenos
f6f91bf668 Change preserve all claim to just preserve live variables and phielimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10469 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-15 04:55:38 +00:00
Alkis Evlogimenos
4d7af65903 Change interface of MachineOperand as follows:
a) remove opIsUse(), opIsDefOnly(), opIsDefAndUse()
    b) add isUse(), isDef()
    c) rename opHiBits32() to isHiBits32(),
              opLoBits32() to isLoBits32(),
              opHiBits64() to isHiBits64(),
              opLoBits64() to isLoBits64().

This results to much more readable code, for example compare
"op.opIsDef() || op.opIsDefAndUse()" to "op.isDef()" a pattern used
very often in the code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10461 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-14 13:24:17 +00:00
Alkis Evlogimenos
94743e4915 When reserving a preallocated register spill the aliases of this
register too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10450 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-13 11:58:10 +00:00
Alkis Evlogimenos
4c214d2bf0 Ignore non-allocatable physical registers in live interval analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10449 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-13 11:11:02 +00:00
Alkis Evlogimenos
7d65a12fe6 Expire any active intervals left when register allocation is done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10448 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-13 05:50:19 +00:00
Alkis Evlogimenos
f6e610c27d Add instruction numbers to debugging output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10447 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-13 05:48:57 +00:00
Alkis Evlogimenos
9435eda699 Handle explicit physical register defs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10445 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-13 05:26:39 +00:00
Alkis Evlogimenos
efe995a406 Remove unecessary if statements when looping on ImplicitDefs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10444 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-13 01:20:58 +00:00
John Criswell
f5ba89df1f This appears to fix Bug 172 and does not break any other feature tests or
regression tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10388 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-10 22:51:41 +00:00
Alkis Evlogimenos
a327e7fea9 Make assertion stricter. Since the source operands are allocated at
this point, the second operand must be a physical register (it cannot
be a virtual one).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10292 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-05 11:31:39 +00:00
Alkis Evlogimenos
49787e35c3 Fix bug in register spilling when a preallocated live range overlaps a
potential register assignment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10291 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-05 11:17:55 +00:00
Alkis Evlogimenos
b27ef248f5 Move operator<<(std::ostream&, const LiveInterval&) out of the header file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10290 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-05 10:38:28 +00:00
Alkis Evlogimenos
91ceae6d20 Sort live intervals by increasing start point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10289 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-05 10:32:01 +00:00
Alkis Evlogimenos
69546d5f84 Improve debugging output and clean up some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10288 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-04 03:57:28 +00:00
Alkis Evlogimenos
585870759b Print instructions before register allocation is performed. Also fix
bug where spill instructions were added to the next basic block
instead of the end of the current one if the instruction that required
the spill was the last in the block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10272 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-30 23:40:39 +00:00