oota-llvm.git
13 years agoAdd -mcpu=cortex-a9-mp. It's cortex-a9 with MP extension. rdar://8648637.
Bob Wilson [Tue, 19 Apr 2011 18:11:52 +0000 (18:11 +0000)]
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

13 years agoAvoid some 's' 16-bit instruction which partially update CPSR
Bob Wilson [Tue, 19 Apr 2011 18:11:49 +0000 (18:11 +0000)]
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

13 years agoAvoid write-after-write issue hazards for Cortex-A9.
Bob Wilson [Tue, 19 Apr 2011 18:11:45 +0000 (18:11 +0000)]
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

13 years agoSome single-precision VFP instructions can execute in either the VPF or Neon
Bob Wilson [Tue, 19 Apr 2011 18:11:38 +0000 (18:11 +0000)]
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

13 years agoImprovements for the Cortex-A9 scheduling itineraries.
Bob Wilson [Tue, 19 Apr 2011 18:11:36 +0000 (18:11 +0000)]
Improvements for the Cortex-A9 scheduling itineraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129770 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for FastISel'ing varargs calls.
Eli Friedman [Tue, 19 Apr 2011 17:22:22 +0000 (17:22 +0000)]
Add support for FastISel'ing varargs calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129765 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoForce the greedy register allocator to be linked alongside linear scan.
Jakob Stoklund Olesen [Tue, 19 Apr 2011 17:17:58 +0000 (17:17 +0000)]
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

13 years agoSelectBasicBlock is rather slow even when it doesn't do anything; skip the
Eli Friedman [Tue, 19 Apr 2011 17:01:08 +0000 (17:01 +0000)]
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

13 years agoSupport nested CALLSEQ_BEGIN/END; necessary for ARM byval support. <rdar://problem...
Stuart Hastings [Tue, 19 Apr 2011 16:16:58 +0000 (16:16 +0000)]
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

13 years agoTrivial simplification.
Jay Foad [Tue, 19 Apr 2011 15:23:29 +0000 (15:23 +0000)]
Trivial simplification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129759 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTighten test case a bit.
Jakob Stoklund Olesen [Tue, 19 Apr 2011 06:14:45 +0000 (06:14 +0000)]
Tighten test case a bit.

Ideally, we would match an S-register to its containing D-register, but that
requires arithmetic (divide by 2).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129756 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement support for x86 fastisel of small fixed-sized memcpys, which are generated
Chris Lattner [Tue, 19 Apr 2011 05:52:03 +0000 (05:52 +0000)]
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

13 years agotidy up
Chris Lattner [Tue, 19 Apr 2011 05:15:59 +0000 (05:15 +0000)]
tidy up

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129753 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement support for fast isel of calls of i1 arguments, even though they are illegal,
Chris Lattner [Tue, 19 Apr 2011 05:09:50 +0000 (05:09 +0000)]
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

13 years agoHandle i1/i8/i16 constant integer arguments to calls by prepromoting them.
Chris Lattner [Tue, 19 Apr 2011 04:42:38 +0000 (04:42 +0000)]
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

13 years agobe layout aware, to produce:
Chris Lattner [Tue, 19 Apr 2011 04:26:32 +0000 (04:26 +0000)]
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

13 years agofix rdar://9297006 - fast isel bails out on trunc to i1 -> bools cry,
Chris Lattner [Tue, 19 Apr 2011 04:22:17 +0000 (04:22 +0000)]
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

13 years agoChange A9 scheduling itineraries VLD* / VST* entries default to "aligned". That
Evan Cheng [Tue, 19 Apr 2011 01:21:49 +0000 (01:21 +0000)]
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

13 years agoMake tests register allocation independent again.
Jakob Stoklund Olesen [Tue, 19 Apr 2011 00:14:43 +0000 (00:14 +0000)]
Make tests register allocation independent again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129739 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDo not lose mem_operands while lowering VLD / VST intrinsics.
Evan Cheng [Tue, 19 Apr 2011 00:04:03 +0000 (00:04 +0000)]
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

13 years agoDisable warning C4181: "qualifier applied to reference type; ignored"
Francois Pichet [Tue, 19 Apr 2011 00:03:17 +0000 (00:03 +0000)]
Disable warning C4181: "qualifier applied to reference type; ignored"
This was causing a flooding of warnings with MSVC 2008. This warning was removed in MSVC 2010.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129737 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agodocs: Use <Hn> as Heading elements instead of <DIV class="doc_foo">.
NAKAMURA Takumi [Mon, 18 Apr 2011 23:59:50 +0000 (23:59 +0000)]
docs: Use <Hn> as Heading elements instead of <DIV class="doc_foo">.

H1 ... doc_title
H2 ... doc_section
H3 ... doc_subsection
H4 ... doc_subsubsection

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129736 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse ArrayRef variants.
Devang Patel [Mon, 18 Apr 2011 23:51:03 +0000 (23:51 +0000)]
Use ArrayRef variants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129735 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd BumpPtrAllocator::getTotalMemory() to allow clients to query how much memory...
Ted Kremenek [Mon, 18 Apr 2011 22:44:46 +0000 (22:44 +0000)]
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

13 years agoRemove test to check line numbers. There are other numerous tests in our test harness...
Devang Patel [Mon, 18 Apr 2011 22:27:20 +0000 (22:27 +0000)]
Remove test to check line numbers. There are other numerous tests in our test harness to check line number information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129725 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTrim a few unneeded includes.
Jim Grosbach [Mon, 18 Apr 2011 21:35:54 +0000 (21:35 +0000)]
Trim a few unneeded includes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129723 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInvert the meaning of printAliasInstr's return value. It now returns
Eric Christopher [Mon, 18 Apr 2011 21:28:11 +0000 (21:28 +0000)]
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

13 years agoSimplify declarations slightly by using typedefs.
Eli Friedman [Mon, 18 Apr 2011 21:21:37 +0000 (21:21 +0000)]
Simplify declarations slightly by using typedefs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129720 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agomalloc elimination: it's a bad idea to use raw_svector_ostream on a
Eli Friedman [Mon, 18 Apr 2011 20:54:46 +0000 (20:54 +0000)]
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

13 years agoReduce clutter in asm output. Do not emit source location as comment for each instruc...
Devang Patel [Mon, 18 Apr 2011 20:26:49 +0000 (20:26 +0000)]
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

13 years agoHandle spilling around an instruction that has an early-clobber re-definition of
Jakob Stoklund Olesen [Mon, 18 Apr 2011 20:23:27 +0000 (20:23 +0000)]
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

13 years agoSmall fix to the ARM AsmParser to ensure that a
Sean Callanan [Mon, 18 Apr 2011 20:20:44 +0000 (20:20 +0000)]
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

13 years agoFix a bug where we were counting the alias sets as completely used
Eric Christopher [Mon, 18 Apr 2011 19:26:25 +0000 (19:26 +0000)]
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

13 years agoMark some functions as used which are used within debug-only code. This
Chandler Carruth [Mon, 18 Apr 2011 18:49:44 +0000 (18:49 +0000)]
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

13 years agoEnhance the fixed-length disassembler to support the callbacks necessary for symbolic...
Owen Anderson [Mon, 18 Apr 2011 18:42:26 +0000 (18:42 +0000)]
Enhance the fixed-length disassembler to support the callbacks necessary for symbolic disassembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129708 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the empty StructType::get overload use an empty ArrayRef.
Anders Carlsson [Mon, 18 Apr 2011 14:02:06 +0000 (14:02 +0000)]
Make the empty StructType::get overload use an empty ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129696 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agowhile we're at it, handle 'sdiv exact' of a power of 2 also,
Chris Lattner [Mon, 18 Apr 2011 07:00:40 +0000 (07:00 +0000)]
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

13 years agofix rdar://9297011 - udiv by power of two causing fast-isel rejects
Chris Lattner [Mon, 18 Apr 2011 06:55:51 +0000 (06:55 +0000)]
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

13 years agoAdd a new bit that ImmLeaf's can opt into, which allows them to duck out of
Chris Lattner [Mon, 18 Apr 2011 06:36:55 +0000 (06:36 +0000)]
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

13 years agoImplement major new fastisel functionality: the matcher can now handle immediates...
Chris Lattner [Mon, 18 Apr 2011 06:22:33 +0000 (06:22 +0000)]
Implement major new fastisel functionality: the matcher can now handle immediates with
value constraints on them (when defined as ImmLeaf's).  This is particularly important
for X86-64, where almost all reg/imm instructions take a i64immSExt32 immediate operand,
which has a value constraint.  Before this patch we ended up iseling the examples into
such amazing code as:

movabsq $7, %rax
imulq %rax, %rdi
movq %rdi, %rax
ret

now we produce:

imulq $7, %rdi, %rax
ret

This dramatically shrinks the generated code at -O0 on x86-64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129691 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agorelax this test to just check that the lock prefix is encoded properly,
Chris Lattner [Mon, 18 Apr 2011 06:15:35 +0000 (06:15 +0000)]
relax this test to just check that the lock prefix is encoded properly,
and to not rely on the register allocator's arbitrary operand choices.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129690 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert r129688; it's breaking buildbots.
Eli Friedman [Mon, 18 Apr 2011 05:54:54 +0000 (05:54 +0000)]
Revert r129688; it's breaking buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129689 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMore malloc elimination: it's a bad idea to use raw_svector_ostream on a
Eli Friedman [Mon, 18 Apr 2011 05:38:58 +0000 (05:38 +0000)]
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

13 years agoMake the StringMaps attached to MCContext use the MCContext's allocator;
Eli Friedman [Mon, 18 Apr 2011 05:02:31 +0000 (05:02 +0000)]
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

13 years agoUse an empty ArrayRef instead of an empty std::vector for the Function::get overload...
Anders Carlsson [Mon, 18 Apr 2011 04:55:06 +0000 (04:55 +0000)]
Use an empty ArrayRef instead of an empty std::vector for the Function::get overload that takes no parameters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129686 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agodocs: Redefine Heading elements as below;
NAKAMURA Takumi [Mon, 18 Apr 2011 01:17:51 +0000 (01:17 +0000)]
docs: Redefine Heading elements as below;

H1 ... Title (and might be Chapter in future)
H2 ... Section
H3 ... Subsection
H4 ... Sub-subsection

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129683 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agointroduce a new OpKind abstraction which wraps up operand flavors in a tidy little...
Chris Lattner [Sun, 17 Apr 2011 23:29:05 +0000 (23:29 +0000)]
introduce a new OpKind abstraction which wraps up operand flavors in a tidy little wrapper.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129680 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agochange OperandsSignature to use SmallVector<char> instead of std::vector<string>
Chris Lattner [Sun, 17 Apr 2011 22:24:13 +0000 (22:24 +0000)]
change OperandsSignature to use SmallVector<char> instead of std::vector<string>
since the strings are always exactly one character, and there are usually only 2-3 operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129678 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agosince the VT is fixed for a ImmLeaf, there is no reason to expose it to the matching...
Chris Lattner [Sun, 17 Apr 2011 22:17:27 +0000 (22:17 +0000)]
since the VT is fixed for a ImmLeaf, there is no reason to expose it to the matching code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129677 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoswitch the rest of the x86 immediate patterns over to ImmLeaf,
Chris Lattner [Sun, 17 Apr 2011 22:12:55 +0000 (22:12 +0000)]
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

13 years agonow that predicates have a decent abstraction layer on them, introduce a new
Chris Lattner [Sun, 17 Apr 2011 22:05:17 +0000 (22:05 +0000)]
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

13 years agoRework our internal representation of node predicates to expose more
Chris Lattner [Sun, 17 Apr 2011 21:38:24 +0000 (21:38 +0000)]
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

13 years agoremove some debugging code I added.
Chris Lattner [Sun, 17 Apr 2011 21:36:19 +0000 (21:36 +0000)]
remove some debugging code I added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129668 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago1. merge fast-isel-shift-imm.ll into fast-isel-x86-64.ll
Chris Lattner [Sun, 17 Apr 2011 20:23:29 +0000 (20:23 +0000)]
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

13 years agofix an x86 fast isel issue where we'd completely give up on folding an address
Chris Lattner [Sun, 17 Apr 2011 17:47:38 +0000 (17:47 +0000)]
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

13 years agofix an oversight which caused us to compile the testcase (and other
Chris Lattner [Sun, 17 Apr 2011 17:12:08 +0000 (17:12 +0000)]
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

13 years agotidy up and reduce indentation.
Chris Lattner [Sun, 17 Apr 2011 17:05:12 +0000 (17:05 +0000)]
tidy up and reduce indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129661 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix rdar://9289512 - not folding load into compare at -O0
Chris Lattner [Sun, 17 Apr 2011 06:35:44 +0000 (06:35 +0000)]
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

13 years agosplit a complex predicate out to a helper function. Simplify two for loops,
Chris Lattner [Sun, 17 Apr 2011 06:03:19 +0000 (06:03 +0000)]
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

13 years agoRemove working entry from README.
Eli Friedman [Sun, 17 Apr 2011 02:36:27 +0000 (02:36 +0000)]
Remove working entry from README.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129654 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix rdar://9289583 - fast isel should handle non-canonical commutative binops
Chris Lattner [Sun, 17 Apr 2011 01:16:47 +0000 (01:16 +0000)]
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

13 years agoPR9055: extend the fix to PR4050 (r70179) to apply to zext and anyext.
Eli Friedman [Sat, 16 Apr 2011 23:25:34 +0000 (23:25 +0000)]
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

13 years agoRename a misleadingly-named variable.
Frits van Bommel [Sat, 16 Apr 2011 14:32:34 +0000 (14:32 +0000)]
Rename a misleadingly-named variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129644 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd test cases for Jay's r129641 and fix a 32-bit-centric testcase in a file with...
Frits van Bommel [Sat, 16 Apr 2011 14:31:50 +0000 (14:31 +0000)]
Add test cases for Jay's r129641 and fix a 32-bit-centric testcase in a file with a 64-bit datalayout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129643 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUnbreak the MSVC 2010 build.
Francois Pichet [Sat, 16 Apr 2011 14:20:39 +0000 (14:20 +0000)]
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

13 years agoFix bug when checking phi operands in InstCombiner::visitPHINode(),
Jay Foad [Sat, 16 Apr 2011 14:17:37 +0000 (14:17 +0000)]
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

13 years agoMSVC needs the return 0 to compile.
Francois Pichet [Sat, 16 Apr 2011 13:59:23 +0000 (13:59 +0000)]
MSVC needs the return 0 to compile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129640 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove unused variable.
Benjamin Kramer [Sat, 16 Apr 2011 10:30:47 +0000 (10:30 +0000)]
Remove unused variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129639 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWrite out uint64_t as i{0..32},i{33..64} instead of i{0..32},0.
Benjamin Kramer [Sat, 16 Apr 2011 10:25:32 +0000 (10:25 +0000)]
Write out uint64_t as i{0..32},i{33..64} instead of i{0..32},0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129638 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't use C++ comments in C code.
Nick Lewycky [Sat, 16 Apr 2011 04:25:36 +0000 (04:25 +0000)]
Don't use C++ comments in C code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129637 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPut each personality function in a section. This fixes the gnu ld warning:
Rafael Espindola [Sat, 16 Apr 2011 03:51:21 +0000 (03:51 +0000)]
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

13 years agoCorrect result when a branch condition is live across a block
Stuart Hastings [Sat, 16 Apr 2011 03:31:26 +0000 (03:31 +0000)]
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

13 years agoFix divmod libcall lowering. Convert to {S|U}DIVREM first and then expand the node...
Evan Cheng [Sat, 16 Apr 2011 03:08:26 +0000 (03:08 +0000)]
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

13 years agoFix cmake build.
Rafael Espindola [Sat, 16 Apr 2011 02:06:46 +0000 (02:06 +0000)]
Fix cmake build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129632 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove the re-stemming function up top and use it where it's currently inlined.
Nick Lewycky [Sat, 16 Apr 2011 02:05:18 +0000 (02:05 +0000)]
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

13 years agoRename LineProfiling to GCOVProfiling to more accurately represent what it
Nick Lewycky [Sat, 16 Apr 2011 01:20:23 +0000 (01:20 +0000)]
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

13 years agoIntroduce support to encode Objective-C property information in debugging information...
Devang Patel [Sat, 16 Apr 2011 00:11:51 +0000 (00:11 +0000)]
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

13 years agoThumb2 BFC was insufficiently encoded.
Johnny Chen [Fri, 15 Apr 2011 22:52:15 +0000 (22:52 +0000)]
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

13 years agoA8.6.315 VLD3 (single 3-element structure to all lanes)
Johnny Chen [Fri, 15 Apr 2011 22:49:08 +0000 (22:49 +0000)]
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

13 years agoRe-enable test o32_cc_vararg.ll.
Akira Hatanaka [Fri, 15 Apr 2011 22:23:09 +0000 (22:23 +0000)]
Re-enable test o32_cc_vararg.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129616 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitial work to improve documentation for Clang's diagnostics, from Matthieu Monrocq
Douglas Gregor [Fri, 15 Apr 2011 22:04:07 +0000 (22:04 +0000)]
Initial work to improve documentation for Clang's diagnostics, from Matthieu Monrocq

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129613 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReverse unnecessary changes made in r129606 and r129608. There is no change in functi...
Akira Hatanaka [Fri, 15 Apr 2011 21:51:11 +0000 (21:51 +0000)]
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

13 years agoAdd ORR and EOR to the CMP peephole optimizer. It's hard to get isel to generate
Cameron Zwarich [Fri, 15 Apr 2011 21:24:38 +0000 (21:24 +0000)]
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

13 years agoFix some broken links, from Matthieu Monrocq
Douglas Gregor [Fri, 15 Apr 2011 21:21:31 +0000 (21:21 +0000)]
Fix some broken links, from Matthieu Monrocq

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129609 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix lines that exceed 80 columns. There is no change in functionality.
Akira Hatanaka [Fri, 15 Apr 2011 21:06:38 +0000 (21:06 +0000)]
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

13 years agoAdd this test back for Darwin.
Rafael Espindola [Fri, 15 Apr 2011 21:06:27 +0000 (21:06 +0000)]
Add this test back for Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129607 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix lines that have incorrect indentation or exceed 80 columns. There is no change...
Akira Hatanaka [Fri, 15 Apr 2011 21:00:26 +0000 (21:00 +0000)]
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

13 years agoThe AND instruction leaves the V flag unmodified, so it falls victim to the same
Cameron Zwarich [Fri, 15 Apr 2011 20:45:00 +0000 (20:45 +0000)]
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

13 years agoFix cmake build.
Rafael Espindola [Fri, 15 Apr 2011 20:34:45 +0000 (20:34 +0000)]
Fix cmake build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129601 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSome refactoring suggested by Anton Korobeynikov.
Rafael Espindola [Fri, 15 Apr 2011 20:32:03 +0000 (20:32 +0000)]
Some refactoring suggested by Anton Korobeynikov.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129600 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd missing register forms of instructions to the ARM CMP-folding code. This
Cameron Zwarich [Fri, 15 Apr 2011 20:28:28 +0000 (20:28 +0000)]
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

13 years agoAdd pass that expands pseudo instructions into target instructions after register...
Akira Hatanaka [Fri, 15 Apr 2011 19:52:08 +0000 (19:52 +0000)]
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

13 years agoIncrease SubtargetFeatureKV Value and Implies fields to 64 bits since some targets...
Evan Cheng [Fri, 15 Apr 2011 19:35:46 +0000 (19:35 +0000)]
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

13 years agoAdd encoding tests for flds/filds
Joerg Sonnenberger [Fri, 15 Apr 2011 19:25:31 +0000 (19:25 +0000)]
Add encoding tests for flds/filds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129589 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplements StringRef::compare with bounds. It is behaves similarly to strncmp()....
Lenny Maiorani [Fri, 15 Apr 2011 17:56:50 +0000 (17:56 +0000)]
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

13 years agoTeach the SplitKit blitter to handle multiply defined values as well.
Jakob Stoklund Olesen [Fri, 15 Apr 2011 17:24:49 +0000 (17:24 +0000)]
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

13 years agoRemember to set flag.
Jakob Stoklund Olesen [Fri, 15 Apr 2011 17:24:46 +0000 (17:24 +0000)]
Remember to set flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129579 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd 129518 back with a fix for when we are producing eh just because of debug info.
Rafael Espindola [Fri, 15 Apr 2011 15:11:06 +0000 (15:11 +0000)]
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

13 years agoFix a ton of comment typos found by codespell. Patch by
Chris Lattner [Fri, 15 Apr 2011 05:18:47 +0000 (05:18 +0000)]
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

13 years agoRevert r129518, "Change ELF systems to use CFI for producing the EH tables. This...
NAKAMURA Takumi [Fri, 15 Apr 2011 03:35:57 +0000 (03:35 +0000)]
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