Commit Graph

39610 Commits

Author SHA1 Message Date
Chris Lattner 45cc4d74a3 Just rip v2f32 support completely out of the X86 backend. In
the example in the testcase, we now generate:

_test1:                                 ## @test1
	movss	4(%esp), %xmm0
	addss	8(%esp), %xmm0
	movl	12(%esp), %eax
	movss	%xmm0, (%eax)
	ret

instead of:

_test1:                                                     ## @test1
	subl	$20, %esp
	movl	24(%esp), %eax
	movq	%mm0, (%esp)
	movq	%mm0, 8(%esp)
	movss	(%esp), %xmm0
	addss	12(%esp), %xmm0
	movss	%xmm0, (%eax)
	addl	$20, %esp
	ret

v2f32 support did not work reliably because most of the X86
backend didn't know it was legal.  It was apparently only added
to support returning source-level v2f32 values in MMX registers
in x86-32 mode.  If ABI compatibility is important on this
GCC-extended-vector type for some reason, then the frontend
should generate IR that returns v2i32 instead of v2f32.  However,
we generally don't try very hard to be abi compatible on gcc
extended vectors. 

llvm-svn: 107601
2010-07-04 23:07:25 +00:00
Chris Lattner 681b926d54 fix PR7518 - terrible codegen of <2 x float>, by only marking
v2f32 as legal in 32-bit mode.  It is just as terrible there,
but I just care about x86-64 and noone claims it is valuable
in 64-bit mode.

llvm-svn: 107600
2010-07-04 22:57:10 +00:00
Chris Lattner cb948d3329 indentation
llvm-svn: 107599
2010-07-04 22:56:10 +00:00
Evan Cheng f3aeb2c22c Infer alignments of fixed frame objects when they are constructed. This ensures remat'ed loads from fixed slots have the right alignments.
llvm-svn: 107591
2010-07-04 18:52:05 +00:00
Bill Wendling 199cacf179 Revert r107583. I no longer think that this is the way to solve the problem.
llvm-svn: 107585
2010-07-04 09:16:57 +00:00
Bill Wendling 701aa053b9 Mark sse_load_f32 and sse_load_f64 as having memory operands
(SDNPMemOperand). This way when they're morphed the memory operands will be
copied as well.

llvm-svn: 107583
2010-07-04 08:59:55 +00:00
Bill Wendling f844642350 Proper indentation.
llvm-svn: 107581
2010-07-04 08:58:43 +00:00
Eli Friedman c8f595212f Minor amendment to switch-lowering improvement.
llvm-svn: 107569
2010-07-03 08:43:32 +00:00
Eli Friedman 836fdbc85b Note switch-lowering inefficiency.
llvm-svn: 107565
2010-07-03 07:38:12 +00:00
Bruno Cardoso Lopes ca99012ac0 Add AVX SSE4.1 blend, mpsadbw and vdp
llvm-svn: 107560
2010-07-03 01:37:03 +00:00
Bruno Cardoso Lopes bc75502f09 Add AVX SSE4.1 binop (some forms of packed max,min,mul,pack,cmp) instructions
llvm-svn: 107558
2010-07-03 01:15:47 +00:00
Eric Christopher 128a0197bb Fix typo.
llvm-svn: 107556
2010-07-03 01:09:18 +00:00
Bruno Cardoso Lopes fc9cdc4d61 Add AVX SSE4.1 Horizontal Minimum and Position instruction
llvm-svn: 107552
2010-07-03 00:49:21 +00:00
Evan Cheng 0664a67fe1 Remove isSS argument from CreateFixedObject. Fixed objects cannot be spill slots so it's always false.
llvm-svn: 107550
2010-07-03 00:40:23 +00:00
Bruno Cardoso Lopes 621c85b038 Add AVX SSE4.1 round instructions
llvm-svn: 107549
2010-07-03 00:37:44 +00:00
Jakob Stoklund Olesen 4c82a9e7d0 Detect and handle COPY in many places.
This code is transitional, it will soon be possible to eliminate
isExtractSubreg, isInsertSubreg, and isMoveInstr in most places.

llvm-svn: 107547
2010-07-03 00:04:37 +00:00
Bruno Cardoso Lopes 5b59c1bf1f Simple refactoring of SSE4.1 instructions, making room for the AVX forms
llvm-svn: 107540
2010-07-02 23:27:59 +00:00
Eric Christopher 5e5416056b 80-col fixup.
llvm-svn: 107537
2010-07-02 23:17:38 +00:00
Jakob Stoklund Olesen 676a15bdf5 Add a new target independent COPY instruction and code to lower it.
The COPY instruction is intended to replace the target specific copy
instructions for virtual registers as well as the EXTRACT_SUBREG and
INSERT_SUBREG instructions in MachineFunctions. It won't we used in a selection
DAG.

COPY is lowered to native register copies by LowerSubregs.

llvm-svn: 107529
2010-07-02 22:29:50 +00:00
Bruno Cardoso Lopes c7111fd355 - Add support for the rest of AVX SSE3 instructions
- Fix VEX prefix to be emitted with 3 bytes whenever VEX_5M
represents a REX equivalent two byte leading opcode

llvm-svn: 107523
2010-07-02 22:06:54 +00:00
Jim Grosbach 3c43248560 Custom inserters (e.g., conditional moves in Thumb1 can introduce
new basic blocks, and if used as a function argument, that can cause call frame
setup / destroy pairs to be split across a basic block boundary. That prevents
us from doing a simple assertion to check that the pairs match and alloc/
dealloc the same amount of space. Modify the assertion to only check the
amount allocated when there are matching pairs in the same basic block.

rdar://8022442

llvm-svn: 107517
2010-07-02 21:23:37 +00:00
Devang Patel cefe3831b7 MDString is already checked earlier.
llvm-svn: 107516
2010-07-02 21:13:23 +00:00
Evan Cheng c3525dc0fd Remove early IT block formation. It's not used.
llvm-svn: 107513
2010-07-02 21:07:09 +00:00
Evan Cheng 0ce84486c3 - Two-address pass should not assume unfolding is always successful.
- X86 unfolding should check if the instructions being unfolded has memoperands.
  If there is no memoperands, then it must assume conservative alignment. If this
  would introduce an expensive sse unaligned load / store, then unfoldMemoryOperand
  etc. should not unfold the instruction.

llvm-svn: 107509
2010-07-02 20:36:18 +00:00
Dale Johannesen 4d887f7ca7 Propagate the AlignStack bit in InlineAsm's to the
PrologEpilog code, and use it to determine whether
the asm forces stack alignment or not.  gcc consistently
does not do this for GCC-style asms; Apple gcc inconsistently
sometimes does it for asm blocks.  There is no
convenient place to put a bit in either the SDNode or
the MachineInstr form, so I've added an extra operand
to each; unlovely, but it does allow for expansion for
more bits, should we need it.  PR 5125.  Some
existing testcases are affected.
The operand lists of the SDNode and MachineInstr forms
are indexed with awesome mnemonics, like "2"; I may
fix this someday, but not now.  I'm not making it any
worse.  If anyone is inspired I think you can find all
the right places from this patch.

llvm-svn: 107506
2010-07-02 20:16:09 +00:00
Jakob Stoklund Olesen df8429aeb4 Remove invalid assert
llvm-svn: 107505
2010-07-02 19:54:47 +00:00
Jakob Stoklund Olesen cf6c5c960f Properly handle debug values during inline spilling.
llvm-svn: 107503
2010-07-02 19:54:40 +00:00
Gabor Greif 9da02a83e9 beautify output
llvm-svn: 107500
2010-07-02 19:26:28 +00:00
Gabor Greif e537ddbdb4 use ArgOperand API
llvm-svn: 107498
2010-07-02 19:08:46 +00:00
Dan Gohman 832282e061 Don't claim to preserve AliasAnalysis. First, this is doesn't actually
have any effect, and second, deleting stores can potentially invalidate
an AliasAnalysis, and there's currently no notification for this.

llvm-svn: 107496
2010-07-02 18:43:05 +00:00
Jakob Stoklund Olesen 96037187e5 Rematerialize as much as possible before inserting spills and reloads.
This allows us to recognize the common case where all uses could be
rematerialized, and no stack slot allocation is necessary.

If some values could be fully rematerialized, remove them from the live range
before allocating a stack slot for the rest.

llvm-svn: 107492
2010-07-02 17:44:57 +00:00
Jim Grosbach 9b7755fbc6 80-column and trailing whitespace cleanup.
llvm-svn: 107490
2010-07-02 17:41:59 +00:00
Jim Grosbach 64a4f3f062 grammar tweaks
llvm-svn: 107489
2010-07-02 17:38:34 +00:00
Bob Wilson 771d04b969 Fix incorrect asm-printing of some NEON immediates. Fix weak testcase so
that it checks the immediate values, not just the instructions opcodes.
Radar 8110263.

llvm-svn: 107487
2010-07-02 17:23:44 +00:00
Gabor Greif 56de4675b6 use ArgOperand API (found by my previous commit)
llvm-svn: 107482
2010-07-02 13:37:16 +00:00
Dan Gohman ee8d80d6a3 IndirectBr is not safe to speculatively execute (!)
llvm-svn: 107454
2010-07-02 00:35:34 +00:00
Dan Gohman 93f5920914 Rename CreateReg to CreateRegs, and MakeReg to CreateReg.
llvm-svn: 107451
2010-07-02 00:10:16 +00:00
Bruno Cardoso Lopes 4ca8ddaceb Shrink down SSE3 code by more multiclass refactoring
llvm-svn: 107448
2010-07-01 23:10:49 +00:00
Bill Wendling 504055ce9e Make the "linker_private" linkage type emit a non-weak symbol to the file. It
will still be stripped by the linker when it generates the final image.

llvm-svn: 107440
2010-07-01 22:38:24 +00:00
Bruno Cardoso Lopes 0a17241a0d Shrink down SSE3 code by some multiclass refactoring - 1st part
llvm-svn: 107438
2010-07-01 22:33:18 +00:00
Bob Wilson 8a99b730a9 ARM function alignments were off by a power of two. svn 83242 changed
getFunctionAlignment and the corresponding use of that value in the ARM
asm printer, but now we're using the standard asm printer.  The result of
this was that function alignments were dropped completely for Thumb functions.
Radar 8143571.

llvm-svn: 107435
2010-07-01 22:26:26 +00:00
Bill Wendling 03bcd6ecc8 Implement the "linker_private_weak" linkage type. This will be used for
Objective-C metadata types which should be marked as "weak", but which the
linker will remove upon final linkage. However, this linkage isn't specific to
Objective-C.

For example, the "objc_msgSend_fixup_alloc" symbol is defined like this:

      .globl l_objc_msgSend_fixup_alloc
      .weak_definition l_objc_msgSend_fixup_alloc
      .section __DATA, __objc_msgrefs, coalesced
      .align 3
l_objc_msgSend_fixup_alloc:
       .quad   _objc_msgSend_fixup
       .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".

Currently only supported on Darwin platforms.

llvm-svn: 107433
2010-07-01 21:55:59 +00:00
Devang Patel 429397529a Do not require line number entry for undefined local variable.
This is a regression caused by r106792 and caught by gdb testsuite.

llvm-svn: 107430
2010-07-01 21:38:08 +00:00
Daniel Dunbar 0e980755d3 MC: Fix some stray hunks I didn't intend to commit.
llvm-svn: 107428
2010-07-01 20:48:51 +00:00
Daniel Dunbar 02877d6e85 MC: Pass the target instance to the AsmParser constructor.
llvm-svn: 107426
2010-07-01 20:41:56 +00:00
Daniel Dunbar 0aa4365e47 MC: Fix an error message.
llvm-svn: 107424
2010-07-01 20:20:01 +00:00
Dan Gohman 84f90a387d Remove context sensitivity concerns from interprocedural-basic-aa, and
make it more aggressive in cases where both pointers are known to live
in the same function.

llvm-svn: 107420
2010-07-01 20:08:40 +00:00
Daniel Dunbar 329d202362 MC: Move COFF enumeration constants to llvm/Support/COFF.h, patch by Michael
Spencer!

llvm-svn: 107418
2010-07-01 20:07:24 +00:00
Devang Patel 2b434e12cd Debugging infomration is encoded in llvm IR using metadata. This is designed
such a way that debug info for symbols preserved even if symbols are
optimized away by the optimizer. 

Add new special pass to remove debug info for such symbols.

llvm-svn: 107416
2010-07-01 19:49:20 +00:00
Devang Patel b9e2e4b762 If a named mdnode is removed then mark module as changed.
llvm-svn: 107412
2010-07-01 18:27:46 +00:00
Bruno Cardoso Lopes 5e88700f28 Move SSE3 Move patterns to a more appropriate section
Add AVX SSE3 packed horizontal and & sub instructions

llvm-svn: 107405
2010-07-01 17:35:02 +00:00
Bruno Cardoso Lopes 886ee33a38 Add AVX SSE3 packed addsub instructions
llvm-svn: 107404
2010-07-01 17:08:18 +00:00
Dan Gohman d2965c10a1 Temporarily disable on-demand fast-isel.
llvm-svn: 107393
2010-07-01 12:15:30 +00:00
Gabor Greif 9dc154bcb4 reformulate CallSite::getCallee to adapt to CallInst::ArgOffset, and make it work even if CallInst::op_* are private
llvm-svn: 107390
2010-07-01 10:41:37 +00:00
Dan Gohman 42b7ee15f5 Use FuncInfo's isExportedInst accessor method instead of
doing the work manually.

llvm-svn: 107384
2010-07-01 03:57:05 +00:00
Dan Gohman 85e02e9340 Rename CreateRegForValue to CreateReg, and change its argument
from a Value to a Type, because it doesn't actually care about
the Value.

llvm-svn: 107383
2010-07-01 03:55:39 +00:00
Dan Gohman 4d29fd85f9 Fast isel no longer needs DeadMachineInstrElim to clean up after it.
llvm-svn: 107381
2010-07-01 03:49:59 +00:00
Dan Gohman aef3d140b7 Teach fast-isel to avoid loading a value from memory when it's already
available in a register. This is pretty primitive, but it reduces the
number of instructions in common testcases by 4%.

llvm-svn: 107380
2010-07-01 03:49:38 +00:00
Dan Gohman 722f5fc567 Enable on-demand fast-isel.
llvm-svn: 107377
2010-07-01 02:58:57 +00:00
Dan Gohman 207624edb0 Fix X86FastISel's add folding to actually work, and not fall back
to SelectionDAG.

llvm-svn: 107376
2010-07-01 02:58:21 +00:00
Bruno Cardoso Lopes a7a0c83563 Add AVX SSE3 replicate and convert instructions
llvm-svn: 107375
2010-07-01 02:33:39 +00:00
Dan Gohman 7937d5606d Teach X86FastISel to fold constant offsets and scaled indices in
the same address.

llvm-svn: 107373
2010-07-01 02:27:15 +00:00
Dan Gohman d432223163 Reapply r106422, splitting the code for materializing a value out of
SelectionDAGBuilder::getValue into a helper function, with fixes to
use DenseMaps safely.

llvm-svn: 107371
2010-07-01 01:59:43 +00:00
Dan Gohman 9576645a84 Don't use operator[] here, because it's not desirable to insert a default
value if the search fails.

llvm-svn: 107368
2010-07-01 01:33:21 +00:00
Bruno Cardoso Lopes 05166740eb - Add AVX SSE2 Move doubleword and quadword instructions.
- Add encode bits for VEX_W
- All 128-bit SSE 1 & SSE2 instructions that are described
  in the .td file now have a AVX encoded form already working.

llvm-svn: 107365
2010-07-01 01:20:06 +00:00
Mikhail Glushenkov 22fa66cf2b 80-col violation.
llvm-svn: 107361
2010-07-01 01:00:27 +00:00
Mikhail Glushenkov 4721ad855e Trailing whitespace.
llvm-svn: 107360
2010-07-01 01:00:22 +00:00
Jakob Stoklund Olesen 8656a4549a Add memory operand folding support to InlineSpiller.
llvm-svn: 107355
2010-07-01 00:13:04 +00:00
Jakob Stoklund Olesen bde96ad23e Add support for rematerialization to InlineSpiller.
llvm-svn: 107351
2010-06-30 23:03:52 +00:00
Bill Wendling e0dfb98ea0 Use the catch-all selectors we already found when converting them to use the
correct catch-all value. This saves having to iterate through all of the
selectors in the program again.

llvm-svn: 107345
2010-06-30 22:49:53 +00:00
Jim Grosbach e74c78d539 lowerinvoke needs to handle aggregate function args like sjlj eh does.
llvm-svn: 107335
2010-06-30 22:22:59 +00:00
Jim Grosbach e8c97a7cd7 Handle array and vector typed parameters in sjljehprepare like we do
structs. rdar://8145832

llvm-svn: 107332
2010-06-30 22:20:38 +00:00
Devang Patel db735cbbab Remove all debug info related named mdnodes.
llvm-svn: 107323
2010-06-30 21:29:00 +00:00
Jim Grosbach caf9b3ab7d grammar tweak in comment.
llvm-svn: 107321
2010-06-30 21:27:56 +00:00
Dan Gohman f638f4ff84 In ScalarEvolution::forgetValue, eliminate any SCEVUnknown
entries associated with the value being erased in the
folding set map.  These entries used to be harmless, because
a SCEVUnknown doesn't store any information about its Value*,
so having a new Value allocated at the old Value's address
wasn't a problem. But now that ScalarEvolution is storing more
information about values, this is no longer safe.

llvm-svn: 107316
2010-06-30 20:21:12 +00:00
Bruno Cardoso Lopes d0eacf715f Move MOVD/MODQ code around, creating sections for each of them
llvm-svn: 107308
2010-06-30 18:49:10 +00:00
Jakob Stoklund Olesen 59e1cae377 Some fool committed without testing (or even building) first.
llvm-svn: 107307
2010-06-30 18:41:20 +00:00
Bruno Cardoso Lopes cbcebe2950 Add AVX SSE2 mask creation and conditional store instructions
llvm-svn: 107306
2010-06-30 18:38:10 +00:00
Jakob Stoklund Olesen c39d3497c8 Remember to track spill slot uses in VirtRegMap when inserting loads and stores.
LocalRewriter::runOnMachineFunction uses this information to mark dead spill
slots.

This means that InlineSpiller now also works for functions that spill.

llvm-svn: 107302
2010-06-30 18:19:08 +00:00
Bruno Cardoso Lopes 5c768e4915 Fix a bug introduced in r107211 where instructions with memory operands are declared as commutable
llvm-svn: 107300
2010-06-30 18:06:01 +00:00
Dan Gohman c0cca7fdda Revert the part of r107257 which introduced new logic for using
nsw and nuw flags from IR Instructions. On further consideration,
this isn't valid.

llvm-svn: 107298
2010-06-30 17:27:11 +00:00
Duncan Sands 945a347478 Remove an unused variable. The call to getRoot has side-effects, so
this could break something (but doesn't seem to).

llvm-svn: 107295
2010-06-30 17:22:28 +00:00
Bruno Cardoso Lopes d079c91683 Add AVX SSE2 packed integer extract/insert instructions
llvm-svn: 107293
2010-06-30 17:03:03 +00:00
Duncan Sands 7b90966d4a Rather than giving SmallPtrSetImpl a member field SmallArray which is magically
replaced by a bigger array in SmallPtrSet (by overridding it), instead just use a
pointer to the start of the storage, and have SmallPtrSet pass in the value to use.
This has the disadvantage that SmallPtrSet becomes bigger by one pointer.  It has
the advantage that it no longer uses tricky C++ rules, and is clearly correct while
I'm not sure the previous version was.  This was inspired by g++-4.6 pointing out
that SmallPtrSetImpl was writing off the end of SmallArray, which it was.  Since
SmallArray is replaced with a bigger array in SmallPtrSet, the write was still to
valid memory.  But it was writing off the end of the declared array type - sounds
kind of dubious to me, like it sounded dubious to g++-4.6.  Maybe g++-4.6 is wrong
and this construct is perfectly valid and correctly compiled by all compilers, but
I think it is better to avoid the whole can of worms by avoiding this construct.

llvm-svn: 107285
2010-06-30 15:02:37 +00:00
Gabor Greif 647d9c9797 use ArgOperand API
llvm-svn: 107282
2010-06-30 13:45:50 +00:00
Gabor Greif 12ca3d9fac use ArgOperand API
llvm-svn: 107280
2010-06-30 13:03:37 +00:00
Gabor Greif f69acfe133 use ArgOperand API
llvm-svn: 107279
2010-06-30 12:55:46 +00:00
Gabor Greif 74470192d7 use ArgOperand API
llvm-svn: 107278
2010-06-30 12:42:43 +00:00
Gabor Greif d50572802e use ArgOperand API
llvm-svn: 107277
2010-06-30 12:40:35 +00:00
Gabor Greif 3390e746fa use CallSite::arg_end instead of CallInst::op_end
llvm-svn: 107276
2010-06-30 12:39:23 +00:00
Gabor Greif 3abd881bea use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
llvm-svn: 107275
2010-06-30 12:38:26 +00:00
Gabor Greif 743b3fd196 use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
llvm-svn: 107273
2010-06-30 09:19:23 +00:00
Gabor Greif f628ecd15f use getNumArgOperands instead of getNumOperands
llvm-svn: 107272
2010-06-30 09:17:53 +00:00
Gabor Greif fe252e6fa0 use getArgOperand instead of getOperand
llvm-svn: 107271
2010-06-30 09:16:16 +00:00
Gabor Greif 8ae3095286 use getArgOperand instead of getOperand
llvm-svn: 107270
2010-06-30 09:15:28 +00:00
Gabor Greif e9acc46f65 use getArgOperand instead of getOperand
llvm-svn: 107269
2010-06-30 09:14:26 +00:00
Dan Gohman 16206132b6 Improve ScalarEvolution's nsw and nuw preservation.
llvm-svn: 107257
2010-06-30 07:16:37 +00:00
Dan Gohman 9396b42ca4 When computing a new ConservativeResult, intersect it with
the old one instead of replacing it, to be more precise.

llvm-svn: 107256
2010-06-30 06:58:35 +00:00
Dan Gohman 0865966440 Rework scev-aa's basic computation so that it doesn't depend
on ScalarEvolution successfully folding and preserving
range information for both A-B and B-A. Now, if it gets
either one, it's sufficient.

llvm-svn: 107249
2010-06-30 06:12:16 +00:00
Dan Gohman 37f145c55b Simplify.
llvm-svn: 107248
2010-06-30 06:09:46 +00:00