Commit Graph

904 Commits

Author SHA1 Message Date
Chris Lattner
e6d04f1a99 Eliminate operator[] is deprecated warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11578 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 16:43:51 +00:00
Chris Lattner
fdc01cedd4 Fix deprecated operator[] warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11577 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 16:38:18 +00:00
Alkis Evlogimenos
23c114fd3b Be more agressive when joining ranges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11575 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 04:38:37 +00:00
Alkis Evlogimenos
99d9923608 Fix overly conservative spill interval computation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11574 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 03:35:38 +00:00
Alkis Evlogimenos
3a9986f5d8 Beautify debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11573 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 00:35:06 +00:00
Chris Lattner
56ddada278 Remove the -disable-kill option. The register allocator is buggy with it,
and it was only for debugging in the first place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11557 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 17:49:10 +00:00
Chris Lattner
11390e76e7 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11542 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:09:40 +00:00
Chris Lattner
cdee28724e Fix a bug in my previous refactoring change... arg!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11535 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:02:17 +00:00
Alkis Evlogimenos
7093d37304 Add LiveIntervals::Interval::empty() member function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11520 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 05:14:37 +00:00
Chris Lattner
1e3812c1c5 Once we have a way to fold spill code reloads into instructions, we have a way to use it. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11517 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 04:08:37 +00:00
Alkis Evlogimenos
355a724bd8 Fix spilled interval update. It was too conservative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11516 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 04:04:20 +00:00
Chris Lattner
42e0a8fded Refactor code a bit. No functionality changes, though the comment hints at things to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11515 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 03:57:19 +00:00
Alkis Evlogimenos
aad5c05051 Add LeakDetection to MachineInstr.
Move out of line member functions of MachineBasicBlock to
MachineBasicBlock.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11497 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 07:17:43 +00:00
Chris Lattner
9b700f7951 By default, llvm.setjmp/llvm.longjmp intrinsics get lowered to their libc counterparts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11483 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 22:24:51 +00:00
Chris Lattner
588e72db75 Refactor code. Now the intrinsic lowering pass tries to recycle preexisting
prototypes, even if they don't precisely match what it would prefer to use.
This fixes: CBackend/2004-02-15-PreexistingExternals.llx compiling it into:

  ltmp_0_30 = memcpy(l14_C, 4u, 17);
  ltmp_1_30 = memcpy(((int *)l27_A), ((unsigned )(long)l27_B), ((int )123u));

instead of:

  ltmp_0_30 = memcpy(l14_C, 4u, 17);
  ltmp_1_27 = l43_memcpy(l27_A, l27_B, 123u);

Which does the wrong thing as you could imagine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11481 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 22:16:39 +00:00
Alkis Evlogimenos
f11800b718 This pass should not require phi elimination or live variable
analysis. It should only preserve them and update LiveVariables if it
already ran.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11479 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 21:50:32 +00:00
Chris Lattner
5aaf1d2820 Finegrainify namespacification
Remove one of the operands of a two operand instruction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11478 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 21:38:28 +00:00
Alkis Evlogimenos
859a18b583 Make dense maps keyed on physical registers smallerusing
MRegisterInfo::getNumRegs() instead of
MRegisterInfo::FirstVirtualRegister.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11477 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 21:37:17 +00:00
Alkis Evlogimenos
843b160a20 Eliminate the use of spill (reserved) registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11476 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 10:24:21 +00:00
Chris Lattner
05d8350c12 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11454 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 00:14:20 +00:00
Alkis Evlogimenos
c81efdc59c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11453 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 00:03:15 +00:00
Chris Lattner
93799292c1 There is no reason to align the stack pointer if there are no callees of this function!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11449 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 20:10:59 +00:00
Chris Lattner
cc42d2c3cc A target that doesn't support these intrinsics will still meet spec (the
intrinsic will always produce zero), but it will behave unexpectedly, so
warn like GCC does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11444 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 04:52:06 +00:00
Chris Lattner
cf89908381 Add llvm.memset/frameaddress/returnaddress intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11431 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 02:47:17 +00:00
Alkis Evlogimenos
f81af21caf Use newly added next() and prior() utility functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11430 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 01:18:34 +00:00
Alkis Evlogimenos
6ab5c15962 Use std::numeric_limits<float>::infinity() instead of
std::numeric_limits<float>::max() for weighting preallocated
intervals.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11427 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 00:44:07 +00:00
Alkis Evlogimenos
be766c7246 Remove getAllocatedRegNum(). Use getReg() instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11393 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 21:01:20 +00:00
Alkis Evlogimenos
4de473bc59 Use getNumVirtualRegs().
Whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11389 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 18:20:47 +00:00
Brian Gaeke
90421cd8f9 Refactor MachineFunction::print() into MachineBasicBlock::print().
Add MachineBasicBlock::dump().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11364 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 04:39:55 +00:00
Brian Gaeke
21326fc2ad 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11363 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 04:39:32 +00:00
Alkis Evlogimenos
ab8672c8bb 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11357 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 18:49:07 +00:00
Chris Lattner
2751e76a70 Add support for the llvm.memmove intrinsic
Patch graciously contributed by Reid Spencer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11355 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 18:11:20 +00:00
Chris Lattner
5fe51cc2c4 Implement the llvm.memcpy intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11349 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 17:01:09 +00:00
Chris Lattner
2a90ba6017 Rename the opCode instance variable to Opcode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11348 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 16:09:53 +00:00
Chris Lattner
3081db8d01 This field is never read
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11346 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 16:04:49 +00:00
Alkis Evlogimenos
c0b9dc5be7 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11340 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 02:27:10 +00:00
Brian Gaeke
918cdd420b getOpCode() --> getOpcode().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11339 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 01:34:05 +00:00
Chris Lattner
61b08f193a Add #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11285 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 21:18:55 +00:00
Chris Lattner
1cbe4d0ad0 Do not use MachineOperand::isVirtualRegister either!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11283 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 21:12:22 +00:00
Chris Lattner
3d878d80d6 Eliminate users of MachineOperand::isPhysicalRegister
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11278 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:41:10 +00:00
Brian Gaeke
f738db0818 Move InstrSchedule's iterator begin/end methods inline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11239 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 18:42:46 +00:00
Brian Gaeke
0dc5753f2b 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11238 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 18:42:05 +00:00
Chris Lattner
ecea5635f8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11219 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 02:12:04 +00:00
Chris Lattner
499487742e 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11217 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 01:43:23 +00:00
Chris Lattner
96aef89338 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11216 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 01:35:21 +00:00
Chris Lattner
64667b6418 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 :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11215 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 01:26:13 +00:00
Alkis Evlogimenos
f5eaf16b94 Increase code clarity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11151 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-06 18:08:18 +00:00
Alkis Evlogimenos
54d23c754a Eliminate uneeded lookups by passing a Virt2PhysMap::iterator instead
of the virtual register to certain functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11143 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-06 03:15:40 +00:00
Alkis Evlogimenos
0b8cb2bc47 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)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11141 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-05 22:55:25 +00:00
Alkis Evlogimenos
ad48cd6327 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11135 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-05 20:45:40 +00:00