oota-llvm.git
11 years agoFix llvm::removeUnreachableBlocks to handle unreachable loops.
Evgeniy Stepanov [Fri, 22 Mar 2013 08:43:04 +0000 (08:43 +0000)]
Fix llvm::removeUnreachableBlocks to handle unreachable loops.

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

11 years agoInstCombine: Improve the result bitvect type when folding (cmp pred (load (gep GV...
Arnaud A. de Grandmaison [Fri, 22 Mar 2013 08:25:01 +0000 (08:25 +0000)]
InstCombine: Improve the result bitvect type when folding (cmp pred (load (gep GV, i)) C) to a bit test.

The original code used i32, and i64 if legal. This introduced unneeded
casts when they aren't legal, or when the index variable i has another
type. In order of preference: try to use i's type; use the smallest
fitting legal type (using an added DataLayout method); default to i32.
A testcase checks that this works when the index gep operand is i16.

Patch by : Ahmed Bougacha <ahmed.bougacha@gmail.com>
Reviewed by : Duncan

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

11 years agoRemove ScavengedRC from RegisterScavenging
Hal Finkel [Fri, 22 Mar 2013 07:27:44 +0000 (07:27 +0000)]
Remove ScavengedRC from RegisterScavenging

ScavengedRC was a dead private variable (set, but not otherwise used). No
functionality change intended.

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

11 years agoReorder the DIFile field in DILexicalBlock to become a prefix common with other DIScopes
David Blaikie [Fri, 22 Mar 2013 05:47:44 +0000 (05:47 +0000)]
Reorder the DIFile field in DILexicalBlock to become a prefix common with other DIScopes

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

11 years agoRemove the empty directory. Silly git-svn.
Chandler Carruth [Fri, 22 Mar 2013 05:42:33 +0000 (05:42 +0000)]
Remove the empty directory. Silly git-svn.

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

11 years agoRemove the ARM-specific variant of this test. It's already covered by
Chandler Carruth [Fri, 22 Mar 2013 05:16:46 +0000 (05:16 +0000)]
Remove the ARM-specific variant of this test. It's already covered by
the ARM build bots, and it adds a weird case to the test suite where
a test uses as inputs files in the parent directory.

Talked about this with Dave on IRC and he's fine with this approach even
though it isn't optimal.

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

11 years agoIntroduce LLVM_STATIC_ASSERT macro, which expands to C/C++'s static_assert on compile...
Argyrios Kyrtzidis [Fri, 22 Mar 2013 03:10:51 +0000 (03:10 +0000)]
Introduce LLVM_STATIC_ASSERT macro, which expands to C/C++'s static_assert on compilers which support it.

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

11 years agoRevert r177543: Add timing of the IR parsing code with a new
Chandler Carruth [Fri, 22 Mar 2013 02:20:34 +0000 (02:20 +0000)]
Revert r177543: Add timing of the IR parsing code with a new
-time-ir-parsing flag

This breaks the layering of the Support library. We can't add an
implementation side to IRReader because it refers directly to entities
only accessible as part of the IR, AsmParser, and BitcodeReader
libraries. It can only be used in a context where all of those libraries
will be available.

We'll need to find some other way to get this functionality, and
hopefully solve the long-standing layering problem of IRReader.h...

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

11 years agoFix the invalid opcode for Mips branch instructions in the assembler
Jack Carter [Fri, 22 Mar 2013 00:29:10 +0000 (00:29 +0000)]
Fix the invalid opcode for Mips branch instructions in the assembler

For mips a branch an 18-bit signed offset (the 16-bit
offset field shifted left 2 bits) is added to the
address of the instruction following the branch
(not the branch itself), in the branch delay slot,
to form a PC-relative effective target address.

Previously, the code generator did not perform the
shift of the immediate branch offset which resulted
in wrong instruction opcode. This patch fixes the issue.

Contributor: Vladimir Medic

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

11 years agoThis patch that enables the Mips assembler to use symbols for offset for instructions
Jack Carter [Fri, 22 Mar 2013 00:05:30 +0000 (00:05 +0000)]
This patch that enables the Mips assembler to use symbols for offset for instructions

This patch uses the generated instruction info tables to
identify memory/load store instructions.
After successful matching and based on the operand type
and size, it generates additional instructions to the output.

Contributor: Vladimir Medic

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

11 years agoRemove the G8RC_NOX0_and_GPRC_NOR0 PPC register class
Hal Finkel [Thu, 21 Mar 2013 23:45:03 +0000 (23:45 +0000)]
Remove the G8RC_NOX0_and_GPRC_NOR0 PPC register class

As Jakob pointed out in his review of r177423, having a shared ZERO
register between the 32- and 64-bit register classes causes this
odd G8RC_NOX0_and_GPRC_NOR0 class to be created. As recommended,
this adds a ZERO8 register which differentiates the 32- and 64-bit
zeros.

No functionality change intended.

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

11 years agoAdd TableGen ctags(1) emitter and helper script.
Sean Silva [Thu, 21 Mar 2013 23:40:38 +0000 (23:40 +0000)]
Add TableGen ctags(1) emitter and helper script.

To use this in conjunction with exuberant ctags to generate a single
combined tags file, run tblgen first and then
  $ ctags --append [...]

Since some identifiers have corresponding definitions in C++ code,
it can be useful (if using vim) to also use cscope, and
  :set cscopetagorder=1
so that
  :tag X
will preferentially select the tablegen symbol, while
  :cscope find g X
will always find the C++ symbol.

Patch by Kevin Schoedel!

(a couple small formatting changes courtesy of clang-format)

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

11 years agoAlways forward 'resume' instructions to the outter landing pad.
Bill Wendling [Thu, 21 Mar 2013 23:30:12 +0000 (23:30 +0000)]
Always forward 'resume' instructions to the outter landing pad.

How did this ever work?

Basically, if you have a function that's inlined into the caller, it may not
have any 'call' instructions, but any 'resume' instructions it may have should
still be forwarded to the outer (caller's) landing pad. This requires that all
of the 'landingpad' instructions in the callee have their clauses merged with
the caller's outer 'landingpad' instruction (hence the bit of ugly code in the
`forwardResume' method).

Testcase in a follow commit to the test-suite repository.

<rdar://problem/13360379> & PR15555

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

11 years agoFix a register-class comparison bug in PPCCTRLoops
Hal Finkel [Thu, 21 Mar 2013 23:23:34 +0000 (23:23 +0000)]
Fix a register-class comparison bug in PPCCTRLoops

Thanks to Jakob for isolating the underlying problem from the
test case in r177423. The original commit had introduced
asymmetric copy operations, but these turned out to be a work-around
to the real problem (the use of == instead of hasSubClassEq in PPCCTRLoops).

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

11 years agoRefactor the filename/directory information in DISubprogram to refer directly to...
David Blaikie [Thu, 21 Mar 2013 23:08:34 +0000 (23:08 +0000)]
Refactor the filename/directory information in DISubprogram to refer directly to the pair rather than the DIFile.

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

11 years agoAdd a query to tell if a landing pad has a catch-all.
Bill Wendling [Thu, 21 Mar 2013 23:01:03 +0000 (23:01 +0000)]
Add a query to tell if a landing pad has a catch-all.

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

11 years agoMove the DIFile in DISubprogram to the beginning to be a common prefix along with...
David Blaikie [Thu, 21 Mar 2013 22:29:36 +0000 (22:29 +0000)]
Move the DIFile in DISubprogram to the beginning to be a common prefix along with other DIScopes

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

11 years ago<rdar://problem/13477190> On Darwin, use DARWIN_USER_TEMP_DIR or DARWIN_USER_CACHE_DI...
Douglas Gregor [Thu, 21 Mar 2013 21:46:10 +0000 (21:46 +0000)]
<rdar://problem/13477190> On Darwin, use DARWIN_USER_TEMP_DIR or DARWIN_USER_CACHE_DIR for the system temporary directory.

The DARWIN_USER_TEMP_DIR and DARWIN_USER_CACHE_DIR configuration
settings are more idiomatic for Darwin than the TMPDIR environment
variable.

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

11 years agoThis patch enables the Mips .set directive to define aliases
Jack Carter [Thu, 21 Mar 2013 21:44:16 +0000 (21:44 +0000)]
This patch enables the Mips .set directive to define aliases

The .set directive in the Mips the assembler can be
used to set the value of a symbol to an expression.
This changes the symbol's value and type to conform
to the expression's.

Syntax: .set symbol, expression

This patch implements the parsing of the above syntax
and enables the parser to use defined symbols when
parsing operands.

Contributor: Vladimir Medic

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

11 years agoImplement builtin_{setjmp/longjmp} on PPC
Hal Finkel [Thu, 21 Mar 2013 21:37:52 +0000 (21:37 +0000)]
Implement builtin_{setjmp/longjmp} on PPC

This implements SJLJ lowering on PPC, making the Clang functions
__builtin_{setjmp/longjmp} functional on PPC platforms. The implementation
strategy is similar to that on X86, with the exception that a branch-and-link
variant is used to get the right jump address. Credit goes to Bill Schmidt for
suggesting the use of the unconditional bcl form (instead of the regular bl
instruction) to limit return-address-cache pollution.

Benchmarking the speed at -O3 of:

static jmp_buf env_sigill;

void foo() {
                __builtin_longjmp(env_sigill,1);
}

main() {
...

        for (int i = 0; i < c; ++i) {
                if (__builtin_setjmp(env_sigill)) {
                        goto done;
                } else {
                        foo();
                }

done:;
        }

...
}

vs. the same code using the libc setjmp/longjmp functions on a P7 shows that
this builtin implementation is ~4x faster with Altivec enabled and ~7.25x
faster with Altivec disabled. This comparison is somewhat unfair because the
libc version must also save/restore the VSX registers which we don't yet
support.

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

11 years agoFix Darwin NEON FP and increase coverage
Renato Golin [Thu, 21 Mar 2013 21:30:49 +0000 (21:30 +0000)]
Fix Darwin NEON FP and increase coverage

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

11 years agoRemove unused field in DISubprogram
David Blaikie [Thu, 21 Mar 2013 20:28:52 +0000 (20:28 +0000)]
Remove unused field in DISubprogram

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

11 years agoAdd support for spilling VRSAVE on PPC
Hal Finkel [Thu, 21 Mar 2013 19:03:21 +0000 (19:03 +0000)]
Add support for spilling VRSAVE on PPC

Although there is only one Altivec VRSAVE register, it is a member of
a register class, and we need the ability to spill it. Because this
register is normally callee-preserved and handled by special code this
has never before been necessary. However, this capability will be required by
a forthcoming commit adding SjLj support.

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

11 years agoCorrect PPC FRAMEADDR lowering using a pseudo-register
Hal Finkel [Thu, 21 Mar 2013 19:03:19 +0000 (19:03 +0000)]
Correct PPC FRAMEADDR lowering using a pseudo-register

The old code used to lower FRAMEADDR tried to replicate the logic in the real
frame-lowering code that determines whether or not the frame pointer (r31) will
be used. When it seemed as through the frame pointer would not be used, the
stack pointer (r1) was used instead. Unfortunately, because the stack size is
not yet known, this does not work. Instead, this change introduces new
always-reserved pseudo-registers (FP and FP8) that are replaced during prologue
insertion with the real frame-pointer register (either r1 or r31).

It is important that this intrinsic always return a valid frame address because
it is used by Clang to store the frame address as part of code generation for
__builtin_setjmp.

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

11 years agoAvoid NEON SP-FP unless unsafe-math or Darwin
Renato Golin [Thu, 21 Mar 2013 18:47:47 +0000 (18:47 +0000)]
Avoid NEON SP-FP unless unsafe-math or Darwin

NEON is not IEEE 754 compliant, so we should avoid lowering single-precision
floating point operations with NEON unless unsafe-math is turned on. The
equivalent VFP instructions are IEEE 754 compliant, but in some cores they're
much slower, so some archs/OSs might still request it to be on by default,
such as Swift and Darwin.

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

11 years agoUpdate some EH tests that were violating the new EH model.
Bill Wendling [Thu, 21 Mar 2013 18:30:10 +0000 (18:30 +0000)]
Update some EH tests that were violating the new EH model.

The landingpad instruction needs to be the first non-PHI instruction in the
unwind destination block.

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

11 years agoHoist the definition of getTypeSizeInBits to be inlinable and in the
Chandler Carruth [Thu, 21 Mar 2013 09:52:22 +0000 (09:52 +0000)]
Hoist the definition of getTypeSizeInBits to be inlinable and in the
header.

This method is called in the hot path for *many* passes, SROA is what
caught my interest. A common pattern is that which branch of the switch
should be taken is known in the callsite and so it is a very good
candidate for inlining and simplification. Moving it into the header
allows the optimizer to fold a lot of boring, repeatitive code in
callers of this routine.

I'm seeing pretty significant speedups in parts of SROA and I suspect
other passes will see similar speedups if they end up working with type
sizes frequently. I've not seen any significant growth of the binaries
as a consequence, but let me know if you see anything suspicious here.

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

11 years ago[SROA] Prefix names using a custom IRBuilder inserter.
Chandler Carruth [Thu, 21 Mar 2013 09:52:18 +0000 (09:52 +0000)]
[SROA] Prefix names using a custom IRBuilder inserter.

The key part of this is ensuring that name prefixes remain in a Twine
form until we get to a point where we can nuke them under NDEBUG. This
is tricky using the old APIs as they played fast and loose with Twine,
which is prone to serious error. The inserter is much cleaner as it is
actually in the call stack leading to the setName call, and so has
a good opportunity to prepend the prefix.

This matters more than you might imagine because most runs over an
alloca find a single partition, and rewrite 3 or 4 instructions
referring to it. As a consequence doing this lazily and exclusively with
Twine allows the optimizer to delete more of it and shaves another 2% to
3% off of the release build's SROA run time for PR15412. I also think
the APIs are cleaner, and the use of Twine is more reliable, so
I consider it a win-win despite the churn required to reach this state.

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

11 years ago[msan] Add an option to disable poisoning of shadow for undef values.
Evgeniy Stepanov [Thu, 21 Mar 2013 09:38:26 +0000 (09:38 +0000)]
[msan] Add an option to disable poisoning of shadow for undef values.

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

11 years agosimplify-libcalls: Removed unused variable
Meador Inge [Thu, 21 Mar 2013 02:44:07 +0000 (02:44 +0000)]
simplify-libcalls: Removed unused variable

The 'Modified' variable should have been removed from SimplifyLibCalls
in r177619, but was missed.  This commit removes it.

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

11 years agoFix missing std::. Not sure how this compiles for anyone else.
Matt Arsenault [Thu, 21 Mar 2013 00:57:21 +0000 (00:57 +0000)]
Fix missing std::. Not sure how this compiles for anyone else.

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

11 years agoMove library call prototype attribute inference to functionattrs
Meador Inge [Thu, 21 Mar 2013 00:55:59 +0000 (00:55 +0000)]
Move library call prototype attribute inference to functionattrs

The simplify-libcalls pass implemented a doInitialization hook to infer
function prototype attributes for well-known functions.  Given that the
simplify-libcalls pass is going away *and* that the functionattrs pass
is already in place to deduce function attributes, I am moving this logic
to the functionattrs pass.  This approach was discussed during patch
review:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121126/157465.html.

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

11 years agoRemoving unused DISubprogram::getFile
David Blaikie [Thu, 21 Mar 2013 00:10:31 +0000 (00:10 +0000)]
Removing unused DISubprogram::getFile

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

11 years agoAdd a WriteMicrocoded for ancient microcoded instructions.
Jakob Stoklund Olesen [Thu, 21 Mar 2013 00:07:17 +0000 (00:07 +0000)]
Add a WriteMicrocoded for ancient microcoded instructions.

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

11 years agoDebug info: refactor the first field of DICompileUnit to be a raw file/directory...
David Blaikie [Wed, 20 Mar 2013 23:58:12 +0000 (23:58 +0000)]
Debug info: refactor the first field of DICompileUnit to be a raw file/directory pair

This removes the DICompileUnit special case from DIScope.

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

11 years agoUse pre-inc, pre-dec when possible.
Jakub Staszak [Wed, 20 Mar 2013 23:56:19 +0000 (23:56 +0000)]
Use pre-inc, pre-dec when possible.
They are generally faster (at least not slower) than post-inc, post-dec.

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

11 years agoRemove 'else' after 'return'.
Jakub Staszak [Wed, 20 Mar 2013 23:53:45 +0000 (23:53 +0000)]
Remove 'else' after 'return'.

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

11 years ago[lit] Avoid CRLFs in bash scripts on Windows
Reid Kleckner [Wed, 20 Mar 2013 23:32:14 +0000 (23:32 +0000)]
[lit] Avoid CRLFs in bash scripts on Windows

Native Windows Python will do line ending translation by default, which
we don't want in bash scripts.  If we're not native Windows Python, then
'b' is ignored.

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

11 years agoMake variable name more explicit and eliminate redundant lookup in SDNodeOrdering
Justin Holewinski [Wed, 20 Mar 2013 23:10:59 +0000 (23:10 +0000)]
Make variable name more explicit and eliminate redundant lookup in SDNodeOrdering

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

11 years agoModel prefetches and barriers as loads.
Jakob Stoklund Olesen [Wed, 20 Mar 2013 23:09:53 +0000 (23:09 +0000)]
Model prefetches and barriers as loads.

It's not yet clear if these instructions need a more careful model.

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

11 years agoAdd a catch-all WriteSystem SchedWrite type.
Jakob Stoklund Olesen [Wed, 20 Mar 2013 23:09:50 +0000 (23:09 +0000)]
Add a catch-all WriteSystem SchedWrite type.

This is used for all the expensive system instructions.

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

11 years agoWhen computing the demanded bits of Load SDNodes, make sure that we are looking at...
Nadav Rotem [Wed, 20 Mar 2013 22:53:44 +0000 (22:53 +0000)]
When computing the demanded bits of Load SDNodes, make sure that we are looking at the loaded-value operand and not the ptr result (in case of pre-inc loads).
rdar://13348420

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

11 years agoDebug Info: Swap the 2nd and 3rd parameters to DICompileUnit to match the common...
David Blaikie [Wed, 20 Mar 2013 22:52:54 +0000 (22:52 +0000)]
Debug Info: Swap the 2nd and 3rd parameters to DICompileUnit to match the common DIScope prefix

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

11 years agoAnnotate the remaining SSE MOV instructions.
Jakob Stoklund Olesen [Wed, 20 Mar 2013 22:37:16 +0000 (22:37 +0000)]
Annotate the remaining SSE MOV instructions.

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

11 years agoAnnotate SSE horizontal and integer instructions.
Jakob Stoklund Olesen [Wed, 20 Mar 2013 22:37:13 +0000 (22:37 +0000)]
Annotate SSE horizontal and integer instructions.

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

11 years agoRemove unused field in DICompileUnit
David Blaikie [Wed, 20 Mar 2013 22:34:33 +0000 (22:34 +0000)]
Remove unused field in DICompileUnit

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

11 years agoCorrect cost model for vector shift on AVX2
Michael Liao [Wed, 20 Mar 2013 22:01:10 +0000 (22:01 +0000)]
Correct cost model for vector shift on AVX2

- After moving logic recognizing vector shift with scalar amount from
  DAG combining into DAG lowering, we declare to customize all vector
  shifts even vector shift on AVX is legal. As a result, the cost model
  needs special tuning to identify these legal cases.

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

11 years agoRemove trailing spaces.
Jakub Staszak [Wed, 20 Mar 2013 21:47:51 +0000 (21:47 +0000)]
Remove trailing spaces.

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

11 years agoCall the new llvm_gcov_init function to register the environment.
Bill Wendling [Wed, 20 Mar 2013 21:13:59 +0000 (21:13 +0000)]
Call the new llvm_gcov_init function to register the environment.

Use the new `llvm_gcov_init' function to register the writeout and flush
functions. The initialization function will also call `atexit' for some cleanups
and final writout calls. But it does this only once. This is better than
checking for the `main' function, because in a library that function may not
exist.
<rdar://problem/12439551>

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

11 years agominor code style cleanup.
Chris Lattner [Wed, 20 Mar 2013 21:04:53 +0000 (21:04 +0000)]
minor code style cleanup.

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

11 years agoxlC doesn't like Header being both a type and a member variable. Rename the
Rafael Espindola [Wed, 20 Mar 2013 21:03:41 +0000 (21:03 +0000)]
xlC doesn't like Header being both a type and a member variable. Rename the
member variable.

Patch by Kai <kai@redstar.de>

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

11 years agoAdd std prefixes to fix the build with xlc.
Rafael Espindola [Wed, 20 Mar 2013 21:00:22 +0000 (21:00 +0000)]
Add std prefixes to fix the build with xlc.
Patch by Kai <kai@redstar.de>.

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

11 years agoMake sure TableGen exits with an error code after printing errors.
Jakob Stoklund Olesen [Wed, 20 Mar 2013 20:43:11 +0000 (20:43 +0000)]
Make sure TableGen exits with an error code after printing errors.

This makes it possible to report multiple errors in one invocation.
There are already calls to PrintError in CodeGenDAGPatterns.cpp which
previously would not cause TableGen to fail.

<rdar://problem/13463339>

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

11 years agoRefactor file/directory path in namespace debug info to refer directly to the pair...
David Blaikie [Wed, 20 Mar 2013 19:39:15 +0000 (19:39 +0000)]
Refactor file/directory path in namespace debug info to refer directly to the pair rather than the DIFile

(paired to a Clang test - excuse the buildbot skew/fallout)

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

11 years agoEnhance debug info namespace test to check for context/scope reference
David Blaikie [Wed, 20 Mar 2013 19:14:16 +0000 (19:14 +0000)]
Enhance debug info namespace test to check for context/scope reference

The differing file (due to the #line directive in the original source) is for
future testing improvements coming soon.

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

11 years agoRemove blank line before block comment.
Eric Christopher [Wed, 20 Mar 2013 18:25:12 +0000 (18:25 +0000)]
Remove blank line before block comment.

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

11 years agoDIBuilder: allow linkage name to be specified for global variables
David Blaikie [Wed, 20 Mar 2013 17:49:48 +0000 (17:49 +0000)]
DIBuilder: allow linkage name to be specified for global variables

Patch by Kai Nacke (kai@redstar.de)

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

11 years agoMake target-specific test case in r177474 only run when that target is built
David Blaikie [Wed, 20 Mar 2013 17:39:02 +0000 (17:39 +0000)]
Make target-specific test case in r177474 only run when that target is built

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

11 years agoAdd timing of the IR parsing code with a new -time-ir-parsing flag
Eli Bendersky [Wed, 20 Mar 2013 17:00:25 +0000 (17:00 +0000)]
Add timing of the IR parsing code with a new -time-ir-parsing flag

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

11 years agoAdd some missing SSE annotations.
Jakob Stoklund Olesen [Wed, 20 Mar 2013 16:56:39 +0000 (16:56 +0000)]
Add some missing SSE annotations.

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

11 years agoAnnotate remaining IIC_BIN_* instructions.
Jakob Stoklund Olesen [Wed, 20 Mar 2013 16:56:36 +0000 (16:56 +0000)]
Annotate remaining IIC_BIN_* instructions.

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

11 years agoRevert "pre-RA-sched: fix TargetOpcode usage"
Christian Konig [Wed, 20 Mar 2013 15:43:00 +0000 (15:43 +0000)]
Revert "pre-RA-sched: fix TargetOpcode usage"

This reverts commit 06091513c283c863296f01cc7c2e86b56bb50d02.

The code is obviously wrong, but the trivial fix causes
inefficient code generation on X86. Somebody with more
knowledge of the code needs to take a look here.

Signed-off-by: Christian König <christian.koenig@amd.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177529 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMove SDNode order propagation to SDNodeOrdering, which also fixes a missed
Justin Holewinski [Wed, 20 Mar 2013 14:51:01 +0000 (14:51 +0000)]
Move SDNode order propagation to SDNodeOrdering, which also fixes a missed
case of order propagation during isel.

Thanks Owen for the suggestion!

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

11 years agopre-RA-sched: fix TargetOpcode usage
Christian Konig [Wed, 20 Mar 2013 13:49:22 +0000 (13:49 +0000)]
pre-RA-sched: fix TargetOpcode usage

TargetOpcodes need to be treaded as Machine- and not ISD-Opcodes.

Signed-off-by: Christian König <christian.koenig@amd.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177518 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a silly search-and-replace goof with r177495 that only broke
Chandler Carruth [Wed, 20 Mar 2013 07:40:56 +0000 (07:40 +0000)]
Fix a silly search-and-replace goof with r177495 that only broke
non-release builds.

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

11 years ago[SROA] Don't preserve the IR names in release builds.
Chandler Carruth [Wed, 20 Mar 2013 07:30:36 +0000 (07:30 +0000)]
[SROA] Don't preserve the IR names in release builds.

This is espcially important because the new SROA pass goes to great
lengths to provide helpful names for debugging, and as a consequence
they can become very slow to render.

Good for between 5% and 15% of the SROA runtime on some slow test cases
such as the one in PR15412.

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

11 years agoMove the endif to the correct line so we don't have warnings about
Chandler Carruth [Wed, 20 Mar 2013 06:47:00 +0000 (06:47 +0000)]
Move the endif to the correct line so we don't have warnings about
unused statistics variables.

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

11 years agoIntroduce some new statistics to help track the exact behavior of the
Chandler Carruth [Wed, 20 Mar 2013 06:30:46 +0000 (06:30 +0000)]
Introduce some new statistics to help track the exact behavior of the
new SROA pass.

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

11 years agoReorder the DIFile parameter in DINameSpace
David Blaikie [Wed, 20 Mar 2013 06:27:06 +0000 (06:27 +0000)]
Reorder the DIFile parameter in DINameSpace

Moving the DIFile parameter to immediately proceed the tag so that it will be a
common prefix with other DIScopes (once the DIFile is replaced with the raw
file/directory pair).

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

11 years agoAdd a test case for PR15318 fixed in r177472
Hao Liu [Wed, 20 Mar 2013 06:18:06 +0000 (06:18 +0000)]
Add a test case for PR15318 fixed in r177472

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

11 years agoDon't assume the test directory is writable, use %T to find a writable
Nick Lewycky [Wed, 20 Mar 2013 05:59:40 +0000 (05:59 +0000)]
Don't assume the test directory is writable, use %T to find a writable
directory.

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

11 years agoTest DW_TAG_namespace support in the backend
David Blaikie [Wed, 20 Mar 2013 05:15:37 +0000 (05:15 +0000)]
Test DW_TAG_namespace support in the backend

This is the backend portion of a Clang test case
(clang/test/CodeGenCXX/debug-info-namespace.cpp) that was roughly/coarsely
testing LLVM.

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

11 years agoProvide more details for DINameSpace debug info in the IR comment annotations
David Blaikie [Wed, 20 Mar 2013 05:14:14 +0000 (05:14 +0000)]
Provide more details for DINameSpace debug info in the IR comment annotations

Sorry for the version skew - I should've committed this before the
corresponding Clang test case.

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

11 years agoFix PR15296
Michael Liao [Wed, 20 Mar 2013 02:33:21 +0000 (02:33 +0000)]
Fix PR15296

- Move SRA/SRL/SHL lowering support from DAG combination to DAG lowering
  to support extended 256-bit integer in AVX but not AVX2.

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

11 years agoMark all variable shifts needing customizing
Michael Liao [Wed, 20 Mar 2013 02:28:20 +0000 (02:28 +0000)]
Mark all variable shifts needing customizing

- Prepare moving logic from DAG combining into DAG lowering. There's no
  functionality change.

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

11 years agoMove scalar immediate shift lowering into a dedicated func
Michael Liao [Wed, 20 Mar 2013 02:20:36 +0000 (02:20 +0000)]
Move scalar immediate shift lowering into a dedicated func

- no functionality change

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

11 years agoFix test case regression on ARM & PPC introduced r177239
David Blaikie [Wed, 20 Mar 2013 01:55:11 +0000 (01:55 +0000)]
Fix test case regression on ARM & PPC introduced r177239

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

11 years agoFix AsmPrinter crashes with assertion. Bug 15318 in Bugzilla
Hao Liu [Wed, 20 Mar 2013 01:46:36 +0000 (01:46 +0000)]
Fix AsmPrinter crashes with assertion. Bug 15318 in Bugzilla

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

11 years agoRefactor the DIFile (2nd) parameter to DITypes to be an MDNode reference to a raw...
David Blaikie [Wed, 20 Mar 2013 00:26:26 +0000 (00:26 +0000)]
Refactor the DIFile (2nd) parameter to DITypes to be an MDNode reference to a raw directory/file pair

This makes DIType's first non-tag parameter the same as DIFile's, allowing them
to both share the common implementation of getFilename/getDirectory in DIScope.

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

11 years agoPropagate DAG node ordering during type legalization and instruction selection
Justin Holewinski [Wed, 20 Mar 2013 00:10:32 +0000 (00:10 +0000)]
Propagate DAG node ordering during type legalization and instruction selection

A node's ordering is only propagated during legalization if (a) the new node does
not have an ordering (is not a CSE'd node), or (b) the new node has an ordering
that is higher than the node being legalized.

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

11 years agoFix pr13145 - Naming a function like a register name confuses the asm parser.
Chad Rosier [Tue, 19 Mar 2013 23:44:03 +0000 (23:44 +0000)]
Fix pr13145 - Naming a function like a register name confuses the asm parser.
Patch by Stepan Dyatkovskiy <stpworld@narod.ru>
rdar://13457826

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

11 years agoMove the DIFile operand to DITypes from the 4th operand to the 2nd.
David Blaikie [Tue, 19 Mar 2013 23:25:22 +0000 (23:25 +0000)]
Move the DIFile operand to DITypes from the 4th operand to the 2nd.

This is another step along the way to making all DIScopes have a common prefix
which can be added to in a general manner to support using directives
(DW_TAG_imported_module).

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

11 years agoAnnotate various null idioms with SchedRW lists.
Jakob Stoklund Olesen [Tue, 19 Mar 2013 23:23:31 +0000 (23:23 +0000)]
Annotate various null idioms with SchedRW lists.

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

11 years agoAnnotate SSE float conversions with SchedRW lists.
Jakob Stoklund Olesen [Tue, 19 Mar 2013 23:23:29 +0000 (23:23 +0000)]
Annotate SSE float conversions with SchedRW lists.

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

11 years agoAnnotate X86InstrCMovSetCC.td with SchedRW lists.
Jakob Stoklund Olesen [Tue, 19 Mar 2013 23:23:26 +0000 (23:23 +0000)]
Annotate X86InstrCMovSetCC.td with SchedRW lists.

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

11 years agoFormatting fixups.
Eric Christopher [Tue, 19 Mar 2013 23:10:26 +0000 (23:10 +0000)]
Formatting fixups.

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

11 years agoDead code.
Chad Rosier [Tue, 19 Mar 2013 22:13:05 +0000 (22:13 +0000)]
Dead code.

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

11 years agoDead code.
Chad Rosier [Tue, 19 Mar 2013 22:12:47 +0000 (22:12 +0000)]
Dead code.

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

11 years ago[ms-inline asm] Move the immediate asm rewrite into the target specific
Chad Rosier [Tue, 19 Mar 2013 21:58:18 +0000 (21:58 +0000)]
[ms-inline asm] Move the immediate asm rewrite into the target specific
logic as a QOI cleanup.  No functional change.  Tests already in place.
rdar://13456414

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

11 years agoUpdate global merge pass according to Duncan's advices:
Quentin Colombet [Tue, 19 Mar 2013 21:46:49 +0000 (21:46 +0000)]
Update global merge pass according to Duncan's advices:
- Remove useless includes
- Change misleading comments
- Move code into doFinalization

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

11 years agoAnnotate X86InstrCompiler.td with SchedRW lists.
Jakob Stoklund Olesen [Tue, 19 Mar 2013 21:16:56 +0000 (21:16 +0000)]
Annotate X86InstrCompiler.td with SchedRW lists.

Add a new WriteZero SchedWrite type for the common dependency-breaking
instructions that clear a register.

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

11 years ago[ms-inline asm] Remove the brackets from X86Operand in the IR. These will be
Chad Rosier [Tue, 19 Mar 2013 21:12:14 +0000 (21:12 +0000)]
[ms-inline asm] Remove the brackets from X86Operand in the IR. These will be
added back in by X86AsmPrinter::printIntelMemReference() during codegen.
Previously, this following example

  void t() {
    int i;
    __asm mov eax, [i]
  }

would generate the below assembly

  mov eax, dword ptr [[eax]]

which resulted in a fatal error when compiling.  Test case coming on the
clang side.
rdar://13444264

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

11 years ago[ms-inline asm] Create a helper function, CreateMemForInlineAsm, that creates
Chad Rosier [Tue, 19 Mar 2013 21:11:56 +0000 (21:11 +0000)]
[ms-inline asm] Create a helper function, CreateMemForInlineAsm, that creates
an X86Operand, but also performs a Sema lookup and adds the sizing directive
when appropriate.  Use this when parsing a bracketed statement.  This is
necessary to get the instruction matching correct as well.  Test case coming
on clang side.
rdar://13455408

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

11 years agoRegister the GCOV writeout functions so that they're emitted serially.
Bill Wendling [Tue, 19 Mar 2013 21:03:22 +0000 (21:03 +0000)]
Register the GCOV writeout functions so that they're emitted serially.

We don't want to write out >1000 files at the same time. That could make things
prohibitively expensive. Instead, register the "writeout" function so that it's
emitted serially.
<rdar://problem/12439551>

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

11 years agoAdd a comment to the CodeGen/PowerPC/asym-regclass-copy.ll test
Hal Finkel [Tue, 19 Mar 2013 20:22:32 +0000 (20:22 +0000)]
Add a comment to the CodeGen/PowerPC/asym-regclass-copy.ll test

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

11 years agoIndVarSimplify: do not recompute an IV value outside of the loop if :
Arnaud A. de Grandmaison [Tue, 19 Mar 2013 20:00:22 +0000 (20:00 +0000)]
IndVarSimplify: do not recompute an IV value outside of the loop if :

- it is trivially known to be used inside the loop in a way that can not be optimized away
- there is no use outside of the loop which can take advantage of the computation hoisting

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

11 years agoAdd missing mayLoad flag to LHAUX8 and LWAUX.
Ulrich Weigand [Tue, 19 Mar 2013 19:53:27 +0000 (19:53 +0000)]
Add missing mayLoad flag to LHAUX8 and LWAUX.

All pre-increment load patterns need to set the mayLoad flag (since
they don't provide a DAG pattern).

This was missing for LHAUX8 and LWAUX, which is added by this patch.

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

11 years agoRewrite LHAU8 pattern to use standard memory operand.
Ulrich Weigand [Tue, 19 Mar 2013 19:52:30 +0000 (19:52 +0000)]
Rewrite LHAU8 pattern to use standard memory operand.

As opposed to to pre-increment store patterns, the pre-increment
load patterns were already using standard memory operands, with
the sole exception of LHAU8.

As there's no real reason why LHAU8 should be different here,
this patch simply rewrites the pattern to also use a memri
operand, just like all the other patterns.

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

11 years agoRewrite pre-increment store patterns to use standard memory operands.
Ulrich Weigand [Tue, 19 Mar 2013 19:52:04 +0000 (19:52 +0000)]
Rewrite pre-increment store patterns to use standard memory operands.

Currently, pre-increment store patterns are written to use two separate
operands to represent address base and displacement:

  stwu $rS, $ptroff($ptrreg)

This causes problems when implementing the assembler parser, so this
commit changes the patterns to use standard (complex) memory operands
like in all other memory access instruction patterns:

  stwu $rS, $dst

To still match those instructions against the appropriate pre_store
SelectionDAG nodes, the patch uses the new feature that allows a Pat
to match multiple DAG operands against a single (complex) instruction
operand.

Approved by Hal Finkel.

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

11 years agoExtend TableGen instruction selection matcher to improve handling
Ulrich Weigand [Tue, 19 Mar 2013 19:51:09 +0000 (19:51 +0000)]
Extend TableGen instruction selection matcher to improve handling
of complex instruction operands (e.g. address modes).

Currently, if a Pat pattern creates an instruction that has a complex
operand (i.e. one that consists of multiple sub-operands at the MI
level), this operand must match a ComplexPattern DAG pattern with the
correct number of output operands.

This commit extends TableGen to alternatively allow match a complex
operands against multiple separate operands at the DAG level.

This allows using Pat patterns to match pre-increment nodes like
pre_store (which must have separate operands at the DAG level) onto
an instruction pattern that uses a multi-operand memory operand,
like the following example on PowerPC (will be committed as a
follow-on patch):

  def STWU  : DForm_1<37, (outs ptr_rc:$ea_res), (ins GPRC:$rS, memri:$dst),
                    "stwu $rS, $dst", LdStStoreUpd, []>,
                    RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">;

  def : Pat<(pre_store GPRC:$rS, ptr_rc:$ptrreg, iaddroff:$ptroff),
            (STWU GPRC:$rS, iaddroff:$ptroff, ptr_rc:$ptrreg)>;

Here, the pair of "ptroff" and "ptrreg" operands is matched onto the
complex operand "dst" of class "memri" in the "STWU" instruction.

Approved by Jakob Stoklund Olesen.

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