Jakob Stoklund Olesen
8a3fdae0aa
Teach MachineBasicBlock::updateTerminator() to handle a failing TII->ReverseBranchCondition(Cond) call.
...
This fixes the MallocBench/cfrac test case regression.
llvm-svn: 89608
2009-11-22 18:28:04 +00:00
Jakob Stoklund Olesen
2bbeaa8774
Add MachineBasicBlock::getName, and use it in place of getBasicBlock()->getName.
...
Fix debug code that assumes getBasicBlock never returns NULL.
llvm-svn: 89428
2009-11-20 01:17:03 +00:00
Evan Cheng
57be2f2c40
Add a WriteAsOperand for MachineBasicBlock so MachineLoopInfo dump looks sane.
...
llvm-svn: 89130
2009-11-17 19:19:59 +00:00
Jim Grosbach
801b33b17c
Move the utility function UpdateTerminator() from CodePlacementOpt() into
...
MachineBasicBlock so other passes can utilize it.
llvm-svn: 86947
2009-11-12 03:55:33 +00:00
Dan Gohman
64b5d0f468
Add support for tail duplication to BranchFolding, and extend
...
tail merging support to handle more cases.
- Recognize several cases where tail merging is beneficial even when
the tail size is smaller than the generic threshold.
- Make use of MachineInstrDesc::isBarrier to help detect
non-fallthrough blocks.
- Check for and avoid disrupting fall-through edges in more cases.
llvm-svn: 86871
2009-11-11 19:48:59 +00:00
Dan Gohman
34341e69c4
Make -print-machineinstrs more readable.
...
- Be consistent when referring to MachineBasicBlocks: BB#0.
- Be consistent when referring to virtual registers: %reg1024.
- Be consistent when referring to unknown physical registers: %physreg10.
- Be consistent when referring to known physical registers: %RAX
- Be consistent when referring to register 0: %reg0
- Be consistent when printing alignments: align=16
- Print jump table contents.
- Don't print host addresses, in general.
- and various other cleanups.
llvm-svn: 85682
2009-10-31 20:19:03 +00:00
Dan Gohman
e0a8b8fc56
Mention if a block has its address taken in debug output.
...
llvm-svn: 85571
2009-10-30 02:08:26 +00:00
Dan Gohman
6c9388011b
Initial target-independent CodeGen support for BlockAddresses.
...
llvm-svn: 85556
2009-10-30 01:27:03 +00:00
Chris Lattner
565449d79e
remove std::ostream versions of printing stuff for MBB and MF,
...
upgrading a few things to use raw_ostream
llvm-svn: 79811
2009-08-23 03:13:20 +00:00
Chris Lattner
1216f54276
remove dead PrefixPrinter class.
...
llvm-svn: 79796
2009-08-23 00:47:04 +00:00
Chris Lattner
af119ca368
random cleanups.
...
llvm-svn: 79794
2009-08-23 00:35:30 +00:00
Chris Lattner
63d3fa5f3b
fix another bozo bug
...
llvm-svn: 79313
2009-08-18 04:34:36 +00:00
Chris Lattner
249e1acf1b
fix accidentally inverted conditional and add comment.
...
llvm-svn: 79312
2009-08-18 04:33:15 +00:00
Chris Lattner
523d2f6e2c
turn this conditional into something humans might actually
...
be able to understand ;-)
llvm-svn: 79311
2009-08-18 04:30:35 +00:00
David Greene
ec9bc28812
Re-apply LiveInterval index dumping patch, with fixes suggested by Bill
...
and others.
llvm-svn: 78003
2009-08-03 21:55:09 +00:00
Daniel Dunbar
796e43eede
Move more to raw_ostream, provide support for writing MachineBasicBlock,
...
LiveInterval, etc to raw_ostream.
llvm-svn: 76965
2009-07-24 10:36:58 +00:00
Chris Lattner
1eede6c635
revert r76602, 76603, and r76615, pending design discussions.
...
llvm-svn: 76646
2009-07-21 21:12:58 +00:00
David Greene
3b458645be
Add PrefixPrinter arguments to the dump routines for MachineFunction and
...
MachineBasicBlock. We'll use these shortly.
llvm-svn: 76603
2009-07-21 18:27:05 +00:00
Dan Gohman
bb2f10759e
If a MachineBasicBlock has multiple ways of reaching another block,
...
allow it to have multiple CFG edges to that block. This is needed
to allow MachineBasicBlock::isOnlyReachableByFallthrough to work
correctly. This fixes PR4126.
llvm-svn: 71018
2009-05-05 21:10:19 +00:00
Dan Gohman
6b42dfddf4
Reapply 68073, with fixes. EH Landing-pad basic blocks are not
...
entered via fall-through. Don't miss fallthroughs from blocks
terminated by conditional branches. Also, move
isOnlyReachableByFallthrough out of line.
llvm-svn: 68129
2009-03-31 18:39:13 +00:00
Dan Gohman
ff62c62b7c
Constify arguments in isSuccessor and isLayoutSuccessor.
...
llvm-svn: 68054
2009-03-30 20:06:29 +00:00
Dan Gohman
f87dc9264a
Delete unnecessary parens around return values.
...
llvm-svn: 61950
2009-01-08 22:19:34 +00:00
Dan Gohman
0d1e9a8e04
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
a78bae34a5
Add a new MachineBasicBlock utility function, isLayoutSuccessor, that
...
can be used when deciding if a block can transfer control to another
via a fall-through instead of a branch.
llvm-svn: 56968
2008-10-02 22:09:09 +00:00
Dan Gohman
38453eebdc
Remove isImm(), isReg(), and friends, in favor of
...
isImmediate(), isRegister(), and friends, to avoid confusion
about having two different names with the same meaning. I'm
not attached to the longer names, and would be ok with
changing to the shorter names if others prefer it.
llvm-svn: 56189
2008-09-13 17:58:21 +00:00
Dan Gohman
804c95df52
Fold the useful features of alist and alist_node into ilist, and
...
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.
Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.
Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.
llvm-svn: 54146
2008-07-28 21:51:04 +00:00
Dan Gohman
0ece943845
Re-introduce LeakDetector support for MachineInstrs and MachineBasicBlocks.
...
Fix a leak that this turned up in LowerSubregs.cpp.
And, comment a leak in LiveIntervalAnalysis.cpp.
llvm-svn: 53746
2008-07-17 23:49:46 +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
Mon P Wang
3e58393c3d
Added addition atomic instrinsics and, or, xor, min, and max.
...
llvm-svn: 50663
2008-05-05 19:05:59 +00:00
Evan Cheng
3980a7911a
- Check if a register is livein before removing it. It may have already been removed.
...
- Do not iterate over SmallPtrSet, the order of iteration is not deterministic.
llvm-svn: 50209
2008-04-24 09:06:33 +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
Bill Wendling
d7a258d325
Rename PrintableName to Name.
...
llvm-svn: 47629
2008-02-26 21:47:57 +00:00
Bill Wendling
c24ea4fb41
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
3a4be0fdef
Rename MRegisterInfo to TargetRegisterInfo.
...
llvm-svn: 46930
2008-02-10 18:45:23 +00:00
Chris Lattner
f3efadcb5b
remove #includage
...
llvm-svn: 45697
2008-01-07 07:42:25 +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
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
961e7427ea
Implement automatically updated def/use lists for all MachineInstr register
...
operands. The lists are currently kept in MachineRegisterInfo, but it does
not yet provide an iterator interface to them.
llvm-svn: 45477
2008-01-01 01:12:31 +00:00
Chris Lattner
574e7166e0
properly encapsulate the parent field of MBB and MI with get/set accessors.
...
llvm-svn: 45469
2007-12-31 04:56:33 +00:00
Chris Lattner
a5bb370aa4
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.
llvm-svn: 45464
2007-12-30 23:10:15 +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
Dan Gohman
c731c97fac
Use empty() member functions when that's what's being tested for instead
...
of comparing begin() and end().
llvm-svn: 42585
2007-10-03 19:26:29 +00:00
Anton Korobeynikov
35322d745c
Silence warning while compiling with gcc 4.2
...
llvm-svn: 41676
2007-09-02 22:11:14 +00:00
David Greene
451d1a6ecd
Fix misue of iterator pointing to erased object. Uncovered by
...
_GLIBCXX_DEBUG.
llvm-svn: 37793
2007-06-29 02:45:24 +00:00
Evan Cheng
2afd702c20
Move CorrectExtraCFGEdges() from BranchFolding.cpp to a MachineBasicBlock method.
...
llvm-svn: 37633
2007-06-18 22:43:58 +00:00
Evan Cheng
df75785594
Move ReplaceUsesOfBlockWith() out of BranchFolding into a MachineBasicBlock general facility.
...
llvm-svn: 37408
2007-06-04 06:44:01 +00:00
Evan Cheng
a92b2b38ff
Move isSuccessor() offline, change it to use std::find.
...
llvm-svn: 37190
2007-05-17 23:58:53 +00:00
Chris Lattner
f90c8fbd2b
print isLandingPad() for MBBs
...
llvm-svn: 36600
2007-04-30 23:12:53 +00:00
Evan Cheng
9bc8d4b6f2
Print preds / succs BB numbers.
...
llvm-svn: 35040
2007-03-09 08:29:08 +00:00
Evan Cheng
f7ed82da10
Re-apply my liveintervalanalysis changes. Now with PR1207 fixes.
...
llvm-svn: 34428
2007-02-19 21:49:54 +00:00
Reid Spencer
da81bf4d3e
For PR1207:
...
Revert patches that caused the problem. Evan, please investigate and reapply
when you've discovered the problem.
llvm-svn: 34399
2007-02-19 03:20:00 +00:00
Evan Cheng
41d2a1d8bf
Added removeLiveIn.
...
llvm-svn: 34381
2007-02-17 11:10:48 +00:00
Evan Cheng
bcf1d7faef
Add live-ins to MachineBasicBlock.
...
llvm-svn: 34111
2007-02-10 02:38:19 +00:00
Jeff Cohen
29192e6274
The best unbreakage yet, addressing Bill's concerns.
...
llvm-svn: 32622
2006-12-16 02:15:42 +00:00
Jeff Cohen
b82309f1ab
An even better unbreakage...
...
llvm-svn: 32617
2006-12-15 22:57:14 +00:00
Bill Wendling
355fc5ad50
Removed more <iostream> includes
...
llvm-svn: 32321
2006-12-07 20:28:15 +00:00
Evan Cheng
20350c4025
Change MachineInstr ctor's to take a TargetInstrDescriptor reference instead
...
of opcode and number of operands.
llvm-svn: 31947
2006-11-27 23:37:22 +00:00
Chris Lattner
ace542fa6c
Implement operator<< for machine basic blocks to make it easier to dump them.
...
llvm-svn: 31857
2006-11-18 21:47:36 +00:00
Chris Lattner
94866bef35
add moveBefore/moveAfter helper methods
...
llvm-svn: 31145
2006-10-24 00:02:26 +00:00
Chris Lattner
4e107aa0b6
print labels even if a MBB doesn't have a corresponding LLVM BB, just don't
...
print the LLVM BB label.
llvm-svn: 30775
2006-10-06 21:28:17 +00:00
Chris Lattner
16ae43e901
MachineBasicBlock::splice was incorrectly updating parent pointers on
...
instructions.
llvm-svn: 30760
2006-10-06 01:12:44 +00:00
Chris Lattner
de154b1737
Print the MBB ID # along with the bb tag in the -print-machine-instrs output.
...
llvm-svn: 30708
2006-10-03 20:17:24 +00:00
Chris Lattner
9a1e91b107
print the preds of each MBB
...
llvm-svn: 30606
2006-09-26 03:41:59 +00:00
Owen Anderson
8c2c1e90c4
Refactor a bunch of includes so that TargetMachine.h doesn't have to include
...
TargetData.h. This should make recompiles a bit faster with my current
TargetData tinkering.
llvm-svn: 28238
2006-05-12 06:33:49 +00:00
Chris Lattner
469647bf38
Remove and simplify some more machineinstr/machineoperand stuff.
...
llvm-svn: 28105
2006-05-04 18:16:01 +00:00
Chris Lattner
ee64b6b40f
Remove a bunch more dead V9 specific stuff
...
llvm-svn: 28094
2006-05-04 01:26:39 +00:00
Misha Brukman
835702a094
Remove trailing whitespace
...
llvm-svn: 21420
2005-04-21 22:36:52 +00:00
Chris Lattner
329c14a8bc
print the machine CFG in the -print-machineinstrs dump
...
llvm-svn: 20976
2005-04-01 06:48:38 +00:00
Chris Lattner
f6c93e36c7
Improve conformance with the Misha spelling benchmark suite
...
llvm-svn: 19930
2005-01-30 00:09:23 +00:00
Chris Lattner
e6074aa08b
adjust to ilist changes.
...
llvm-svn: 19924
2005-01-29 18:41:25 +00:00
Chris Lattner
4336b87f2c
Move method bodies that depend on <algorithm> from MBB.h to MBB.cpp
...
llvm-svn: 17253
2004-10-26 15:43:42 +00:00
Alkis Evlogimenos
fcb3f5197e
Indent to 2 spaces.
...
llvm-svn: 16187
2004-09-05 18:39:20 +00:00
Reid Spencer
7c16caa336
Changes For Bug 352
...
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.
llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Reid Spencer
eb04d9bcb4
Add #include <iostream> since Value.h does not #include it any more.
...
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Chris Lattner
449af59c7e
Change MBB autonumber a bit to get the reverse mapping as well as a forward
...
mapping
llvm-svn: 14521
2004-07-01 06:02:27 +00:00
Tanya Lattner
23dbc8170c
Made a fix so that you can print out MachineInstrs that belong to a MachineBasicBlock that is not yet attached to a MachineFunction. This change includes changing the third operand (TargetMachine) to a pointer for the MachineInstr::print function.
...
llvm-svn: 14389
2004-06-25 00:13:11 +00:00
Brian Gaeke
4300ca9d32
Make debugging dumps w/ multiple MachineBBs for a given LLVM BB readable.
...
llvm-svn: 14205
2004-06-17 22:26:53 +00:00
Chris Lattner
2150542af9
Adjust to new TargetMachine interface
...
llvm-svn: 13956
2004-06-02 05:57:12 +00:00
Tanya Lattner
91fa3a9908
Moved MachineBasicBlock deconstructor to cpp file and removed it from LeakDetector to fix memory leak bug.
...
llvm-svn: 13718
2004-05-24 07:14:35 +00:00
Tanya Lattner
a578cb7a65
Added MachineFunction parent* to MachineBasicBlock. Customized ilist template
...
to set the parent when a MachineBasicBlock is added to a MachineFunction.
llvm-svn: 13716
2004-05-24 06:11:51 +00:00
Chris Lattner
18dad6ed52
Eliminate an explicit use of the LLVM basic block, using getParent instead,
...
which simplifies the code
llvm-svn: 13707
2004-05-24 03:44:52 +00:00
Brian Gaeke
cb5d22a0cb
Add non-const MachineBasicBlock::getParent() accessor method.
...
MBBs start out as #-1. When a MBB is added to a MachineFunction, it
gets the next available unique MBB number. If it is removed from a
MachineFunction, it goes back to being #-1.
llvm-svn: 13514
2004-05-12 21:35:22 +00:00
Alkis Evlogimenos
b525d54045
Use MachineBasicBlock::getParent().
...
llvm-svn: 11756
2004-02-23 18:36:38 +00:00
Alkis Evlogimenos
af2de4848e
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).
llvm-svn: 11748
2004-02-23 18:14:48 +00:00
Chris Lattner
d23a882f2f
Add a MachineBasicBlock::getParent() method
...
llvm-svn: 11622
2004-02-19 16:13:54 +00:00
Alkis Evlogimenos
14f3fe81c6
Add LeakDetection to MachineInstr.
...
Move out of line member functions of MachineBasicBlock to
MachineBasicBlock.cpp.
llvm-svn: 11497
2004-02-16 07:17:43 +00:00
Chris Lattner
8c63b6897d
Change MachineBasicBlock's to not be Annotations, instead they are kept as
...
part of a linked list tracked by MachineFunction. MachineBasicBlock::get
is now linear time instead of constant time, and thus is deprecated!
llvm-svn: 4337
2002-10-28 05:30:46 +00:00
Chris Lattner
8710aab04c
Rename MachineCodeForBasicBlock to MachineBasicBlock
...
llvm-svn: 4318
2002-10-28 01:41:47 +00:00
Chris Lattner
9baa9ad7c7
Inline some methods from .cpp files into .h files, minor cleanups
...
llvm-svn: 4313
2002-10-28 01:21:55 +00:00
Chris Lattner
9f99867c6c
Updates to match misha's changes
...
llvm-svn: 4302
2002-10-28 00:37:53 +00:00
Vikram S. Adve
f0b84cefb0
Implementation of class MachineCodeForBasicBlock.
...
Moved here from MachineInstr.cpp to make it an annotation on BasicBlock.
llvm-svn: 2827
2002-07-08 23:01:11 +00:00