Commit Graph

5888 Commits

Author SHA1 Message Date
Chris Lattner
3f53c8398d clean up the asmprinter header and privatize some stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100342 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 18:52:31 +00:00
Jakob Stoklund Olesen
bbef815a3b Switch SSEDomainFix to SpecificBumpPtrAllocator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100332 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 18:00:21 +00:00
Chris Lattner
b23569aff0 Momentous day: remove the "O" member from AsmPrinter. Now all
"asm printering" happens through MCStreamer.  This also 
Streamerizes PIC16 debug info, which escaped my attention.

This removes a leak from LLVMTargetMachine of the 'legacy'
output stream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100327 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 08:18:47 +00:00
Chris Lattner
1ce3f565ef streamerize printing of dbg_value, the x86 backend is now fully
streamerized for everything.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100316 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 05:40:34 +00:00
Chris Lattner
bfbab35653 split DEBUG_VALUE printing stuff out to its own method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100315 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 05:38:19 +00:00
Chris Lattner
c82d9c4e5c mc'ize elf stub printing, convert cygwin stuff to EmitRawText,
which will abort in .o file writing mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 05:35:04 +00:00
Chris Lattner
c75c028a15 fix PrintAsmOperand and PrintAsmMemoryOperand to pass down
raw_ostream to print to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100313 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 05:29:35 +00:00
Chris Lattner
e812d4c604 use predicates in DBG_VALUE printing code to simplify it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100312 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 05:21:31 +00:00
Chris Lattner
88db786712 remove more implicit uses of "O".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100311 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 05:19:20 +00:00
Chris Lattner
d374087be5 fix an ugly wart in the MCInstPrinter api where the
raw_ostream to print an instruction to had to be specified
at MCInstPrinter construction time instead of being able
to pick at each call to printInstruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100307 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 05:04:31 +00:00
Chris Lattner
35c33bd772 change a ton of code to not implicitly use the "O" raw_ostream
member of AsmPrinter.  Instead, pass it in explicitly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 04:47:45 +00:00
Mon P Wang
20adc9dc46 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 03:10:48 +00:00
Chris Lattner
0c08d09204 asmstreamerize the .size directive for function bodies, force clients
of printOffset to pass in a stream to print to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 22:28:33 +00:00
Eric Christopher
b3500fd2f3 Rewrite aesimc handling. It only takes a single input and has a single
dest.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100252 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 23:48:33 +00:00
Eric Christopher
6d1cd1cd04 Separate out the AES-NI instructions from the SSE4.2 instructions. Add
a new subtarget option for AES and check for the support.  Add "westmere"
line of processors and add AES-NI support to the core i7.

Add a couple of TODOs for information I couldn't verify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 21:54:27 +00:00
Sean Callanan
a144c3f34d Fixes to the X86 disassembler. The disassembler will now
return an error status in all failure cases, printing
messages to debugs() only when debugging is enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100229 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 21:23:51 +00:00
Chris Lattner
c7f3ace20c use DebugLoc default ctor instead of DebugLoc::getUnknownLoc()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100214 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 20:16:16 +00:00
Evan Cheng
f28f8bc40e Correctly lower memset / memcpy of undef. It should be a nop. PR6767.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100208 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 19:36:14 +00:00
Mon P Wang
e754d3fb85 Revert r100191 since it breaks objc in clang
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 18:43:02 +00:00
Mon P Wang
e33c848fa4 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 18:04:15 +00:00
Eric Christopher
906af6f518 Remove FIXME - if there's a better way to do this it isn't here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100176 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 04:32:37 +00:00
Dale Johannesen
93d6a7e9c2 Teach AnalyzeBranch, RemoveBranch and the branch
folder to be tolerant of debug info following the
branch(es) at the end of a block.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100168 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 01:38:09 +00:00
Chandler Carruth
ae1d41c8ae Disambiguate conditional expression for newer GCCs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100167 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 01:31:24 +00:00
Eric Christopher
1d8f83d0a0 Revert r100143.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 22:54:42 +00:00
Evan Cheng
3ea97550e3 In 64-bit mode, use i64 to lower memcpy / memset instead of f64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 20:27:45 +00:00
Evan Cheng
42642d06c9 Add comments about DstAlign and SrcAlign.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 20:10:42 +00:00
Evan Cheng
94107ba9ce - Avoid using floating point stores to implement memset unless the value is zero.
- Do not try to infer GV alignment unless its type is sized. It's not possible to infer alignment if it has opaque type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100118 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 18:19:11 +00:00
Evan Cheng
255f20f7f7 Fix sdisel memcpy, memset, memmove lowering:
1. Makes it possible to lower with floating point loads and stores.
2. Avoid unaligned loads / stores unless it's fast.
3. Fix some memcpy lowering logic bug related to when to optimize a
   load from constant string into a constant.
4. Adjust x86 memcpy lowering threshold to make it more sane.
5. Fix x86 target hook so it uses vector and floating point memory
   ops more effectively.
rdar://7774704


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 06:04:33 +00:00
Evan Cheng
48c58bb861 Nehalem unaligned memory access is fast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 05:58:17 +00:00
Eric Christopher
ec306a9771 Add aeskeygenassist intrinsic and rename all of the aes intrinsics to
aes instead of sse4.2.  Add a brief todo for a subtarget flag and rework
the aeskeygenassist instruction to more closely match the docs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 03:05:45 +00:00
Chris Lattner
563d83ff53 reduce indentation, minor cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 20:32:51 +00:00
Jakob Stoklund Olesen
85ffee2c78 Use spaces, not tabs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100037 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 20:05:12 +00:00
Bill Wendling
d93bf04a07 Comment the changes for r98218 and friends inside the source code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100033 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 18:48:58 +00:00
Jakob Stoklund Olesen
5f282b5dfd Fix PR6750. Don't try to merge a DomainValue with itself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100016 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 17:13:16 +00:00
Jakob Stoklund Olesen
d363b4ebc7 Replace V_SET0 with variants for each SSE execution domain.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99975 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 00:40:13 +00:00
Jakob Stoklund Olesen
b16df90b48 Fix typo. Thank you, valgrind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 00:40:08 +00:00
Jakob Stoklund Olesen
bfcd61b907 Enable -sse-domain-fix by default. Now with tests!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99954 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 22:47:00 +00:00
Jakob Stoklund Olesen
428e152469 V_SETALLONES is an integer instruction.
Since it is just a pxor in disguise, we should probably expand it to a full
polymorphic triple.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 22:46:55 +00:00
Jakob Stoklund Olesen
357be7f289 Renumber SSE execution domains for better code size.
SSEDomainFix will collapse to the domain with the lower number when it has a
choice. The SSEPackedSingle domain often has smaller instructions, so prefer
that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 22:46:53 +00:00
Bob Wilson
100f090add Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99948 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 22:27:04 +00:00
Jakob Stoklund Olesen
adffc9d20e Revert "Enable -sse-domain-fix by default. What could possibly go wrong?"
Not running 'make check-all' before committing is a bad idea.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 21:36:32 +00:00
Jakob Stoklund Olesen
90b9df4e6f Enable -sse-domain-fix by default. What could possibly go wrong?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 21:09:31 +00:00
Mon P Wang
808bab0169 Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
A update of langref will occur in a subsequent checkin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 20:55:56 +00:00
Jakob Stoklund Olesen
1a5d2a8fa1 Add cross-block inference to SSEDomainFix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99916 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 20:04:01 +00:00
Eric Christopher
8258d0b4bf Remove the pmulld intrinsic and autoupdate it as a vector multiply.
Rewrite the pmulld patterns, and make sure that they fold in loads of
arguments into the instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99910 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 18:49:01 +00:00
Chris Lattner
9b97a73ded Rip out the 'is temporary' nonsense from the MCContext interface to
create symbols.  It is extremely error prone and a source of a lot
of the remaining integrated assembler bugs on x86-64.

This fixes rdar://7807601.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 18:10:53 +00:00
Eric Christopher
4bd24c257e Add FIXME for operand promotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99859 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 01:04:59 +00:00
Jakob Stoklund Olesen
d77f8181b4 Be gentle to MSVC. C++ is hard, after all.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 00:09:32 +00:00
Jakob Stoklund Olesen
e4b94b4efb Basic implementation of SSEDomainFix pass.
Cross-block inference is primitive and wrong, but the pass is working otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99848 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-29 23:24:21 +00:00
Benjamin Kramer
34247a0f35 Make isInt?? and isUint?? template specializations of the generic versions. This
makes calls a little bit more consistent and allows easy removal of the
specializations in the future. Convert all callers to the templated functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99838 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-29 21:13:41 +00:00
Eric Christopher
545d3b18d5 We'll never match these as instructions, just as intrinsics so remove
the SDNodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99835 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-29 20:41:51 +00:00
Chris Lattner
dc7500bbaf zap an extra line that Eli noticed!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-28 18:52:28 +00:00
Chris Lattner
6269b6c9cb remove a pattern with no testcase that doesn't appear to be
matchable: it seems like it would always constant fold.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99758 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-28 08:40:48 +00:00
Chris Lattner
ed52c8f5f4 revert r99743, this is saying that the repmovs instructinos have an
*input* of other type, which is the VT. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99749 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-28 07:38:39 +00:00
Chris Lattner
b616c6a25d remove a bunch of dead patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99748 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-28 07:38:00 +00:00
Chris Lattner
0b5d4908dd claiming to return other is pointless.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99743 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-28 05:57:36 +00:00
Chris Lattner
d486d77444 fix some modelling problems exposed by a patch I'm working on. bsr/bsf/ptest
nodes all have an EFLAGS result when made by isel lowering.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99736 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-28 05:07:17 +00:00
Chris Lattner
baba4bb72f eliminate the last of the parallel's!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99700 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-27 02:47:14 +00:00
Chris Lattner
ec856800da eliminate almost all the rest of the x86-32 parallels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-27 00:45:04 +00:00
Evan Cheng
2c12cb47d9 Do not sibcall if stack needs to be dynamically aligned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99620 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-26 16:26:03 +00:00
Evan Cheng
3c262eec53 Allow trivial sibcall of vararg callee when no arguments are being passed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-26 02:13:13 +00:00
Daniel Dunbar
6307dd263f Fix -Asserts warning, again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 19:35:53 +00:00
Jakob Stoklund Olesen
4a2a6e73d9 Tag SSE2 integer instructions as SSEPackedInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99540 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 18:52:04 +00:00
Jakob Stoklund Olesen
70feca409e Teach TableGen to understand X.Y notation in the TSFlagsFields strings.
Remove much horribleness from X86InstrFormats as a result. Similar
simplifications are probably possible for other targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 18:52:01 +00:00
Jakob Stoklund Olesen
352aa503fa Add a late SSEDomainFix pass that twiddles SSE instructions to avoid domain crossings.
On Nehalem and newer CPUs there is a 2 cycle latency penalty on using a register
in a different domain than where it was defined. Some instructions have
equvivalents for different domains, like por/orps/orpd.

The SSEDomainFix pass tries to minimize the number of domain crossings by
changing between equvivalent opcodes where possible.

This is a work in progress, in particular the pass doesn't do anything yet. SSE
instructions are tagged with their execution domain in TableGen using the last
two bits of TSFlags. Note that not all instructions are tagged correctly. Life
just isn't that simple.

The SSE execution domain issue is very similar to the ARM NEON/VFP pipeline
issue handled by NEONMoveFixPass. This pass may become target independent to
handle both.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99524 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 17:25:00 +00:00
Bob Wilson
86afec7730 Reapply Kevin's change 94440, now that Chris has fixed the limitation on
opcode values fitting in one byte (svn r99494).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99514 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 16:36:14 +00:00
Chris Lattner
589ad5d8c2 eliminate a bunch more parallels now that scheduling
handles dead implicit results more aggressively.  More
to come, I think this is now just a data entry problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 05:44:01 +00:00
Evan Cheng
cb0f06e05c Disable folding loads into tail call in 32-bit PIC mode. It can introduce illegal code like this:
addl    $12, %esp
        popl    %esi
        popl    %edi
        popl    %ebx
        popl    %ebp
        jmpl    *__Block_deallocator-L1$pb(%esi)  # TAILCALL

The problem is the global base register is assigned GR32 register class. TCRETURNmi needs the registers making up the address mode to have the GR32_TC register class.

The *proper* fix is for X86DAGToDAGISel::getGlobalBaseReg() to return a copy from the global base register of the machine function rather than returning the register itself. But that has the potential of causing it to be coalesced to a more restrictive register class: GR32_TC. It can introduce additional copies and spills. For something as important the PIC base, it's not worth it especially since this is not an issue on 64-bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 00:10:31 +00:00
Bob Wilson
014dc4e720 Speculatively revert this to see if it fixes buildbot failures.
--- Reverse-merging r99440 into '.':
U    test/MC/AsmParser/X86/x86_32-bit_cat.s
U    test/MC/AsmParser/X86/x86_32-encoding.s
U    include/llvm/IntrinsicsX86.td
U    include/llvm/CodeGen/SelectionDAGNodes.h
U    lib/Target/X86/X86InstrSSE.td
U    lib/Target/X86/X86ISelLowering.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99450 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 23:26:29 +00:00
Kevin Enderby
760c2f34d9 Added the Advanced Encryption Standard (AES) Instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99440 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 22:33:33 +00:00
Kevin Enderby
044be39090 Fixed the SS42AI template for the SSE 4.2 instructions with TA prefix so it does
not get an "Unknown immediate size" assert failure when used.  All instructions 
of this form have an 8-bit immediate.  Also added a test case of an example
instruction that is of this form.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 22:28:42 +00:00
Nate Begeman
1449f29100 Per chris's request, add some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 22:19:06 +00:00
Nate Begeman
fdea31a463 BUILD_VECTOR was missing out on some prime opportunities to use SSE 4.1 inserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 20:49:50 +00:00
Chris Lattner
c54a2f150d Switch INC8r to defining its pattern in terms of X86inc_flag
and defining the add pattern with Pat<>, eliminating a use of
parallel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 01:02:12 +00:00
Chris Lattner
1aec4d7596 switch SDTBinaryArithWithFlags to be a multiple-result node as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99370 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 00:49:29 +00:00
Chris Lattner
74c8d67af8 Switch SDTUnaryArithWithFlags to being modeled as a two-result
ISD node.  The only change in the generated isel code are comments
like:

<                 // Src: (X86dec_flag:i16 GR16:i16:$src)
---
>                 // Src: (X86dec_flag:i16:i32 GR16:i16:$src)

because now it knows that X86dec_flag returns both an i16 (for the result)
and an i32 (for EFLAGS) in this case.  Wewt.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99369 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 00:47:47 +00:00
Chris Lattner
7e504141e0 remove 64-bit or_is_add parallels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99360 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 00:16:52 +00:00
Chris Lattner
a0f7017752 remove useless or_is_add parallel's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99359 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 00:15:23 +00:00
Chris Lattner
fdac0b66f0 reduce nesting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99358 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 00:12:57 +00:00
Jakob Stoklund Olesen
fe4b92baf1 Revert "Add a late SSEDomainFix pass that twiddles SSE instructions to avoid domain crossings."
This reverts commit 99345. It was breaking buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99352 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 23:48:51 +00:00
Jakob Stoklund Olesen
c75c5fa125 Add a late SSEDomainFix pass that twiddles SSE instructions to avoid domain crossings.
This is work in progress. So far, SSE execution domain tables are added to
X86InstrInfo, and a skeleton pass is enabled with -sse-domain-fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99345 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 23:14:44 +00:00
Evan Cheng
8d1f0dd983 Teach isSafeToClobberEFLAGS to ignore dbg_value's. We need a MachineBasicBlock::iterator that does this automatically?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 20:35:45 +00:00
Daniel Dunbar
337055e62f MC: Add TargetAsmBackend::MayNeedRelaxation, for checking whether a particular instruction + fixups might need relaxation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99249 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 03:13:05 +00:00
Daniel Dunbar
8f9b80e5df MC: Add TargetAsmBackend::WriteNopData and use to eliminate some target dependencies in MCMachOStreamer and MCAssembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 02:36:58 +00:00
Daniel Dunbar
829680048c MC: Add TargetAsmBackend::RelaxInstruction callback, and custom X86 implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99245 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 01:39:09 +00:00
Daniel Dunbar
f2de13f8d7 MC/X86: Fix an MCOperand link, when we parsing shrld $1,%eax and friends; I believe this fixes the last memory leaks under test/MC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99102 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 22:36:38 +00:00
Daniel Dunbar
5d067fe158 TargetRegistry: Fix create{AsmInfo,MCDisassembler} to return non-const objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 22:36:22 +00:00
Evan Cheng
f5b9d6cc82 If call result is in ST0 and it is not being passed to the caller's
caller, then it is not safe to optimize the call into a sibcall since
the call result has to be popped off the x87 stack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 02:58:15 +00:00
Chris Lattner
99521af212 remove the patterns that I commented out in r98930, Dan verified
that they are dead.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 21:43:36 +00:00
Kevin Enderby
b46b03b36f Fixed the encoding problems of the crc32 instructions. All had the Operand size
override prefix and only the r/m16 forms should have had that.  Also for variant
one, the AT&T syntax, added suffixes to all forms.  Also added the missing
64-bit form for 'CRC32 r64, r/m8'.  Plus added test cases for all forms and
tweaked one test case to add the needed suffixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98980 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 20:04:42 +00:00
Daniel Dunbar
0180daee02 MC/X86: Rename alternate spellings of {ADD64,CMP64} and mark as "code gen only" so they don't get selected by the asm matcher.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98972 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 18:07:48 +00:00
Daniel Dunbar
1a9158c301 MC: Add TargetAsmBackend::createObjectWriter.
- MCAssembler is now object-file independent, although we will surely need more work to fully support ELF/COFF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 10:43:26 +00:00
Daniel Dunbar
b36052f0e4 MCCodeEmitter: Add target independent fixup flag for is-pc-relative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98954 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 10:43:23 +00:00
Daniel Dunbar
cc5b84c6fb MC: Add TargetAsmBackend::isVirtualSection hook.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98950 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 09:29:03 +00:00
Daniel Dunbar
87190c473c MCAssembler: Move ApplyFixup to the TargetAsmBackend, this is a target specific not object writer specific task.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 09:28:12 +00:00
Chris Lattner
e8cabf3c2e add a new SDNPVariadic SDNP node flag, and use it in
dag isel gen instead of instruction properties.  This
allows the oh-so-useful behavior of matching a variadic
non-root node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98934 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 05:07:09 +00:00
Chris Lattner
1d7dbd1716 comment out a bunch of parallel store patterns that apparently
can't match or just have no testcases.  Will remove after 
confirmation from dan that they really are dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 04:14:21 +00:00
Daniel Dunbar
c28c7689fc X86: Fix encoding for TEST64rr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98919 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 01:15:03 +00:00
Chris Lattner
e3486a4c9a Now that tblgen can handle matching implicit defs of instructions
to input patterns, we can fix X86ISD::CMP and X86ISD::BT as taking
two inputs (which have to be the same type) and *returning an i32*.
This is how the SDNodes get made in the graph, but we weren't able
to model it this way due to deficiencies in the pattern language.

Now we can change things like this:

 def UCOM_FpIr80: FpI_<(outs), (ins RFP80:$lhs, RFP80:$rhs), CompareFP,
-                  [(X86cmp RFP80:$lhs, RFP80:$rhs),
-                   (implicit EFLAGS)]>; // CC = ST(0) cmp ST(i)
+                  [(set EFLAGS, (X86cmp RFP80:$lhs, RFP80:$rhs))]>;

and fix terrible crimes like this:

-def : Pat<(parallel (X86cmp GR8:$src1, 0), (implicit EFLAGS)),
+def : Pat<(X86cmp GR8:$src1, 0),
           (TEST8rr GR8:$src1, GR8:$src1)>;

This relies on matching the result of TEST8rr (which is EFLAGS, which is
an implicit def) to the result of X86cmp, an i32.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98903 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 00:01:11 +00:00
Eric Christopher
88dee30a6e Couple of changes that Dan mentioned for llvm.stackprotector fast-isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98881 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 21:58:33 +00:00
Daniel Dunbar
9fdac902d4 X86MCCodeEmitter: Fix two minor issues with reloc_riprel_4byte_movq_load, we
were missing it on some movq instructions and were not including the appropriate
PCrel bias.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98880 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 21:53:54 +00:00
Chris Lattner
34b8a8857c outs come before ins.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98864 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 20:50:06 +00:00
Eric Christopher
07754c2a1b Make fast-isel understand llvm.stackprotector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98862 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 20:27:26 +00:00
Daniel Dunbar
f98bc6320b MC/X86/AsmMatcher: Use the new instruction cleanup routine to implement a
temporary workaround for matching inc/dec on x86_64 to the correct instruction.
 - This hack will eventually be replaced with a robust mechanism for handling
   matching instructions based on the available target features.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 20:06:02 +00:00
Chris Lattner
618d0ed4bc fix an x86-64 encoding bug Daniel found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 20:04:36 +00:00
Chris Lattner
0f53cf2236 add a special relocation type for movq loads for object
files that produce special relocation types where the 
linker changes movq's into lea's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 18:10:56 +00:00
Chris Lattner
e10038e54e callq is pcrelative
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98835 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 17:52:22 +00:00
Benjamin Kramer
7c97ed7d07 Try to fix a valgrind error on 32 bit platforms: use %zu instead of %llu to format a size_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 12:18:36 +00:00
Evan Cheng
bdc652bab8 Turning off post-ra scheduling for x86. It isn't a consistent win.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98810 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 06:55:42 +00:00
Daniel Dunbar
0682951b4f MC/Darwin: Add a new target hook for whether the target uses "reliable" symbol differences, basically whether the assembler should attempt to understand atoms when using scattered symbols.
Also, avoid some virtual call overhead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 00:58:53 +00:00
Evan Cheng
f3caa525cc X86 address mode matching code MatchAddressRecursively does some aggressive hack which require doing a RAUW. It may end up deleting some SDNode up stream. It should avoid referencing deleted nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98780 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 23:58:35 +00:00
Chris Lattner
77e7694026 fix GetOrCreateTemporarySymbol to require a name, clients
should use CreateTempSymbol() if they don't care about the
name.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98712 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 05:41:18 +00:00
Chris Lattner
4d82068167 fix the same bug on the x86-64 side of the fence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98616 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 06:39:08 +00:00
Chris Lattner
840e6371ea fix the encoding of TAILJMPd. This fixes Benchmarks/Olden/bisort
with the integrated assembler!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98615 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 06:30:18 +00:00
Daniel Dunbar
4e815f8a8c MC: Allow modifiers in MCSymbolRefExpr, and eliminate X86MCTargetExpr.
- Although it would be nice to allow this decoupling, the assembler needs to be able to reason about MCSymbolRefExprs in too many places to make this viable. We can use a target specific encoding of the variant if this becomes an issue.
 - This patch also extends llvm-mc to support parsing of the modifiers, as opposed to lumping them in with the symbol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98592 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 23:51:06 +00:00
Dan Gohman
1bbf72b069 Recognize code for doing vector gather/scatter index calculations with
32-bit indices. Instead of shuffling each element out of the index vector,
when all indices are needed, just store the input vector to the stack and
load the elements out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98588 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 23:23:03 +00:00
Daniel Dunbar
d6e59084d0 MC/Mach-O/x86_64: Temporary labels in cstring sections require symbols (and external relocations, but we don't have x86_64 relocations yet).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98583 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 21:56:50 +00:00
Bill Wendling
505ad8bed3 Now that the default for Darwin platforms is to place the LSDA into the TEXT
section, remove the target-specific code that performs this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98580 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 21:09:38 +00:00
Chris Lattner
034721eb6a use Mang->getSymbol()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98578 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 20:37:57 +00:00
Bill Wendling
757e75b033 Place the LSDA into the TEXT section for x86 Darwin. If the global it's pointing
to is local to the translation unit, we need to place fill the value of that
symbol into the non-lazy pointer.

This should conclude all Darwin changes for placing the LSDA into the TEXT
section. There is some cleanup to do. I.e., there's no longer a special need for
target-specific code here. But that can come later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98564 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 19:04:37 +00:00
Evan Cheng
a375d47137 Avoid sibcall optimization if either caller or callee is using sret semantics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98561 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 18:54:48 +00:00
Chris Lattner
3d00578c95 fix a few more ambiguous types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 05:53:30 +00:00
Jeffrey Yasskin
f28411f732 Tell Valgrind when we modify already-executed machine code so it knows
to re-instrument the code.  We depend on the system valgrind.h to
avoid adding a new license.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98529 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 04:57:55 +00:00
Chris Lattner
1c436d0b0b no really, all 64-bit cpu's have cmov support. This should
fix the rest of the buildbot failures on non-x86 hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98522 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 22:39:35 +00:00
Chris Lattner
1f84e32ada all 64-bit cpus have cmov, this should fix CodeGen/X86/cmov.ll
(at least) on non-x86 builders.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98520 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 22:24:34 +00:00
Evan Cheng
700c71d2e8 Fix jit encoding bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98510 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 19:28:34 +00:00
Chris Lattner
da0688e08a fix PR6605, X86ISD::CMP always returns i32 (EFLAGS), not
the operand type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 18:44:35 +00:00
Chris Lattner
314a113184 add support for pentium class CPUs which do not have cmov,
PR4841.  Patch by Craig Smith!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98496 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 18:31:44 +00:00
Chris Lattner
c441e97220 comment fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98494 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 17:10:52 +00:00
Chris Lattner
166604e6ce shrink 4-byte branches to 1-byte branches when lowering from
MachineInstr -> MCInst.  This is what the assembler backend wants,
it relaxes from smaller to larger things.  This fixes rdar://7750815


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98493 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 17:04:18 +00:00
Chris Lattner
63d7836267 get MMI out of the label uniquing business, just go to MCContext
to get unique assembler temporary labels.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98489 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 08:36:50 +00:00
Chris Lattner
2e9919a5e5 Now that DBG_LABEL is updated, we can finally make MachineMove
contain an MCSymbol instead of a label index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98482 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 08:12:40 +00:00
Chris Lattner
6ffcccab51 change the DBG_LABEL MachineInstr to always be created
with an MCSymbol instead of an immediate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98481 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 07:56:48 +00:00
Chris Lattner
aba9bcb9b6 switch GC_LABEL to use an MCSymbol operand instead of a label ID operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98474 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 07:27:07 +00:00
Evan Cheng
f48ef03655 Do not force indirect tailcall through fixed registers: eax, r11. Add support to allow loads to be folded to tail call instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98465 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 03:48:46 +00:00
Chris Lattner
7561d48095 change the LabelSDNode to be EHLabelSDNode and make it hold
an MCSymbol.  Make the EH_LABEL MachineInstr hold its label
with an MCSymbol instead of ID.  Fix a bug in MMI.cpp which
would return labels named "Label4" instead of "label4".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98463 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 02:33:54 +00:00
Chris Lattner
1611273351 change EH related stuff (other than EH_LABEL) to use MCSymbol
instead of label ID's.  This cleans up and regularizes a bunch 
of code and makes way for future progress.

Unfortunately, this pointed out to me that JITDwarfEmitter.cpp
is largely copy and paste from DwarfException/MachineModuleInfo
and other places.  This is very sad and disturbing. :(

One major change here is that TidyLandingPads moved from being
called in DwarfException::BeginFunction to being called in
DwarfException::EndFunction.  There should not be any 
functionality change from doing this, but I'm not an EH expert.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98459 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 01:41:15 +00:00
Daniel Dunbar
bf2d4c034d X86_64: Fix encoding for the rest of the 64i32 instructions too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 22:57:53 +00:00
Daniel Dunbar
859c9dc867 X86: Fix ADD64i32 encoding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98457 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 22:49:39 +00:00
Chris Lattner
1b2eb0e8a6 eliminate the now-unneeded context argument of MBB::getSymbol()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98451 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 21:04:28 +00:00
Chris Lattner
11d53c129f rearrange MCContext ownership. Before LLVMTargetMachine created it
and passing off ownership to AsmPrinter.  Now MachineModuleInfo
creates it and owns it by value.  This allows us to use MCSymbols
more consistently throughout the rest of the code generator, and
simplifies a bit of code.  This also allows MachineFunction to 
keep an MCContext reference handy, and cleans up the TargetRegistry
interfaces for AsmPrinters.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98450 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 20:55:24 +00:00
Daniel Dunbar
96e2cec9c7 MC/X86_64: Fix matching of leaq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98444 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 19:31:44 +00:00
Daniel Dunbar
989ac72981 MC/X86_64: Fix matching of callq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 19:31:38 +00:00
Chris Lattner
464bee191f simplify some overly general code. The stack always grows down on x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98431 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 08:04:35 +00:00
Chris Lattner
1bd1e6db1d switch to the text section at the start of the .s file for darwin/x86
targets.  This is a temporary hack for the .o file writer that Daniel
wants :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98413 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 02:10:00 +00:00
Daniel Dunbar
d5e7705a05 MC/X86: Add temporary hack to match shrl $1,%eax correctly, to support testing
other functionality on 403.gcc compiled at -O0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 00:47:29 +00:00
Jeffrey Yasskin
150ae11976 Fix LLVM build when the user specifies CPPFLAGS on the make command line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98394 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:42:14 +00:00
Chris Lattner
70501b72cf remove special case code that isn't needed anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98391 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:21:19 +00:00
Chris Lattner
d62f1b4168 inline GetGlobalValueSymbol into the rest its callers and
remove it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:19:23 +00:00
Chris Lattner
deb0cba1ba inline the now-trivial implementation of GetGlobalValueSymbol into
some of its callers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:09:07 +00:00
Chris Lattner
b6fc4a5650 eliminate the X86 version of GetGlobalValueSymbol, allowing
it to be non-virtual and soon disappear.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:06:41 +00:00
Chris Lattner
08d04f591f prune #includes, this file should be removed pending hte cygwin stub issue being resolved.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:04:31 +00:00
Chris Lattner
8a29fa6e02 move fastcall/stdcall mangling up into Mangler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98384 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:03:47 +00:00
Daniel Dunbar
a0e36d55c4 MC: Constify MCAsmLayout argument to MCExpr::EvaluteAs...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98380 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:00:45 +00:00
Chris Lattner
3f185a72cd make DecorateCygMingName a static method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 20:43:52 +00:00
Chris Lattner
9c59268197 minor tidying, only do work if a function is
actually X86_StdCall or X86_FastCall.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98374 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 19:48:03 +00:00
Chris Lattner
c9747c05d1 eliminate the string form of DecorateCygMingName
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98373 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 19:42:40 +00:00
Chris Lattner
355670bf0f remove the FnArgWords cache to make way for future changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 19:31:03 +00:00
Bill Wendling
ec041eba38 Add a beta-test for placing the LSDA into the TEXT section on X86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98370 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 19:20:40 +00:00
Devang Patel
b45fb90b20 Fix llc crash on invalid input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98369 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 19:18:30 +00:00
Chris Lattner
1c95488880 Remove some dead code. This method only gets called on
definitions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98368 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 19:14:18 +00:00
Chris Lattner
2341f6ccf8 use Mang->getSymbol instead of duplicating the logic, reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98367 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 19:04:14 +00:00
Chris Lattner
b0f129a5d9 simplify code to use OutContext.GetOrCreateTemporarySymbol with
no arguments instead of having to come up with a unique name.
This also makes the code less fragile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 18:47:50 +00:00
Benjamin Kramer
018cbd5ddf Use StringRef::substr instead of std::string::substr to avoid using a free'd
string temporary. This should fix PR6590.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98349 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 13:54:59 +00:00
Dan Gohman
a257095ebb Remove getWidenVectorType, which is no longer used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 21:39:57 +00:00
Bill Wendling
c6678b0014 revert r98270.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98281 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 19:50:31 +00:00
Chris Lattner
3192d14076 rename getSymbolForDwarf* to getExprForDwarf* since it returns
an MCExpr and not an MCSymbol.  Change it to take an MCStreamer,
which is currently unused.

No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 19:41:58 +00:00
Evan Cheng
55282267e1 Bad bad bug. x86 force indirect tail call address into eax when it's meant to force it into a call preserved register instead. Change it to ecx for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 18:49:14 +00:00
Eric Christopher
f27805b5c5 Have fast-isel understand llvm.objectsize. Update testcase for slightly
different codegen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98244 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 06:20:22 +00:00
Daniel Dunbar
f82f4490b1 MC: Sketch initial MCAsmLayout class, which encapsulates the current layout of an assembly file. The MCAsmLayout is also available for use by MCExpr::EvaluateAs{Absolute,Relocatable}, to allow target specific hooks and "absolutizing" of symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98227 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 02:28:59 +00:00
Daniel Dunbar
23ac7c78e4 MC: Sketch some TargetAsmBackend hooks we are going to need.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98221 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 01:34:21 +00:00
Daniel Dunbar
6c27f5e574 MC: Provide the target triple to AsmBackend constructors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98220 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 01:34:16 +00:00
Chris Lattner
2968943463 add support, testcases, and dox for the new GHC calling
convention.  Patch by David Terei!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98212 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 00:22:57 +00:00
Chris Lattner
bcc5cb4061 Work around a bug in the openbsd assembler on i386,
which doesn't support .quad correctly because it is
"really really old".  PR6528.

Yet another reason the mc assembler should take over ;-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 00:06:19 +00:00
Bill Wendling
cebae36f57 Add a bit along with the MCSymbols stored in the MachineModuleInfo maps that
indicates that an MCSymbol is external or not. (It's true if it's external.)
This will be used to specify the correct information to add to non-lazy
pointers. That will be explained further when this bit is used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 22:34:10 +00:00
Dale Johannesen
bfdf7f3852 Progress towards shepherding debug info through SelectionDAG.
No functional effect yet.  This is still evolving and should
not be viewed as final.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98195 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 22:13:47 +00:00
Chris Lattner
98cdab53c3 set the temporary bit on MCSymbols correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98124 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 02:25:11 +00:00
Daniel Dunbar
f291be3159 MC/X86: Rename alternate spellings of ADD{8,16,32} and mark as "code gen only" so they don't get selected by the asm matcher.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98098 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 22:50:46 +00:00
Daniel Dunbar
1e8ee89c21 MC/X86: Rename alternate spellings of CMP{8,16,32} and mark as "code gen only" so they don't get selected by the asm matcher.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 22:50:40 +00:00
Jim Grosbach
dff4b4c5a7 Change the Value argument to eliminateFrameIndex to a type-tagged value. This
is preparatory to having PEI's scavenged frame index value reuse logic
properly distinguish types of frame values (e.g., whether the value is
stack-pointer relative or frame-pointer relative).

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 21:45:49 +00:00
Dan Gohman
81d0c36d22 Don't try to fold V_SET0 and V_SETALLONES to loads in medium and
large code models.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 03:01:40 +00:00
Bill Wendling
becd83e3f4 MC-ize the stub printing in ARM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98018 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 00:40:17 +00:00
Chris Lattner
82f05078b0 don't reset defaults.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 23:18:21 +00:00
Kevin Enderby
0e822407b2 Fix the vmxon entry in the X86InstrInfo.td so it has the correct prefix bytes
for the encoding and is not the same as vmptrld.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 22:17:26 +00:00
Daniel Dunbar
b93c72cda4 X86: Fix encoding for TEST{8,16,32}rr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97982 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 21:10:36 +00:00
Chris Lattner
3485b51c4d fix some more ambiguous patterns, remove another nontemporalstore
pattern which is broken (source and address swapped).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 18:57:56 +00:00
Chris Lattner
341b27406d Correct immediate sizes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 18:55:15 +00:00
Chris Lattner
9a1ac4c107 remove a non-temporal store pattern which is not tested and
could never have matched because the operand list was backwards.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 03:18:28 +00:00
Anton Korobeynikov
e765f2b5e3 Describe what's going on with mingw alloca and why do we need separate instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97888 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-06 20:07:32 +00:00
Anton Korobeynikov
043f3c2a0e Lower dynamic stack allocation on mingw32 to separate instruction.
We cannot use a normal call here since it has extra unmodelled side
effects (it changes stack pointer). This should fix PR5292.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-06 19:32:29 +00:00
Evan Cheng
10718492c8 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97818 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 19:55:55 +00:00
Evan Cheng
4cae133780 Fix an oops in x86 sibcall optimization. If the ByVal callee argument is itself passed as a pointer, then it's obviously not safe to do a tail call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97797 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 08:38:04 +00:00
Evan Cheng
26e19ba9aa Rever 96389 and 96990. They are causing some miscompilation that I do not fully understand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97782 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 03:08:23 +00:00
Bill Wendling
18ce64e069 Revert r97766. It's deleting a tag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 00:33:59 +00:00
Bill Wendling
37b52ee6d9 Micro-optimization:
This code:

float floatingPointComparison(float x, float y) {
    double product = (double)x * y;
    if (product == 0.0)
        return product;
    return product - 1.0;
}

produces this:

_floatingPointComparison:
0000000000000000        cvtss2sd        %xmm1,%xmm1
0000000000000004        cvtss2sd        %xmm0,%xmm0
0000000000000008        mulsd           %xmm1,%xmm0
000000000000000c        pxor            %xmm1,%xmm1
0000000000000010        ucomisd         %xmm1,%xmm0
0000000000000014        jne             0x00000004
0000000000000016        jp              0x00000002
0000000000000018        jmp             0x00000008
000000000000001a        addsd           0x00000006(%rip),%xmm0
0000000000000022        cvtsd2ss        %xmm0,%xmm0
0000000000000026        ret

The "jne/jp/jmp" sequence can be reduced to this instead:

_floatingPointComparison:
0000000000000000        cvtss2sd        %xmm1,%xmm1
0000000000000004        cvtss2sd        %xmm0,%xmm0
0000000000000008        mulsd           %xmm1,%xmm0
000000000000000c        pxor            %xmm1,%xmm1
0000000000000010        ucomisd         %xmm1,%xmm0
0000000000000014        jp              0x00000002
0000000000000016        je              0x00000008
0000000000000018        addsd           0x00000006(%rip),%xmm0
0000000000000020        cvtsd2ss        %xmm0,%xmm0
0000000000000024        ret

for a savings of 2 bytes.

This xform can happen when we recognize that jne and jp jump to the same "true"
MBB, the unconditional jump would jump to the "false" MBB, and the "true" branch
is the fall-through MBB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97766 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 00:24:26 +00:00
Jakob Stoklund Olesen
3cfe01072c Fix the remaining MUL8 and DIV8 to define AX instead of AL,AH.
These instructions technically define AL,AH, but a trick in X86ISelDAGToDAG
reads AX in order to avoid reading AH with a REX instruction.

Fix PR6489.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 20:42:07 +00:00
Dan Gohman
0ef701e6ae Fix recognition of 16-bit bswap for C front-ends which emit the
clobber registers in a different order.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97741 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 19:58:08 +00:00
Chris Lattner
bfcc8e0a66 not committing what you test = bad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97740 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 19:54:45 +00:00
Chris Lattner
225d4ca8ab make gep matching in fastisel match the base of the gep as a
register if it isn't possible to match the indexes *and* the base.
This fixes some fast isel rejects of load instructions on oggenc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97739 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 19:48:19 +00:00
Chris Lattner
97d853451e add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 01:43:43 +00:00
Chris Lattner
99fe641325 remove nvload and two patterns that use it which are
better done by dag combine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 02:14:54 +00:00
Chris Lattner
f85eff76b2 factor the 'in the default address space' check out to a single
'dsload' pattern.  tblgen doesn't check patterns to see if they're
textually identical.  This allows better factoring.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97630 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 01:52:59 +00:00
Chris Lattner
1840991d54 factor the 'sign extended from 8 bit' patterns better so
that they are not destination type specific.  This allows
tblgen to factor them and the type check is redundant with
what the isel does anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 01:45:01 +00:00
Chris Lattner
fb444af5c9 merge two loops over all nodes in the graph into one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97606 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 23:12:51 +00:00
Chris Lattner
98d45790ae eliminate PreprocessForRMW now that isel handles it.
We still preprocess calls and fp return stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 22:33:56 +00:00
Chris Lattner
d1b7382983 Fix some issues in WalkChainUsers dealing with
CopyToReg/CopyFromReg/INLINEASM.  These are annoying because
they have the same opcode before an after isel.  Fix this by
setting their NodeID to -1 to indicate that they are selected,
just like what automatically happens when selecting things that
end up being machine nodes.

With that done, give IsLegalToFold a new flag that causes it to
ignore chains.  This lets the HandleMergeInputChains routine be
the one place that validates chains after a match is successful,
enabling the new hotness in chain processing.  This smarter
chain processing eliminates the need for "PreprocessRMW" in the
X86 and MSP430 backends and enables MSP to start matching it's
multiple mem operand instructions more aggressively.

I currently #if out the dead code in the X86 backend and MSP 
backend, I'll remove it for real in a follow-on patch.

The testcase changes are:
  test/CodeGen/X86/sse3.ll: we generate better code
  test/CodeGen/X86/store_op_load_fold2.ll: PreprocessRMW was 
      miscompiling this before, we now generate correct code
      Convert it to filecheck while I'm at it.
  test/CodeGen/MSP430/Inst16mm.ll: Add a testcase for mem/mem
      folding to make anton happy. :)




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97596 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 22:20:06 +00:00
Chris Lattner
7c306da505 Sink InstructionSelect() out of each target into SDISel, and rename it
DoInstructionSelection.  Inline "SelectRoot" into it from DAGISelHeader.
Sink some other stuff out of DAGISelHeader into SDISel.

Eliminate the various 'Indent' stuff from various targets, which dates
to when isel was recursive.

 17 files changed, 114 insertions(+), 430 deletions(-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 06:34:30 +00:00
Bill Wendling
46ada19645 Remove dead parameter passing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 01:55:18 +00:00
Dan Gohman
a9445e11c5 Floating-point add, sub, and mul are now spelled fadd, fsub, and fmul,
respectively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 01:11:08 +00:00
Chris Lattner
e60f7b4412 remove a little hack I did for the old isel, not needed
now that it is gone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97516 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 22:51:11 +00:00
Evan Cheng
73736df88b Remove the optimize for code size limitation on r67917. Optimize 64-bit imul by constants into leas + shl regardless if optimizing for code size. The size saving from using imulq isn't worth it. Also, the lea and shl instructions may expose further optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 22:00:11 +00:00
Chris Lattner
31c020a147 remove a terrible hack that disabled assertions from this file because of build time
problems.  rdar://7697850.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97500 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 21:20:46 +00:00
Dan Gohman
85e9601862 This is now done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97450 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 17:43:57 +00:00
Mikhail Glushenkov
5d96eb8671 80-col violations/trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 22:54:30 +00:00
Dan Gohman
874cadaf21 Implement XMM subregs.
Extracting the low element of a vector is now done with EXTRACT_SUBREG,
and the zero-extension performed by load movss is now modeled with
SUBREG_TO_REG, and so on.

Register-to-register movss and movsd are no longer considered copies;
they are two-address instructions which insert a scalar into a vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97354 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 00:17:42 +00:00
Dan Gohman
bc9d98b52d The mayHaveSideEffects flag is no longer used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97348 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 23:47:46 +00:00
Chris Lattner
4446c3f4d0 fix an incorrect (overly conservative) predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97316 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 08:18:55 +00:00
Evan Cheng
2c755ba12a Re-apply 97040 with fix. This survives a ppc self-host llvm-gcc bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97310 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 07:36:59 +00:00
Dale Johannesen
45df761652 Move dbg_value generation to target-independent FastISel,
as X86 is currently the only FastISel target.  Per review.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97255 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 20:01:55 +00:00
Dan Gohman
6fe0df2abb movl is a cheaper way to materialize 0 without clobbering EFLAGS than movabsq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97227 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 16:49:27 +00:00
Dan Gohman
e13709af60 Delete a bunch of redundant predicates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97201 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 01:14:30 +00:00
Daniel Dunbar
010b1b2a0d Fix TextAlignFillValue in a few places
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97151 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 18:07:10 +00:00
Dan Gohman
377fbc073c Truncate from i64 to i32 is "free" on x86-32, because it involves
just discarding one of the registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 03:04:36 +00:00
Daniel Dunbar
cfe30effbb Speculatively revert r97011, "Re-apply 96540 and 96556 with fixes.", again in
the hopes of fixing PPC bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97040 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 17:05:47 +00:00
Dan Gohman
e832693acb When forming SSE min and max nodes for UGE and ULE comparisons, it's
necessary to swap the operands to handle NaN and negative zero properly.

Also, reintroduce logic for checking for NaN conditions when forming
SSE min and max instructions, fixed to take into consideration NaNs and
negative zeros. This allows forming min and max instructions in more
cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 06:52:40 +00:00
Evan Cheng
97e6b8390b Re-apply 96540 and 96556 with fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 01:42:31 +00:00
Jakob Stoklund Olesen
c3027f769a DIV8r must define %AX since X86DAGToDAGISel::Select() sometimes uses it
instead of %AL/%AH.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 00:39:35 +00:00
Evan Cheng
01be611b82 Fix rev 96389 by restricting the xform to mask that's either signbit or max signed value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 21:51:54 +00:00
Chris Lattner
652b7e488d no need to override IsLegalToFold, the base implementation
disables load folding at -O0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 19:33:11 +00:00
Chris Lattner
4d0f7c9f39 remove a confused pattern that is trying to match an address
then use it as an MMX register (!?).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96901 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 07:16:12 +00:00
Chris Lattner
6d9f86b773 remove a bunch of dead named arguments in input patterns,
though some look dubious afaict, these are all ok.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96899 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 06:54:29 +00:00
Chris Lattner
be5ad7dce2 fix a type mismatch in this pattern, where we were using an i64 imm in a
place where an i32 imm was required, the old isel just got lucky.

This fixes CodeGen/X86/x86-64-and-mask.ll



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96894 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 06:09:57 +00:00
Chris Lattner
8f2b4cc071 X86InstrInfoSSE.td declares PINSRW as having type v8i16,
don't alis it in the MMX .td file with a different width,
split into two X86ISD opcodes.  This fixes an x86 testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96859 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 02:07:48 +00:00
Arnold Schwaighofer
9265275a9a Mark the return address stack slot as mutable when moving the return address
during a tail call. A parameter might overwrite this stack slot during the tail
call. 

The sequence during a tail call is:
1.) load return address to temp reg
2.) move parameters (might involve storing to return address stack slot)
3.) store return address to new location from temp reg

If the stack location is marked immutable CodeGen can colocate load (1) with the
store (3).

This fixes bug 6225.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 16:18:09 +00:00
Dan Gohman
b4e8aabba7 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96778 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 04:09:26 +00:00
Dan Gohman
8ce05daf54 Remove the logic for reasoning about NaNs from the code that forms
SSE min and max instructions. The real thing this code needs to be
concerned about is negative zero.

Update the sse-minmax.ll test accordingly, and add tests for
-enable-unsafe-fp-math mode as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 04:03:39 +00:00
Chris Lattner
ccfea35efb fix an incorrect VT: eflags is always i32. The bug was causing us to
create an X86ISD::Cmp node with result type i64 on the 
CodeGen/X86/shift-i256.ll testcase and the new isel was assert on it
downstream.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 00:28:59 +00:00
Daniel Dunbar
12783d1c3a MC/X86: Add stub AsmBackend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 21:54:14 +00:00
Anton Korobeynikov
293d592bf9 It turned out that we failed to emit proper symbol stubs on non-x86/darwin for ages (we emitted a reference to a stub, but no stub was emitted). The code inside x86-32/macho target objfile lowering should actually be the generic one - move it there.
This (I really, really hope) should fix EH issues on ppc/darwin
and arm/darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 20:28:15 +00:00
Chris Lattner
f1c6428164 fix and un-xfail X86/vec_ss_load_fold.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96720 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 04:53:34 +00:00
Chris Lattner
a170b5e818 rename SelectScalarSSELoad -> SelectScalarSSELoadXXX and rewrite
it to follow the mode needed by the new isel.  Instead of returning
the input and output chains, it just returns the (currently only one,
which is a silly limitation) node that has input and output chains.

Since we want the old thing to still work, add a new 
SelectScalarSSELoad to emulate the old interface.  The XXX suffix
and the wrapper will eventually go away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96715 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 03:17:59 +00:00
Charles Davis
5dfa26795d Add support for the 'alignstack' attribute to the x86 backend. Fixes PR5254.
Also, FileCheck'ize a test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 18:17:13 +00:00
Bob Wilson
6b89aa57e6 Revert Anton's most recent EH patch (r96637), since it breaks a lot of
ARM and Thumb tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96680 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 17:10:59 +00:00
Duncan Sands
3eba667081 Revert commits 96556 and 96640, because commit 96556 breaks the
dragonegg self-host build.  I reverted 96640 in order to revert
96556 (96640 goes on top of 96556), but it also looks like with
both of them applied the breakage happens even earlier.  The
symptom of the 96556 miscompile is the following crash:

  llvm[3]: Compiling AlphaISelLowering.cpp for Release build
  cc1plus: /home/duncan/tmp/tmp/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4982: void llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode*, llvm::SDNode*, llvm::SelectionDAG::DAGUpdateListener*): Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"' failed.
  Stack dump:
  0.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN4llvm19AlphaTargetLowering14LowerOperationENS_7SDValueERNS_12SelectionDAGE'
  g++: Internal error: Aborted (program cc1plus)

This occurs when building LLVM using LLVM built by LLVM (via
dragonegg).  Probably LLVM has miscompiled itself, though it
may have miscompiled GCC and/or dragonegg itself: at this point
of the self-host build, all of GCC, LLVM and dragonegg were built
using LLVM.  Unfortunately this kind of thing is extremely hard
to debug, and while I did rummage around a bit I didn't find any
smoking guns, aka obviously miscompiled code.

Found by bisection.

r96556 | evancheng | 2010-02-18 03:13:50 +0100 (Thu, 18 Feb 2010) | 5 lines

Some dag combiner goodness:
Transform br (xor (x, y)) -> br (x != y)
Transform br (xor (xor (x,y), 1)) -> br (x == y)
Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"

r96640 | evancheng | 2010-02-19 01:34:39 +0100 (Fri, 19 Feb 2010) | 16 lines

Transform (xor (setcc), (setcc)) == / != 1 to
(xor (setcc), (setcc)) != / == 1.

e.g. On x86_64
  %0 = icmp eq i32 %x, 0
  %1 = icmp eq i32 %y, 0
  %2 = xor i1 %1, %0
  br i1 %2, label %bb, label %return
=>
	testl   %edi, %edi
	sete    %al
	testl   %esi, %esi
	sete    %cl
	cmpb    %al, %cl
	je      LBB1_2



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 11:30:41 +00:00
Anton Korobeynikov
f0e7c87e56 Use the same encoding for EH stuff uniformly on all MachO targets.
This hopefulyl should unbreak EH on PPC/Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 00:29:36 +00:00
Dale Johannesen
116b799488 Generate DBG_VALUE from dbg.value intrinsics. These currently
comes out as comments but will eventually generate DWARF.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96601 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 18:51:15 +00:00
Chris Lattner
1a7d087154 add a missing type cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96574 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 06:33:42 +00:00
Evan Cheng
89bb7b5640 Some dag combiner goodness:
Transform br (xor (x, y)) -> br (x != y)
Transform br (xor (xor (x,y), 1)) -> br (x == y)
Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96556 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 02:13:50 +00:00
Chris Lattner
64b4986c94 rename and document some arguments so I don't have to keep
reverse engineering what they are.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96456 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 06:07:47 +00:00
Anton Korobeynikov
4e9c6dfb8b Use pointer-wide encoding for LSDA and FDE on Darwin.
Hopefully, this will fix the remaining issues seen there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96454 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 05:53:11 +00:00