Dan Gohman
a79db30d28
Tidy up several unbeseeming casts from pointer to intptr_t.
...
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Dan Gohman
14714cb4fa
Fix SmallVector's size calculation so that a size of 0 is
...
handled correctly, and change a few SmallVector uses to use
size 0 to more clearly reflect their intent.
llvm-svn: 55181
2008-08-22 16:07:55 +00:00
Owen Anderson
4f6bf04616
Convert uses of std::vector in TargetInstrInfo to SmallVector. This change had to be propoagated down into all the targets and up into all clients of this API.
...
llvm-svn: 54802
2008-08-14 22:49:33 +00:00
Dan Gohman
3b46030375
Pool-allocation for MachineInstrs, MachineBasicBlocks, and
...
MachineMemOperands. The pools are owned by MachineFunctions.
This drastically reduces the number of calls to malloc/free made
during the "Emit" phase of scheduling, as well as later phases
in CodeGen. Combined with other changes, this speeds up the
"instruction selection" phase of CodeGen by 10% in some cases.
llvm-svn: 53212
2008-07-07 23:14:23 +00:00
Evan Cheng
c5b3a3bea5
Register if-converter pass for -debug-pass.
...
llvm-svn: 51931
2008-06-04 09:15:51 +00:00
Evan Cheng
c799065cc3
Add a quick and dirty "loop aligner pass". x86 uses it to align its loops to 16-byte boundaries.
...
llvm-svn: 47703
2008-02-28 00:43:03 +00:00
Anton Korobeynikov
035eaacd1f
Update gcc 4.3 warnings fix patch with recent head changes
...
llvm-svn: 47368
2008-02-20 11:10:28 +00:00
Dan Gohman
70de4cb1cd
Use empty() instead of comparing size() with zero.
...
llvm-svn: 46514
2008-01-29 13:02:09 +00:00
Chris Lattner
03ad885039
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
769c86bf63
simplify some code using new predicates
...
llvm-svn: 45689
2008-01-07 05:40:58 +00:00
Chris Lattner
a98c679de0
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
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Evan Cheng
fbc73099dc
Somehow this wasn't committed last time. M_CLOBBERS_PRED is gone.
...
llvm-svn: 38495
2007-07-10 17:50:43 +00:00
Evan Cheng
96c1457bff
Teach if-conversion about instructions that were already predicated, e.g. conditional move.
...
llvm-svn: 37964
2007-07-06 23:24:39 +00:00
Evan Cheng
a955c02c9b
Avoid if-converting simple block that ends with unconditional branch or fallthrough unless it branches / falls to the 'false' block. Not profitable, may end up increasing code size.
...
llvm-svn: 37660
2007-06-19 21:45:13 +00:00
Evan Cheng
a7ca624028
Replace TargetInstrInfo::CanBeDuplicated() with a M_NOT_DUPLICABLE bit.
...
llvm-svn: 37643
2007-06-19 01:26:51 +00:00
Evan Cheng
0598b2d5eb
Fix some fragile code wrt CFG edge updating.
...
llvm-svn: 37634
2007-06-18 22:44:57 +00:00
Evan Cheng
51eb2c3bbe
Properly remove duplicate instructions as result of diamond if-conversion. Other bug fixes.
...
llvm-svn: 37623
2007-06-18 08:37:25 +00:00
Evan Cheng
3a51c854d0
Really turn if-converter loose:
...
1. Consider all possible ifcvt cases at once. No longer restricted to bottom
up iterative approach.
2. Sort all possible cases based on a cost function. Perform the most profitable
ones first invalidate others that target the same blocks.
3. Fixed a number of bugs related to block duplication.
llvm-svn: 37613
2007-06-16 09:34:52 +00:00
Evan Cheng
23402fcaef
Not every predicable block can be safely duplicated.
...
llvm-svn: 37607
2007-06-15 21:18:05 +00:00
Evan Cheng
234a90e83e
MachineInstr::isPredicable() is no longer needed.
...
llvm-svn: 37599
2007-06-15 19:06:07 +00:00
Evan Cheng
cd5f5e3ecd
Extra edges are deleted later if needed.
...
llvm-svn: 37593
2007-06-15 17:34:48 +00:00
Evan Cheng
92fb5453c3
Allow small blocks to be duplicated to enable if-conversion.
...
llvm-svn: 37590
2007-06-15 07:36:12 +00:00
Evan Cheng
add977670f
No really, clear predcessors states.
...
llvm-svn: 37581
2007-06-14 23:34:09 +00:00
Evan Cheng
9fc56c079d
If BB is predicated, invalidate its predecessor(s) which would if-convert it. It needs to be re-analyzed.
...
llvm-svn: 37580
2007-06-14 23:13:19 +00:00
Evan Cheng
e08f0eefa6
Fix typo.
...
llvm-svn: 37577
2007-06-14 21:26:08 +00:00
Evan Cheng
1e6f08b2a2
Fix some stupid bugs that have effectively disabled if-conversion.
...
llvm-svn: 37575
2007-06-14 20:28:52 +00:00
Evan Cheng
cbaaff58bf
Typo
...
llvm-svn: 37566
2007-06-13 00:04:00 +00:00
Evan Cheng
9acfa7b063
Now if-converting all 4 variants of triangles.
...
llvm-svn: 37565
2007-06-12 23:54:05 +00:00
Evan Cheng
4dd31a7b1b
Restructure code to reduce ifcvt compile time cost.
...
llvm-svn: 37543
2007-06-11 22:26:22 +00:00
Reid Spencer
14b62a553e
Fix the build.
...
llvm-svn: 37537
2007-06-10 00:19:17 +00:00
Evan Cheng
2117d1f20e
Don't change CFG during analysis stage. Do so during ifcvt and invalidate predecessors accordingly.
...
llvm-svn: 37531
2007-06-09 01:03:43 +00:00
Evan Cheng
288f1545a6
Carefully remove extraneous CFG edges after each ifcvt.
...
llvm-svn: 37529
2007-06-08 22:01:07 +00:00
Evan Cheng
df1a42935b
Correct transfer predicate information.
...
llvm-svn: 37524
2007-06-08 19:17:12 +00:00
Evan Cheng
e93ccc013f
Hidden options to help debugging ifcvt issues.
...
llvm-svn: 37523
2007-06-08 19:10:51 +00:00
Evan Cheng
7783f82e21
Allow more cmp / bcc to be predicated; clean up triangle ifcvt checking code.
...
llvm-svn: 37518
2007-06-08 09:36:04 +00:00
Evan Cheng
1236ef7bcc
Only remove the edge from entry to false if false block is merged.
...
llvm-svn: 37503
2007-06-07 22:31:28 +00:00
Evan Cheng
d3f3f0adad
ifcvt a triangle: don't merge ifcvt block with rejoin block if it can fall through to it. If merged, the resulting block is not a candidate for iterative ifcvting since it contains both predicated and non-predicated code.
...
llvm-svn: 37487
2007-06-07 08:13:00 +00:00
Evan Cheng
be9859eea2
Lots of bug fixes. Now finally in a reasonable state.
...
llvm-svn: 37485
2007-06-07 02:12:15 +00:00
Owen Anderson
cfb6f40424
Quick patch to fix the build, based on what it appears Evan meant to write.
...
Evan, please check that this is in fact correct.
llvm-svn: 37471
2007-06-06 16:22:00 +00:00
Evan Cheng
9030b98aca
Lots of bug fixes.
...
llvm-svn: 37467
2007-06-06 10:16:17 +00:00
Evan Cheng
e4ec918be0
If a unconditional branch is added to branch to the false path during ifcvt, the predicated block cannot be iteratively ifcvted.
...
llvm-svn: 37456
2007-06-06 02:08:52 +00:00
Evan Cheng
b30a89457c
Minor statistics counting bug.
...
llvm-svn: 37451
2007-06-06 01:12:44 +00:00
Evan Cheng
30565998bb
Fix a couple of typos and be smarter about order of blocks when ifcvt a diamond.
...
llvm-svn: 37449
2007-06-06 00:57:55 +00:00
Evan Cheng
7948422b78
Fix diamond shape ifcvt bugs.
...
llvm-svn: 37444
2007-06-05 23:46:14 +00:00
Evan Cheng
c1a0b8ce1d
ReplaceUsesOfBlockWith() can modify the predecessors list.
...
llvm-svn: 37441
2007-06-05 22:03:53 +00:00
Evan Cheng
3e5bf0827c
Do not ifcvt if either true / false path is a backedge. Not profitable in almost all cases.
...
llvm-svn: 37440
2007-06-05 20:38:42 +00:00
Evan Cheng
2c1acd6d9e
I had a senior moment.
...
llvm-svn: 37433
2007-06-05 07:05:25 +00:00
Evan Cheng
6e4babe8cc
If the predicated block requires an early exit, end the block there and add a unconditional branch to false block. AnalyzeBranch() does not understand early exits.
...
llvm-svn: 37430
2007-06-05 01:31:40 +00:00
Evan Cheng
17aad8164e
Fix some subtle bugs: bug during succeessor copying; incorrectly updating states of ifcvted blocks.
...
llvm-svn: 37429
2007-06-05 00:07:37 +00:00