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