Commit Graph

11358 Commits

Author SHA1 Message Date
Duncan Sands
2aea490e16 Pacify the compiler. BestWeight cannot in fact be used uninitialized
in this function, but the compiler was warning that it might be when
doing a release build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-28 10:07:15 +00:00
Cameron Zwarich
c3ab20e62e Change an assertion to assert what the code actually relies upon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-27 22:08:42 +00:00
Cameron Zwarich
4e7f23b1b6 Land a first cut at StrongPHIElimination. There are only 5 new test failures
when running without the verifier, and I have not yet checked them to see if
the new results are still correct. There are more verifier failures, but they
all seem to be additional occurrences of verifier failures that occur with the
existing PHIElimination pass. There are a few obvious issues with the code:

1) It doesn't properly update the register equivalence classes during copy
insertion, and instead recomputes them before merging live intervals and
renaming registers. I wanted to keep this first patch simple for debugging
purposes, but it shouldn't be very hard to do this.

2) It doesn't mix the renaming and live interval merging with the copy insertion
process, which leads to a lot of virtual register churn. Virtual registers and
live intervals are created, only to later be merged into others. The code should
be smarter and only create a new virtual register if there is no existing
register in the same congruence class.

3) In one place the code uses a DenseMap per basic block, which is unnecessary
heap allocation. There should be an inline storage version of DenseMap.

I did a quick compile-time test of running llc on 403.gcc with and without
StrongPHIElimination. It is slightly slower with StrongPHIElimination, because
the small decrease in the coalescer runtime can't beat the increase in phi
elimination runtime. Perhaps fixing the above performance issues will narrow
the gap.

I also haven't yet run any tests of the quality of the generated code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122582 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-27 10:08:19 +00:00
Cameron Zwarich
4eee42cb28 Add knowledge of phi-def and phi-kill valnos to MachineVerifier's predecessor
valno verification. The "Different value live out of predecessor" check is
incorrect in the case of phi-def valnos, so just skip that check for phi-def
valnos and instead check that all of the valnos for predecessors have phi-kill.
Fixes PR8863.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122581 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-27 05:17:23 +00:00
Andrew Trick
a75ce9f5d2 Minor cleanup related to my latest scheduler changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 07:10:19 +00:00
Andrew Trick
24312230ad Fix a few cases where the scheduler is not checking for phys reg copies. The scheduling node may have a NULL DAG node, yuck.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122544 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 06:46:50 +00:00
Andrew Trick
2da8bc8a5f Various bits of framework needed for precise machine-level selection
DAG scheduling during isel. Most new functionality is currently
guarded by -enable-sched-cycles and -enable-sched-hazard.

Added InstrItineraryData::IssueWidth field, currently derived from
ARM itineraries, but could be initialized differently on other targets.

Added ScheduleHazardRecognizer::MaxLookAhead to indicate whether it is
active, and if so how many cycles of state it holds.

Added SchedulingPriorityQueue::HasReadyFilter to allowing gating entry
into the scheduler's available queue.

ScoreboardHazardRecognizer now accesses the ScheduleDAG in order to
get information about it's SUnits, provides RecedeCycle for bottom-up
scheduling, correctly computes scoreboard depth, tracks IssueCount, and
considers potential stall cycles when checking for hazards.

ScheduleDAGRRList now models machine cycles and hazards (under
flags). It tracks MinAvailableCycle, drives the hazard recognizer and
priority queue's ready filter, manages a new PendingQueue, properly
accounts for stall cycles, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 05:03:26 +00:00
Andrew Trick
6e8f4c4048 whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 04:28:06 +00:00
Cameron Zwarich
ef485d8658 Simplify a check for implicit defs and remove a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122537 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 03:09:36 +00:00
Chris Lattner
29d8f0cae4 flags -> glue for selectiondag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122509 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 17:24:32 +00:00
Chris Lattner
a4359be032 sdisel flag -> glue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 17:13:18 +00:00
Andrew Trick
2902736a50 Reorganize ListScheduleBottomUp in preparation for modeling machine cycles and instruction issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122491 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 05:42:20 +00:00
Andrew Trick
3d420cb2fe Converted LiveRegCycles to LiveRegGens. It's easier to work with and allows multiple nodes per cycle.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122474 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 04:16:14 +00:00
Andrew Trick
cb7947b81b In CheckForLiveRegDef use TRI->getOverlaps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 03:43:21 +00:00
Andrew Trick
1b1658741a Fixes PR8823: add-with-overflow-128.ll
In the bottom-up selection DAG scheduling, handle two-address
instructions that read/write unspillable registers. Treat
the entire chain of two-address nodes as a single live range.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 03:15:51 +00:00
Jeffrey Yasskin
8e68c38735 Change all self assignments X=X to (void)X, so that we can turn on a
new gcc warning that complains on self-assignments and
self-initializations.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 00:58:24 +00:00
Benjamin Kramer
f50125ecaa DAGCombine add (sext i1), X into sub X, (zext i1) if sext from i1 is illegal. The latter usually compiles into smaller code.
example code:
unsigned foo(unsigned x, unsigned y) {
  if (x != 0) y--;
  return y;
}

before:
  _foo:                           ## @foo
    cmpl  $1, 4(%esp)             ## encoding: [0x83,0x7c,0x24,0x04,0x01]
    sbbl  %eax, %eax              ## encoding: [0x19,0xc0]
    notl  %eax                    ## encoding: [0xf7,0xd0]
    addl  8(%esp), %eax           ## encoding: [0x03,0x44,0x24,0x08]
    ret                           ## encoding: [0xc3]

after:
  _foo:                           ## @foo
    cmpl  $1, 4(%esp)             ## encoding: [0x83,0x7c,0x24,0x04,0x01]
    movl  8(%esp), %eax           ## encoding: [0x8b,0x44,0x24,0x08]
    adcl  $-1, %eax               ## encoding: [0x83,0xd0,0xff]
    ret                           ## encoding: [0xc3]



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 23:17:45 +00:00
Jakob Stoklund Olesen
770d42de3b When RegAllocGreedy decides to spill the interferences of the current register,
pick the victim with the lowest total spill weight.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122445 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 22:01:30 +00:00
Jakob Stoklund Olesen
c64379da07 Include a shadow of the original CFG edges in the edge bundle graph.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122444 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 22:01:28 +00:00
Chris Lattner
cbf68dfbc0 Fix a bug in ReduceLoadWidth that wasn't handling extending
loads properly.  We miscompiled the testcase into:

_test:                                  ## @test
	movl	$128, (%rdi)
	movzbl	1(%rdi), %eax
	ret

Now we get a proper:

_test:                                  ## @test
	movl	$128, (%rdi)
	movsbl	(%rdi), %eax
	movzbl	%ah, %eax
	ret

This fixes PR8757.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122392 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 08:02:57 +00:00
Chris Lattner
7a2a7faf9c more cleanups, move a check for "roundedness" earlier to reject
unhanded cases faster and simplify code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122391 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 08:01:44 +00:00
Chris Lattner
4c32bc24de reduce indentation and improve comments, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 07:36:50 +00:00
Andrew Trick
feac09801b In DelayForLiveRegsBottomUp, handle instructions that read and write
the same physical register. Simplifies the fix from the previous
checkin r122211.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122370 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 22:27:44 +00:00
Andrew Trick
38036d8b36 whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122368 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 22:25:04 +00:00
Dale Johannesen
c72b18cdc8 Reapply 122353-122355 with fixes. 122354 was wrong;
the shift type was needed one place, the shift count
type another.  The transform in 123555 had the same
problem.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122366 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 21:55:50 +00:00
Dale Johannesen
d0cf2585a0 Revert 122353-122355 for the moment, they broke stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122360 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 21:22:27 +00:00
Dale Johannesen
a83bf35d16 Add a new transform to DAGCombiner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 20:10:51 +00:00
Dale Johannesen
5ecc340e34 Get the type of a shift from the shift, not from its shift
count operand.  These should be the same but apparently are
not always, and this is cleaner anyway.  This improves the
code in an existing test.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122354 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 20:06:19 +00:00
Dale Johannesen
efc96dd38c Shift by the word size is invalid IR; don't create it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122353 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 20:00:06 +00:00
Chris Lattner
90b0364cff fix some typos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122349 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 18:05:22 +00:00
Stuart Hastings
56500edc7a Fix indentation, add comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122345 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 17:16:58 +00:00
Stuart Hastings
2965e69e04 Missing logic for nested CALLSEQ_START/END.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122342 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 17:07:24 +00:00
Cameron Zwarich
47bce43229 Incremental progress towards a new implementation of StrongPHIElimination. Most
of the problems with my last attempt were in the updating of LiveIntervals
rather than the coalescing itself. Therefore, I decided to get that right first
by essentially reimplementing the existing PHIElimination using LiveIntervals.

It works correctly, with only a few tests failing (which may not be legitimate
failures) and no new verifier failures (at least as far as I can tell, I didn't
count the number per file).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122321 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 06:54:43 +00:00
Chris Lattner
f1b4eafbfe rename MVT::Flag to MVT::Glue. "Flag" is a terrible name for
something that just glues two nodes together, even if it is
sometimes used for flags.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122310 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 02:38:05 +00:00
Chris Lattner
5df1578dec improve "cannot yet select" errors a trivial amount: now
they are just as useless, but at least a bit more gramatical


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122305 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 02:07:03 +00:00
Jakob Stoklund Olesen
8d0963f72c Add EdgeBundles to SplitKit.
Edge bundles is an annotation on the CFG that turns it into a bipartite directed
graph where each basic block is connected to an outgoing and an ingoing bundle.
These bundles are useful for identifying regions of the CFG for live range
splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122301 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 01:50:21 +00:00
Jakob Stoklund Olesen
b907e8a2d4 Use IntEqClasses to compute connected components of live intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 00:48:17 +00:00
Dale Johannesen
025cc6e1be Cosmetic changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122259 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 20:10:50 +00:00
Cameron Zwarich
2100d21f39 MachineVerifier should count landing pad successors as basic blocks rather than
out-edges. Fixes PR8824.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122228 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 04:19:48 +00:00
Cameron Zwarich
0b13d7db28 Teach MachineVerifier that early clobber defs begin at USE slots and other defs
begin at DEF slots. Fixes the second half of PR8813.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 03:15:20 +00:00
Cameron Zwarich
5e61f9916e Add a missing check from r122218.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 02:59:51 +00:00
Chris Lattner
5c3d4f0fc9 implement type legalization promotion support for SMULO and UMULO, giving
ARM (and other 32-bit-only) targets support for i8 and i16 overflow 
multiplies.  The generated code isn't great, but this at least fixes
CodeGen/Generic/overflow.ll when running on ARM hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122221 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 02:05:39 +00:00
Cameron Zwarich
636f15ff04 Don't assume that an instruction ending a register's live range always reads
the register; it may be a dead def instead. Fixes PR8820.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122218 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 01:22:37 +00:00
Chris Lattner
37944985a5 Fix a bug in the scheduler's handling of "unspillable" vregs.
Imagine we see:

EFLAGS = inst1
EFLAGS = inst2 FLAGS
gpr = inst3 EFLAGS

Previously, we would refuse to schedule inst2 because it clobbers
the EFLAGS of the predecessor.  However, it also uses the EFLAGS
of the predecessor, so it is safe to emit.  SDep edges ensure that
the right order happens already anyway.

This fixes 2 testsuite crashes with the X86 patch I'm going to
commit next.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122211 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:55:43 +00:00
Chris Lattner
142d21c861 the result of CheckForLiveRegDef is dead, remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122209 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:51:56 +00:00
Chris Lattner
5078293cc2 reduce indentation, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122208 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:50:16 +00:00
Cameron Zwarich
8ec88ba588 Ignore debug values when performing MachineVerifier liveness checks. Fixes
PR8822.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122207 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:08:10 +00:00
Cameron Zwarich
1b031ddede Early clobber operands are allowed to be defined at use indices. This fixes one
half of PR8813.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 23:50:53 +00:00
Cameron Zwarich
fb69f6037d Fix PR8815 by checking for an explicit clobber def tied to a use operand in
ConnectedVNInfoEqClasses::Classify().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 22:12:45 +00:00
Cameron Zwarich
22d67cf6ac Fix PR8811 by teaching MachineVerifier about optional defs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 21:37:23 +00:00
Cameron Zwarich
c44270dd6f StrongPHIElimination will never run before TwoAddressInstructionPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122197 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 21:32:29 +00:00
Nick Lewycky
476b242fe7 Add missing standard headers. Patch by Joerg Sonnenberger!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122193 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:43:38 +00:00
Chris Lattner
da60588402 teach MaskedValueIsZero how to analyze ADDE. This is
enough to teach it that ADDE(0,0) is known 0 except the 
low bit, for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:38:28 +00:00
Cameron Zwarich
d959da92a5 Remove some checks for StrongPHIElim. These checks make it impossible to use an
alternative register allocator that does not require LiveIntervals by specifying
it on the command-line for a target that has StrongPHIElimination enabled by
default.

These checks are pretty meaningless anyways, since StrongPHIElimination and
PHIElimination are never used at the same time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122176 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 18:03:27 +00:00
Chris Lattner
96ba57fdda fix PR8642: if a critical edge has a PHI value that can trap,
isel is *required* to split the edge.  PHI values get evaluated
on the edge, not in their predecessor block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122170 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 04:58:57 +00:00
Jakob Stoklund Olesen
390482569c Apparently, operandices is not a word.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:28:32 +00:00
Jakob Stoklund Olesen
83d1ba5728 Teach the inline spiller to attempt folding a load instruction into its single
use before rematerializing the load.

This allows us to produce:

    addps	LCPI0_1(%rip), %xmm2

Instead of:

    movaps	LCPI0_1(%rip), %xmm3
    addps	%xmm3, %xmm2

Saving a register and an instruction. The standard spiller already knows how to
do this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122133 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:04:14 +00:00
Jakob Stoklund Olesen
87c6d25c71 Tweak debug spew.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:04:11 +00:00
Jakob Stoklund Olesen
dfe3b6d2a9 Check that the register is live-in to the loop header before inserting copies in
the loop predecessors.

The register can be live-out from a predecessor without being live-in to the
loop header if there is a critical edge from the predecessor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122123 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 01:06:19 +00:00
Nick Lewycky
bb1744ec15 Fix GCC warning:
lib/CodeGen/RegAllocGreedy.cpp:311: error: unused variable 'PhysReg' [-Wunused-variable]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122122 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 01:05:55 +00:00
Jakob Stoklund Olesen
89cab93fe9 Pass a Banner argument to the machine code verifier both from
createMachineVerifierPass and MachineFunction::verify.

The banner is printed before the machine code dump, just like the printer pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:06:56 +00:00
Jakob Stoklund Olesen
8d12140437 Avoid dereferencing end() in collectInterferingVRegs() when there is no
interference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122108 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:16:38 +00:00
Jakob Stoklund Olesen
af24964251 Make the -verify-regalloc command line option available to base classes as
RegAllocBase::VerifyEnabled.

Run the machine code verifier in a few interesting places during RegAllocGreedy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122107 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:16:35 +00:00
Jakob Stoklund Olesen
f428eb6c1b Enable loop splitting in RegAllocGreedy.
The heuristics split around the largest loop where the current register may be
allocated without interference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:16:32 +00:00
Bill Wendling
976ef86689 During local stack slot allocation, the materializeFrameBaseRegister function
may be called. If the entry block is empty, the insertion point iterator will be
the "end()" value. Calling ->getParent() on it (among others) causes problems.

Modify materializeFrameBaseRegister to take the machine basic block and insert
the frame base register at the beginning of that block. (It's very similar to
what the code does all ready. The only difference is that it will always insert
at the beginning of the entry block instead of after a previous materialization
of the frame base register. I doubt that that matters here.)

<rdar://problem/8782198>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122104 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:09:14 +00:00
Bob Wilson
d727343a40 Fix a DAGCombiner crash when folding binary vector operations with constant
BUILD_VECTOR operands where the element type is not legal.  I had previously
changed this code to insert TRUNCATE operations, but that was just wrong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122102 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:06:49 +00:00
Dale Johannesen
f5daf8bb7f Add a transform to DAG Combiner. This improves the
code for the case where 32-bit divide by constant is
turned into 64-bit multiply by constant.  8771012.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 21:45:49 +00:00
Jakob Stoklund Olesen
2f3a4aa550 Allow missing kill flags on an untied operand of a two-address instruction when
the operand uses the same register as a tied operand:

  %r1 = add %r1, %r1

If add were a three-address instruction, kill flags would be required on at
least one of the uses. Since it is a two-address instruction, the tied use
operand must not have a kill flag.

This change makes the kill flag on the untied use operand optional.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 19:18:41 +00:00
Jakob Stoklund Olesen
090100fdb1 Add MachineLoopRange comparators for sorting loop lists by number and by area.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122073 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:13:52 +00:00
Jakob Stoklund Olesen
ff2e9b4225 Provide LiveIntervalUnion::Query::checkLoopInterference.
This is a three-way interval list intersection between a virtual register, a
live interval union, and a loop. It will be used to identify interference-free
loops for live range splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 04:09:47 +00:00
Bob Wilson
495de3b783 Fix crash compiling a QQQQ REG_SEQUENCE for a Neon vld3_lane operation.
Radar 8776599

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122018 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 01:21:12 +00:00
Bob Wilson
c7c5e781a3 Fix a comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122016 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 01:21:05 +00:00
Daniel Dunbar
745dacc91d MC: Make TargetAsmBackend available to the AsmStreamer.
- Treaty talks on the non-proliferation of MC objects broke down.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 03:05:59 +00:00
Jakob Stoklund Olesen
d0bb5e2ca0 Start using SplitKit and MachineLoopRanges in RegAllocGreedy in preparation of
live range splitting around loops guided by register pressure.

So far, trySplit() simply prints a lot of debug output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121918 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 23:46:13 +00:00
Jakob Stoklund Olesen
ceadc01e91 Add MachineLoopRanges analysis.
A MachineLoopRange contains the intervals of slot indexes covered by the blocks
in a loop. This representation of the loop blocks is more efficient to compare
against interfering registers during register coalescing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 23:41:23 +00:00
Evan Cheng
a63cde26ff Teach machine cse to commute instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121903 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 22:16:21 +00:00
Dan Gohman
5034dd318a Move Value::getUnderlyingObject to be a standalone
function so that it can live in Analysis instead of
VMCore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121885 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 20:02:24 +00:00
Jakob Stoklund Olesen
6203295473 Fix build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121872 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 18:07:48 +00:00
Jakob Stoklund Olesen
697483addf Detect and enumerate bypass loops.
Bypass loops have the current live range live through, but contain no uses or
defs. Splitting around a bypass loop can free registers for other uses inside
the loop by spilling the split range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121871 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 17:49:52 +00:00
Jakob Stoklund Olesen
521a453721 Separate SplitAnalysis::getSplitLoops().
This method returns the set of loops with uses that are candidates for
splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 17:41:19 +00:00
Chris Lattner
33e77d3cb9 take care of some todos, transforming [us]mul_lohi into
a wider mul if the wider mul is legal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121848 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 06:04:19 +00:00
Chris Lattner
1a0fbe2cf4 when transforming a MULHS into a wider MUL, there is no need to SRA the
result, the top bits are truncated off anyway, just use SRL.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 05:51:39 +00:00
Jakob Stoklund Olesen
257c556d85 Simplify RegAllocGreedy's use of register aliases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121807 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 23:38:19 +00:00
Jakob Stoklund Olesen
eb7464ebda Simplify CCState's use of register aliases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121806 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 23:28:01 +00:00
Jakob Stoklund Olesen
597faa8f1f Simplify AggressiveAntiDepBreaker's use of register aliases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121805 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 23:23:15 +00:00
Jakob Stoklund Olesen
16999da951 Simplyfy RegAllocBasic by using getOverlaps instead of getAliasSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121801 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 23:10:48 +00:00
Evan Cheng
bbc726d624 Fix a minor bug in two-address pass. It was missing a commute opportunity.
regB = move RCX
regA = op regB, regC
RAX  = move regA
where both regB and regC are killed. If regB is constrainted to non-compatible
physical registers but regC is not constrainted at all, then it's better to
commute the instruction.
       movl    %edi, %eax
       shlq    $32, %rcx
       leaq    (%rcx,%rax), %rax
=>
       movl    %edi, %eax
       shlq    $32, %rcx
       orq     %rcx, %rax
rdar://8762995


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121793 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 21:34:53 +00:00
Matt Beaumont-Gay
3ef9f3da39 Move debugging code entirely within DEBUG(). Silences an unused variable
warning in the opt build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 21:14:55 +00:00
Jakob Stoklund Olesen
bfce678de7 Add LiveIntervalUnion print methods, RegAllocGreedy::trySplit debug spew.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 19:38:49 +00:00
Jakob Stoklund Olesen
4a84cce3ed Use TRI::printReg instead of AbstractRegisterDescription when printing
LiveIntervalUnions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121781 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 18:53:47 +00:00
Jakob Stoklund Olesen
d84de8cf62 Q.seenAllInterferences() must be called after Q.collectInterferingVRegs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121774 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 17:47:36 +00:00
Jakob Stoklund Olesen
885b3283ea Remove unused vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121741 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 00:58:47 +00:00
Jakob Stoklund Olesen
46c83c80c5 Try reassigning all virtual register interferences, not just those with lower
spill weight. Filter out fixed registers instead.

Add support for reassigning an interference that was assigned to an alias.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 00:37:49 +00:00
Jakob Stoklund Olesen
b64d92e29f Add stub for RAGreedy::trySplit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121736 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 00:37:44 +00:00
Chris Lattner
de1c3605a6 Add a couple dag combines to transform mulhi/mullo into a wider multiply
when the wider type is legal.  This allows us to compile:

define zeroext i16 @test1(i16 zeroext %x) nounwind {
entry:
	%div = udiv i16 %x, 33
	ret i16 %div
}

into:

test1:                                  # @test1
	movzwl	4(%esp), %eax
	imull	$63551, %eax, %eax      # imm = 0xF83F
	shrl	$21, %eax
	ret

instead of:

test1:                                  # @test1
        movw    $-1985, %ax             # imm = 0xFFFFFFFFFFFFF83F
        mulw    4(%esp)
        andl    $65504, %edx            # imm = 0xFFE0
        movl    %edx, %eax
        shrl    $5, %eax
        ret

Implementing rdar://8760399 and example #4 from:
http://blog.regehr.org/archives/320

We should implement the same thing for [su]mul_hilo, but I don't
have immediate plans to do this.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 08:39:01 +00:00
Chris Lattner
11ae9e29a9 remove the verbose-asm "constant pool double" comments that we were printing
for each constant pool entry.  Using WriteTypeSymbolic here takes time
proportional to the size of the module, for each constant pool entry.

This speeds up -verbose-asm llc on 252.eon (a random testcase at my disposal)
from 4.4s to 2.137s.  llc takes 2.11s with asm-verbose off, so this is now a
pretty reasonable cost for verbose comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121691 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 07:35:47 +00:00
Chris Lattner
d5b4db9824 reduce indentation by using continue, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 01:11:17 +00:00
Duncan Sands
a30b7d2c70 Catch attempts to remove a deleted node from the CSE maps. Better to
catch this here rather than later after accessing uninitialized memory
etc.  Fires when compiling the testcase in PR8237.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121635 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-12 13:22:50 +00:00
Jakob Stoklund Olesen
533f58ecdd Add named timer groups for the different stages of register allocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121604 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-11 00:19:56 +00:00
Jakob Stoklund Olesen
4680dec5fb Move MRI into RegAllocBase. Clean up debug output a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121599 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 23:49:00 +00:00
Nick Lewycky
a0bb037283 Remove extraneous close parenthesis.
Fix build breakage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121596 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 23:14:35 +00:00
Nick Lewycky
5a4308bca8 Move variable that's unused in an NDEBUG build inside the DEBUG() macro, fixing
lib/CodeGen/RegAllocGreedy.cpp:233: error: unused variable 'TRC' [-Wunused-variable]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121594 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 23:05:10 +00:00
Jakob Stoklund Olesen
f6dff84d4e Force the greedy register allocator to always use the inline spiller.
Soon, RegAllocGreedy will start splitting live ranges, and then deferred
spilling won't work anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121591 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 22:54:44 +00:00
Jakob Stoklund Olesen
3bda29eb4f Rip out live range splitting support from the inline spiller.
The spiller should only spill. The register allocator will drive live range
splitting, it has the needed information about register pressure and
interferences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121590 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 22:54:40 +00:00
Jakob Stoklund Olesen
dd479e9769 Use AllocationOrder in RegAllocGreedy, fix a bug in the hint calculation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121584 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 22:21:05 +00:00
Jakob Stoklund Olesen
6ce219ec64 Fix miscompilation caused by trivial logic error in the reassignVReg()
interference check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121519 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 20:45:04 +00:00
Jakob Stoklund Olesen
c9672cb8be Add an AllocationOrder class that can iterate over the allocatable physical
registers for a given virtual register.

Reserved registers are filtered from the allocation order, and any valid hint is
returned as the first suggestion.

For target dependent hints, a number of arcane target hooks are invoked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121497 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 18:36:02 +00:00
Rafael Espindola
89b9372605 Fixed version of 121434 with no new memory leaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121471 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 07:39:47 +00:00
Rafael Espindola
f7fd4aa261 Revert my previous patch to make the valgrind bots happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121461 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 04:01:09 +00:00
Rafael Espindola
1c952b9cc9 Initial support for the cfi directives. This is just enough to get
f:
        .cfi_startproc
        nop
        .cfi_endproc

assembled (on ELF).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 23:48:29 +00:00
Stuart Hastings
a304d02791 Initial support for nested CALLSEQ_START/CALLSEQ_END constructs in LegalizeDAG.
Necessary for byval support on ARM.  Radar 7662569.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121412 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 21:25:20 +00:00
Jakob Stoklund Olesen
ff092faffb Remember to filter out reserved rergisters from the allocation order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121411 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 21:20:46 +00:00
Jakob Stoklund Olesen
a0382c6290 Add a forgotten initializer for CheckedFirstInterference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 21:20:44 +00:00
Andrew Trick
b853e6c370 Added register reassignment prototype to RAGreedy. It's a simple
heuristic to reshuffle register assignments when we can't find an
available reg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 18:15:21 +00:00
Eric Christopher
503a64dcd4 80-col fixups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 04:48:06 +00:00
Jakob Stoklund Olesen
a35cce1a14 IntervalMap iterators are heavyweight, so avoid copying them around and use
references instead.

Similarly, IntervalMap::begin() is almost as expensive as find(), so use find(x)
instead of begin().advanceTo(x);

This makes RegAllocBasic run another 5% faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 01:06:52 +00:00
Devang Patel
d639c7cab4 DW_FORM_data1 may not provide sufficient room for vtable index, use _udata instead.
This fixes radar 8730409.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121323 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 00:10:40 +00:00
Jakob Stoklund Olesen
9b0c4f8af3 Properly deal with empty intervals when checking for interference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121319 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 23:51:35 +00:00
Jakob Stoklund Olesen
90c1d7ddfc Implement very primitive hinting support in RegAllocGreedy.
The hint is simply tried first and then forgotten if it couldn't be allocated
immediately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 22:57:16 +00:00
Jakob Stoklund Olesen
d0bec3e62c Store (priority,regnum) pairs in the priority queue instead of providing an
abstract priority queue interface in subclasses that want to override the
priority calculations.

Subclasses must provide a getPriority() implementation instead.

This approach requires less code as long as priorities are expressable as simple
floats, and it avoids the dangers of defining potentially expensive priority
comparison functions.

It also should speed up priority_queue operations since they no longer have to
chase pointers when comparing registers. This is not measurable, though.

Preferably, we shouldn't use floats to guide code generation. The use of floats
here is derived from the use of floats for spill weights. Spill weights have a
dynamic range that doesn't lend itself easily to a fixpoint implementation.

When someone invents a stable spill weight representation, it can be reused for
allocation priorities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121294 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 22:22:41 +00:00
Eric Christopher
bece04845e Reword comment slightly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121293 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 22:21:42 +00:00
Eric Christopher
f299da8ec3 Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 21:35:09 +00:00
Jakob Stoklund Olesen
753936602e Trim includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121283 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 21:12:00 +00:00
Andrew Trick
6b1207267f Generalize PostRAHazardRecognizer so it can be used in any pass for
both forward and backward scheduling. Rename it to
ScoreboardHazardRecognizer (Scoreboard is one word). Remove integer
division from the scoreboard's critical path.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 20:04:29 +00:00
Jakob Stoklund Olesen
cba2e06d52 Stub out RegAllocGreedy.
This new register allocator is initially identical to RegAllocBasic, but it will
receive all of the tricks that RegAllocBasic won't get.

RegAllocGreedy will eventually replace linear scan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 03:26:16 +00:00
Jakob Stoklund Olesen
1b19dc1d8b Move RABasic::addMBBLiveIns to the base class, it is generally useful.
Minor optimization to the use of IntervalMap iterators. They are fairly
heavyweight, so prefer SI.valid() over SI != end().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121217 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 01:06:06 +00:00
Jakob Stoklund Olesen
953af2c3c5 Switch LiveIntervalUnion from std::set to IntervalMap.
This speeds up RegAllocBasic by 20%, not counting releaseMemory which becomes
way faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121201 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:18:47 +00:00
Jakob Stoklund Olesen
2b38c51f0e Simplify assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121162 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 18:51:27 +00:00
Jay Foad
40f8f6264d PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 08:25:19 +00:00
Jakob Stoklund Olesen
1fe045279b Remove unused member.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121098 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 01:32:45 +00:00
Devang Patel
b7313e274c Undefined value in reg 0 may need a marker to identify end of source range.
This will be used to truncate live range of DBG_VALUE instruction by register allocator and friends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 22:48:22 +00:00
Devang Patel
afeaae7a94 If dbg_declare() or dbg_value() is not lowered by isel then emit DEBUG message instead of creating DBG_VALUE for undefined value in reg0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121059 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 22:39:26 +00:00
Rafael Espindola
0bbe0b440e Second try at making direct object emission produce the same results
as llc + llvm-mc. This time ELF is not changed and I tested that llvm-gcc
bootstrap on darwin10 using darwin9's assembler and linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 17:27:56 +00:00
Rafael Espindola
6d86492f5e Revert previous two patches while I try to find out how to make both
linux and darwin assemblers happy :-(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 15:35:15 +00:00
Rafael Espindola
2303c9dd69 Add an EmitAbsValue helper method and use it in cases where we want to be sure
that no relocations are used (on MochO).
Fixes llc producing different output from llc + llvm-mc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 14:53:14 +00:00
Cameron Zwarich
9eaf49b320 Some cleanup before I start committing some incremental progress on
StrongPHIElimination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120961 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05 22:34:08 +00:00
Cameron Zwarich
0a3fdd6e11 Remove the PHIElimination.h header, as it is no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120959 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05 21:39:42 +00:00
Cameron Zwarich
120188605f I forgot to actually remove the FindCopyInsertPoint() declaration from
PHIElimination.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05 19:58:57 +00:00
Cameron Zwarich
2225dd81e9 Remove the SplitCriticalEdge() method declaration from PHIElimination.h. At one
time, this method existed, but now PHIElimination uses the method of the same
name on MachineBasicBlock.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05 19:54:23 +00:00
Cameron Zwarich
a474685d06 Move the FindCopyInsertPoint method of PHIElimination to a new standalone
function so that it can be shared with StrongPHIElimination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120951 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05 19:51:05 +00:00
Cameron Zwarich
2a7942926b Remove PHIElimination's private copy of SkipPHIsAndLabels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120918 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 20:40:15 +00:00
Benjamin Kramer
3069cbf7b3 Remove unneeded zero arrays.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120910 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 15:28:22 +00:00
Jakob Stoklund Olesen
6ed4c6af97 Rename virtRegMap to avoid confusion with the VirtRegMap that it isn't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 22:25:09 +00:00
Jakob Stoklund Olesen
5daec2215b Coalesce debug locations when possible, causing less DBG_VALUE instructions to
be emitted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 22:25:07 +00:00
Jakob Stoklund Olesen
42acf069c9 Emit DBG_VALUE instructions from LiveDebugVariables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 21:47:10 +00:00
Jakob Stoklund Olesen
8d2584a1d9 Also update virtRegMap when renaming virtual registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120841 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 21:47:08 +00:00
Jakob Stoklund Olesen
68be956fff Delete the StrongPHIElimination pass, leaving only a shell.
The StrongPHIElimination pass did not work, and nobody has worked on it for two
years.

A rewrite is underway, so I am leaving this shell pass instead of deleting it
completely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120830 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 19:21:53 +00:00
Jakob Stoklund Olesen
30e2128a73 Update LiveDebugVariables during coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120720 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 18:15:44 +00:00
Jakob Stoklund Olesen
0613516b16 Implement the first half of LiveDebugVariables.
Scan the MachineFunction for DBG_VALUE instructions, and replace them with a
data structure similar to LiveIntervals. The live range of a DBG_VALUE is
determined by propagating it down the dominator tree until a new DBG_VALUE is
found. When a DBG_VALUE lives in a register, its live range is confined to the
live range of the register's value.

LiveDebugVariables runs before coalescing, so DBG_VALUEs are not artificially
extended when registers are joined.

The missing half will recreate DBG_VALUE instructions from the intervals when
register allocation is complete.

The pass is disabled by default. It can be enabled with the temporary command
line option -live-debug-variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120636 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 00:37:37 +00:00
Jay Foad
7a874ddda0 PR5207: Rename overloaded APInt methods set(), clear(), flip() to
setAllBits(), setBit(unsigned), etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120564 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 08:53:58 +00:00
Andrew Trick
34fff59cad Comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120504 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:59:50 +00:00
Evan Cheng
3d2125c9db Enable sibling call optimization of libcalls which are expanded during
legalization time. Since at legalization time there is no mapping from
SDNode back to the corresponding LLVM instruction and the return
SDNode is target specific, this requires a target hook to check for
eligibility. Only x86 and ARM support this form of sibcall optimization
right now.
rdar://8707777


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120501 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:55:39 +00:00
Andrew Trick
18c57a8a09 Coding style. No significant functionality. Abandon linear scan style
in favor of the widespread llvm style. Capitalize variables and add
newlines for visual parsing. Rename variables for readability.
And other cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120490 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:18:47 +00:00
Chris Lattner
de189be53f add TLI support indicating that jumps are more expensive than logical operations
and use this to disable a specific optimization.  Patch by Micah Villmow!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 18:12:52 +00:00
Jay Foad
a99793c5ea PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120413 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 09:02:01 +00:00
Jakob Stoklund Olesen
bb7b23f5b7 Stub out a new LiveDebugVariables pass.
This analysis is going to run immediately after LiveIntervals. It will stay
alive during register allocation and keep track of user variables mentioned in
DBG_VALUE instructions.

When the register allocator is moving values between registers and the stack, it
is very hard to keep track of DBG_VALUE instructions. We usually get it wrong.
This analysis maintains a data structure that makes it easy to update DBG_VALUE
instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 02:17:10 +00:00
Michael J. Spencer
1f6efa3996 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:16:10 +00:00
Bob Wilson
bebfbc560b Fix a comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120235 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 06:51:19 +00:00
Anton Korobeynikov
94c5ae0875 Move more PEI-related hooks to TFI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120229 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 23:05:25 +00:00
Anton Korobeynikov
cd775ceff0 Move callee-saved regs spills / reloads to TFI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120228 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 23:05:03 +00:00
Benjamin Kramer
c62feda741 Namespacify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-25 16:42:51 +00:00
Wesley Peck
bf17cfa3f9 Renaming ISD::BIT_CONVERT to ISD::BITCAST to better reflect the LLVM IR concept.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 03:31:01 +00:00
Benjamin Kramer
ce750f0332 Implement the "if (X == 6 || X == 4)" -> "if ((X|2) == 6)" optimization.
This currently only catches the most basic case, a two-case switch, but can be
extended later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-22 09:45:38 +00:00
Anton Korobeynikov
82f58740c7 Move some more hooks to TargetFrameInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 15:59:32 +00:00
Benjamin Kramer
3ca136312a Silence Release build warnings about unused functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119903 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 15:53:24 +00:00
Duncan Sands
59d2dad59e On X86, MEMBARRIER, MFENCE, SFENCE, LFENCE are not target memory intrinsics,
so don't claim they are.  They are allocated using DAG.getNode, so attempts
to access MemSDNode fields results in reading off the end of the allocated
memory.  This fixes crashes with "llc -debug" due to debug code trying to
print MemSDNode fields for these barrier nodes (since the crashes are not
deterministic, use valgrind to see this).  Add some nasty checking to try
to catch this kind of thing in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119901 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 11:25:00 +00:00
Andrew Trick
b9e6fe1e3a Removing the useless test that I added recently. It was meant as an example, but not complicated enough to merit another test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119898 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 07:26:51 +00:00
Andrew Trick
316df4bfe3 RABasic fix. Regalloc is responsible for updating block live ins.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 02:57:05 +00:00
Andrew Trick
13bdbb0544 Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119895 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 02:43:55 +00:00
Bill Wendling
04d14ff349 Check for _setjmp too, because it's also used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119875 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 00:03:09 +00:00
Mon P Wang
cab98e3168 Make isScalarToVector to return false if the node is a scalar. This will prevent
DAGCombine from making an illegal transformation of bitcast of a scalar to a
vector into a scalar_to_vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 19:08:12 +00:00
Jakob Stoklund Olesen
e7fbdcdfc6 Don't attempt trivial coalescing for sub-register copies.
Patch by Krister Wombell!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 05:45:24 +00:00
Rafael Espindola
195a0ce484 Change some methods in MCDwarf.cpp to be able to handle an arbitrary
MCStreamer instead of just MCObjectStreamer. Address changes cannot
be as efficient as we have to use DW_LNE_set_addres, but at least
most of the logic is shared.

This will be used so that, with CodeGen still using EmitDwarfLocDirective,
llvm-gcc is able to produce debug_line sections without needing an
assembler that supports .loc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119777 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 02:26:16 +00:00
Anton Korobeynikov
d9e3385ced Move getInitialFrameState() to TargetFrameInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119754 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 23:25:52 +00:00
Anton Korobeynikov
d0c3817669 Move hasFP() and few related hooks to TargetFrameInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119740 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 21:19:35 +00:00
Duncan Sands
b9064bb964 Fix thinko: we must turn select(anyext, sext) into sext(select)
not anyext(select).  Spotted by Frits van Bommel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119739 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 21:16:28 +00:00
Duncan Sands
dcfd3a798f The DAGCombiner was threading select over pairs of extending loads even
if the extension types were not the same.  The result was that if you
fed a select with sext and zext loads, as in the testcase, then it
would get turned into a zext (or sext) of the select, which is wrong
in the cases when it should have been an sext (resp. zext).  Reported
and diagnosed by Sebastien Deldon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119728 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 20:05:18 +00:00
Dan Gohman
bd77d399c4 Oops, missed this file when remaing ExpandPseudos to ExpandISelPseudos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119717 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 18:48:28 +00:00
Dan Gohman
8ec9d62380 Rename ExpandPseudos to ExpandISelPseudos to help clarify its role.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119716 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 18:45:06 +00:00
Dan Gohman
4229c62dcf Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119712 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 17:44:17 +00:00
Dan Gohman
409d64a764 ExpandPseudos doesn't have any dependencies, so it can use the
simple form of INITIALIZE_PASS.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 17:14:05 +00:00
Rafael Espindola
5c0556341e Change CodeGen to use .loc directives. This produces a lot more readable output
and testing is easier.  A good example is the unknown-location.ll test that
now can just look for ".loc 1 0 0".  We also don't use a DW_LNE_set_address for
every address change anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119613 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 02:04:25 +00:00
Dale Johannesen
b4ac2858da Do not throw away alignment when generating the DAG for
memset; we may need it to decide between MOVAPS and MOVUPS
later.  Adjust a test that was looking for wrong code.
PR 3866 / 8675131.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119605 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 01:35:23 +00:00
John Thompson
7730318000 Bug 8621 fix - pointer cast stripped from inline asm constraint argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119590 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 23:58:47 +00:00
Evan Cheng
c4af4638df Remove ARM isel hacks that fold large immediates into a pair of add, sub, and,
and xor. The 32-bit move immediates can be hoisted out of loops by machine
LICM but the isel hacks were preventing them.

Instead, let peephole optimization pass recognize registers that are defined by
immediates and the ARM target hook will fold the immediates in.

Other changes include 1) do not fold and / xor into cmp to isel TST / TEQ
instructions if there are multiple uses. This happens when the 'and' is live
out, machine sink would have sinked the computation and that ends up pessimizing
code. The peephole pass would recognize situations where the 'and' can be
toggled to define CPSR and eliminate the comparison anyway.

2) Move peephole pass to after machine LICM, sink, and CSE to avoid blocking
important optimizations.

rdar://8663787, rdar://8241368


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119548 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 20:13:28 +00:00
Chris Lattner
ce1b9ad539 With the newly simplified SourceMgr interfaces and the generalized
SrcMgrDiagHandler, we can improve clang diagnostics for inline asm:
instead of reporting them on a source line of the original line,
we can report it on the correct line wherever the string literal came
from. For something like this:

void foo() {
  asm("push %rax\n"
      ".code32\n");
}

we used to get this: (note that the line in t.c isn't helpful)

t.c:4:7: error: warning: ignoring directive for now
  asm("push %rax\n"
      ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

now we get:

t.c:5:8: error: warning: ignoring directive for now
      ".code32\n"
       ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

Note that we're pointing to line 5 properly now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119488 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:20:42 +00:00
Chris Lattner
4afa12890f now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate the
cookie argument to the SourceMgr diagnostic stuff.  This cleanly separates
LLVMContext's inlineasm handler from the sourcemgr error handling 
definition, increasing type safety and cleaning things up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:13:01 +00:00
Chris Lattner
6e30c6a1d3 rearrange how the handler in SourceMgr is installed, eliminating the use of
the cookie argument to setDiagHandler


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119483 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:03:32 +00:00
Chris Lattner
a38941d458 refactor the interface to EmitInlineAsm a bit, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119482 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:53:40 +00:00
Eric Christopher
113a06cff4 Only avoid the check if we're the last operand before the variable
operands in a variadic instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119446 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:55:36 +00:00
Dan Gohman
76043670d5 Fix grammaro.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:27:00 +00:00
Evan Cheng
61f1a97e61 Add ExpandPseudos.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:20:36 +00:00
Dan Gohman
668ac2fdae Split pseudo-instruction expansion into a separate pass, to make it
easier to debug, and to avoid complications when the CFG changes
in the middle of the instruction selection process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:02:37 +00:00
Jakob Stoklund Olesen
f4840c07f8 Fix emergency spilling in LiveIntervals::spillPhysRegAroundRegDefsUses.
Always spill the full representative register at any point where any subregister
is live.

This fixes PR8620 which caused the old logic to get confused and not spill
anything at all.

The fundamental problem here is that the coalescer is too aggressive about
physical register coalescing. It sometimes makes it impossible to allocate
registers without these emergency spills.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 19:55:14 +00:00
Jakob Stoklund Olesen
fd900a2c07 Print out the register class of the current interval.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119374 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 19:55:12 +00:00
Eric Christopher
800e57313e Make the verifier a little quieter on instructions that it's probably
(and likely) wrong about anyhow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 01:58:21 +00:00
Jakob Stoklund Olesen
b55e91e087 Remember to resize SpillSlotToUsesMap when allocating an emergency spill slot.
Use amazing new function call technology instead of writing identical code in
multiple places.

This fixes PR8604.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 00:41:01 +00:00
Jakob Stoklund Olesen
7c2e4a8715 Fix PR8612 in the standard spiller, take two.
The live range of a register defined by an early clobber starts at the use slot,
not the def slot.

Except when it is an early clobber tied to a use operand. Then it starts at the
def slot like a standard def.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119305 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 00:40:59 +00:00
Jakob Stoklund Olesen
bea0b6a049 Revert "Fix PR8612 in the standard spiller as well."
This reverts r119183 which borke the buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 21:51:51 +00:00
Evan Cheng
eb96a2f6c0 Code clean up. The peephole pass should be the one updating the instruction
iterator, not TII->OptimizeCompareInstr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 21:20:45 +00:00
Jakob Stoklund Olesen
a284aa1657 Fix PR8612 in the standard spiller as well.
The live range of a register defined by an early clobber starts at the use slot,
not the def slot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119183 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 20:55:53 +00:00
Jakob Stoklund Olesen
68257e61eb When spilling a register defined by an early clobber, make sure that the new
live ranges for the spill register are also defined at the use slot instead of
the normal def slot.

This fixes PR8612 for the inline spiller. A use was being allocated to the same
register as a spilled early clobber def.

This problem exists in all the spillers. A fix for the standard spiller is
forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119182 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 20:55:49 +00:00
Anton Korobeynikov
3346491223 First step of huge frame-related refactoring: move emit{Prologue,Epilogue} out of TargetRegisterInfo to TargetFrameInfo, which is definitely much better suitable place
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 00:06:54 +00:00
Chris Lattner
142b531e02 move the pic base symbol stuff up to MachineFunction
since it is trivial and will be shared between ppc and x86.
This substantially simplifies the X86 backend also.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14 22:48:15 +00:00
Devang Patel
522ad74e4b Remove DW_AT_start_scope support. It is incomplete and superseeded by location entries support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118940 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 23:20:42 +00:00
Andrew Trick
f06202f8e8 typo (4th checkin for one fix)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 18:36:03 +00:00
Andrew Trick
de91f3c5eb Fixes PR8287: SD scheduling time. The fix is a failsafe that prevents
catastrophic compilation time in the event of unreasonable LLVM
IR. Code quality is a separate issue--someone upstream needs to do a
better job of reducing to llvm.memcpy. If the situation can be reproduced with
any supported frontend, then it will be a separate bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 17:50:46 +00:00
Chris Lattner
a29aae7aca tidy up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 17:24:29 +00:00
Lang Hames
5e77f4b1d2 Fix some style issues in PBQP. Patch by David Blaikie.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118883 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 05:47:21 +00:00
Dan Gohman
fca0b106f7 Add a FIXME comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 18:08:43 +00:00
Andrew Trick
8a83d54528 Check TRI->getReservedRegs because other allocators do it. Even though
it makes no sense for allocation_order iterators to visit reserved regs.
The inline spiller depends on AliasAnalysis.
Manage the Query state to avoid uninitialized or stale results.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 17:46:29 +00:00
Dan Gohman
efb8a9d0c2 Remove the memmove->memcpy optimization from CodeGen. MemCpyOpt does this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 16:24:49 +00:00
Jakob Stoklund Olesen
a05f60b241 Delete SplittingSpiller. It was not being used by anyone, and it is being
superceded by SplitKit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118754 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 00:52:44 +00:00
Jakob Stoklund Olesen
1e8e72d72a Insert two blank SlotIndexes between basic blocks instead of just one.
This is the first small step towards using closed intervals for liveness instead
of the half-open intervals we're using now.

We want to be able to distinguish between a SlotIndex that represents a variable
being live-out of a basic block, and an index representing a variable live-in to
its successor.

That requires two separate indexes between blocks. One for live-outs and one for
live-ins.

With this change, getMBBEndIdx(MBB).getPrevSlot() becomes stable so it stays
greater than any instructions inserted at the end of MBB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118747 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 00:19:20 +00:00
Jakob Stoklund Olesen
b5f327b30f No need to add liveness that's already there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 23:56:00 +00:00
Jakob Stoklund Olesen
e93198af07 Hook up AliasAnalysis in InlineSpiller. This is used for rematerializing
constant loads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118741 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 23:55:56 +00:00
Devang Patel
62367045a4 Take care of special characters while creating named MDNode name to hold function specific local variable's info.
This fixes radar 8653152. I am checking in testcase as a separate check-in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118726 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 22:19:21 +00:00
Jakob Stoklund Olesen
cfa7134a9c Basic rematerialization during splitting.
Whenever splitting wants to insert a copy, it checks if the value can be
rematerialized cheaply instead.

Missing features:
- Delete instructions when all uses have been rematerialized.
- Truncate live ranges to the remaining uses after rematerialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118702 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 19:31:50 +00:00
Andrew Trick
f4baeaf848 RABasic is nearly functionally complete. There are a few remaining
benchmarks hitting an assertion.
Adds LiveIntervalUnion::collectInterferingVRegs.
Fixes "late spilling" by checking for any unspillable live vregs among
all physReg aliases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118701 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 19:18:47 +00:00
Jakob Stoklund Olesen
b80e973c95 Simplify the LiveRangeEdit::canRematerializeAt() interface a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118661 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 01:05:12 +00:00
Rafael Espindola
34be396a12 Fixed version of 118639 with an extra assert to catch similar problems
earlier. Implicit bool -> int conversions are evil!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118651 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 23:42:07 +00:00
Andrew Trick
071d1c063f Adds RABasic verification and tracing.
(retry now that the windows build is green)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118630 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 21:04:34 +00:00
Matt Beaumont-Gay
e33daaaaf9 Add a trivial virtual dtor to AbstractRegisterDescription to appease
-Wnon-virtual-dtor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118616 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 19:56:25 +00:00
Andrew Trick
32d9aeb1df Reverting r118604. Windows build broke.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118613 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 19:47:51 +00:00
Andrew Trick
39a5ce46a5 Adds RABasic verification and tracing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118604 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 19:01:17 +00:00
Dan Gohman
6a559cd695 Fix DAGCombiner to avoid folding a sext-in-reg or similar through a shl
in order to fold it into a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118471 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 01:54:35 +00:00
Dale Johannesen
71365d3774 Fix an inline asm pasto from 117667; was preventing
{i64, i64} from matching i128.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118465 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 01:15:07 +00:00
Andrew Trick
e141a4960f Adds support for spilling previously allocated live intervals to
handle cases in which a register is unavailable for spill code.
Adds LiveIntervalUnion::extract. While processing interferences on a
live virtual register, reuses the same Query object for each
physcial reg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 18:02:08 +00:00
Che-Liang Chiou
6da24ca51d Add registry hook for assembly text output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118394 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 02:21:17 +00:00
Benjamin Kramer
f788854d20 Prune includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118342 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-06 11:45:59 +00:00
Duncan Sands
69300a2f47 When passing a parameter using the 'byval' mechanism, inline code needs to be used
to perform the copy, which may be of lots of memory [*].  It would be good if the
fall-back code generated something reasonable, i.e. did the copy in a loop, rather
than vast numbers of loads and stores.  Add a note about this.  Currently target
specific code seems to always kick in so this is more of a theoretical issue rather
than a practical one now that X86 has been fixed.
[*] It's amazing how often people pass mega-byte long arrays by copy...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118275 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-05 15:20:29 +00:00
Rafael Espindola
7387345016 Add 118023 back, but with proper spelling for .uleb128/.sleb128.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118254 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 18:17:08 +00:00
Rafael Espindola
537ebeaffc Revert previous patch. Some targets don't support uleb and say
they do :-(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 17:04:24 +00:00
Rafael Espindola
40f6514ff0 MCize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118249 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 16:32:18 +00:00
Duncan Sands
1e96bab329 In the calling convention logic, ValVT is always a legal type,
and as such can be represented by an MVT - the more complicated
EVT is not needed.  Use MVT for ValVT everywhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118245 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 10:49:57 +00:00
Jakob Stoklund Olesen
8c42f48d02 Disable fancy splitting during spilling unless -extra-spiller-splits is given.
This way, InlineSpiller does the same amount of splitting as the standard
spiller. Splitting should really be guided by the register allocator, and
doesn't belong in the spiller at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118216 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 00:32:32 +00:00
Eric Christopher
d81f17acb4 Just return undef for invalid masks or elts, and since we're doing that,
just do it earlier too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118195 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 20:44:42 +00:00
Jakob Stoklund Olesen
964bc25e5a Let RegAllocBasic require MachineDominators - they are already available and
splitting needs them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118194 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 20:39:26 +00:00
Jakob Stoklund Olesen
376dcbd6c2 Tag debug output as regalloc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118193 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 20:39:23 +00:00
Duncan Sands
cdfad36b40 Simplify uses of MVT and EVT. An MVT can be compared directly
with a SimpleValueType, while an EVT supports equality and
inequality comparisons with SimpleValueType.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118169 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 12:17:33 +00:00
Duncan Sands
1440e8b918 Inside the calling convention logic LocVT is always a simple
value type, so there is no point in passing it around using
an EVT.  Use the simpler MVT everywhere.  Rather than trying
to propagate this information maximally in all the code that
using the calling convention stuff, I chose to do a mainly
low impact change instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118167 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 11:35:31 +00:00
Eric Christopher
caebdd44f3 If we have an undef mask our Elt will be -1 for our access, handle
this by using an undef as a pointer.

Fixes rdar://8625016


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118164 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 09:36:40 +00:00
Dan Gohman
394d6298bc Fix DAGCombiner to avoid going into an infinite loop when it
encounters (and:i64 (shl:i64 (load:i64), 1), 0xffffffff).
This fixes rdar://8606584.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118143 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 01:47:46 +00:00
Evan Cheng
8239daf7c8 Two sets of changes. Sorry they are intermingled.
1. Fix pre-ra scheduler so it doesn't try to push instructions above calls to
   "optimize for latency". Call instructions don't have the right latency and
   this is more likely to use introduce spills.
2. Fix if-converter cost function. For ARM, it should use instruction latencies,
   not # of micro-ops since multi-latency instructions is completely executed
   even when the predicate is false. Also, some instruction will be "slower"
   when they are predicated due to the register def becoming implicit input.
   rdar://8598427


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 00:45:17 +00:00
Andrew Trick
4638852696 Fixes <rdar://problem/8612856>: During postRAsched, the antidependence
breaker needs to check all definitions of the antidepenent register to
avoid multiple defs of the same new register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 18:16:45 +00:00
Devang Patel
c8821046f8 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 17:37:00 +00:00
Devang Patel
8bc9ef77b7 If value map does not have register for an argument then try to find frame index before giving up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118022 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 17:19:03 +00:00
Devang Patel
a90b305af9 Use frameindex, if available, as a last resort to emit debug info for a parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118020 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 17:01:30 +00:00
Jakob Stoklund Olesen
371e82bf51 Don't try to split weird critical edges that really aren't:
BB#1: derived from LLVM BB %bb.nph28
    Live Ins: %AL
    Predecessors according to CFG: BB#0
	TEST8rr %reg16384<kill>, %reg16384, %EFLAGS<imp-def>; GR8:%reg16384
	JNE_4 <BB#2>, %EFLAGS<imp-use,kill>
	JMP_4 <BB#2>
    Successors according to CFG: BB#2 BB#2

These double CFG edges only ever occur in bugpoint-generated code, so there is
no need to attempt something clever.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 00:58:37 +00:00
Jakob Stoklund Olesen
8bcf7603f7 MachineLICM should not claim to be preserving the CFG when it can split critical
edges on demand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117982 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 23:59:55 +00:00
Jakob Stoklund Olesen
962c71089d Be more precise about verifying missing kill flags.
It is legal for an instruction to have two operands using the same register,
only one a kill. This is interpreted as a kill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 23:59:53 +00:00
Jakob Stoklund Olesen
3d4114c464 When inserting copies during splitting, always use the parent register as the
source, and let rewrite() clean it up.

This way, kill flags on the inserted copies are fixed as well during rewrite().

We can't just assume that all the copies we insert are going to be kills since
critical edges into loop headers sometimes require both source and dest to be
live out of a block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117980 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 23:59:48 +00:00
Jakob Stoklund Olesen
1c163d2a06 Add kill flag verification.
At least X86FloatingPoint requires correct kill flags after register allocation,
and targets using register scavenging benefit. Conservative kill flags are not
enough.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117960 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 21:51:31 +00:00
Jakob Stoklund Olesen
79cb53ce95 Update kill flags while rewriting instructions after splitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117959 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 21:51:29 +00:00
Bill Wendling
40a5eb18b0 When we look at instructions to convert to setting the 's' flag, we need to look
at more than those which define CPSR. You can have this situation:

(1)  subs  ...
(2)  sub   r6, r5, r4
(3)  movge ...
(4)  cmp   r6, 0
(5)  movge ...

We cannot convert (2) to "subs" because (3) is using the CPSR set by
(1). There's an analogous situation here:

(1)  sub   r1, r2, r3
(2)  sub   r4, r5, r6
(3)  cmp   r4, ...
(5)  movge ...
(6)  cmp   r1, ...
(7)  movge ...

We cannot convert (1) to "subs" because of the intervening use of CPSR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117950 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 20:41:43 +00:00
Jakob Stoklund Olesen
a37d5cf342 Don't assign new registers created during a split to the same stack slot, but
give them individual stack slots once the are actually spilled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 19:49:57 +00:00
Jakob Stoklund Olesen
e8f0823a68 Add basic LiveStacks verification.
When an instruction refers to a spill slot with a LiveStacks entry, check that
the spill slot is live at the instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 19:49:52 +00:00
Bill Wendling
9e7cb3d243 The testcase is now XFAILed. Sorry about the breakage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 05:50:55 +00:00
Eric Christopher
b698a56dd4 Revert r117876 for now, it's causing more testsuite failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117879 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-31 22:42:55 +00:00
Bill Wendling
b3747706fc Disable the peephole optimizer until 186.crafty on armv6 is fixed. This is what
looks like is happening:

Without the peephole optimizer:
  (1)   sub     r6, r6, #32
        orr     r12, r12, lr, lsl r9
        orr     r2, r2, r3, lsl r10
  (x)   cmp     r6, #0
        ldr     r9, LCPI2_10
        ldr     r10, LCPI2_11
  (2)   sub     r8, r8, #32
  (a)   movge   r12, lr, lsr r6
  (y)   cmp     r8, #0
LPC2_10:
        ldr     lr, [pc, r10]
  (b)   movge   r2, r3, lsr r8

With the peephole optimizer:
        ldr     r9, LCPI2_10
        ldr     r10, LCPI2_11
  (1*)  subs    r6, r6, #32
  (2*)  subs    r8, r8, #32
  (a*)  movge   r12, lr, lsr r6
  (b*)  movge   r2, r3, lsr r8

(1) is used by (x) for the conditional move at (a). (2) is used by (y) for the
conditional move at (b). After the peephole optimizer, these the flags resulting
from (1*) are ignored and only the flags from (2*) are considered for both
conditional moves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117876 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-31 22:07:12 +00:00
Nicolas Geoffray
7a5a3f75eb Attach a GCModuleInfo to a MachineFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117867 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-31 20:38:38 +00:00
Jakob Stoklund Olesen
e5f4e9fb2b Include MachineBasicBlock numbers in viewCFG() output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117765 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 01:26:19 +00:00
Jakob Stoklund Olesen
5b4bb218d1 Make sure copies are inserted after any exception handling labels at the top of
a basic block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117764 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 01:26:16 +00:00
Jakob Stoklund Olesen
92095e7b3f Add SkipPHIsAndLabels from PHIElimination to MachineBasicBlock. It is needed
elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 01:26:14 +00:00
Jakob Stoklund Olesen
ab56647e6b Disable more of physical register live intervals verification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117762 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 01:26:11 +00:00
Jakob Stoklund Olesen
7d57753df3 Print out register class of spilled register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117761 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 01:26:09 +00:00
Evan Cheng
189c1ec4c1 Teach machine cse to eliminate instructions with multiple physreg uses and defs. rdar://8610857.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 23:36:03 +00:00
Bob Wilson
46455096be Remove DAG combiner patch to fold vector splats. Instcombiner does it now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117720 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 22:03:02 +00:00
Jakob Stoklund Olesen
db4eec3d2c Fix sign error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117677 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 18:21:18 +00:00
Evan Cheng
089751535d Avoiding overly aggressive latency scheduling. If the two nodes share an
operand and one of them has a single use that is a live out copy, favor the
one that is live out. Otherwise it will be difficult to eliminate the copy
if the instruction is a loop induction variable update. e.g.

BB:
sub r1, r3, #1
str r0, [r2, r3]
mov r3, r1
cmp
bne BB

=>

BB:
str r0, [r2, r3]
sub r3, r3, #1
cmp
bne BB

This fixed the recent 256.bzip2 regression.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117675 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 18:09:28 +00:00
Jakob Stoklund Olesen
3ccfce0e35 Don't transfer unused values to the new intervals formed by splitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117673 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 17:47:49 +00:00
Benjamin Kramer
8a8e26fb18 Silence Release build warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117671 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 17:40:05 +00:00
Jakob Stoklund Olesen
6d309059a7 Teach ConnectedVNInfoEqClasses::Classify to deal with unused values.
We don't want unused values forming their own equivalence classes, so we lump
them all together in one class, and then merge them with the class of the last
used value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117670 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 17:37:29 +00:00
Jakob Stoklund Olesen
c94fcb1507 Never propagate the idom value out of a block that defines its own value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117669 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 17:37:25 +00:00
John Thompson
44ab89eb37 Inline asm multiple alternative constraints development phase 2 - improved basic logic, added initial platform support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117667 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 17:29:13 +00:00
Bill Wendling
49ad731adf This may be an ARM target, so check for _Unwind_SjLj_Resume.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 07:46:01 +00:00
Jakob Stoklund Olesen
eeaae20be0 Fix broken equivalence class calculation. We could probably also use
EquvivalenceClasses.h except it looks like overkill when elements are continuous
integers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117631 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 00:40:59 +00:00
Jakob Stoklund Olesen
cb367778c0 Print out the connected components in the verifier after complaining about their
multiplicity.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117630 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 00:40:57 +00:00
Jakob Stoklund Olesen
1f46a0ac66 Run a verification pass before any splitting to better distribute blame.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 00:40:55 +00:00
Devang Patel
4d7f9a00a5 Ignore empty blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117615 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 22:11:59 +00:00
Jakob Stoklund Olesen
8c4564287d One day, physical register live ranges will be sensible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117602 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 20:44:22 +00:00
Jakob Stoklund Olesen
e1dde7b05a Replace SplitKit SSA update with an iterative algorithm very similar to the one
in SSAUpdaterImpl.h

Verifying live intervals revealed that the old method was completely wrong, and
we need an iterative approach to calculating PHI placemant. Fortunately, we have
MachineDominators available, so we don't have to compute that over and over
like SSAUpdaterImpl.h must.

Live-out values are cached between calls to mapValue() and computed in a greedy
way, so most calls will be working with very small block sets.

Thanks to Bob for explaining how this should work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117599 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 20:34:52 +00:00
Jakob Stoklund Olesen
d68f458244 Make MachineDominators available for SplitEditor. We are going to need it for
proper SSA updating.

This doesn't cause MachineDominators to be recomputed since we are already
requiring MachineLoopInfo which uses dominators as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 20:34:50 +00:00
Jakob Stoklund Olesen
26b92be922 Add a temporary command line option to verify machine code after each spill or
split.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117597 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 20:34:47 +00:00
Devang Patel
bc2bb9bbd0 Do not work too hard to find type's file info. There is a special field to record file info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117588 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 19:50:08 +00:00
Devang Patel
3cabc9d2c9 Technically DIFile scope should also be handled here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117563 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 17:30:52 +00:00
Bob Wilson
0f1db1a6c6 Teach the DAG combiner to fold a splat of a splat. Radar 8597790.
Also do some minor refactoring to reduce indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117558 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 17:06:14 +00:00
Evan Cheng
7e2fe9150f Re-commit 117518 and 117519 now that ARM MC test failures are out of the way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 06:47:08 +00:00
Evan Cheng
9e08ee5d16 Revert 117518 and 117519 for now. They changed scheduling and cause MC tests to fail. Ugh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117520 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 02:00:25 +00:00
Evan Cheng
7c88cdcc3b Fix a major bug in operand latency computation. The use index must be adjusted
by the number of defs first for it to match the instruction itinerary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117518 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 01:46:29 +00:00
Evan Cheng
de5fa932b9 Putting r117193 back except for the compile time cost. Rather than assuming fallthroughs uses all registers, just gather the union of all successor liveins.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117506 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 23:17:17 +00:00
Michael J. Spencer
3931b54a5f COFF: Add IMAGE_SCN_MEM_READ to text sections.
There are currently 100 references to COFF::IMAGE_SCN in 6 files
and 11 different functions. Section to attribute mapping really
needs to happen in one place to avoid problems like this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 18:52:29 +00:00
Michael J. Spencer
579d7a3dcc Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 18:52:20 +00:00
Jim Grosbach
0ed257c036 Formatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117453 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 16:30:18 +00:00
Jakob Stoklund Olesen
c95c1465fd Handle critical loop predecessors by making both inside and outside registers
live out.

This doesn't prevent us from inserting a loop preheader later on, if that is
better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117424 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 00:39:07 +00:00
Jakob Stoklund Olesen
0960a650b7 Compute critical loop predecessors in the same way as critical loop exits.
Critical edges going into a loop are not as bad as critical exits. We can handle
them by splitting the critical edge, or by having both inside and outside
registers live out of the predecessor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 00:39:05 +00:00
Jakob Stoklund Olesen
8c593f9173 Physical registers trivially have multiple connected components all the time.
Only virtuals should be requires to be connected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 00:39:01 +00:00
Dale Johannesen
1de4aa904e Use a MemIntrinsicSDNode for ISD::PREFETCH, which touches
memory, so a MachineMemOperand is useful (not propagated
into the MachineInstr yet).  No functional change except
for dump output.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117413 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 23:11:10 +00:00
Andrew Trick
3d26d5d524 Remove the vector of live vregs. I thought we would need to track
them, but hopefully we won't. And this is not the right data structure
to do it anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117412 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 22:58:24 +00:00
Jakob Stoklund Olesen
3a0e0715a5 After splitting, compute connected components of all new registers, not just for
the remainder register.

Example:

bb0:
  x = 1
bb1:
  use(x)
  ...
  x = 2
  jump bb1

When x is isolated in bb1, the inner part breaks into two components, x1 and x2:

bb0:
  x0 = 1
bb1:
  x1 = x0
  use(x1)
  ...
  x2 = 2
  x0 = x2
  jump bb1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 22:36:09 +00:00