Commit Graph

184 Commits

Author SHA1 Message Date
Dale Johannesen ae87fc43a7 Something broke. Hard to believe it was this patch
but it's harder to believe it's the other candidate,
so reverting.  Temporarily I hope.

llvm-svn: 96303
2010-02-16 00:43:58 +00:00
Dale Johannesen 5b80f0d67f More handling of DBG_VALUE.
llvm-svn: 96294
2010-02-15 23:05:03 +00:00
Dale Johannesen c704ea1c51 Ignore DBG_VALUE in a couple more places.
llvm-svn: 96207
2010-02-15 01:45:47 +00:00
Dale Johannesen 3d1f1cccbb Fix comments to reflect renaming elsewhere.
llvm-svn: 95730
2010-02-10 00:11:11 +00:00
Chris Lattner b06015aa69 move target-independent opcodes out of TargetInstrInfo
into TargetOpcodes.h.  #include the new TargetOpcodes.h
into MachineInstr.  Add new inline accessors (like isPHI())
to MachineInstr, and start using them throughout the 
codebase.

llvm-svn: 95687
2010-02-09 19:54:29 +00:00
Dale Johannesen a466692552 Reapply 95050 with a tweak to check the register class.
llvm-svn: 95183
2010-02-03 01:40:33 +00:00
Dale Johannesen da431c76fb Test revert 95050; there's a good chance it's causing
buildbot failure.

llvm-svn: 95103
2010-02-02 18:52:56 +00:00
Dale Johannesen c84816a62e Make local RA smarter about reusing input register of a copy
as output.  Needed for (functional) correctness in inline asm,
and should be generally beneficial.  7361612.

llvm-svn: 95050
2010-02-02 02:08:02 +00:00
Dale Johannesen e057403835 Fix a case where debug_value could affect codegen.
llvm-svn: 94866
2010-01-30 00:57:47 +00:00
David Greene fc886b99da Change errs() to dbgs().
llvm-svn: 92595
2010-01-05 01:26:05 +00:00
Dale Johannesen 56f041406d Do better with physical reg operands (typically, from inline asm)
in local register allocator.  If a reg-reg copy has a phys reg
input and a virt reg output, and this is the last use of the phys
reg, assign the phys reg to the virt reg.  If a reg-reg copy has
a phys reg output and we need to reload its spilled input, reload
it directly into the phys reg than passing it through another reg.

Following 76208, there is sometimes no dependency between the def of
a phys reg and its use; this creates a window where that phys reg
can be used for spilling (this is true in linear scan also).  This
is bad and needs to be fixed a better way, although 76208 works too
well in practice to be reverted.  However, there should normally be
no spilling within inline asm blocks.  The patch here goes a long way
towards making this actually be true.

llvm-svn: 91485
2009-12-16 00:29:41 +00:00
David Greene 1fbe054450 Add a bool flag to StackObjects telling whether they reference spill
slots.  The AsmPrinter will use this information to determine whether to
print a spill/reload comment.

Remove default argument values.  It's too easy to pass a wrong argument
value when multiple arguments have default values.  Make everything
explicit to trap bugs early.

Update all targets to adhere to the new interfaces..

llvm-svn: 87022
2009-11-12 20:49:22 +00:00
Nick Lewycky 974e12b2d3 Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.

llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky 02d5f77d26 Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.

llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Evan Cheng 4729191bb2 Distinquish stack slots from other stack objects. They (and fixed objects) get FixedStack PseudoSourceValues.
llvm-svn: 84326
2009-10-17 09:20:14 +00:00
Bill Wendling fc8f54be92 Convert DOUT to DEBUG(errs()...).
llvm-svn: 79758
2009-08-22 20:38:09 +00:00
Dan Gohman 0402315d41 Use setPreservesAll and setPreservesCFG in CodeGen passes.
llvm-svn: 77754
2009-07-31 23:37:33 +00:00
Daniel Dunbar 0dd5e1ed39 More migration to raw_ostream, the water has dried up around the iostream hole.
- Some clients which used DOUT have moved to DEBUG. We are deprecating the
   "magic" DOUT behavior which avoided calling printing functions when the
   statement was disabled. In addition to being unnecessary magic, it had the
   downside of leaving code in -Asserts builds, and of hiding potentially
   unnecessary computations.

llvm-svn: 77019
2009-07-25 00:23:56 +00:00
Torok Edwin ccb29cd290 Convert more assert(0)+abort() -> LLVM_UNREACHABLE,
and abort()/exit() -> llvm_report_error().

llvm-svn: 75363
2009-07-11 13:10:19 +00:00
Bob Wilson e20be4183c Fix pr4100. Do not remove no-op copies when they are dead. The register
scavenger gets confused about register liveness if it doesn't see them.
I'm not thrilled with this solution, but it only comes up when there are dead
copies in the code, which is something that hopefully doesn't happen much.

Here is what happens in pr4100: As shown in the following excerpt from the
debug output of llc, the source of a move gets reloaded from the stack,
inserting a new load instruction before the move.  Since that source operand
is a kill, the physical register is free to be reused for the destination
of the move.  The move ends up being a no-op, copying R3 to R3, so it is
deleted.  But, it leaves behind the load to reload %reg1028 into R3, and
that load is not updated to show that it's destination operand (R3) is dead.
The scavenger gets confused by that load because it thinks that R3 is live.

Starting RegAlloc of: %reg1025<def,dead> = MOVr %reg1028<kill>, 14, %reg0, %reg0
  Regs have values: 
  Reloading %reg1028 into R3
  Last use of R3[%reg1028], removing it from live set
  Assigning R3 to %reg1025
  Register R3 [%reg1025] is never used, removing it from live set

Alternative solutions might be either marking the load as dead, or zapping
the load along with the no-op copy.  I couldn't see an easy way to do
either of those, though.

llvm-svn: 71196
2009-05-07 23:47:03 +00:00
Bob Wilson 5352454e6b Fix a comment (again).
llvm-svn: 71180
2009-05-07 21:20:42 +00:00
Bob Wilson 94c0a9fe8e Fix a comment.
llvm-svn: 71179
2009-05-07 21:19:45 +00:00
Bob Wilson 51856173c8 Fix pr3954. The register scavenger asserts for inline assembly with
register destinations that are tied to source operands.  The
TargetInstrDescr::findTiedToSrcOperand method silently fails for inline
assembly.  The existing MachineInstr::isRegReDefinedByTwoAddr was very
close to doing what is needed, so this revision makes a few changes to
that method and also renames it to isRegTiedToUseOperand (for consistency
with the very similar isRegTiedToDefOperand and because it handles both
two-address instructions and inline assembly with tied registers).

llvm-svn: 68714
2009-04-09 17:16:43 +00:00
Evan Cheng 1361cbbb0b Added MachineInstr::isRegTiedToDefOperand to check for two-addressness.
llvm-svn: 67335
2009-03-19 20:30:06 +00:00
Evan Cheng a160d4af82 Local register allocator shouldn't assume only the entry and landing pad basic blocks have live-ins.
llvm-svn: 63323
2009-01-29 18:37:30 +00:00
Evan Cheng 76a2736c74 Exit with nice warnings when register allocator run out of registers.
llvm-svn: 63267
2009-01-29 02:20:59 +00:00
Evan Cheng 89ba594975 A slight compile time optimization. If the caller knows there isn't a free register getReg() should not call getFreeReg().
llvm-svn: 63263
2009-01-29 01:13:00 +00:00
Evan Cheng c544cb0eca Change TargetInstrInfo::isMoveInstr to return source and destination sub-register indices as well.
llvm-svn: 62600
2009-01-20 19:12:24 +00:00
Dan Gohman d24be45d99 Drop the reg argument to isRegReDefinedByTwoAddr, which was redundant.
llvm-svn: 60586
2008-12-05 05:45:42 +00:00
Matthijs Kooijman 1dc8363d95 Minor fix debug for register allocation debug output.
llvm-svn: 59961
2008-11-24 16:01:21 +00:00
Dan Gohman 9c4b7d5c4f Fix command-line option printing to print two spaces where needed,
instead of requiring all "short description" strings to begin with
two spaces. This makes these strings less mysterious, and it fixes
some cases where short description strings mistakenly did not
begin with two spaces.

llvm-svn: 57521
2008-10-14 20:25:08 +00:00
Owen Anderson bfe12ee668 Fix the case where an instruction is not properly marked as using all registers that alias its inputs.
llvm-svn: 57286
2008-10-08 04:30:51 +00:00
Dan Gohman 78bb44fcd4 Fix a bug in the local allocator's liveness computation where it
was setting kill flags on tied uses in two-address instructions.
The kill flags were causing the allocator to think it could
allocate the use and its tied def in different registers.

llvm-svn: 57039
2008-10-04 00:31:14 +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
Dale Johannesen 86d421df23 Remove SelectionDag early allocation of registers
for earlyclobbers.  Teach Local RA about earlyclobber,
and add some tests for it.

llvm-svn: 56592
2008-09-24 23:13: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 a79db30d28 Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Chris Lattner 5fc8ab6d18 consolidate DenseMapInfo implementations, and add one for std::pair.
Patch contributed by m-s.

llvm-svn: 55167
2008-08-22 05:08:25 +00:00
Evan Cheng 45fdeb6c3f Change StackSlotForVirtReg (which maps vregs to frame indices) from std::map to IndexedMap.
llvm-svn: 53414
2008-07-10 18:23:23 +00:00
Evan Cheng e9ba28dd68 - Change the horrible N^2 isRegReDefinedByTwoAddr. Now callers must supply the operand index of def machineoperand and at most one full scan of non-implicit operands is needed.
- Change local register allocator to use the new isRegReDefinedByTwoAddr instead of reinventing the wheel.

llvm-svn: 53394
2008-07-10 07:35:43 +00:00
Owen Anderson 04a77c2492 Use DenseMap instead of std::map in local register allocation. This improves the time on instcombine from .31s to .22s
llvm-svn: 53390
2008-07-10 01:56:35 +00:00
Owen Anderson 20f41dac8d Fix 403.gcc. Finally got the check for two-address-ness correct.
llvm-svn: 53389
2008-07-10 01:53:01 +00:00
Owen Anderson be2e9a4447 Revert r53367, which was breaking things.
llvm-svn: 53378
2008-07-09 23:09:10 +00:00
Owen Anderson d3736ca1e0 Loosen our check here. Local regalloc only cares that the reg is used and def'd by the same instruction, but about the details of
the relationship.

llvm-svn: 53367
2008-07-09 21:34:36 +00:00
Owen Anderson b42ed21894 Don't use an expensive check for two-address-ness when we have the information sitting around to determine it much more quickly,
This speeds up the local register allocator from 0.37s to 0.31s on instcombine.

llvm-svn: 53359
2008-07-09 21:15:10 +00:00
Owen Anderson a0bc522466 Factor local liveness computation out into its own function.
llvm-svn: 53352
2008-07-09 20:14:53 +00:00
Dan Gohman 70aa89d215 Reuse the MO variable instead of recomputing it in RegAllocLocal.
Keep RegAllocSimple in sync.

llvm-svn: 53351
2008-07-09 20:12:26 +00:00
Dan Gohman 8ab08642ee RegAllocLocal has a TargetInstrInfo data member. Use it instead
of having local variables duplicate it.

llvm-svn: 53346
2008-07-09 19:55:19 +00:00
Dan Gohman 8a95073098 Use find with std::map, when that's what's needed, instead of lower_bound
with extra checks.

llvm-svn: 53344
2008-07-09 19:51:00 +00:00
Owen Anderson 27b8a21dfd Fix the build. Apparently MachineInstr& is no longer implicitly convertable to MachineBasicBlock::iterator.
llvm-svn: 53260
2008-07-08 23:36:37 +00:00