Commit Graph

46845 Commits

Author SHA1 Message Date
Bob Wilson
84c5eed15b This patch combines several changes from Evan Cheng for rdar://8659675.
Making use of VFP / NEON floating point multiply-accumulate / subtraction is
difficult on current ARM implementations for a few reasons.
1. Even though a single vmla has latency that is one cycle shorter than a pair
   of vmul + vadd, a RAW hazard during the first (4? on Cortex-a8) can cause
   additional pipeline stall. So it's frequently better to single codegen
   vmul + vadd.
2. A vmla folowed by a vmul, vmadd, or vsub causes the second fp instruction to
   stall for 4 cycles. We need to schedule them apart.
3. A vmla followed vmla is a special case. Obvious issuing back to back RAW
   vmla + vmla is very bad. But this isn't ideal either:
     vmul
     vadd
     vmla
   Instead, we want to expand the second vmla:
     vmla
     vmul
     vadd
   Even with the 4 cycle vmul stall, the second sequence is still 2 cycles
   faster.

Up to now, isel simply avoid codegen'ing fp vmla / vmls. This works well enough
but it isn't the optimial solution. This patch attempts to make it possible to
use vmla / vmls in cases where it is profitable.

A. Add missing isel predicates which cause vmla to be codegen'ed.
B. Make sure the fmul in (fadd (fmul)) has a single use. We don't want to
   compute a fmul and a fmla.
C. Add additional isel checks for vmla, avoid cases where vmla is feeding into
   fp instructions (except for the #3 exceptional case).
D. Add ARM hazard recognizer to model the vmla / vmls hazards.
E. Add a special pre-regalloc case to expand vmla / vmls when it's likely the
   vmla / vmls will trigger one of the special hazards.

Enable these fp vmlx codegen changes for Cortex-A9.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129775 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 18:11:57 +00:00
Bob Wilson
cd70496ad1 Add -mcpu=cortex-a9-mp. It's cortex-a9 with MP extension. rdar://8648637.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129774 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 18:11:52 +00:00
Bob Wilson
5dde893c2b Avoid some 's' 16-bit instruction which partially update CPSR
(and add false dependency) when it isn't dependent on last CPSR defining
instruction. rdar://8928208

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129773 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 18:11:49 +00:00
Bob Wilson
f6a4d3c2f3 Avoid write-after-write issue hazards for Cortex-A9.
Add a avoidWriteAfterWrite() target hook to identify register classes that
suffer from write-after-write hazards. For those register classes, try to avoid
writing the same register in two consecutive instructions.

This is currently disabled by default.  We should not spill to avoid hazards!
The command line flag -avoid-waw-hazard can be used to enable waw avoidance.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129772 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 18:11:45 +00:00
Bob Wilson
b34d837397 Some single-precision VFP instructions can execute in either the VPF or Neon
pipelines, at least on Cortex-A9.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129771 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 18:11:38 +00:00
Bob Wilson
11334dbd66 Improvements for the Cortex-A9 scheduling itineraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129770 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 18:11:36 +00:00
Eli Friedman
3762046dbf Add support for FastISel'ing varargs calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129765 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 17:22:22 +00:00
Jakob Stoklund Olesen
430721cff8 Force the greedy register allocator to be linked alongside linear scan.
This means that the new register allocator can be used with 'clang -mllvm -regalloc=greedy'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129764 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 17:17:58 +00:00
Eli Friedman
37d38bfbbf SelectBasicBlock is rather slow even when it doesn't do anything; skip the
unnecessary work where possible.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129763 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 17:01:08 +00:00
Stuart Hastings
fc52163a45 Support nested CALLSEQ_BEGIN/END; necessary for ARM byval support. <rdar://problem/7662569>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129761 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 16:16:58 +00:00
Jay Foad
1a0390253b Trivial simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129759 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 15:23:29 +00:00
Chris Lattner
832e494359 Implement support for x86 fastisel of small fixed-sized memcpys, which are generated
en-mass for C++ PODs.  On my c++ test file, this cuts the fast isel rejects by 10x 
and shrinks the generated .s file by 5%


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129755 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 05:52:03 +00:00
Chris Lattner
ff009ad1e1 tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129753 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 05:15:59 +00:00
Chris Lattner
b44101c140 Implement support for fast isel of calls of i1 arguments, even though they are illegal,
when they are a truncate from something else.  This eliminates fully half of all the 
fastisel rejections on a test c++ file I'm working with, which should make a substantial
improvement for -O0 compile of c++ code.

This fixed rdar://9297003 - fast isel bails out on all functions taking bools


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129752 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 05:09:50 +00:00
Chris Lattner
e03b8d3162 Handle i1/i8/i16 constant integer arguments to calls by prepromoting them.
Before we would bail out on i1 arguments all together, now we just bail on
non-constant ones.  Also, we used to emit extraneous code.  e.g. test12 was:

	movb	$0, %al
	movzbl	%al, %edi
	callq	_test12

and test13 was:
	movb	$0, %al
	xorl	%edi, %edi
	movb	%al, 7(%rsp)
	callq	_test13f

Now we get:

	movl	$0, %edi
	callq	_test12
and:
	movl	$0, %edi
	callq	_test13f



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129751 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 04:42:38 +00:00
Chris Lattner
c76d121807 be layout aware, to produce:
testb	$1, %al
	je	LBB0_2
## BB#1:                                ## %if.then
	movb	$0, %al

instead of:

	testb	$1, %al
	jne	LBB0_1
	jmp	LBB0_2
LBB0_1:                                 ## %if.then
	movb	$0, %al

how 'bout that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129749 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 04:26:32 +00:00
Chris Lattner
90cb88a9b4 fix rdar://9297006 - fast isel bails out on trunc to i1 -> bools cry,
a common cause of fast isel rejects on c++ code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129748 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 04:22:17 +00:00
Evan Cheng
75b41f1540 Change A9 scheduling itineraries VLD* / VST* entries default to "aligned". That
is, it assumes addresses are 64-bit aligned (which should be the more common
case). If the alignment is found not to be aligned, then getOperandLatency()
would adjust the operand latency computation by one to compensate for it.
rdar://9294833


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129742 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 01:21:49 +00:00
Evan Cheng
b58a340fa2 Do not lose mem_operands while lowering VLD / VST intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129738 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 00:04:03 +00:00
Devang Patel
1f48a95ccb Use ArrayRef variants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129735 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 23:51:03 +00:00
Ted Kremenek
1da29dd3f8 Add BumpPtrAllocator::getTotalMemory() to allow clients to query how much memory a BumpPtrAllocator allocated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129727 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 22:44:46 +00:00
Jim Grosbach
0d062c1e14 Trim a few unneeded includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129723 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 21:35:54 +00:00
Eric Christopher
721ef66d17 Invert the meaning of printAliasInstr's return value. It now returns
true on success and false on failure. Update callers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129722 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 21:28:11 +00:00
Eli Friedman
6dda916358 Simplify declarations slightly by using typedefs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129720 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 21:21:37 +00:00
Eli Friedman
50ebe53353 malloc elimination: it's a bad idea to use raw_svector_ostream on a
small heap-allocated SmallString because it unconditionally forces a malloc.

(Revised version of r129688, with the necessary flush() call.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129716 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 20:54:46 +00:00
Devang Patel
3f3bf9387b Reduce clutter in asm output. Do not emit source location as comment for each instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129715 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 20:26:49 +00:00
Jakob Stoklund Olesen
5d5ef4a886 Handle spilling around an instruction that has an early-clobber re-definition of
the spilled register.

This is quite common on ARM now that some stores have early-clobber defines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129714 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 20:23:27 +00:00
Sean Callanan
f6d9109124 Small fix to the ARM AsmParser to ensure that a
superclass variable is instantiated properly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129713 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 20:20:44 +00:00
Eric Christopher
d574bb5a6e Fix a bug where we were counting the alias sets as completely used
registers for fast allocation a different way. This has us updating
used registers only when we're using that exact register.

Fixes rdar://9207598



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129711 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 19:26:25 +00:00
Chandler Carruth
3b55a372d4 Mark some functions as used which are used within debug-only code. This
silences Clang's -Wunused-function when building in release mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129709 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 18:49:44 +00:00
Chris Lattner
f051c1a29d while we're at it, handle 'sdiv exact' of a power of 2 also,
this fixes a few rejects on c++ iterator loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129694 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 07:00:40 +00:00
Chris Lattner
090ca9108b fix rdar://9297011 - udiv by power of two causing fast-isel rejects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129693 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 06:55:51 +00:00
Chris Lattner
202a7a1e3f Add a new bit that ImmLeaf's can opt into, which allows them to duck out of
the generated FastISel.  X86 doesn't need to generate code to match ADD16ri8 
since ADD16ri will do just fine.  This is a small codesize win in the generated
instruction selector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129692 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 06:36:55 +00:00
Eli Friedman
205132e904 Revert r129688; it's breaking buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129689 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 05:54:54 +00:00
Eli Friedman
24b9654f12 More malloc elimination: it's a bad idea to use raw_svector_ostream on a
small heap-allocated SmallString because it unconditionally forces a malloc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129688 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 05:38:58 +00:00
Eli Friedman
f4387d9afb Make the StringMaps attached to MCContext use the MCContext's allocator;
reduces the number of calls to malloc().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129687 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 05:02:31 +00:00
Chris Lattner
5662bc959a switch the rest of the x86 immediate patterns over to ImmLeaf,
simplifying them and exposing more information to tblgen.  It would be nice
if other target authors adopted this as well, particularly arm since it has fastisel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129676 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 22:12:55 +00:00
Chris Lattner
7ed1391ff6 now that predicates have a decent abstraction layer on them, introduce a new
kind of predicate: one that is specific to imm nodes.  The predicate function
specified here just checks an int64_t directly instead of messing around with
SDNode's.  The virtue of this is that it means that fastisel and other things
can reason about these predicates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129675 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 22:05:17 +00:00
Chris Lattner
543790673c Rework our internal representation of node predicates to expose more
structure and fix some fixmes.  We now have a TreePredicateFn class
that handles all of the decoding of these things.  This is an internal
cleanup that has no impact on the code generated by tblgen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129670 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 21:38:24 +00:00
Chris Lattner
602fc06817 1. merge fast-isel-shift-imm.ll into fast-isel-x86-64.ll
2. implement rdar://9289501 - fast isel should fold trivial multiplies to shifts
3. teach tblgen to handle shift immediates that are different sizes than the 
   shifted operands, eliminating some code from the X86 fast isel backend.
4. Have FastISel::SelectBinaryOp use (the poorly named) FastEmit_ri_ function
   instead of FastEmit_ri to simplify code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 20:23:29 +00:00
Chris Lattner
0a1c997c27 fix an x86 fast isel issue where we'd completely give up on folding an address
when we have a global variable base an an index.  Instead, just give up on
folding the global variable.

Before we'd geenrate:

_test:                                  ## @test
## BB#0:
	movq	_rtx_length@GOTPCREL(%rip), %rax
	leaq	(%rax), %rax
	addq	%rdi, %rax
	movzbl	(%rax), %eax
	ret

now we generate:

_test:                                  ## @test
## BB#0:
	movq	_rtx_length@GOTPCREL(%rip), %rax
	movzbl	(%rax,%rdi), %eax
	ret

The difference is even more significant when there is a scale
involved.

This fixes rdar://9289558 - total fail with addr mode formation at -O0/x86-64


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129664 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 17:47:38 +00:00
Chris Lattner
685090f598 fix an oversight which caused us to compile the testcase (and other
less trivial things) into a dummy lea.  Before we generated:

_test:                                  ## @test
	movq	_G@GOTPCREL(%rip), %rax
	leaq	(%rax), %rax
	ret

now we produce:

_test:                                  ## @test
	movq	_G@GOTPCREL(%rip), %rax
	ret

This is part of rdar://9289558



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129662 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 17:12:08 +00:00
Chris Lattner
dceb52a01b tidy up and reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129661 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 17:05:12 +00:00
Chris Lattner
fd3f635103 Fix rdar://9289512 - not folding load into compare at -O0
The basic issue here is that bottom-up isel is matching the branch
and compare, and was failing to fold the load into the branch/compare
combo.  Fixing this (by allowing folding into any instruction of a
sequence that is selected) allows us to produce things like:


cmpb    $0, 52(%rax)
je      LBB4_2

instead of:

movb    52(%rax), %cl
cmpb    $0, %cl
je      LBB4_2

This makes the generated -O0 code run a bit faster, but also speeds up
compile time by putting less pressure on the register allocator and 
generating less code.

This was one of the biggest classes of missing load folding.  Implementing
this shrinks 176.gcc's c-decl.s (as a random example) by about 4% in (verbose-asm)
line count.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129656 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 06:35:44 +00:00
Chris Lattner
8bdc251dc5 split a complex predicate out to a helper function. Simplify two for loops,
which don't need to check for falling off the end of a block *and* end of phi
nodes, since terminators are never phis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129655 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 06:03:19 +00:00
Eli Friedman
2f108f81c1 Remove working entry from README.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129654 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 02:36:27 +00:00
Chris Lattner
fff65b354f fix rdar://9289583 - fast isel should handle non-canonical commutative binops
allowing us to fold the immediate into the 'and' in this case:

int test1(int i) {
  return 8&i;
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129653 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 01:16:47 +00:00
Eli Friedman
e545d38a28 PR9055: extend the fix to PR4050 (r70179) to apply to zext and anyext.
Returning a new node makes the code try to replace the old node, which
in the included testcase is killed by CSE.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129650 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 23:25:34 +00:00
Frits van Bommel
86f72a8002 Rename a misleadingly-named variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129644 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 14:32:34 +00:00
Francois Pichet
cbc5f407ef Unbreak the MSVC 2010 build.
For further information on this particular issue see: http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129642 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 14:20:39 +00:00
Jay Foad
4130278fbe Fix bug when checking phi operands in InstCombiner::visitPHINode(),
found by code inspection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129641 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 14:17:37 +00:00
Francois Pichet
6144686af6 MSVC needs the return 0 to compile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129640 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 13:59:23 +00:00
Benjamin Kramer
e5060984aa Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 10:30:47 +00:00
Rafael Espindola
30deafc84a Put each personality function in a section. This fixes the gnu ld warning:
error in foo.o; no .eh_frame_hdr table will be created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129635 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 03:51:21 +00:00
Stuart Hastings
c5eecbc4ec Correct result when a branch condition is live across a block
boundary.  <rdar://problem/8933028>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129634 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 03:31:26 +00:00
Evan Cheng
65279cb9bd Fix divmod libcall lowering. Convert to {S|U}DIVREM first and then expand the node to a libcall. rdar://9280991
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129633 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 03:08:26 +00:00
Rafael Espindola
86837e8745 Fix cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129632 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 02:06:46 +00:00
Nick Lewycky
0c4de8a4eb Move the re-stemming function up top and use it where it's currently inlined.
Break the arc-profile code out to a function like the notes emission code is,
and reorder the functions in the file.

The only functionality change is that we no longer modify the Module when the
Module has no debug info to use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129631 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 02:05:18 +00:00
Nick Lewycky
b192870420 Rename LineProfiling to GCOVProfiling to more accurately represent what it
does. Also mostly implement it. Still a work-in-progress, but generates legal
output on crafted test cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129630 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 01:20:23 +00:00
Devang Patel
e9db5e29e3 Introduce support to encode Objective-C property information in debugging information generated for an interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129624 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-16 00:11:51 +00:00
Johnny Chen
3a96122c4a Thumb2 BFC was insufficiently encoded.
rdar://problem/9292717


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129619 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 22:52:15 +00:00
Johnny Chen
a704bc9354 A8.6.315 VLD3 (single 3-element structure to all lanes)
The a bit must be encoded as 0.

rdar://problem/9292625


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129618 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 22:49:08 +00:00
Akira Hatanaka
4552c9a3b3 Reverse unnecessary changes made in r129606 and r129608. There is no change in functionality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129612 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 21:51:11 +00:00
Cameron Zwarich
0cb11ac32f Add ORR and EOR to the CMP peephole optimizer. It's hard to get isel to generate
a case involving EOR, so I only added a test for ORR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129610 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 21:24:38 +00:00
Akira Hatanaka
6c3541d559 Fix lines that exceed 80 columns. There is no change in functionality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129608 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 21:06:38 +00:00
Akira Hatanaka
0bf3dfbef6 Fix lines that have incorrect indentation or exceed 80 columns. There is no change in functionality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129606 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 21:00:26 +00:00
Cameron Zwarich
b485de5d8c The AND instruction leaves the V flag unmodified, so it falls victim to the same
problem as all of the other instructions we fold with CMPs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129602 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 20:45:00 +00:00
Rafael Espindola
ed7cd9610a Fix cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129601 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 20:34:45 +00:00
Rafael Espindola
126ae68152 Some refactoring suggested by Anton Korobeynikov.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129600 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 20:32:03 +00:00
Cameron Zwarich
ca3f6a3925 Add missing register forms of instructions to the ARM CMP-folding code. This
fixes <rdar://problem/9287901>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129599 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 20:28:28 +00:00
Akira Hatanaka
99a2e98edd Add pass that expands pseudo instructions into target instructions after register allocation. Define pseudos that get expanded into mtc1 or mfc1 instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129594 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 19:52:08 +00:00
Evan Cheng
b6a638898a Increase SubtargetFeatureKV Value and Implies fields to 64 bits since some targets are getting very close to 32 subtarget features. Also teach tablegen to error when there are more than 64 features to guard against undefined behavior. rdar://9282332
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129590 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 19:35:46 +00:00
Lenny Maiorani
437ef0cfb7 Implements StringRef::compare with bounds. It is behaves similarly to strncmp(). Unit tests also included.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129582 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 17:56:50 +00:00
Jakob Stoklund Olesen
44b7ae2355 Teach the SplitKit blitter to handle multiply defined values as well.
The transferValues() function can now handle both singly and multiply defined
values, as long as the resulting live range is known. Only rematerialized values
have their live range recomputed by extendRange().

The updateSSA() function can now insert PHI values in bulk across multiple
values in multiple target registers in one pass. The list of blocks received
from transferValues() is in layout order which seems to work well for the
iterative algorithm. Blocks from extendRange() are still in reverse BFS order,
but this function is used so rarely now that it doesn't matter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129580 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 17:24:49 +00:00
Jakob Stoklund Olesen
806562cc59 Remember to set flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129579 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 17:24:46 +00:00
Rafael Espindola
f0adba9a7e Add 129518 back with a fix for when we are producing eh just because of debug info.
Change ELF systems to use CFI for producing the EH tables. This reduces the
size of the clang binary in Debug builds from 690MB to 679MB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129571 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 15:11:06 +00:00
Chris Lattner
7a2bdde0a0 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:18:47 +00:00
NAKAMURA Takumi
bcb8c6d09e Revert r129518, "Change ELF systems to use CFI for producing the EH tables. This reduces the"
It broke several builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129557 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 03:35:57 +00:00
Evan Cheng
9eec66e604 Fix another fcopysign lowering bug. If src is f64 and destination is f32, don't
forget to right shift the source by 32 first. rdar://9287902


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129556 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 01:31:00 +00:00
Johnny Chen
188ce9c78b For t2BFI, both Inst{26} and Inst{5} "should" be 0.
Ref: I.1 Instruction encoding diagrams and pseudocode


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129552 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 00:35:08 +00:00
Michael J. Spencer
4babeeeeed Add 3DNow! intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129551 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 00:32:41 +00:00
Johnny Chen
de29a52940 The ARM disassembler did not handle the alignment correctly for VLD*DUP* instructions
(single element or n-element structure to all lanes).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129550 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 00:10:45 +00:00
Evan Cheng
06b2a60ef9 Follow up on r127913. Fix Thumb revsh isel. rdar://9286766
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129548 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 23:27:44 +00:00
Eli Friedman
3ec01b7dac Add an instcombine for constructs like a | -(b != c); a select is more
canonical, and generally leads to better code.  Found while looking at
an article about saturating arithmetic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129545 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 22:41:27 +00:00
Owen Anderson
f6832bbda0 Fix an infinite alternation in JumpThreading where two transforms would repeatedly undo each other. The solution is to perform more aggressive constant folding to make one of the edges just folded away rather than trying to thread it.
Fixes <rdar://problem/9284786>.

Discovered with CSmith.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129538 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 21:35:50 +00:00
Mon P Wang
481823aa81 Cleanup r129509 based on comments by Chris
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129532 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 19:20:42 +00:00
Johnny Chen
cd695fdac1 Add sanity checkings for Thumb2 Load/Store Register Exclusive family of operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129531 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 19:13:28 +00:00
Chris Lattner
b8295f7a0e move PR9661 out to here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129527 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 18:47:18 +00:00
Owen Anderson
a34d93630e Fix another instance of the DAG combiner not using the correct type for the RHS of a shift.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 17:30:49 +00:00
Rafael Espindola
3dae6e7333 Change ELF systems to use CFI for producing the EH tables. This reduces the
size of the clang binary in Debug builds from 690MB to 679MB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129518 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 15:18:53 +00:00
Michael J. Spencer
9a0bac41b3 Fix whitespace and tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129517 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 14:33:36 +00:00
Mon P Wang
ddf9abf2b6 Cleanup r129472 by using a utility routine as suggested by Eli.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 08:04:01 +00:00
Andrew Trick
12f0dc6bb5 In the pre-RA scheduler, maintain cmp+br proximity.
This is done by pushing physical register definitions close to their
use, which happens to handle flag definitions if they're not glued to
the branch. This seems to be generally a good thing though, so I
didn't need to add a target hook yet.

The primary motivation is to generate code closer to what people
expect and rule out missed opportunity from enabling macro-op
fusion. As a side benefit, we get several 2-5% gains on x86
benchmarks. There is one regression:
SingleSource/Benchmarks/Shootout/lists slows down be -10%. But this is
an independent scheduler bug that will be tracked separately.
See rdar://problem/9283108.

Incidentally, pre-RA scheduling is only half the solution. Fixing the
later passes is tracked by:
<rdar://problem/8932804> [pre-RA-sched] on x86, attempt to schedule CMP/TEST adjacent with condition jump

Fixes:
<rdar://problem/9262453> Scheduler unnecessary break of cmp/jump fusion


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129508 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 05:15:06 +00:00
Chris Lattner
df2ef9015f add a minor missed dag combine that is blocking mid-level optimization
improvements, that will lead to fixing PR6627.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129504 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 04:21:42 +00:00
Chris Lattner
c0c7fca2fe sink a call into its only use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129503 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 04:12:47 +00:00
Chris Lattner
3c6e746b5f rework FoldBranchToCommonDest to exit earlier when there is a bonus
instruction around, reducing work.

Greatly simplify handling of debug instructions.  There is no need to
build up a vector of them and then move them into the one predecessor
if we're processing a block.  Instead just rescan the block and *copy*
them into the pred.  If a block gets merged into multiple preds, this
will retain more debug info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 02:44:53 +00:00
Chris Lattner
b3b15711b9 fix a couple -Wsign-compare warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129501 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 02:27:25 +00:00
Bill Wendling
d336de318e As Dan pointed out, movzbl, movsbl, and friends are nicer than their alias
(movzx/movsx) because they give more information. Revert that part of the patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129498 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 01:46:37 +00:00
Bill Wendling
c6df9883da Have the X86 back-end emit the alias instead of what's being aliased. In most
cases, it's much nicer and more informative reading the alias.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129497 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 01:11:51 +00:00
Bill Wendling
eef965f04b Add an option to not print the alias of an instruction. It defaults to "print
the alias".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129485 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 23:36:21 +00:00
Owen Anderson
7adf862eb2 During post-legalization DAG combining, be careful to only create shifts where the RHS is of the legal type for the new operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 23:22:23 +00:00
Johnny Chen
e8d087ad35 Thumb disassembler did not handle tBRIND (indirect branch) properly.
rdar://problem/9280370


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129480 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 21:59:01 +00:00
Mon P Wang
be0761c820 Vectors with different number of elements of the same element type can have
the same allocation size but different primitive sizes(e.g., <3xi32> and
<4xi32>).  When ScalarRepl promotes them, it can't use a bit cast but
should use a shuffle vector instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129472 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 21:40:02 +00:00
Johnny Chen
6c7e4147dc Check for unallocated instruction encodings when disassembling Thumb Branch instructions (tBcc and t2Bcc).
rdar://problem/9280470


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129471 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 21:35:49 +00:00
Johnny Chen
471d73d5d3 The LDR*T/STR*T (unpriviledged load/store) operations don't take SP or PC as Rt.
rdar://problem/9279440


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129469 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 21:04:32 +00:00
Cameron Zwarich
5af60ce2a8 Fix a typo in an ARM-specific DAG combine. This fixes <rdar://problem/9278274>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129468 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 21:01:19 +00:00
Cameron Zwarich
1335022e19 Fix a regression caused by r102515 where explicit alignment on globals is
ignored. There was a test to catch this, but it was just blindly updated in
a large change. This fixes another part of <rdar://problem/9275290>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129466 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 20:36:04 +00:00
Devang Patel
be7cd7580d Fix debug message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129463 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 19:47:41 +00:00
Johnny Chen
9bb386a933 Check the corner cases for t2LDRSHi12 correctly and mark invalid encodings as such.
rdar://problem/9276651


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129462 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 19:46:05 +00:00
Devang Patel
65705d559a Remove extra bytes that were added for gdb. We do not have good poiner to understand actual reason behind this fixme. Spot checking suggest that newer gdb does not need this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129461 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 19:41:17 +00:00
Johnny Chen
119af20c7b Fix a bug where for t2MOVCCi disassembly, the TIED_TO register operand was not properly handled.
rdar://problem/9276427


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129456 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 17:51:02 +00:00
Johnny Chen
6e3ccc3c85 Forgot to add this change for http://llvm.org/viewvc/llvm-project?view=rev&revision=129387.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129451 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 16:56:08 +00:00
Junjie Gu
7133b85b87 Fixed the revision 129449.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129450 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 16:45:49 +00:00
Junjie Gu
32644d9bfd Passing unroll parameters (unroll-count, threshold, and partial unroll) via LoopUnroll class's ctor. Doing so
will allow multiple context with different loop unroll parameters to run.  This is a minor change and no effect 
on existing application.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129449 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 16:15:29 +00:00
Rafael Espindola
0d9874b48d Add the alias analysis to the C api.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129447 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 15:44:58 +00:00
Jim Grosbach
69e813282d MCJIT relocation resolution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129445 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 15:28:10 +00:00
Jay Foad
d30aa5a1ed PR9214: Convert ConstantExpr::getIndices() to return an ArrayRef, plus
related tweaks to ExprMapKeyType.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129443 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 15:22:40 +00:00
Jakob Stoklund Olesen
fd1cced726 Stop using dead function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129442 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 15:00:11 +00:00
Jay Foad
cb53632869 Remove some redundant llvm:: prefixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129441 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 14:39:42 +00:00
Jay Foad
b81e457eb0 PR9214: Convert ConstantExpr::getWithOperands() to use ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129439 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 13:46:01 +00:00
Jay Foad
5b24017ca8 Like the coding standards say, do not use "using namespace std".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129435 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 12:46:01 +00:00
Cameron Zwarich
eb04a33dc7 Fix an obvious problem with an alignment computation. AsmPrinter actually does
the max itself, so it is not easy to write a test case for this, but I added a
test case that would fail if the code in AsmPrinter were removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129432 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 09:02:43 +00:00
Cameron Zwarich
5876db7a66 Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129429 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 06:39:16 +00:00
Cameron Zwarich
d8b88d8558 If a global variable has a specified alignment that is less than the preferred
alignment for its type, use the minimum of the specified alignment and the ABI
alignment. This fixes <rdar://problem/9275290>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129428 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 06:03:16 +00:00
Andrew Trick
87896d9368 Recommit r129383. PreRA scheduler heuristic fixes: VRegCycle, TokenFactor latency.
Additional fixes:
Do something reasonable for subtargets with generic
itineraries by handle node latency the same as for an empty
itinerary. Now nodes default to unit latency unless an itinerary
explicitly specifies a zero cycle stage or it is a TokenFactor chain.

Original fixes:
UnitsSharePred was a source of randomness in the scheduler: node
priority depended on the queue data structure. I rewrote the recent
VRegCycle heuristics to completely replace the old heuristic without
any randomness. To make the ndoe latency adjustments work, I also
needed to do something a little more reasonable with TokenFactor. I
gave it zero latency to its consumers and always schedule it as low as
possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129421 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 00:38:32 +00:00
Bill Wendling
f93f7b2446 Reapply r129401 with patch for clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129419 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 00:36:11 +00:00
Eric Christopher
d31df87f41 Temporarily revert r129408 to see if it brings the bots back.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129417 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 00:20:59 +00:00
Rafael Espindola
066c2f495a Be consistent about being virtual and returning void in the cfi methods.
Implement the ones that were missing in the asm streamer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 23:59:07 +00:00
Johnny Chen
55e6419b12 Add sanity check for Ld/St Dual forms of Thumb2 instructions.
rdar://problem/9273947


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129411 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 23:31:00 +00:00
Jakob Stoklund Olesen
836a7de159 Add @earlyclobber constraints to the writeback register of all ARM store instructions.
The ARMARM specifies these instructions as unpredictable when storing the
writeback register. This shouldn't affect code generation much since storing a
pointer to itself is quite rare.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129409 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 23:27:48 +00:00
Eric Christopher
8e98de9979 Fix a bug where we were counting the alias sets as completely used
registers for fast allocation.

Fixes rdar://9207598


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129408 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 23:23:14 +00:00
Devang Patel
161b2f45c2 I missed this new file in previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 23:21:44 +00:00
Devang Patel
513edf62fa Simplify. There is no need to use static variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129406 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 23:10:47 +00:00
Devang Patel
5d60763831 Do not reuse parameter name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129405 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 23:09:06 +00:00
Bill Wendling
f9b2dc66c8 Revert r129401 for now. Clang is using the old way of doing things.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129403 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 22:59:27 +00:00
Devang Patel
3cbee30eac This mechanical patch moves type handling into CompileUnit from DwarfDebug. In case of multiple compile unit in one object file, each compile unit is responsible for its own set of type entries anyway. This refactoring makes this obvious.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129402 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 22:53:02 +00:00
Bill Wendling
d5f323d70b Remove the unaligned load intrinsics in favor of using native unaligned loads.
Now that we have a first-class way to represent unaligned loads, the unaligned
load intrinsics are superfluous.

First part of <rdar://problem/8460511>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129401 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 22:46:31 +00:00
Eric Christopher
0b756349a7 Add more comments... err debug statements to the fast allocator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129400 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 22:17:44 +00:00
Johnny Chen
ec51a6225c The Thumb2 RFE instructions need to have their second halfword fully specified.
In addition, the base register is not rGPR, but GPR with th exception that:

    if n == 15 then UNPREDICTABLE

rdar://problem/9273836


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129391 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 21:41:51 +00:00
Jakob Stoklund Olesen
5db4289e40 SparseBitVector is SLOW.
Use a Bitvector instead, we didn't need the smaller memory footprint anyway.
This makes the greedy register allocator 10% faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129390 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 21:30:53 +00:00
Jim Grosbach
f8c1c8465f MCJIT lazy relocation resolution and symbol address re-assignment.
Add handling for tracking the relocations on symbols and resolving them.
Keep track of the relocations even after they are resolved so that if
the RuntimeDyld client moves the object, it can update the address and any
relocations to that object will be updated.

For our trival object file load/run test harness (llvm-rtdyld), this enables
relocations between functions located in the same object module. It should
be trivially extendable to load multiple objects with mutual references.

As a simple example, the following now works (running on x86_64 Darwin 10.6):


$ cat t.c
int bar() {
  return 65;
}

int main() {
  return bar();
}
$ clang t.c -fno-asynchronous-unwind-tables -o t.o -c
$ otool -vt t.o
t.o:
(__TEXT,__text) section
_bar:
0000000000000000  pushq %rbp
0000000000000001  movq  %rsp,%rbp
0000000000000004  movl  $0x00000041,%eax
0000000000000009  popq  %rbp
000000000000000a  ret
000000000000000b  nopl  0x00(%rax,%rax)
_main:
0000000000000010  pushq %rbp
0000000000000011  movq  %rsp,%rbp
0000000000000014  subq  $0x10,%rsp
0000000000000018  movl  $0x00000000,0xfc(%rbp)
000000000000001f  callq 0x00000024
0000000000000024  addq  $0x10,%rsp
0000000000000028  popq  %rbp
0000000000000029  ret
$ llvm-rtdyld t.o -debug-only=dyld ; echo $?
Function sym: '_bar' @ 0
Function sym: '_main' @ 16
Extracting function: _bar from [0, 15]
    allocated to 0x100153000
Extracting function: _main from [16, 41]
    allocated to 0x100154000
Relocation at '_main' + 16 from '_bar(Word1: 0x2d000000)
Resolving relocation at '_main' + 16 (0x100154010) from '_bar (0x100153000)(pcrel, type: 2, Size: 4).
loaded '_main' at: 0x100154000
65
$




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129388 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 21:20:41 +00:00
Johnny Chen
32cefad4b3 Add bad register checks for Thumb2 Ld/St instructions.
rdar://problem/9269047


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129387 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 21:17:51 +00:00
Andrew Trick
c558bf3972 Revert 129383. It causes some targets to hit a scheduler assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129385 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 20:14:07 +00:00
Andrew Trick
3eb4319313 PreRA scheduler heuristic fixes: VRegCycle, TokenFactor latency.
UnitsSharePred was a source of randomness in the scheduler: node
priority depended on the queue data structure. I rewrote the recent
VRegCycle heuristics to completely replace the old heuristic without
any randomness. To make these heuristic adjustments to node latency work,
I also needed to do something a little more reasonable with TokenFactor. I
gave it zero latency to its consumers and always schedule it as low as
possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129383 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 19:54:36 +00:00
Jakob Stoklund Olesen
fd5c51342a Create new intervals for isolated blocks during region splitting.
This merges the behavior of splitSingleBlocks into splitAroundRegion, so the
RS_Region and RS_Block register stages can be coalesced. That means the leftover
intervals after region splitting go directly to spilling instead of a second
pass of per-block splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 19:32:53 +00:00
Rafael Espindola
5d7dcd3335 Remove LastOffset from the asm parser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129378 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 18:53:30 +00:00
Johnny Chen
f9ce2cba42 The Thumb2 Ld, St, and Preload instructions with the i12 forms should have its Inst{23}
be specified as '1' (add = TRUE).

Also add a utility function for Thumb2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129377 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 18:48:00 +00:00
Jakob Stoklund Olesen
e1b43c3b40 Add SplitKit API to query and select the current interval being worked on.
This makes it possible to target multiple registers in one pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129374 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 18:11:31 +00:00
Jakob Stoklund Olesen
dfaf0e2c0e Fix a bug in RegAllocBase::addMBBLiveIns() where a basic block could accidentally be skipped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129373 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 18:11:28 +00:00
Devang Patel
860cf9693a Remove dead typedef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129368 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 17:43:12 +00:00
Devang Patel
8b9df62d02 Refactor CompileUnit into a separate header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 17:40:32 +00:00
Johnny Chen
49fdfe3ce5 Print out a debug message when the reglist fails the sanity check for Thumb Ld/St Multiple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129365 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 17:09:04 +00:00
Rafael Espindola
25f492e778 Fix the case of a .cfi_rel_offset before any .cfi_def_cfa_offset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129362 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 16:12:03 +00:00
Rafael Espindola
c57543964d Implement .cfi_same_value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129361 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 15:31:05 +00:00
Cameron Zwarich
d0aacbcc2e Split a store of a VMOVDRR into two integer stores to avoid mixing NEON and ARM
stores of arguments in the same cache line. This fixes the second half of
<rdar://problem/8674845>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129345 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 02:24:17 +00:00
NAKAMURA Takumi
39df9b5920 lib/Transforms/Instrumentation/CMakeLists.txt: Add LineProfiling.cpp to fix up r129340.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 01:54:40 +00:00
Nick Lewycky
93b68b20d4 Add support for line profiling. Very work-in-progress.
Use debug info in the IR to find the directory/file:line:col. Each time that location changes, bump a counter.

Unlike the existing profiling system, we don't try to look at argv[], and thusly don't require main() to be present in the IR. This matches GCC's technique where you specify the profiling flag when producing each .o file.

The runtime library is minimal, currently just calling printf at program shutdown time. The API is designed to make it possible to emit GCOV data later on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129340 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 01:06:09 +00:00
Nick Lewycky
ceb465a8a4 Consider ConstantAggregateZero as well as ConstantArray/Struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129338 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 01:02:45 +00:00
Eric Christopher
bbfc3b3098 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129334 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:48:08 +00:00
Nick Lewycky
cb4e4eae1a Make IRBuilder support StringRef for building strings.
Also document that the global variables produced are mergable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129330 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:29:07 +00:00
Jim Grosbach
7cbf92d1d9 Tidy up a bit now that we're using the MemoryManager interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129328 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:23:32 +00:00
Eric Christopher
05f9e4e8bd Match case for invalid constant error messages and add a new
test for invalid hexadecimals.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129326 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:18:03 +00:00
Johnny Chen
e77f72d7d2 A8.6.16 B
Encoding T1 (tBcc)
if cond == '1110' then UNDEFINED;

rdar://problem/9268681


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129325 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:14:49 +00:00
Dan Gohman
dac5dbadeb Fix reassociate to use a worklist instead of recursing when new
reassociation opportunities are exposed. This fixes a bug where
the nested reassociation expects to be the IR to be consistent,
but it isn't, because the outer reassociation has disconnected
some of the operands.  rdar://9167457


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129324 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:11:56 +00:00
Eric Christopher
f3755b2d0e To avoid printing out multiple error messages for cases like:
.long 80+08

go ahead and assume that if we've got an Error token that we handled it
already. Otherwise if it's a token we can't handle then go ahead and
return the default error.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129322 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:03:13 +00:00
Jakob Stoklund Olesen
560ab9ebf7 Reuse live interval union between functions. This saves a bit of compile time
when compiling many small functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129321 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 23:57:14 +00:00
Johnny Chen
de16508955 Thumb disassembler was erroneously rejecting "blx sp" instruction.
rdar://problem/9267838


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129320 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 23:33:30 +00:00
Chris Lattner
c8fbc34869 comment cleanup, use moveBefore instead of removeFromParent+insertBefore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129319 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 23:24:57 +00:00
Chris Lattner
b5f18f5df0 remove the StructRetPromotion pass. It is unused, not maintained and
has some bugs.  If this is interesting functionality, it should be 
reimplemented in the argpromotion pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 23:09:44 +00:00
Wesley Peck
ef9d9fdde1 Fix an error in the MBlaze delay slot filler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129313 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 22:45:02 +00:00
Wesley Peck
3d820baf19 Add scheduling information for the MBlaze backend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129311 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 22:31:52 +00:00
Eric Christopher
120fd2dd6d Lex, and then fail on invalid constants.
Testcase forthcoming.

rdar://8490596


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129309 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 22:24:56 +00:00
Nick Lewycky
5ea5c61589 Just because a GlobalVariable's initializer is [N x { i32, void ()* }] doesn't
mean that it has to be ConstantArray of ConstantStruct. We might have
ConstantAggregateZero, at either level, so don't crash on that.

Also, semi-deprecate the sentinal value. The linker isn't aware of sentinals so
we end up with the two lists appended, each with their "sentinals" on them.
Different parts of LLVM treated sentinals differently, so make them all just
ignore the single entry and continue on with the rest of the list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129307 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 22:11:20 +00:00
Rafael Espindola
a61842bf6e Implement cfi_rel_offset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129306 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 21:49:50 +00:00
Jakob Stoklund Olesen
3f5bedf5cb Speed up eviction by stopping collectInterferingVRegs as soon as the spill
weight limit has been exceeded.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129305 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 21:47:01 +00:00
Wesley Peck
e53060fdf4 Don't crash on invalid instructions when disassembling MBlaze code.
This fixes http://llvm.org/bugs/show_bug.cgi?id=9653


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129303 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 21:35:21 +00:00
Bill Wendling
cc88595bce The default of the dispatch switch statement was to branch to a BB that executed
the 'unwind' instruction. However, later on that instruction was converted into
a jump to the basic block it was located in, causing an infinite loop when we
get there.

It turns out, we get there if the _Unwind_Resume_or_Rethrow call returns (which
it's not supposed to do). It returns if it cannot find a place to unwind
to. Thus we would get what appears to be a "hang" when in reality it's just that
the EH couldn't be propagated further along.

Instead of infinitely looping (or calling `unwind', which none of our back-ends
support (it's lowered into nothing...)), call the @llvm.trap() intrinsic
instead. This may not conform to specific rules of a particular language, but
it's rather better than infinitely looping.

<rdar://problem/9175843&9233582>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129302 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 21:32:34 +00:00
Johnny Chen
35563fee7b Fix the bug where the immediate shift amount for Thumb logical shift instructions are incorrectly disassembled.
rdar://problem/9266265


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129298 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 21:14:35 +00:00
Evan Cheng
d67705faaa Look pass copies when determining whether hoisting would end up inserting more copies. rdar://9266679
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129297 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 21:09:18 +00:00
Rafael Espindola
53abbe5064 implement .cfi_adjust_cfa_offset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129296 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 20:29:16 +00:00
Owen Anderson
78a546936d Fix another using-CPSR-twice bug in my ADCS/SBCS cleanups, and make proper use of the Commutable bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129294 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 20:12:19 +00:00
Jakob Stoklund Olesen
6d73c7dad1 Use a faster algorithm for computing MBB live-in registers after register allocation.
LiveIntervals::findLiveInMBBs has to do a full binary search for each segment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129292 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 20:01:41 +00:00
Johnny Chen
f18dfc3a31 Trivial comment fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129288 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:51:50 +00:00
Evan Cheng
cfea985f53 Fix a couple of places where changes are made but not tracked.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129287 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:47:20 +00:00
Johnny Chen
e679d3331b Check invalid register encodings for LdFrm/StFrm ARM instructions and flag them as
invalid instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129286 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:34:12 +00:00
Kevin Enderby
bd3327654b Adding support for printing operands symbolically to llvm's public 'C'
disassembler API.  Hooked this up to the ARM target so such tools as Darwin's
otool(1) can now print things like branch targets for example this:
  blx _puts
instead of this:
  blx #-36
And even print the expression encoded in the Mach-O relocation entried for
things like this:
  movt r0, :upper16:((_foo-_bar)+1234)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129284 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:08:50 +00:00
Jakob Stoklund Olesen
0fb215a154 Don't add live ranges for sub-registers when clobbering a physical register.
Both coalescing and register allocation already check aliases for interference,
so these extra segments are only slowing us down.

This speeds up both linear scan and the greedy register allocator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129283 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:08:10 +00:00
Jakob Stoklund Olesen
11983cd861 Speed up LiveIntervalUnion::unify by handling end insertion specially.
This particularly helps with the initial transfer of fixed intervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129277 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 15:00:44 +00:00
Jakob Stoklund Olesen
bd1926dfd4 Time the initial seeding of live registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129276 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 15:00:42 +00:00
Jakob Stoklund Olesen
1edc3cf65d Don't shrink live ranges after dead code elimination unless it is going to help.
In particular, don't repeatedly recompute the PIC base live range after rematerialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129275 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 15:00:39 +00:00
Jay Foad
8340d0b659 Fix or remove code which seemed to think that the operand of a Constant
was always a User.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129272 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 09:48:55 +00:00
Jay Foad
562b84b3ae Don't include Operator.h from InstrTypes.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 09:35:34 +00:00
Jay Foad
4e9b0e3587 Phi nodes always use an even number of operands, so don't ever allocate
an odd number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129270 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 09:25:51 +00:00
Bill Wendling
5d7a5a4f53 Revert r129235 pending a vetting of the EH rewrite.
--- Reverse-merging r129235 into '.':
D    test/Feature/bb_attrs.ll
U    include/llvm/BasicBlock.h
U    include/llvm/Bitcode/LLVMBitCodes.h
U    lib/VMCore/AsmWriter.cpp
U    lib/VMCore/BasicBlock.cpp
U    lib/AsmParser/LLParser.cpp
U    lib/AsmParser/LLLexer.cpp
U    lib/AsmParser/LLToken.h
U    lib/Bitcode/Reader/BitcodeReader.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129259 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 23:18:04 +00:00
Nicolas Geoffray
c6cf197315 Bugfix in the Cpp backend after API change on PHINode::Create.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129248 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 17:39:40 +00:00
Bill Wendling
d7bb295d22 Beginning of the Great Exception Handling Rewrite.
* Add a "landing pad" attribute to the BasicBlock.
* Modify the bitcode reader and writer to handle said attribute.

Later: The verifier will ensure that the landing pad attribute is used in the
appropriate manner. I.e., not applied to the entry block, and applied only to
basic blocks that are branched to via a `dispatch' instruction.

(This is a work-in-progress.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129235 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 00:04:27 +00:00
Chris Lattner
15f8951799 fix rdar://8735979 - "int 3" doesn't match to "int3". Unfortunately,
InstAlias doesn't allow matching immediate operands, so we have to write
C++ code to do this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129223 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 19:41:05 +00:00
Benjamin Kramer
5731ff636b Fix potential buffer overflow on win32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129214 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 14:06:12 +00:00
Benjamin Kramer
c18214a6e0 Don't store Twine temporaries, it's not safe.
And don't append the name over and over again in the loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129210 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 11:26:27 +00:00
Benjamin Kramer
cc513e1cf1 Make error message more useful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129209 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 10:10:35 +00:00
Eli Friedman
18a2e50a9b Add back a couple checks removed by r129128; the fact that an intitializer
is an array of structures doesn't imply it's a ConstantArray of
ConstantStruct.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129207 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 09:11:09 +00:00
Chris Lattner
f5bf464b70 fix PR9523, a crash in looprotate on a non-canonical loop made out of indirectbr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129203 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 07:25:58 +00:00
Chris Lattner
0403b473dd Fix a bug where RecursivelyDeleteTriviallyDeadInstructions could
delete the instruction pointed to by CGP's current instruction
iterator, leading to a crash on the testcase.  This fixes PR9578.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129200 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 07:05:44 +00:00
Chris Lattner
c3e4e59d10 Avoid excess precision issues that lead to generating host-compiler-specific code.
Switch lowering probably shouldn't be using FP for this.  This resolves PR9581.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129199 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 06:57:13 +00:00
Eli Friedman
9055ccdb6b PR9604; try to deal with RAUW updates correctly in the AST. I'm not convinced
it's completely safe to cache the AST across LICM runs even with this fix,
but this fix can't hurt.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129198 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 06:55:46 +00:00
Chris Lattner
6ff80b2281 regexes are allowed to match empty things, e.g. {{.*}} in filecheck.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129193 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 06:29:24 +00:00
Jakob Stoklund Olesen
f4afdfc501 Build the Hopfield network incrementally when splitting global live ranges.
It is common for large live ranges to have few basic blocks with register uses
and many live-through blocks without any uses. This approach grows the Hopfield
network incrementally around the use blocks, completely avoiding checking
interference for some through blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129188 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 02:59:09 +00:00
Jakob Stoklund Olesen
9d29cbad32 Precompute interference for neighbor blocks as long as there is no interference.
This doesn't require seeking in the live interval union, so it is very cheap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129187 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 02:59:05 +00:00
Chris Lattner
b3452ea35c have dag combine zap "store undef", which can be formed during call lowering
with undef arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129185 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 02:32:02 +00:00
Sean Callanan
457856c03f Redirected errors from the AsmParser to the proper
error stream, in cases where the AsmParser is
being invoked by EDDisassembler.  Before, they
were being sent to errs() because no error handler
was installed in the SourceMgr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129177 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 00:37:25 +00:00
Devang Patel
3f932a74be Simplify array bound checks and clarify comments. One element array can have same non-zero number as lower bound as well as upper bound.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129170 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 23:39:38 +00:00
Nick Lewycky
918035f802 Add a function for profiling to run at shutdown. Unlike the existing API, this
can be used even when main() isn't present in the Module, but it means that you
don't get to read argv[].


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129163 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 22:19:52 +00:00
Matt Beaumont-Gay
7c90e46622 Fix an apparent typo that made GCC complain
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129160 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 21:59:49 +00:00
Devang Patel
fb6e8d6554 Do not emit DW_AT_upper_bound and DW_AT_lower_bound for unbouded array.
If lower bound is more then upper bound then consider it is an unbounded array.
An array is unbounded if non-zero lower bound is same as upper bound.
If lower bound and upper bound are zero than array has one element.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129156 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 21:55:10 +00:00
Evan Cheng
4da0c7c0c9 Change -arm-trap-func= into a non-arm specific option. Now Intrinsic::trap is lowered into a call to the specified trap function at sdisel time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129152 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 21:37:21 +00:00
Jim Grosbach
e2e777b0e7 Workaround g++ 4.2.1 warning diagnostic false positive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129149 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 21:11:20 +00:00
Johnny Chen
ee10b13a44 Check opcoe (dmb, dsb) instead of bitfields matching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129148 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 20:03:46 +00:00
Johnny Chen
c636074afc Hanlde the checking of bad regs for SMMLAR properly, instead of asserting.
PR9650
rdar://problem/9257565


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129147 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 19:41:22 +00:00
Johnny Chen
40de2b3f15 Sanity check the option operand for DMB/DSB.
PR9648
rdar://problem/9257634


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129146 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 19:18:07 +00:00
Jim Grosbach
5b03a3a59a Mark hasExtraDefRegAllocReq=1 on LDRD.
The previous cleanup of LDRD got overzealous and removed it, causing post-RA
scheduling to get overzealous in breaking antidependencies and invalidate these instructions. Hilarity and invalid assembly ensued.

rdar://9244161


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129144 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 18:47:05 +00:00
Jim Grosbach
b027105fa5 Refactor MCJIT 32-bit section loading.
Teach 32-bit section loading to use the Memory Manager interface, just like
the 64-bit loading does. Tidy up a few other things here and there.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129138 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 17:31:24 +00:00
Nick Lewycky
2c44a80d99 llvm.global_[cd]tor is defined to be either external, or appending with an array
of { i32, void ()* }. Teach the verifier to verify that, deleting copies of
checks strewn about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 07:30:21 +00:00
Johnny Chen
97fdff1d3f Add sanity checking for bad register specifier(s) for the DPFrm instructions.
Add more test cases to exercise the logical branches related to the above change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129117 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 00:29:09 +00:00
Rafael Espindola
d5321da8d2 Micro optimization and improved similarity with gas' output:
When two section names share a suffix, reuse the entry in shstrtab.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129115 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 23:21:52 +00:00
Devang Patel
60d490cdc7 Do not let debug info interfer with branch folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129114 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 23:11:25 +00:00
Bill Wendling
44dcfd3625 Replace the old algorithm that emitted the "print the alias for an instruction"
with the newer, cleaner model. It uses the IAPrinter class to hold the
information that is needed to match an instruction with its alias. This also
takes into account the available features of the platform.

There is one bit of ugliness. The way the logic determines if a pattern is
unique is O(N**2), which is gross. But in reality, the number of items it's
checking against isn't large. So while it's N**2, it shouldn't be a massive time
sink.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129110 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 21:20:06 +00:00
Evan Cheng
274d8d4eba Add option to emit @llvm.trap as a function call instead of a trap instruction. rdar://9249183.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 20:31:12 +00:00
Rafael Espindola
ce8463f1fb Add support for .skip.
Patch by Roman Divacky.
Fixes PR9361.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129106 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 20:26:23 +00:00
Akira Hatanaka
8d580659f9 Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 20:25:10 +00:00
Akira Hatanaka
3f92b439d9 Update ATUsed every time after expandRegLargeImmPair is called.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 20:23:26 +00:00
Mon P Wang
e32cdef38e Fixed encoding for VEXTqf
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129101 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 19:56:12 +00:00
Andrew Trick
5469976506 Added a check in the preRA scheduler for potential interference on a
induction variable. The preRA scheduler is unaware of induction vars,
so we look for potential "virtual register cycles" instead.

Fixes <rdar://problem/8946719> Bad scheduling prevents coalescing


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129100 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 19:54:57 +00:00
Akira Hatanaka
9777e7afd4 Fix handling of functions with internal linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129099 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 19:51:44 +00:00
Johnny Chen
22dc4d9f59 Add sanity checking for invalid register encodings for signed/unsigned extend instructions.
Add some test cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129098 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 19:28:58 +00:00
Johnny Chen
8dbda0b51b Add sanity checking for invalid register encodings for saturating instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129096 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 19:02:08 +00:00
Jakob Stoklund Olesen
e815dab69f Recompute hasPHIKill flags when shrinking live intervals.
PHI values may be deleted, causing the flags to be wrong. This fixes PR9616.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129092 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 18:43:14 +00:00
Johnny Chen
4d4e25740b Add some more comments about checkings of invalid register numbers.
And two test cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129090 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 18:33:19 +00:00
Rafael Espindola
45e1a53efd Expose more passes to the C API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129087 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 18:20:46 +00:00
Jakob Stoklund Olesen
f34ae32a6b Avoid moving iterators when the previous block was just visited.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129081 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 17:27:50 +00:00
Jakob Stoklund Olesen
0bd2bd9ecc Prefer multiplications to divisions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129080 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 17:27:48 +00:00
Jakob Stoklund Olesen
7b41fbe872 Extract SpillPlacement::addLinks for handling the special transparent blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129079 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 17:27:46 +00:00
Devang Patel
949666ea16 While hoisting common code from if/else, hoist debug info intrinsics if they match.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129078 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 17:27:36 +00:00
Tanya Lattner
0433b21c98 Prevent ARM DAG Combiner from doing an AND or OR combine on an illegal vector type (vectors of size 3). Also included test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129074 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 15:24:20 +00:00
Sean Callanan
5c3a245f3c Fixed a bug where missing EDInstInfo would cause
tokenization to crash and burn.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129051 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 01:56:01 +00:00
Johnny Chen
f16f4e09ec Sanity check MSRi for invalid mask values and reject it as invalid.
rdar://problem/9246844


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129050 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 01:37:34 +00:00
Eli Friedman
0e382192c1 PR9634: Don't unconditionally tell the AliasSetTracker that the PreheaderLoad
is equivalent to any other relevant value; it isn't true in general.
If it is equivalent, the LoopPromoter will tell the AST the equivalence.
Also, delete the PreheaderLoad if it is unused.

Chris, since you were the last one to make major changes here, can you check
that this is sane?



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129049 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 01:35:06 +00:00
Johnny Chen
8424a60fc9 The ARM disassembler was not recognizing USADA8 instruction. Need to add checking for register values
for USAD8 and USADA8.

rdar://problem/9247060


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129047 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 01:05:52 +00:00
Evan Cheng
2c69f8eec6 Change -arm-divmod-libcall to a target neutral option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129045 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 00:58:44 +00:00
Evan Cheng
1adb47cc11 Remove dead code. rdar://9221736.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129044 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 00:56:37 +00:00
Johnny Chen
2455268cdd Should also check SMLAD for invalid register values.
rdar://problem/9246650


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129042 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 00:50:25 +00:00