Commit Graph

5528 Commits

Author SHA1 Message Date
Alkis Evlogimenos
537fa9838d Fix instruction numbering in debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11655 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 06:29:51 +00:00
Alkis Evlogimenos
39a0d5c112 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11654 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 06:15:40 +00:00
Chris Lattner
f358c5ad15 It is totally unacceptable to print out (literally) millions of zeros when
compiling 129.compress... so don't!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11649 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 05:49:22 +00:00
Chris Lattner
6559615fc4 Disable the stack trace thing until we can get an autoconf test for it. This
call breaks on sparcs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11635 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 21:21:23 +00:00
Chris Lattner
982774cbeb Implement new function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11631 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 20:03:14 +00:00
Alkis Evlogimenos
d195e99bc8 Fix RA::verifyAssignment()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11629 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 19:24:17 +00:00
Chris Lattner
d368c6163a Fix problem fusing spill code into instructions: we didn't update the live
variable information to take into account the change of instruction
address.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11628 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 18:34:02 +00:00
Chris Lattner
a96478d7d6 Fix an iterator invalidation problem. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11627 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 18:32:29 +00:00
Chris Lattner
5ed001b6af Add method to update livevar when an instruction moves
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11625 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 18:28:02 +00:00
Chris Lattner
8517e1f0be 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11623 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 16:17:08 +00:00
Chris Lattner
5e61fa9519 Add a MachineBasicBlock::getParent() method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11622 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 16:13:54 +00:00
Alkis Evlogimenos
1d29a6d6c7 Make ToolExecutionError inherit std::exception and implement its
interface: getMessage() is gone, use what() instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11621 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 07:39:26 +00:00
Alkis Evlogimenos
280f9c939d Print stacktrace in STDERR before dying on a fatal signal. Currently
the symbols are not demangled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11620 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 07:36:35 +00:00
Alkis Evlogimenos
2acef2da06 Rename reloads/spills to loads/stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11619 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 06:19:09 +00:00
Chris Lattner
9cbbee332f Add support for just running the code generator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11611 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 23:24:41 +00:00
Alkis Evlogimenos
779e640657 Implement assignment correctness verification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11609 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 23:15:23 +00:00
Alkis Evlogimenos
52f8f56ef4 Move unused typedefs in private section. Add method to return interval
given a register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11608 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 23:14:52 +00:00
Chris Lattner
a3de11783f indent correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11601 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 20:58:00 +00:00
Chris Lattner
722ca71285 Don't yell. BUGPOINT should yell, not the tool runner :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11600 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 20:57:38 +00:00
Chris Lattner
89bf9ea65e If there is an error running a tool, include the error message (e.g. assertion failure) in the exception
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11597 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 20:38:00 +00:00
Chris Lattner
8c56be5e2b When an error occurs executing a tool, we now throw an exception instead
of calling exit(1).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11593 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 20:21:57 +00:00
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
e9118f3694 Fix argument size for MOVSX and MOVZX instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11576 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 16:20:40 +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
57cb9883aa Fix PR245: Linking weak and strong global variables is dependent on link order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11565 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 21:56:04 +00:00
Chris Lattner
28a631d37e When we complete the bottom-up pass, make sure to merge the globals in 'main' into
the globals graph.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11562 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 19:06:47 +00:00
Chris Lattner
cc0d2f586f Add support for GlobalAddress's for alkis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11560 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 18:23:55 +00:00
Alkis Evlogimenos
9b9b7fc28d These store to memory too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11558 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 17:53:48 +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
acce13e4cc These store to memory, not read from it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11556 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 17:46:50 +00:00
Alkis Evlogimenos
d886ed99fb Instructiosn with 1 memory operand have 4 operands in our
representation.. duh!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11554 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 15:58:13 +00:00
Alkis Evlogimenos
f41dadafae Align case statements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11552 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 15:50:41 +00:00
Alkis Evlogimenos
14ffe75c9c Add TEST and XCHG memory operand support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11550 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 15:48:42 +00:00
Alkis Evlogimenos
68bff8e15d Add OR and XOR memory operand support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11549 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 15:33:14 +00:00
Alkis Evlogimenos
e287a00440 Peephole optimize SUBmi{16,32} into SUBmi{16,32}b when immediate is 8
bits wide.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11548 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 15:14:29 +00:00
Alkis Evlogimenos
cacca82833 ADDmi{16,32} should be in the next case statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11547 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 15:10:11 +00:00
Alkis Evlogimenos
a7be982e72 Add memory operand folding support for MUL, DIV, IDIV, NEG, NOT,
MOVSX, and MOVZX.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11546 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 09:14:23 +00:00
Alkis Evlogimenos
89b0214b76 Add memory operand folding for CMP{rm,mr,mi}{8,16,32}, INCm{8,16,32}
and DECm{8,16,32} instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11545 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:49:20 +00:00
Alkis Evlogimenos
509d6d65b5 Add CMP{rm,mr,mi}{8,16,32}, INCm{8,16,32} and DECm{8,16,32} instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11544 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:49:00 +00:00
Alkis Evlogimenos
503770cfc3 Add SUB{rm,mr,mi}{8,16,32} instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11543 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:17:40 +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
Alkis Evlogimenos
18bd7bb4d4 Add support for folding memory operands for ADC, SBB and SUB instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11541 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:08:51 +00:00
Alkis Evlogimenos
69da6dba79 Add support for ADC{rm.mr}32 and SBB{rm,mr}32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11540 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:06:31 +00:00
Chris Lattner
ee0919bb10 Add a (hidden) option to print instructions that fail to fuse. It's looking
like compares and test's would be the next huge win...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11539 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:03:47 +00:00
Alkis Evlogimenos
17dc674c13 Add support for folding memory operands in MOVri{8,16,32} instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11538 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:47:20 +00:00
Chris Lattner
5b67252620 Expand the repertoire of the forms we can print and encode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11537 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:40:44 +00:00
Chris Lattner
651fd55d5f Disable this peephole for now. We can't keep track of the fact that the immediate is 8 bits,
but the memory reference is full sized.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11536 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:36:32 +00:00