Evan Cheng
0ca6e3dba5
MachineLICM CSE should match destination register classes; avoid hoisting implicit_def's.
...
llvm-svn: 65592
2009-02-27 00:02:22 +00:00
Evan Cheng
078ac6071d
Machine LICM increases register pressure and it almost always increase code size. For now, disable it for optimizing for size.
...
llvm-svn: 63856
2009-02-05 08:51:13 +00:00
Evan Cheng
5087dd8359
Teach machine licm to CSE hoisted instructions.
...
llvm-svn: 63854
2009-02-05 08:45:46 +00:00
Evan Cheng
ed9464bdec
Don't call isInvariantLoad twice.
...
llvm-svn: 63729
2009-02-04 09:21:58 +00:00
Evan Cheng
d80609a7b3
Don't bother hoisting out a "cheap" instruction if all of its uses are PHIs. LICM "cheap" instructions are not particularly beneficial to start with. This will just end up making the copies harder to coalesce.
...
llvm-svn: 63728
2009-02-04 09:19:56 +00:00
Evan Cheng
68f918e570
For now, only hoist re-materilizable instructions. LICM will increase register pressure. We want to avoid spilling more instructions if it's possible.
...
llvm-svn: 63725
2009-02-04 07:17:49 +00:00
Dan Gohman
23a5f63b21
Simplify the MachineLICM pass by having it only traverse outer
...
loops, hoisting instructions all the way out in one step rather
than hoisting them one nest level at a time. Also, make a few
other code simplifications. This speeds up MachineLICM
by several fold.
llvm-svn: 62283
2009-01-15 22:01:38 +00:00
Dan Gohman
8271066844
Tidy up #includes, deleting a bunch of unnecessary #includes.
...
llvm-svn: 61715
2009-01-05 17:59:02 +00:00
Dan Gohman
1c1b281cd5
Use isTerminator() instead of isBranch()||isReturn() in
...
several places. isTerminator() returns true for a superset
of cases, and includes things like FP_REG_KILL, which are
nither return or branch but aren't safe to move/remat/etc.
llvm-svn: 61373
2008-12-23 17:28:50 +00:00
Dan Gohman
fae8a30dce
Give MachineLICM a name, for -time-passes etc.
...
llvm-svn: 61184
2008-12-18 01:37:56 +00:00
Dan Gohman
30c5ce1b7d
Switch the MachineOperand accessors back to the short names like
...
isReg, etc., from isRegister, etc.
llvm-svn: 57006
2008-10-03 15:45:36 +00:00
Dan Gohman
e1f9be27bc
Tidy up several unbeseeming casts from pointer to intptr_t.
...
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Bill Wendling
4a9ded80e2
Cosmetic changes to Machine LICM. No functionality change.
...
llvm-svn: 55578
2008-08-31 02:30:23 +00:00
Bill Wendling
42a2073ed4
Don't hoist instructions that define a physical register.
...
llvm-svn: 55074
2008-08-20 20:32:05 +00:00
Bill Wendling
12569b3697
Don't hoist instructions that have implicit uses or defines. Before, it was
...
hoisting out some "test" and "cmp" instructions. This was obvious badness.
llvm-svn: 54908
2008-08-18 00:33:49 +00:00
Bill Wendling
d6bd5ea0b7
Prevent option name conflict.
...
llvm-svn: 53166
2008-07-07 05:42:27 +00:00
Dan Gohman
bab18cae46
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Bill Wendling
f3c4b7fbb5
Revert the previous commit. Go ahead and hoist rematerializable instructions.
...
llvm-svn: 50990
2008-05-12 19:47:18 +00:00
Bill Wendling
74cabebb44
One real change - don't hoist something that's trivially rematerializable. It's
...
possible for it to produce worse code than before.
The rest of this patch is code cleanup.
llvm-svn: 50987
2008-05-12 19:38:32 +00:00
Bill Wendling
91ff268a77
Minor cleanup. No functionality change.
...
llvm-svn: 48142
2008-03-10 08:13:01 +00:00
Bill Wendling
8fb166bf6c
Rename PrintableName to Name.
...
llvm-svn: 47629
2008-02-26 21:47:57 +00:00
Bill Wendling
50f5c4be14
Change "Name" to "AsmName" in the target register info. Gee, a refactoring tool
...
would have been a Godsend here!
llvm-svn: 47625
2008-02-26 21:11:01 +00:00
Dan Gohman
cabaec582f
Rename MRegisterInfo to TargetRegisterInfo.
...
llvm-svn: 46930
2008-02-10 18:45:23 +00:00
Chris Lattner
bfffa4f21e
Simplify the side effect stuff a bit more and make licm/sinking
...
both work right according to the new flags.
This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad.
It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags. Now the clients
can decide everything they need.
I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.
llvm-svn: 45843
2008-01-10 23:08:24 +00:00
Chris Lattner
f83aae613c
rename TargetInstrDescriptor -> TargetInstrDesc.
...
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.
llvm-svn: 45695
2008-01-07 07:27:27 +00:00
Chris Lattner
f7f96d818f
Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
...
that it is cheap and efficient to get.
Move a variety of predicates from TargetInstrInfo into
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around. Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.
Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.
llvm-svn: 45674
2008-01-07 01:56:04 +00:00
Bill Wendling
2017097bb8
Add that this preserves some analyses.
...
llvm-svn: 45573
2008-01-04 08:48:49 +00:00
Bill Wendling
13eb1bfc08
Move option to enable machine LICM into LLVMTargetMachine.cpp.
...
llvm-svn: 45572
2008-01-04 08:11:03 +00:00
Bill Wendling
da5d32e248
Call the parent's getAnalysisUsage.
...
llvm-svn: 45571
2008-01-04 07:50:05 +00:00
Chris Lattner
b02b90a8f6
remove dead #includes and reorder the rest.
...
llvm-svn: 45569
2008-01-04 06:41:45 +00:00
Bill Wendling
c677923991
Use the correct MachineRegisterInfo object.
...
llvm-svn: 45499
2008-01-02 21:10:54 +00:00
Bill Wendling
005b47c20c
Remove dead code.
...
llvm-svn: 45496
2008-01-02 20:47:37 +00:00
Bill Wendling
5843183ca2
Use the new architecture to get the containing machine basic block for a machine
...
instruction. Also, use "splice" to move the new instruction instead of
remove/insert (where it was leaking memory anyway).
llvm-svn: 45492
2008-01-02 19:32:43 +00:00
Chris Lattner
ad9a6ccb83
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Bill Wendling
cba1938285
Updated comments to reflect what "side effects" means in this situation.
...
llvm-svn: 45245
2007-12-20 01:08:10 +00:00
Bill Wendling
fe0e399130
Add debugging info. Use the newly created "hasUnmodelledSideEffects" method.
...
llvm-svn: 45178
2007-12-18 21:38:04 +00:00
Bill Wendling
20a11adc5e
Need to grow the indexed map. Added debug statements.
...
llvm-svn: 44892
2007-12-11 23:27:51 +00:00
Bill Wendling
c92c27f928
Simplify slightly.
...
llvm-svn: 44881
2007-12-11 22:22:22 +00:00
Bill Wendling
9f0bcd67cf
Blark! How in the world did this work without this?!
...
llvm-svn: 44874
2007-12-11 19:40:06 +00:00
Bill Wendling
30281897da
- Update the virtual reg to machine instruction map when hoisting.
...
- Fix subtle bug when creating initially creating this map.
llvm-svn: 44873
2007-12-11 19:17:04 +00:00
Bill Wendling
9f02f24469
Checking for "zero operands" during the "CanHoistInst()" method isn't necessary
...
because those with side effects will be caught by other checks in here.
Also, simplify the check for a BB in a sub loop.
llvm-svn: 44871
2007-12-11 18:45:11 +00:00
Bill Wendling
8d8d9a2f5e
Reverting 44702. It wasn't correct to rename them.
...
llvm-svn: 44727
2007-12-08 23:58:46 +00:00
Bill Wendling
d10837def7
Renaming:
...
isTriviallyReMaterializable -> hasNoSideEffects
isReallyTriviallyReMaterializable -> isTriviallyReMaterializable
llvm-svn: 44702
2007-12-08 07:17:56 +00:00
Bill Wendling
3c6bac9686
Incorporated comments from Evan and Chris:
...
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056043.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056048.html
llvm-svn: 44696
2007-12-08 01:47:01 +00:00
Bill Wendling
c08dedb060
Initial commit of the machine code LICM pass. It successfully hoists this:
...
_foo:
li r2, 0
LBB1_1: ; bb
li r5, 0
stw r5, 0(r3)
addi r2, r2, 1
addi r3, r3, 4
cmplw cr0, r2, r4
bne cr0, LBB1_1 ; bb
LBB1_2: ; return
blr
to:
_foo:
li r2, 0
li r5, 0
LBB1_1: ; bb
stw r5, 0(r3)
addi r2, r2, 1
addi r3, r3, 4
cmplw cr0, r2, r4
bne cr0, LBB1_1 ; bb
LBB1_2: ; return
blr
ZOMG!! :-)
Moar to come...
llvm-svn: 44687
2007-12-07 21:42:31 +00:00