Chris Lattner
9b3c702614
Avoid allocating special registers a bit more robustly
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12207 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-08 03:48:07 +00:00
Chris Lattner
7dee5daf85
Implement folding explicit load instructions into binary operations. For a
...
testcase like this:
int %test(int* %P, int %A) {
%Pv = load int* %P
%B = add int %A, %Pv
ret int %B
}
We now generate:
test:
mov %ECX, DWORD PTR [%ESP + 4]
mov %EAX, DWORD PTR [%ESP + 8]
add %EAX, DWORD PTR [%ECX]
ret
Instead of:
test:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
mov %EAX, DWORD PTR [%EAX]
add %EAX, %ECX
ret
... saving one instruction, and often a register. Note that there are a lot
of other instructions that could use this, but they aren't handled. I'm not
really interested in adding them, but mul/div and all of the FP instructions
could be supported as well if someone wanted to add them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12204 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-08 01:58:35 +00:00
Chris Lattner
721d2d4a6e
Rearrange and refactor some code. No functionality changes.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12203 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-08 01:18:36 +00:00
Chris Lattner
9440db8866
Implement ArgumentPromotion/aggregate-promote.ll
...
This allows pointers to aggregate objects, whose elements are only read, to
be promoted and passed in by element instead of by reference. This can
enable a LOT of subsequent optimizations in the caller function.
It's worth pointing out that this stuff happens a LOT of C++ programs, because
objects in templates are generally passed around by reference. When these
templates are instantiated on small aggregate or scalar types, however, it is
more efficient to pass them in by value than by reference.
This transformation triggers most on C++ codes (e.g. 334 times on eon), but
does happen on C codes as well. For example, on mesa it triggers 72 times,
and on gcc it triggers 35 times. this is amazingly good considering that
we are using 'basicaa' so far.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12202 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-08 01:04:36 +00:00
Chris Lattner
86a734bd40
Implement: ArgumentPromotion/chained.ll
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12200 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-07 22:52:53 +00:00
Chris Lattner
7db5a6df78
Fix another minor bug, exposed by perlbmk
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12198 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-07 22:43:27 +00:00
Chris Lattner
c76d80342e
Since 'load null' is undefined, we can make it do whatever we want. Returning
...
a zero value is the most likely way to cause further simplification, so we do it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12197 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-07 22:16:24 +00:00
Chris Lattner
7e6f5090af
Fix a minor bug and turn debug output into, well, debug output.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12195 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-07 21:54:50 +00:00
Chris Lattner
ed570a7dca
New LLVM pass: argument promotion. This version only handles simple scalar
...
variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12193 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-07 21:29:54 +00:00
Alkis Evlogimenos
13d362f310
Add memory operand version of conditional move.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12190 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-07 03:19:11 +00:00
Alkis Evlogimenos
5ae00066c6
As I wrote in the docs, simple is the default spiller :-)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12189 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-06 23:08:44 +00:00
Alkis Evlogimenos
499b2bad27
Add simple spiller.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12188 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-06 22:38:29 +00:00
Brian Gaeke
08f64c3321
Support return values of basic integer types.
...
Emit RETL instruction to return instead of funny JMPL.
Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12186 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-06 05:32:28 +00:00
Brian Gaeke
a8056fabeb
Sort stanzas into Sparc V8 book page number order.
...
Add RET, RETL. Rename SAVE, RESTORE & JMPL for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12185 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-06 05:32:13 +00:00
Brian Gaeke
bda4a3c61a
Hack it so we do not try to allocate values to G0.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12184 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-06 05:31:32 +00:00
Brian Gaeke
d69b3c58d3
Make prolog align stack properly. Make epilog not touch any registers.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12183 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-06 05:31:21 +00:00
Brian Gaeke
a8b00cafc4
Emit register names in lowercase, as required by the assembler.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12182 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-06 05:30:21 +00:00
Brian Gaeke
a98e051417
Teach getRegClassForType where to find FP registers
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12180 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-06 03:54:13 +00:00
Chris Lattner
deb8712b49
Fix a minor bug
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12169 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-05 22:04:07 +00:00
Misha Brukman
a5f2905c71
Unbreak the build on Sparc.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12161 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-05 20:04:40 +00:00
Brian Gaeke
62aa28aef3
Asm output is looking a lot better; not correct for all operands yet though.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12143 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-05 08:39:09 +00:00
Chris Lattner
4ab483c6ad
Fix a bug in a previous checkin that broke 175.vpr
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12128 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 21:36:57 +00:00
Chris Lattner
3aeb40cadb
Add support for strto* and v*printf
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12127 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 21:03:54 +00:00
Chris Lattner
6b3e3ccf73
Add non-crappy support for varargs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12126 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 20:33:47 +00:00
Chris Lattner
e6e93ccd0c
Implement a FIXME, improving the efficiency of DSA on povray.
...
This reduces CBU time from 145s -> 122s (debug build), reduces # allocated nodes
from 129420 to 116477.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12125 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 19:47:04 +00:00
Brian Gaeke
7a3ae1fbad
Support -print-machineinstrs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12124 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 19:22:16 +00:00
Chris Lattner
da5c5a5b95
Speed up the cbu pass from taking somewhere near the age of the universe to about 90s on povray
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12123 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 19:16:35 +00:00
Brian Gaeke
323819e4e1
make -print-machineinstrs work for both SparcV9 and X86
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12122 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 19:16:23 +00:00
Alkis Evlogimenos
ce1e500e2f
Add assertion for scale verification.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12120 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 18:05:02 +00:00
Alkis Evlogimenos
5f65adda50
Hide variable from other functions.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12118 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 17:50:44 +00:00
Chris Lattner
f590ced5c5
Fix BU datastructures with povray!
...
The problem was that we were merging a field of a node with a value that was
deleted. Thanks to bugpoint for reducing povray to a nice small 3 function
example. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12116 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 17:06:53 +00:00
Chris Lattner
16437ff705
Minor changes, remove some debugging code that got checked in somehow.
...
Make sure to scope the NodeMap passed into cloneInto so that it doesn't point
to nodes that are deleted. Add some FIXME's for future performance enhancements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12115 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 17:05:28 +00:00
Brian Gaeke
4acfd039f9
Asm printer support, based on x86 - only prints mnemonics for now
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12113 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 06:00:41 +00:00
Brian Gaeke
da69e7d9b3
Double-FP pseudo-registers.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12112 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 05:15:03 +00:00
Brian Gaeke
775158d62a
Subtract instructions; minor cleanups
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12111 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 04:37:45 +00:00
Brian Gaeke
e7173b7e8e
Floating point regs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12110 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 04:37:22 +00:00
Chris Lattner
2f3469013e
Only clone nodes that are needed in the caller, don't clone ALL aux calls. This improves
...
povray from having ~600K nodes and 300K call nodes to 65K nodes and 25K call nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12109 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 03:57:53 +00:00
Brian Gaeke
e806173ab6
Simple copyConstantToReg support, SETHIi and ORri
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12107 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-04 00:56:25 +00:00
Brian Gaeke
bc1d27aa6e
Support add - note, still missing important copyConstantToRegister stuff
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12106 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 23:03:14 +00:00
Chris Lattner
76a9eb3e40
Fix a minor bug handling incomplete programs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12105 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 23:00:19 +00:00
Chris Lattner
c4ebdcea7a
Fix a DSA bug that caused DSA to generate incredibly huge graphs and take forever to
...
do it on povray. The problem is that we were not copying globals from callees to
callers unless the existed in both graphs. We should have copied them in the case
where the global pointed to a node that was copied as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12104 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 22:01:09 +00:00
Chris Lattner
2c7725abb4
Deinline methods, add fast exit
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12102 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 20:55:27 +00:00
Brian Gaeke
c54839573c
Make MachineOperand's value named 'contents'. Make really, really sure
...
it is always completely initialized and copied.
Also, fix up many comments and asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12100 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 19:07:27 +00:00
Chris Lattner
b1aaeee48a
Fix a node mapping problem that was causing the pool allocator to locally allocate
...
nodes that were globally live, thus breaking programs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12094 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 05:34:31 +00:00
Chris Lattner
b06f103d0c
SPECIFY a target data to initialize the CBE target with. Until now we have
...
been using the default target data layout object to lower malloc instructions,
causing us to allocate more memory than we needed! This could improve the
performance of the CBE generated code substantially!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12088 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 02:14:15 +00:00
Chris Lattner
2bed9ecc4b
Add a new constructor
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12087 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 02:12:47 +00:00
Chris Lattner
0a94348fb9
Don't emit things like malloc(16*1). Allocation instructions are fixed arity now.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12086 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-03 01:40:53 +00:00
Chris Lattner
7252939af0
FINALLY be able to get symbolic type names in the globals graph!
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12082 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-02 21:39:43 +00:00
Chris Lattner
a19ba52596
Really, only if reopen
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12080 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-02 20:46:18 +00:00
Misha Brukman
ab5c6003d2
Doxygenify comments.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12071 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-02 00:22:19 +00:00
Misha Brukman
0256e4bbf9
Implement ExtractCodeRegion()
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12070 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-02 00:20:57 +00:00
Misha Brukman
38b8fd1078
Make a note that this is usually used via bugpoint.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12068 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-02 00:19:09 +00:00
Misha Brukman
538607fe45
Doxygenify some comments.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12064 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 23:53:11 +00:00
Alkis Evlogimenos
dd420e060a
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.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12062 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 23:18:15 +00:00
Alkis Evlogimenos
5f37502bfb
Add the long awaited memory operand folding support for linear scan
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12058 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 20:05:10 +00:00
Misha Brukman
9d0802e7dd
* If a badref has a name, print it out for ease of debugging
...
* Doxygenify (some) comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12057 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 19:48:13 +00:00
Chris Lattner
82e9d7224e
Correctly add an array marker on a node when appropriate!
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12055 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 19:02:54 +00:00
Misha Brukman
b97fce5252
* Add implementation of ExtractBasicBlock()
...
* Add comments to ExtractLoop()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12053 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 18:28:34 +00:00
Chris Lattner
ec726a1a6e
Add this back, as its absence introduces assertions, and it seems to work now
...
that Instructions are annotable again
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12045 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 15:28:27 +00:00
Tanya Lattner
f048bfd97d
fix bug in previous checkin
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12044 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 15:05:17 +00:00
Brian Gaeke
05b15fb075
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12043 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 06:43:29 +00:00
Tanya Lattner
9b3cbdbedb
Adding new Modulo Scheduling graph files.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12031 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 02:50:57 +00:00
Tanya Lattner
d14b83733e
Removing old graph files with new graph files that I wrote. Updated ModuloScheduling pass, but still in progress.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12030 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 02:50:01 +00:00
Chris Lattner
2d6a6aa137
Expand on my note-to-self
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12029 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 02:44:44 +00:00
Chris Lattner
21585221b6
Handle passing constant integers to functions much more efficiently. Instead
...
of generating this code:
mov %EAX, 4
mov DWORD PTR [%ESP], %EAX
mov %AX, 123
movsx %EAX, %AX
mov DWORD PTR [%ESP + 4], %EAX
call Y
we now generate:
mov DWORD PTR [%ESP], 4
mov DWORD PTR [%ESP + 4], 123
call Y
Which hurts the eyes less. :)
Considering that register pressure around call sites is already high (with all
of the callee clobber registers n stuff), this may help a lot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12028 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 02:42:43 +00:00
Chris Lattner
ce6096f49b
Fix a minor code-quality issue. When passing 8 and 16-bit integer constants
...
to function calls, we would emit dead code, like this:
int Y(int, short, double);
int X() {
Y(4, 123, 4);
}
--- Old
X:
sub %ESP, 20
mov %EAX, 4
mov DWORD PTR [%ESP], %EAX
*** mov %AX, 123
mov %AX, 123
movsx %EAX, %AX
mov DWORD PTR [%ESP + 4], %EAX
fld QWORD PTR [.CPIX_0]
fstp QWORD PTR [%ESP + 8]
call Y
mov %EAX, 0
# IMPLICIT_USE %EAX %ESP
add %ESP, 20
ret
Now we emit:
X:
sub %ESP, 20
mov %EAX, 4
mov DWORD PTR [%ESP], %EAX
mov %AX, 123
movsx %EAX, %AX
mov DWORD PTR [%ESP + 4], %EAX
fld QWORD PTR [.CPIX_0]
fstp QWORD PTR [%ESP + 8]
call Y
mov %EAX, 0
# IMPLICIT_USE %EAX %ESP
add %ESP, 20
ret
Next up, eliminate the mov AX and movsx entirely!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12026 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 02:34:08 +00:00
Chris Lattner
99cca7d3aa
Disable tail duplication in a case that breaks on Olden/tsp
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12021 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-01 01:12:13 +00:00
Misha Brukman
99cc88bb64
* Remove function to find "main" in a Module, there's a method for that
...
* Removing extraneous empty space and empty comment lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12014 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 23:09:10 +00:00
Chris Lattner
cbee990a29
Fix -debug-pass=Executions, which relied on Function, Module, and BasicBlock
...
being annotable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12013 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 22:37:04 +00:00
Chris Lattner
06887c9a2a
Fix bug: test/Regression/Transforms/LowerInvoke/2004-02-29-PHICrash.llx
...
... which tickled the lowerinvoke pass because it used the BCE routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12012 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 22:24:41 +00:00
Chris Lattner
92bc3bc11c
Add an assert
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12010 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 22:01:51 +00:00
Chris Lattner
c81295ab24
Add back #include I messed up
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12009 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 21:40:53 +00:00
Chris Lattner
e8d43fdced
Urg, forgot to check this in.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12007 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 21:03:08 +00:00
Chris Lattner
08d4963d49
Move the private MachineInstrAnnot.h into a private directory.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12003 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 19:12:51 +00:00
Chris Lattner
78827e9f8b
Remove use of an ugly header
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12002 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 19:04:31 +00:00
Chris Lattner
585911ee21
Move methods out of .h file
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12001 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 19:02:39 +00:00
Chris Lattner
e85f2348c9
Do not use explicit casts that hide the dependence on Instruction being
...
annotable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12000 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 19:02:26 +00:00
Alkis Evlogimenos
96c9b8b496
Add instruction name description.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11998 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 18:44:03 +00:00
Alkis Evlogimenos
7f6124cfc2
Use correct template for SHLD and SHRD instructions so that the memory
...
operand size is correctly specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11997 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 09:19:40 +00:00
Alkis Evlogimenos
9c22aeb0b2
Improve allocation order:
...
1) For 8-bit registers try to use first the ones that are parts of the
same register (AL then AH). This way we only alias 2 16/32-bit
registers after allocating 4 8-bit variables.
2) Move EBX as the last register to allocate. This will cause less
spills to happen since we will have 8-bit registers available up to
register excaustion (assuming we use the allocation order). It
would be nice if we could push all of the 8-bit aliased registers
towards the end but we much prefer to keep callee saved register to
the end to avoid saving them on entry and exit of the function.
For example this gives a slight reduction of spills with linear scan
on 164.gzip.
Before:
11221 asm-printer - Number of machine instrs printed
975 spiller - Number of loads added
675 spiller - Number of stores added
398 spiller - Number of register spills
After:
11182 asm-printer - Number of machine instrs printed
952 spiller - Number of loads added
652 spiller - Number of stores added
386 spiller - Number of register spills
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11996 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 09:17:01 +00:00
Alkis Evlogimenos
8295f202d9
A big X86 instruction rename. The instructions are renamed to make
...
their names more decriptive. A name consists of the base name, a
default operand size followed by a character per operand with an
optional special size. For example:
ADD8rr -> add, 8-bit register, 8-bit register
IMUL16rmi -> imul, 16-bit register, 16-bit memory, 16-bit immediate
IMUL16rmi8 -> imul, 16-bit register, 16-bit memory, 8-bit immediate
MOVSX32rm16 -> movsx, 32-bit register, 16-bit memory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11995 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 08:50:03 +00:00
Brian Gaeke
6ac5300fbc
Remove dead member variables of SparcV9SchedInfo and TargetSchedInfo
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11994 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 08:40:03 +00:00
Chris Lattner
ee352852e7
Eliminate the X86-specific BMI functions, using BuildMI instead.
...
Replace uses of addZImm with addImm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11992 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 07:22:16 +00:00
Chris Lattner
168aa90bf6
Fix a miscompilation of 197.parser that occurs when you have single basic
...
block loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11990 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 07:10:16 +00:00
Chris Lattner
4279f3c984
Fix PR255: [tailduplication] Single basic block loops are very rare
...
Note that this is a band-aid put over a band-aid. This just undisables
tail duplication in on very specific case that it seems to work in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11989 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 06:41:20 +00:00
Chris Lattner
dce363d5ec
Adjust to change in TII ctor arguments
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11987 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 06:31:44 +00:00
Chris Lattner
bceb68807f
Eliminate the distinction between "real" and "unreal" instructions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11986 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 06:31:16 +00:00
Chris Lattner
1ddf475b6a
These two virtual methods are never called.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11984 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 05:59:33 +00:00
Chris Lattner
0755912c38
Remove a TON of flags that noone cares about
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11983 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 05:58:30 +00:00
Chris Lattner
9a945277c0
Noone calls these virtual methods
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11982 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 05:58:16 +00:00
Chris Lattner
0723969e87
This is the only file in the system that uses this enum. eliminate it.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11981 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 05:57:59 +00:00
Chris Lattner
e1274de2c9
Implement initial prolog/epilog code insertion methods.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11979 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 05:18:30 +00:00
Chris Lattner
561c0107b2
int64_t -> int
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11977 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 05:07:02 +00:00
Alkis Evlogimenos
8777d241cf
Use correct template for ADC instruction with memory operands.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11974 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 02:18:17 +00:00
Chris Lattner
1c809c594b
Add an instruction selector capable of selecting 'ret void'
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11973 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-29 00:27:00 +00:00
Alkis Evlogimenos
da474adb21
SHLD and SHRD take 32-bit operands but an 8-bit immediate. Rename them
...
to denote this fact.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11972 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 23:46:44 +00:00
Alkis Evlogimenos
8e475b8cfd
Floating point loads/stores act on memory operands. Rename them to
...
denote this fact.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11971 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 23:42:35 +00:00
Alkis Evlogimenos
91c4b52e7f
Rename instruction templates to be easier to the human eye to
...
parse. The name is now I (operand size)*. For example:
Im32 -> instruction with 32-bit memory operands.
Im16i8 -> instruction with 16-bit memory operands and 8 bit immediate
operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11970 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 23:09:03 +00:00
Alkis Evlogimenos
f8da4d8839
Uncomment instructions that take both an immediate and a memory
...
operand but their sizes differ.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11969 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 22:06:59 +00:00
Alkis Evlogimenos
5ab29b504d
Each instruction now has both an ImmType and a MemType. This describes
...
the size of the immediate and the memory operand on instructions that
use them. This resolves problems with instructions that take both a
memory and an immediate operand but their sizes differ (i.e. ADDmi32b).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11967 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 22:02:05 +00:00
Brian Gaeke
f822ee999f
Fix typo in comment
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11966 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 21:55:18 +00:00
Chris Lattner
542f149f00
Implement switch->br and br->switch folding by ripping out the switch->switch
...
and br->br code and generalizing it. This allows us to compile code like this:
int test(Instruction *I) {
if (isa<CastInst>(I))
return foo(7);
else if (isa<BranchInst>(I))
return foo(123);
else if (isa<UnwindInst>(I))
return foo(1241);
else if (isa<SetCondInst>(I))
return foo(1);
else if (isa<VAArgInst>(I))
return foo(42);
return foo(-1);
}
into:
int %_Z4testPN4llvm11InstructionE("struct.llvm::Instruction"* %I) {
entry:
%tmp.1.i.i.i.i.i.i.i = getelementptr "struct.llvm::Instruction"* %I, long 0, ubyte 4 ; <uint*> [#uses=1]
%tmp.2.i.i.i.i.i.i.i = load uint* %tmp.1.i.i.i.i.i.i.i ; <uint> [#uses=2]
%tmp.2.i.i.i.i.i.i = seteq uint %tmp.2.i.i.i.i.i.i.i, 27 ; <bool> [#uses=0]
switch uint %tmp.2.i.i.i.i.i.i.i, label %endif.0 [
uint 27, label %then.0
uint 2, label %then.1
uint 5, label %then.2
uint 14, label %then.3
uint 15, label %then.3
uint 16, label %then.3
uint 17, label %then.3
uint 18, label %then.3
uint 19, label %then.3
uint 32, label %then.4
]
...
As well as handling the cases in 176.gcc and many other programs more effectively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11964 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 21:28:10 +00:00
Chris Lattner
9ff6ba1ea1
Change this so that LLC actually tries to run the code generator, though it will
...
immediately abort due to lack of an instruction selector. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11963 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 20:21:45 +00:00
Chris Lattner
8a62384253
SparcV8 now builds.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11960 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 19:54:00 +00:00
Chris Lattner
9a89f37dc7
fine grainify namespacification
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11959 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 19:53:18 +00:00
Chris Lattner
8d8a6bc7a3
Finegrainify namespacification
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11958 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 19:52:49 +00:00
Chris Lattner
a85d46eea8
Tab completion is our friend.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11957 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 19:45:39 +00:00
Chris Lattner
83ba99ac46
Clean up rules
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11956 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 19:43:40 +00:00
Chris Lattner
275f6459ab
Bring this directory into "it actually compiles" land
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11955 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 19:37:18 +00:00
Chris Lattner
f13bd49d6a
Fix multiple inclusion problem
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11954 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 19:31:32 +00:00
Chris Lattner
b99df4f8c2
if there is already a prototype for malloc/free, use it, even if it's incorrect.
...
Do not just inject a new prototype.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11951 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 18:51:45 +00:00
Alkis Evlogimenos
745502a04b
Do not generate instructions with mismatched memory/immediate sized
...
operands. The X86 backend doesn't handle them properly right now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11944 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 06:01:43 +00:00
Chris Lattner
7bcc0e7fff
Rename AddUsesToWorkList -> AddUsersToWorkList, as that is what it does.
...
Create a new AddUsesToWorkList method
optimize memmove/set/cpy of zero bytes to a noop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11941 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 05:22:00 +00:00
Chris Lattner
6160e85201
Turn 'free null' into nothing
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11940 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 04:57:37 +00:00
Misha Brukman
9e4a642c03
Right, it's really Extractor, not Extraction.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11939 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 03:37:58 +00:00
Misha Brukman
9401deb320
A pass that uses the generic CodeExtractor to rip out *every* loop in every
...
function, as long as the loop isn't the only one in that function. This should
help debugging passes easier with BugPoint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11936 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 03:33:01 +00:00
Misha Brukman
e6336031b8
A generic code extractor: given a list of BasicBlocks, it will rip them out into
...
a new function, taking care of inputs and outputs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11935 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 03:26:20 +00:00
Alkis Evlogimenos
84cda0f470
Further comment updates.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11933 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 03:20:31 +00:00
Alkis Evlogimenos
a643a1a528
Update comments.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11932 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 03:12:31 +00:00
Alkis Evlogimenos
2eae379388
My previous commit broke the jit. The shift instructions always take
...
an 8-bit immediate. So mark the shifts that take immediates as taking
an 8-bit argument. The rest with the implicit use of CL are marked
appropriately.
A bug still exists:
def SHLDmri32 : I2A8 <"shld", 0xA4, MRMDestMem>, TB; // [mem32] <<= [mem32],R32 imm8
The immediate in the above instruction is 8-bit but the memory
reference is 32-bit. The printer prints this as an 8-bit reference
which confuses the assembler. Same with SHRDmri32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11931 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-28 02:56:26 +00:00
Brian Gaeke
9f78bf2ff7
Turn off the SparcV9MachineCodeDestructionPass for now, because it's buggy
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11930 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 21:15:40 +00:00
Brian Gaeke
3d1fdee339
Correct DestroyMachineFunction's getPassName
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11929 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 21:01:14 +00:00
Chris Lattner
0321b68f6b
Only clone global nodes between graphs if both graphs have the global.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11928 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 20:05:15 +00:00
Chris Lattner
6b586df328
ADD MORE FUNCTIONS!
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11927 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 20:04:48 +00:00
Alkis Evlogimenos
fa5229691f
Fix argument size for SHL, SHR, SAR, SHLD and SHRD families of
...
instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11923 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 19:46:30 +00:00
Alkis Evlogimenos
f9186e38d5
Fix encoding of ADD and SUB family of instructions. Also rearrange
...
them so that they are consistent with AND, XOR, etc...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11922 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 18:57:00 +00:00
Alkis Evlogimenos
169584ed45
Rename MRMS[0-7]{r,m} to MRM[0-7]{r,m}.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11921 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 18:55:12 +00:00
Chris Lattner
7d90a2738e
setcond instructions don't have aliasing implications.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11919 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 18:09:25 +00:00
Chris Lattner
08092533b1
Fix Regression/Assembler/2004-02-27-SelfUseAssertError.ll
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11913 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 17:28:25 +00:00
Alkis Evlogimenos
08388a4787
Add memory operand folding support for the SETcc family of
...
instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11907 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 16:13:37 +00:00
Alkis Evlogimenos
e56508eb7e
Add memory operand folding support for SHLD and SHRD instructions.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11905 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 15:03:18 +00:00
Alkis Evlogimenos
58ec60589b
Add memory operand folding support for SHL, SHR and SAR, SHLD instructions.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11903 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 09:28:43 +00:00
Alkis Evlogimenos
e35ba65b02
Rename SHL, SHR, SAR, SHLD and SHLR instructions to make them
...
consistent with the rest and also pepare for the addition of their
memory operand variants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11902 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 06:57:05 +00:00
Chris Lattner
a0ebcebc06
Implement test/Regression/Transforms/InstCombine/canonicalize_branch.ll
...
This is a really minor thing, but might help out the 'switch statement induction'
code in simplifycfg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11900 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 06:27:46 +00:00
Alkis Evlogimenos
fc54e83cea
Rename member function to be consistent with the rest.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11898 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 06:11:15 +00:00
Alkis Evlogimenos
57af2cf6f3
Make spiller push stores right after the definition of a register so
...
that they are as far away from the loads as possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11895 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 04:51:35 +00:00
Alkis Evlogimenos
ddcfd9e6fa
Fix crash caused by passing register 0 to
...
MRegisterInfo::isPhysicalRegister().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11894 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-27 01:52:34 +00:00
Alkis Evlogimenos
8fa16e47f8
Clear maps right after basic block is processed.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11892 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 23:22:23 +00:00
John Criswell
3799eec3cf
Fixes for PR258 and PR259.
...
Functions with linkonce linkage are declared with weak linkage.
Global floating point constants used to represent unprintable values
(such as NaN and infinity) are declared static so that they don't interfere
with other CBE generated translation units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11884 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 22:20:58 +00:00
Chris Lattner
cb582406dd
Be a good little compiler and handle direct calls efficiently, even if there
...
are beastly ConstantPointerRefs in the way...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11883 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 22:07:22 +00:00
Alkis Evlogimenos
71e353ed35
Uncomment assertions that register# != 0 on calls to
...
MRegisterInfo::is{Physical,Virtual}Register. Apply appropriate fixes
to relevant files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11882 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 22:00:20 +00:00
Chris Lattner
4f77caaa3d
Since LLVM uses structure type equivalence, it isn't useful to keep around
...
multiple type names for the same structural type. Make DTE eliminate all
but one of the type names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11879 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 20:02:23 +00:00
Chris Lattner
0e7ac16926
Use a map instead of annotations
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11875 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 08:02:17 +00:00
Chris Lattner
b1dfc70ef1
remove obsolete comment
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11872 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 07:59:22 +00:00
Chris Lattner
1cd4c7294c
Make sure that at least one virtual method is defined in a .cpp file to avoid
...
having the compiler emit RTTI and vtables to EVERY translation unit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11871 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 07:24:18 +00:00
Chris Lattner
f2dbf50efa
turn things like:
...
if (X == 0 || X == 2)
...where the comparisons and branches are in different blocks... into a switch
instruction. This comes up a lot in various programs, and works well with
the switch/switch merging code I checked earlier. For example, this testcase:
int switchtest(int C) {
return C == 0 ? f(123) :
C == 1 ? f(3123) :
C == 4 ? f(312) :
C == 5 ? f(1234): f(444);
}
is converted into this:
switch int %C, label %cond_false.3 [
int 0, label %cond_true.0
int 1, label %cond_true.1
int 4, label %cond_true.2
int 5, label %cond_true.3
]
instead of a whole bunch of conditional branches.
Admittedly the code is ugly, and incomplete. To be complete, we need to add
br -> switch merging and switch -> br merging. For example, this testcase:
struct foo { int Q, R, Z; };
#define A (X->Q+X->R * 123)
int test(struct foo *X) {
return A == 123 ? X1() :
A == 12321 ? X2():
(A == 111 || A == 222) ? X3() :
A == 875 ? X4() : X5();
}
Gets compiled to this:
switch int %tmp.7, label %cond_false.2 [
int 123, label %cond_true.0
int 12321, label %cond_true.1
int 111, label %cond_true.2
int 222, label %cond_true.2
]
...
cond_false.2: ; preds = %entry
%tmp.52 = seteq int %tmp.7, 875 ; <bool> [#uses=1]
br bool %tmp.52, label %cond_true.3, label %cond_false.3
where the branch could be folded into the switch.
This kind of thing occurs *ALL OF THE TIME*, especially in programs like
176.gcc, which is a horrible mess of code. It contains stuff like *shudder*:
#define SWITCH_TAKES_ARG(CHAR) \
( (CHAR) == 'D' \
|| (CHAR) == 'U' \
|| (CHAR) == 'o' \
|| (CHAR) == 'e' \
|| (CHAR) == 'u' \
|| (CHAR) == 'I' \
|| (CHAR) == 'm' \
|| (CHAR) == 'L' \
|| (CHAR) == 'A' \
|| (CHAR) == 'h' \
|| (CHAR) == 'z')
and
#define CONST_OK_FOR_LETTER_P(VALUE, C) \
((C) == 'I' ? SMALL_INTVAL (VALUE) \
: (C) == 'J' ? SMALL_INTVAL (-(VALUE)) \
: (C) == 'K' ? (unsigned)(VALUE) < 32 \
: (C) == 'L' ? ((VALUE) & 0xffff) == 0 \
: (C) == 'M' ? integer_ok_for_set (VALUE) \
: (C) == 'N' ? (VALUE) < 0 \
: (C) == 'O' ? (VALUE) == 0 \
: (C) == 'P' ? (VALUE) >= 0 \
: 0)
and
#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
{ \
if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
(X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
copy_to_mode_reg (SImode, XEXP (X, 1))); \
if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
(X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
copy_to_mode_reg (SImode, XEXP (X, 0))); \
if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
(X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
force_operand (XEXP (X, 0), 0)); \
if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
(X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
force_operand (XEXP (X, 1), 0)); \
if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
(X) = gen_rtx (PLUS, Pmode, force_operand (XEXP (X, 0), NULL_RTX),\
XEXP (X, 1)); \
if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
(X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
force_operand (XEXP (X, 1), NULL_RTX)); \
if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
|| GET_CODE (X) == LABEL_REF) \
(X) = legitimize_address (flag_pic, X, 0, 0); \
if (memory_address_p (MODE, X)) \
goto WIN; }
and others. These macros get used multiple times of course. These are such
lovely candidates for macros, aren't they? :)
This code also nicely handles LLVM constructs that look like this:
if (isa<CastInst>(I))
...
else if (isa<BranchInst>(I))
...
else if (isa<SetCondInst>(I))
...
else if (isa<UnwindInst>(I))
...
else if (isa<VAArgInst>(I))
...
where the isa can obviously be a dyn_cast as well. Switch instructions are a
good thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11870 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 07:13:46 +00:00
Chris Lattner
7b1af15612
No need to clear the map here, it will always be empty
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11868 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 05:21:21 +00:00
Chris Lattner
af6926a382
Fix typo
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11864 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 03:45:03 +00:00
Chris Lattner
abcdf80ec6
The node doesn't have to be _no_ node flags, it just has to be complete and
...
not have any globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11863 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 03:43:43 +00:00
Chris Lattner
1fe9874d15
Add _more_ functions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11862 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 03:43:08 +00:00
Chris Lattner
8dd8d261a4
Fix some warnings, some of which were spurious, and some of which were real
...
bugs. Thanks Brian!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11859 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 01:20:02 +00:00
Misha Brukman
23e6c1ff45
Instructions to call and return from functions.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11858 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 00:37:12 +00:00
Chris Lattner
cf14e71c5e
Two changes:
...
1. Functions do not make things incomplete, only variables
2. Constant global variables no longer need to be marked incomplete, because
we are guaranteed that the initializer for the global will be in the
graph we are hacking on now. This makes resolution of indirect calls happen
a lot more in the bu pass, supports things like vtables and the C counterparts
(giant constant arrays of function pointers), etc...
Testcase here: test/Regression/Analysis/DSGraph/constant_globals.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11852 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 23:36:08 +00:00
Chris Lattner
c420ab6c25
When building local graphs, clone the initializer for constant globals into each
...
local graph that uses the global.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11850 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 23:31:02 +00:00
Alkis Evlogimenos
e3fcabe068
Fix bugs found with recent addition of assertions in
...
MRegisterInfo::is{Physical,Virtual}Register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11849 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 23:21:52 +00:00
Chris Lattner
51c06abbf1
Simplify the dead node elimination stuff
...
Make the incompleteness marker faster by looping directly over the globals
instead of over the scalars to find the globals
Fix a bug where we didn't mark a global incomplete if it didn't have any
outgoing edges. This wouldn't break any current clients but is still wrong.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11848 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 23:08:00 +00:00
Chris Lattner
52fc8d7ec9
Add a bunch more functions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11847 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 23:06:40 +00:00
Chris Lattner
153f24070c
Try harder to get symbol info
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11846 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 23:06:30 +00:00
Brian Gaeke
9d20b71eca
Represent va_list in interpreter as a (ec-stack-depth . var-arg-index)
...
pair, and look up varargs in the execution stack every time, instead of
just pushing iterators (which can be invalidated during callFunction())
around. (union GenericValue now has a "pair of uints" member, to support
this mechanism.) Fixes Bug 234.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11845 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 23:01:48 +00:00
Brian Gaeke
367b91d1bd
Great sparc renaming fallout IV: Sparc --> SparcV9.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11844 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 22:09:36 +00:00
Alkis Evlogimenos
1d8b28a357
Remove asssert since it is breaking cases that it shouldn't.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11841 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 22:01:06 +00:00
Alkis Evlogimenos
4d0d864be3
Add DenseMap template and actually use it for for mapping virtual regs
...
to objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11840 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 21:55:45 +00:00
Chris Lattner
079236d1c9
My faith in programmers has been found to be totally misplaced. One would
...
assume that if they don't intend to write to a global variable, that they
would mark it as constant. However, there are people that don't understand
that the compiler can do nice things for them if they give it the information
it needs.
This pass looks for blatently obvious globals that are only ever read from.
Though it uses a trivially simple "alias analysis" of sorts, it is still able
to do amazing things to important benchmarks. 253.perlbmk, for example,
contains several ***GIANT*** function pointer tables that are not marked
constant and should be. Marking them constant allows the optimizer to turn
a whole bunch of indirect calls into direct calls. Note that only a link-time
optimizer can do this transformation, but perlbmk does have several strings
and other minor globals that can be marked constant by this pass when run
from GCCAS.
176.gcc has a ton of strings and large tables that are marked constant, both
at compile time (38 of them) and at link time (48 more). Other benchmarks
give similar results, though it seems like big ones have disproportionally
more than small ones.
This pass is extremely quick and does good things. I'm going to enable it
in gccas & gccld. Not bad for 50 SLOC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11836 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 21:34:36 +00:00
Misha Brukman
757df02826
SparcV8 regs are really 32-bit, not 64! Thanks, Chris.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11835 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 21:03:02 +00:00
Misha Brukman
e07c2aa67c
Clean up the tablegen descriptions for SparcV8.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11834 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 21:02:21 +00:00
Misha Brukman
5914bf6ef5
Fix the SparcV8 register definitions that were imported from PPC template.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11833 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 21:00:05 +00:00
Misha Brukman
3dff822988
SparcV8 has different types of instructions, but F1 is only used for CALL.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11832 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 20:52:20 +00:00
Chris Lattner
95c34f2efd
Add an assertion
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11830 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 19:37:44 +00:00
Chris Lattner
87124425d0
Fix failures in 099.go due to the cfgsimplify pass creating switch instructions
...
where there did not used to be any before
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11829 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 19:30:19 +00:00
Brian Gaeke
e785e531f4
SparcV8 skeleton
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11828 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 19:28:19 +00:00
Brian Gaeke
150666fd82
Great renaming part II: Sparc --> SparcV9 (also includes command-line options and Makefiles)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11827 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 19:08:12 +00:00
Brian Gaeke
e3d6807ab5
Great renaming: Sparc --> SparcV9
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11826 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 18:44:15 +00:00
Chris Lattner
adc1efe81c
Add a bunch more functions used by perlbmk
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11824 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 17:43:20 +00:00
Chris Lattner
940ff563f7
Fix incorrect debug code
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11821 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 15:15:04 +00:00
Chris Lattner
5f2c7b1975
Teach the instruction selector how to transform 'array' GEP computations into X86
...
scaled indexes. This allows us to compile GEP's like this:
int* %test([10 x { int, { int } }]* %X, int %Idx) {
%Idx = cast int %Idx to long
%X = getelementptr [10 x { int, { int } }]* %X, long 0, long %Idx, ubyte 1, ubyte 0
ret int* %X
}
Into a single address computation:
test:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
lea %EAX, DWORD PTR [%EAX + 8*%ECX + 4]
ret
Before it generated:
test:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
shl %ECX, 3
add %EAX, %ECX
lea %EAX, DWORD PTR [%EAX + 4]
ret
This is useful for things like int/float/double arrays, as the indexing can be folded into
the loads&stores, reducing register pressure and decreasing the pressure on the decode unit.
With these changes, I expect our performance on 256.bzip2 and gzip to improve a lot. On
bzip2 for example, we go from this:
10665 asm-printer - Number of machine instrs printed
40 ra-local - Number of loads/stores folded into instructions
1708 ra-local - Number of loads added
1532 ra-local - Number of stores added
1354 twoaddressinstruction - Number of instructions added
1354 twoaddressinstruction - Number of two-address instructions
2794 x86-peephole - Number of peephole optimization performed
to this:
9873 asm-printer - Number of machine instrs printed
41 ra-local - Number of loads/stores folded into instructions
1710 ra-local - Number of loads added
1521 ra-local - Number of stores added
789 twoaddressinstruction - Number of instructions added
789 twoaddressinstruction - Number of two-address instructions
2142 x86-peephole - Number of peephole optimization performed
... and these types of instructions are often in tight loops.
Linear scan is also helped, but not as much. It goes from:
8787 asm-printer - Number of machine instrs printed
2389 liveintervals - Number of identity moves eliminated after coalescing
2288 liveintervals - Number of interval joins performed
3522 liveintervals - Number of intervals after coalescing
5810 liveintervals - Number of original intervals
700 spiller - Number of loads added
487 spiller - Number of stores added
303 spiller - Number of register spills
1354 twoaddressinstruction - Number of instructions added
1354 twoaddressinstruction - Number of two-address instructions
363 x86-peephole - Number of peephole optimization performed
to:
7982 asm-printer - Number of machine instrs printed
1759 liveintervals - Number of identity moves eliminated after coalescing
1658 liveintervals - Number of interval joins performed
3282 liveintervals - Number of intervals after coalescing
4940 liveintervals - Number of original intervals
635 spiller - Number of loads added
452 spiller - Number of stores added
288 spiller - Number of register spills
789 twoaddressinstruction - Number of instructions added
789 twoaddressinstruction - Number of two-address instructions
258 x86-peephole - Number of peephole optimization performed
Though I'm not complaining about the drop in the number of intervals. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11820 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 07:00:55 +00:00
Chris Lattner
b6bac51351
* Make the previous patch more efficient by not allocating a temporary MachineInstr
...
to do analysis.
*** FOLD getelementptr instructions into loads and stores when possible,
making use of some of the crazy X86 addressing modes.
For example, the following C++ program fragment:
struct complex {
double re, im;
complex(double r, double i) : re(r), im(i) {}
};
inline complex operator+(const complex& a, const complex& b) {
return complex(a.re+b.re, a.im+b.im);
}
complex addone(const complex& arg) {
return arg + complex(1,0);
}
Used to be compiled to:
_Z6addoneRK7complex:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
*** mov %EDX, %ECX
fld QWORD PTR [%EDX]
fld1
faddp %ST(1)
*** add %ECX, 8
fld QWORD PTR [%ECX]
fldz
faddp %ST(1)
*** mov %ECX, %EAX
fxch %ST(1)
fstp QWORD PTR [%ECX]
*** add %EAX, 8
fstp QWORD PTR [%EAX]
ret
Now it is compiled to:
_Z6addoneRK7complex:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
fld QWORD PTR [%ECX]
fld1
faddp %ST(1)
fld QWORD PTR [%ECX + 8]
fldz
faddp %ST(1)
fxch %ST(1)
fstp QWORD PTR [%EAX]
fstp QWORD PTR [%EAX + 8]
ret
Other programs should see similar improvements, across the board. Note that
in addition to reducing instruction count, this also reduces register pressure
a lot, always a good thing on X86. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11819 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 06:13:04 +00:00
Chris Lattner
2e68037187
Add a helper to create an addressing mode given all of the pieces.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11818 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 06:01:07 +00:00
Chris Lattner
985fe3df6f
add an inefficient way of folding structure and constant array indexes together
...
into a single LEA instruction. This should improve the code generated for
things like X->A.B.C[12].D.
The bigger benefit is still coming though. Note that this uses an LEA instruction
instead of an add, giving the register allocator more freedom. We should probably
never generate ADDri32's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11817 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 03:45:50 +00:00
Chris Lattner
5a83096d6a
Implement special case for storing an immediate into memory so that we don't need
...
an intermediate register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11816 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 02:56:58 +00:00
Chris Lattner
39bb2dc557
Add support for 'rename'
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11813 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 22:17:00 +00:00
Chris Lattner
2a11653fa9
Make the verifier a little more explicit about this problem.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11811 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 22:06:07 +00:00
Chris Lattner
d561209a47
Add support for remove, fwrite, and fread
...
Also fix problem where we didn't check to see if a node pointer was null.
Though fclose(null) doesn't make a lot of sense, 300.twolf does it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11810 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 22:02:48 +00:00
Brian Gaeke
748fba141f
FunctionLiveVarInfo.h moved: include/llvm/CodeGen -> lib/Target/Sparc/LiveVar
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11804 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 19:46:00 +00:00
Chris Lattner
2bcab1f900
Fix some unexpected fallout from the config.h changes. Because the CBE no
...
longer was getting this #include, it always fell back on the less precise
floating point initializer values, causing some testsuite failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11803 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 18:34:10 +00:00
Chris Lattner
d38f208cd9
Fix a faulty optimization on FP values
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11801 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 18:10:14 +00:00
Chris Lattner
8e509dd5e8
If a block is made dead, make sure to promptly remove it.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 16:09:21 +00:00
Alkis Evlogimenos
0d6c5b6489
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11798 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 08:58:30 +00:00
Chris Lattner
d52c261cf8
Implement SimplifyCFG/switch_switch_fold.ll
...
This case occurs many times in various benchmarks, especially when combined
with the previous patch. This allows it to get stuff like:
if (X == 4 || X == 3)
if (X == 5 || X == 8)
and
switch (X) {
case 4: case 5: case 6:
if (X == 4 || X == 5)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11797 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 07:23:58 +00:00
Alkis Evlogimenos
ec8b8bb9ab
Add predicates for checking if a virtual register has a physical
...
register mapping or a stack slot mapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11795 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 06:30:36 +00:00
Chris Lattner
e14ea0804a
Rearrange code a bit
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11793 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 05:54:22 +00:00
Chris Lattner
0d56008f53
Implement: test/Regression/Transforms/SimplifyCFG/switch_create.ll
...
This turns code like this:
if (X == 4 | X == 7)
and
if (X != 4 & X != 7)
into switch instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11792 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-24 05:38:11 +00:00
Alkis Evlogimenos
e8124b9ddb
Make enum private as it is an implementation detail.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11782 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 23:49:40 +00:00
Alkis Evlogimenos
797428719f
Remove '4Virt' from member function names as it is obvious.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11781 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 23:47:10 +00:00
Alkis Evlogimenos
34d9bc9f16
Refactor VirtRegMap out of RegAllocLinearScan as the first part of bug
...
251 (providing a generic machine code rewriter/spiller).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11780 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 23:08:11 +00:00
Alkis Evlogimenos
c38aa6dd79
Include Config/config.h for SHLIBEXT.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11779 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 22:42:51 +00:00
Chris Lattner
d8864ce766
Generate much more efficient code in programs like pifft
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11775 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 21:46:58 +00:00
Chris Lattner
077a373791
Fix a small typeo in my checkin last night that broke vortex and other programs :(
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11774 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 21:46:42 +00:00
Chris Lattner
8adac75298
Fix InstCombine/2004-02-23-ShiftShiftOverflow.ll
...
Also, turn 'shr int %X, 1234' into 'shr int %X, 31'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11768 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 20:30:06 +00:00
Alkis Evlogimenos
575649322f
Add number of spilled registers statistic.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11759 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:45:32 +00:00
Chris Lattner
11d1f21e1d
Fix bugs in finegrainification
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11758 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:40:08 +00:00
Chris Lattner
0742b59913
Finegrainify namespacification
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11757 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:38:20 +00:00
Alkis Evlogimenos
e699b16a76
Use MachineBasicBlock::getParent().
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11756 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:36:38 +00:00
Alkis Evlogimenos
e6394e2b62
Remove implementation of default constructor as it is useless now.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11755 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:28:35 +00:00
Alkis Evlogimenos
743d0a1f83
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).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11748 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 18:14:48 +00:00
Chris Lattner
fbc39d5045
Simplify code a bit, don't go off the end of the block, now that the current
...
block we are in might be empty
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11744 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 07:42:19 +00:00
Chris Lattner
65cf42d32f
We were forgetting to add FP_REG_KILL instructions to basic blocks which will
...
eventually get an assignment due to elimination of PHIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11743 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 07:29:45 +00:00
Chris Lattner
c5943fb186
Implement cast.ll::test14/15
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11742 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 07:16:20 +00:00
Chris Lattner
4cb170cc6e
Refactor some code. In the mul - setcc folding case, we really care about
...
whether this is the sign bit or not, so check unsigned comparisons as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11740 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 06:38:22 +00:00
Alkis Evlogimenos
12edc7ef3d
Improved PhysRegTracker interface. RegAlloc lazily allocates the register tracker using a std::auto_ptr
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11738 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 06:10:13 +00:00
Chris Lattner
fed58fd72e
Implement mul.ll:test11
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11737 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 06:00:11 +00:00
Chris Lattner
45aaafef49
Implement "strength reduction" of X <= C and X >= C
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11735 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 05:47:48 +00:00
Chris Lattner
fb54b2b744
Implement InstCombine/mul.ll:test10, which is a case that occurs when dealing
...
with "predication"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11734 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 05:39:21 +00:00
Alkis Evlogimenos
fc2b449a17
Simplify iterator usage now that we have next(). Also don't pass iterators by reference now that MachineInstr* are in an ilist
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11732 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 04:12:30 +00:00
Chris Lattner
f7b42259e9
Work around a gas bug. Print '-9223372036854775808' as unsigned.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11729 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 03:27:05 +00:00
Chris Lattner
311ca2e51f
Implement cast fp -> bool
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11728 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 03:21:41 +00:00
Chris Lattner
baa58a5691
Stop passing iterators around by reference now that we have ilists!
...
Implement cast Type::ULongTy -> double
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11726 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 03:10:10 +00:00
Alkis Evlogimenos
25d9d5800c
Some code cleanups from Chris
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11724 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 01:57:39 +00:00
Alkis Evlogimenos
534f545ef1
Fix comments in PhysRegTracker and rename isPhysRegAvail to isRegAvail to be consistent with the other two
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11723 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 01:25:05 +00:00
Chris Lattner
2d0a82570a
Add a new cmove instruction
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11722 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 01:16:05 +00:00
Alkis Evlogimenos
98e17cf543
Move LiveIntervals.h up to be the first included header
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11721 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 01:01:21 +00:00
Alkis Evlogimenos
888b1a6ccd
Pull PhysRegTracker out of RegAllocLinearScan as it can be used by other allocators as well
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11720 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 00:53:31 +00:00
Alkis Evlogimenos
a2f6a408dc
Move LiveIntervals.h to lib/CodeGen since it shouldn't be exposed to other parts of the compiler
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11719 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 00:50:15 +00:00
Chris Lattner
986618ebc7
Only insert FP_REG_KILL instructions in MachineBasicBlocks that actually
...
use FP instructions. This reduces the number of instructions inserted in
176.gcc (for example) from 58074 to 101 (it doesn't use much FP, which
is typical). This reduction speeds up the entire code generator. In the
case of 176.gcc, llc went from taking 31.38s to 24.78s. The passes that
sped up the most are the register allocator and the 2 live variable analysis
passes, which sped up 2.3, 1.3, and 1.5s respectively. The asmprinter
pass also sped up because it doesn't print the instructions in comments :)
Note that this patch is likely to expose latent bugs in machine code passes,
because now basicblock can be empty, where they were never empty before. I
cleaned out regalloclocal, but who knows about linscan :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11717 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 19:47:26 +00:00
Chris Lattner
d0d1c8f830
Another bug fix for empty MBB's
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11716 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 19:37:31 +00:00
Alkis Evlogimenos
890f92328d
Move MOTy::UseType enum into MachineOperand. This eliminates the
...
switch statements in the constructors and simplifies the
implementation of the getUseType() member function. You will have to
specify defs using MachineOperand::Def instead of MOTy::Def though
(similarly for Use and UseAndDef).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11715 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 19:23:26 +00:00
Chris Lattner
688c8252d2
Fix a bug where we were implicitly assuming that there would be at least
...
one terminator instruction in each basic block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11714 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 19:08:15 +00:00
Chris Lattner
7ca04097ad
Reduce the number of pointless copies inserted due to constant pointer refs.
...
Also, make an assertion actually fireable!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11713 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 17:35:42 +00:00
Chris Lattner
827832c705
Fix bug in previous checkout: leave the iterator at the first instruction
...
AFTER the GEP that was emitted. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11712 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 17:05:38 +00:00
Chris Lattner
3f1e8e7ceb
Completely rewrite how getelementptr instructions are expanded. This has two
...
(minor) benefits right now:
1. An extra dummy MOVrr32 is gone. This move would often be coallesced by
both allocators anyway.
2. The code now uses the gep_type_iterator to walk the gep, which should future
proof it a bit. It still assumes that array indexes are Longs though.
These don't really justify rewriting the code. The big benefit will come later
though.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11710 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 07:04:00 +00:00
Alkis Evlogimenos
f216421181
When folding memory operands in machine instructions be careful to
...
leave register operands with the same use/def flags as the original
instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11709 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 06:54:26 +00:00
Chris Lattner
e735b2de30
Fix a soon-to-be-missing #include
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11707 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 06:26:17 +00:00
Chris Lattner
b228f9c86b
Get all instruction definitions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11706 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 06:25:38 +00:00
Chris Lattner
14c6ef7ca1
Wow this is out of date. When we have _real_ code generator documentation,
...
this should be folded into it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11705 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 05:53:54 +00:00
Alkis Evlogimenos
0f338a1e8c
Print basic block boundaries in machine instruction debug output.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11704 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 05:46:04 +00:00
Chris Lattner
c6bd195336
Implement Transforms/InstCombine/cast.ll:test13, a case which occurs in a
...
hot 164.gzip loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11702 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 05:25:17 +00:00
Chris Lattner
6d2fdcfb8a
The two address pass cannot handle two addr instructions where one incoming
...
value is a physreg and one is a virtreg. For this reason, disable copy folding
entirely for physregs. Also, use the new isMoveInstr target hook which gives us
folding of FP moves as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11700 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 04:44:58 +00:00
Alkis Evlogimenos
7200c6b82a
Abstract merging of ranges away from number of slots per instruction.
...
Also make it less aggressive as the current implementation breaks in
some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11696 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 04:05:13 +00:00
Chris Lattner
0ad9170327
Use isNull instead of getNode() to test for existence of a node, this is cheaper.
...
FIX MAJOR BUG, whereby we didn't merge null edges correctly. Correcting this
fixes poolallocation on 175.vpr, and possibly others.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11695 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 00:53:54 +00:00
Chris Lattner
d85645f526
Fix an iterator invalidation problem which was causing some nodes to not be
...
correctly merged over!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11693 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-21 22:28:26 +00:00
Chris Lattner
5171115cf3
Use handy method
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11692 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-21 22:27:31 +00:00
Misha Brukman
ac2ecd0ba0
`cat' is usually in /bin, not /usr/bin, at least on our systems.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11690 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-21 21:51:41 +00:00
Chris Lattner
b9632bee7c
When printing a stack trace, demangle it if possible. Since we are potentially
...
in a signal handler, allocating memory or doing other unsafe things is bad,
which means we should do it in a different process.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11689 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-21 21:06:19 +00:00
Alkis Evlogimenos
d6f6d1a80d
Make 'fold' statistic's description the same in both allocators.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11687 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-21 18:07:33 +00:00
Chris Lattner
3567937f16
Instead of cloning the globals for main into the globals graph at the end of
...
BU propagation, clone the globals into the GG of EACH FUNCTION that finishes
processing! The GlobalsGraph *must* include all globals and effects from
all functions in the program. Fixing this makes pool allocation work better
on 175.vpr, but it still ultimately crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11686 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-21 00:30:28 +00:00
Chris Lattner
d10b5fd395
There is no need to merge the globals graph into the function graphs at the
...
end of the BU and CBU passes. The globals will be marked incomplete, so it
doesn't matter if they are missing some info, and merging isn't guaranteed
to bring everything in anyway!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11684 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 23:52:15 +00:00
Chris Lattner
4e46e320a5
Add two missing returns, which caused us to be very pessimistic about the
...
printf and scanf families!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11683 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 23:27:09 +00:00
Alkis Evlogimenos
007726ca6f
Some more statistics improvements.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11676 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 20:53:26 +00:00
Alkis Evlogimenos
df158c7e3f
Disambiguate statistic descriptions.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11675 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 20:46:49 +00:00
Alkis Evlogimenos
cea4471120
Rename statistic and add another one.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11674 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 20:43:08 +00:00
Chris Lattner
8ecc27e667
Add support for some string functions, the scanf family, and sprintf
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11673 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 20:27:11 +00:00
Alkis Evlogimenos
fa510c4af5
Fix crash in debug output.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11659 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 06:41:12 +00:00
Brian Gaeke
38ce7e57d4
Use backtrace() and include execinfo.h, if they were detected by autoconf.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11658 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-20 06:40:59 +00:00
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