Commit Graph

82 Commits

Author SHA1 Message Date
Chris Lattner
749c6f6b5e rename TargetInstrDescriptor -> TargetInstrDesc.
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 07:27:27 +00:00
Chris Lattner
69244300b8 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.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 01:56:04 +00:00
Chris Lattner
834f1ce031 rename isLoad -> isSimpleLoad due to evan's desire to have such a predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06 23:38:27 +00:00
Chris Lattner
2e48a70b35 rename isStore -> mayStore to more accurately reflect what it captures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06 08:36:04 +00:00
Chris Lattner
8aa797aa51 Add new shorter predicates for testing machine operands for various types:
e.g. MO.isMBB() instead of MO.isMachineBasicBlock().  I don't plan on 
switching everything over, so new clients should just start using the 
shorter names.

Remove old long accessors, switching everything over to use the short
accessor: getMachineBasicBlock() -> getMBB(), 
getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45464 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 23:10:15 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Christopher Lamb
11a4f64bd4 Improve branch folding by recgonizing that explict successor relationships impact the value of fall-through choices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44785 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 07:24:06 +00:00
Bill Wendling
da6efc5268 Changed XXX to FIXME, and added comment to the README file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 19:49:32 +00:00
Bill Wendling
0713a22423 Added comment explaining why we are doing this check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43353 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 18:23:45 +00:00
Bill Wendling
80629c85f1 Don't branch fold inline asm statements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43191 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-19 21:09:55 +00:00
Dan Gohman
61e729e2e9 More explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40757 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 21:21:54 +00:00
Duncan Sands
97b4ac8c84 If assertions are not enabled, we should return False here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38535 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 08:47:55 +00:00
David Greene
67fcdf7f65 Make this work with GLIBCXX_DEBUG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38516 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 22:00:30 +00:00
David Greene
8a46d342d8 Fix misue of iterator pointing to erased object. Uncovered by
_GLIBCXX_DEBUG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37793 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 02:45:24 +00:00
Evan Cheng
2bdb7d0cc8 Move CorrectExtraCFGEdges() from BranchFolding.cpp to a MachineBasicBlock method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37633 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-18 22:43:58 +00:00
Dale Johannesen
1a90a5aebe Make throttle a hidden parameter, per review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37511 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 01:08:52 +00:00
Dale Johannesen
53af4c01a8 Throttle tail merging; handling blocks with large numbers of predecessors
is too slow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37509 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 00:34:27 +00:00
Dale Johannesen
fe7e397100 Tail merging wasn't working for predecessors of landing pads. PR 1496.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37427 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 23:52:54 +00:00
Evan Cheng
0370fad74b Move ReplaceUsesOfBlockWith() out of BranchFolding into a MachineBasicBlock general facility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 06:44:01 +00:00
Dale Johannesen
8e63bf375d Fix CorrectExtraCFGEdges to allow for multiple LandingPad targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37394 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-02 00:08:15 +00:00
Dale Johannesen
a5a2117a46 Implement smarter algorithm for choosing which blocks to tail-merge.
See test/CodeGen/X86/test-pic-jtbl.ll for a case where it works well;
shaves another 10K off our favorite benchmark.  I was hesitant about
this because of compile speed, but seems to do OK on a bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37392 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-01 23:02:45 +00:00
Dale Johannesen
a52dd15137 Arrange for only 1 of multiple branches to landing pad to be kept.
Do not remove empty landing pads (EH table needs to be updated)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37375 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-31 21:54:00 +00:00
Dale Johannesen
44008c5918 Changed per review comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37355 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-30 00:32:01 +00:00
Dale Johannesen
95ef406e0f Make stable_sort in tail merging actually be stable (it never was, but didn't
matter until my last change).  Reenable tail merging by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37354 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-29 23:47:50 +00:00
Dale Johannesen
035fdeb370 Blocks that cond-br and uncond-br/fallthrough to same block should have
only one successor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37324 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 18:31:55 +00:00
Dale Johannesen
de0963df42 Fix for PR1444: do not create two successors to the same block.
Temporarily, this breaks CodeGen/Generic/2006-02-12-InsertLibraryCall.ll
by exposing an unrelated latent problem; working on that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37323 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 17:39:32 +00:00
Dale Johannesen
7aea832034 Two tail merging improvements:
When considering blocks with more than 2 predecessors, merge the block with
the largest number of matching insns, rather than the first block found.
Considering that 1 matching insn is enough to show a win for candidates that
already end with a branch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37315 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-23 21:07:20 +00:00
Dale Johannesen
81da02b553 Make tail merging the default, except on powerPC. There was no prior art
for a target-dependent default with a command-line override; this way
should be generally usable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37285 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-22 17:14:46 +00:00
Dale Johannesen
1cf08c1d6d Remove some unneeded branches. (spotted by Evan, thanks)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37198 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-18 01:28:58 +00:00
Dale Johannesen
14ba0cc429 Remove extra CFG edges before doing these passes; it makes them happier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37089 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-15 21:19:17 +00:00
Dale Johannesen
54f4a6780a Do not generate branches to entry block. This fixes several test suite
failures on PPC (can happen only when prologue code is null)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36979 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-10 23:59:23 +00:00
Dale Johannesen
76b38fcabe Make tail merging handle many more cases (all it can, I think).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36966 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-10 01:01:49 +00:00
Dale Johannesen
7d33b4c59b Handle some non-exit blocks in tail merging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36907 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-07 20:57:21 +00:00
Devang Patel
1997473cf7 Drop 'const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 01:11:54 +00:00
Devang Patel
3e15bf33e0 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 21:39:20 +00:00
Devang Patel
794fd75c67 Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 21:15:47 +00:00
Chris Lattner
77edc4b1b0 Fix PR1228 and CodeGen/Generic/2007-04-30-LandingPadBranchFolding.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36602 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-30 23:35:00 +00:00
Dale Johannesen
69cb9b78f1 maintain LiveIn when splitting blocks (register scavenging needs it)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35226 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 21:35:06 +00:00
Jim Laskey
033c9715d9 Remove isAccessable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34497 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-22 16:39:03 +00:00
Jim Laskey
02b3f5ec4a Make branch folding behave in the presence of landing pads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34476 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 22:42:20 +00:00
Dale Johannesen
6b896cec8b Fixes PR 1200
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-17 00:44:34 +00:00
Jim Laskey
44c3b9fdd4 Change the MachineDebugInfo to MachineModuleInfo to better reflect usage
for debugging and exception handling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33550 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 21:22:28 +00:00
Jim Laskey
1ee2925742 Make LABEL a builtin opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33537 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 14:34:52 +00:00
Chris Lattner
cd3245ac45 Eliminate static ctors from Statistics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32698 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:41:21 +00:00
Chris Lattner
ac0b6ae358 Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 17:46:33 +00:00
Chris Lattner
4b10591265 Don't transform in another bad case: if the block is empty, it should be
simplified before we do this xform so that our cost model is accurate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31864 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-18 22:25:39 +00:00
Chris Lattner
f10a56a86f Fix another case we *don't* want to do this xform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31861 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-18 21:56:39 +00:00
Chris Lattner
154e104718 make the previous change more aggressive, moving any block with no fallthrough.
This speeds up yacr2 by 7% on a core2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31856 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-18 21:30:35 +00:00
Chris Lattner
a7bef4a4e4 Minor code layout tweak: if we have something like this:
if (cond) goto BB2
BB1:
    ...
    return;
BB2:
   ...

Move BB1 to the end of the function so that the code falls through in the
non-return case.  This has the effect of moving assert (and other no-return
call) bodies and return blocks out of loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31855 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-18 20:47:54 +00:00
Chris Lattner
5d056952ba optimize single MBB loops better. In particular, produce:
LBB1_57:        #bb207.i
        movl 72(%esp), %ecx
        movb (%ecx,%eax), %cl
        movl 80(%esp), %edx
        movb %cl, 1(%edx,%eax)
        incl %eax
        cmpl $143, %eax
        jne LBB1_57     #bb207.i
        jmp LBB1_64     #cond_next255.i

intead of:

LBB1_57:        #bb207.i
        movl 72(%esp), %ecx
        movb (%ecx,%eax), %cl
        movl 80(%esp), %edx
        movb %cl, 1(%edx,%eax)
        incl %eax
        cmpl $143, %eax
        je LBB1_64      #cond_next255.i
        jmp LBB1_57     #bb207.i

This eliminates a branch per iteration of the loop.  This hurted PPC
particularly, because the extra branch meant another dispatch group for each
iteration of the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31530 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-08 01:03:21 +00:00