1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

40160 Commits

Author SHA1 Message Date
Eli Friedman
e758dc641d Add support for parsing .size directives for ELF.
llvm-svn: 108606
2010-07-17 03:09:18 +00:00
Daniel Dunbar
4dca88a1e9 MC/AsmParser: Lift Run() and TargetParser to base class.
Also, add constructor function for creating AsmParser instances.

llvm-svn: 108604
2010-07-17 02:26:10 +00:00
Jim Grosbach
e52a4aff12 add BFI to getTargetNodeName()
llvm-svn: 108603
2010-07-17 01:50:57 +00:00
Jim Grosbach
5e095020ae Fix logic think-o
llvm-svn: 108601
2010-07-17 01:22:19 +00:00
Eric Christopher
00b8fa89c8 Remove unnecessary check that was subsumed into canRealignStack.
llvm-svn: 108588
2010-07-17 00:33:04 +00:00
Eric Christopher
b397b001b9 Propagate alloca alignment information via variable size object frame
information.

No functional change yet.

llvm-svn: 108583
2010-07-17 00:28:22 +00:00
Eric Christopher
033201e862 Make more explicit and add some currently disabled error messages for
stack realignment on ARM.

Also check for function attributes as we do on X86 as well as
make explicit that we're checking can as well as needs in this function.

llvm-svn: 108582
2010-07-17 00:27:24 +00:00
Eric Christopher
cfd5cd156c Make comment a bit more clear as well as return statement since
needsStackRealignment is currently checking the can conditions as well.

llvm-svn: 108581
2010-07-17 00:25:41 +00:00
Jim Grosbach
749f4fca0a Add basic support to code-gen the ARM/Thumb2 bit-field insert (BFI) instruction
and a combine pattern to use it for setting a bit-field to a constant
value. More to come for non-constant stores.

llvm-svn: 108570
2010-07-16 23:05:05 +00:00
Dan Gohman
820e65129a Fix whitespace.
llvm-svn: 108569
2010-07-16 22:58:39 +00:00
Bill Wendling
85d6ed81b7 Consider this function:
void foo() { __builtin_unreachable(); }

It will output the following on Darwin X86:

_func1:
Leh_func_begin0:
        pushq %rbp
Ltmp0:
        movq %rsp, %rbp
Ltmp1:
Leh_func_end0:

This prolog adds a new Call Frame Information (CFI) row to the FDE with an
address that is not within the address range of the code it describes -- part is
equal to the end of the function -- and therefore results in an invalid EH
frame. If we emit a nop in this situation, then the CFI row is now within the
address range.

llvm-svn: 108568
2010-07-16 22:51:10 +00:00
Jakob Stoklund Olesen
44949b2e1b Remove the isMoveInstr() hook.
llvm-svn: 108567
2010-07-16 22:35:46 +00:00
Jakob Stoklund Olesen
24994a5d4c Avoid isMoveInstr when printing XCore pseudo-moves.
llvm-svn: 108566
2010-07-16 22:35:37 +00:00
Jakob Stoklund Olesen
c73aa71e90 Use MI.isCopy.
llvm-svn: 108565
2010-07-16 22:35:34 +00:00
Jakob Stoklund Olesen
d073973e61 Use a small local function for a single remaining late isMoveInstr call in
Thumb2ITBlockPass.

llvm-svn: 108564
2010-07-16 22:35:32 +00:00
Bill Wendling
e2833a21c2 Rename DBG_LABEL PROLOG_LABEL, because it's only used during prolog emission and
thus is a much more meaningful name.

llvm-svn: 108563
2010-07-16 22:20:36 +00:00
Jakob Stoklund Olesen
41b1ea4fc9 Keep valgrind quiet.
The isLive() method can read uninitialized memory, but it still gives correct
results.

llvm-svn: 108561
2010-07-16 22:00:33 +00:00
Chris Lattner
02dc24e49a tidy up
llvm-svn: 108560
2010-07-16 21:20:46 +00:00
Jakob Stoklund Olesen
1fb08e33b9 Remove remaining calls to TII::isMoveInstr.
llvm-svn: 108556
2010-07-16 21:03:55 +00:00
Jakob Stoklund Olesen
9521e574f8 Emit COPY instead of FMR/FMSD instructions for floating point conversion on
PowerPC.

llvm-svn: 108555
2010-07-16 21:03:52 +00:00
Chris Lattner
663dd0eb36 eliminate unlockedRefineAbstractTypeTo, types are all per-llvmcontext,
so there is no locking involved in type refinement.

llvm-svn: 108553
2010-07-16 20:50:13 +00:00
Gabor Greif
4121df768b get the first few tags from a precomputed table (count can be increased if desired)
llvm-svn: 108549
2010-07-16 20:35:19 +00:00
Eli Friedman
616313e9c6 Add missing attributes to cpp backend.
llvm-svn: 108547
2010-07-16 18:47:20 +00:00
Dale Johannesen
80b46398ab Accept registers with P modifier. PR 5314.
llvm-svn: 108545
2010-07-16 18:35:46 +00:00
Jakob Stoklund Olesen
701cbc5c89 Teach PPCInstrInfo::storeRegToStackSlot and loadRegFromStackSlot to add memory
operands.

Hopefully this fixes the llvm-gcc-powerpc-darwin9 buildbot. It really shouldn't
since missing memoperands should not affect correctness.

llvm-svn: 108540
2010-07-16 18:22:00 +00:00
Dan Gohman
b5593f8fda Reorder the contents of various getAnalysisUsage functions, eliminating
a redundant loopsimplify run from the default -O2 sequence.

llvm-svn: 108539
2010-07-16 17:58:45 +00:00
Dan Gohman
444c76a3b1 Revert r108369, sorting llvm.dbg.declare information by source position,
since it doesn't work for front-ends which don't emit column information
(which includes llvm-gcc in its present configuration), and doesn't
work for clang for K&R style variables where the variables are declared
in a different order from the parameter list.

Instead, make a separate pass through the instructions to collect the
llvm.dbg.declare instructions in order. This ensures that the debug
information for variables is emitted in this order.

llvm-svn: 108538
2010-07-16 17:54:27 +00:00
Jakob Stoklund Olesen
858d6bb512 Remove the X86::FP_REG_KILL pseudo-instruction and the X86FloatingPointRegKill
pass that inserted it.

It is no longer necessary to limit the live ranges of FP registers to a single
basic block.

llvm-svn: 108536
2010-07-16 17:41:44 +00:00
Jakob Stoklund Olesen
5fbe7d869c Search for a free FP register instead of just assuming FP7 is not in use.
llvm-svn: 108535
2010-07-16 17:41:40 +00:00
Owen Anderson
ca2a306a1a Remove the rest of my instcombine changes. Back to the drawing board on this one.
llvm-svn: 108530
2010-07-16 16:39:00 +00:00
Jakob Stoklund Olesen
d578c5af7e Allow x87 FP registers to be alive globally in a function.
FP_REG_KILL instructions are still inserted, but can be disabled by passing
-live-x87 to llc. The X87FPRegKillInserterPass is going to be removed shortly.

CFG edges are partioned into bundles where the x87 stack must be allocated
identically. Code is insertad at the end of each basic block that shuffles the
live FP registers to match the outgoing bundles expectations.

This fix is in preparation for some upcoming register allocator improvements
that may extend the live range of registers beyond a basic block, similar to
LICM. It also provides a nice runtime speedup if you are building with
-mfpmath=387.

llvm-svn: 108529
2010-07-16 16:38:12 +00:00
Gabor Greif
17c48ecd68 eliminate CallInst::ArgOffset
llvm-svn: 108522
2010-07-16 09:38:02 +00:00
Eli Friedman
a0458f78a8 Get rid of a bunch of duplicated ELF enum values.
llvm-svn: 108520
2010-07-16 07:53:29 +00:00
Nick Lewycky
1b4a83430b Arrays and vectors with different numbers of elements are not equivalent.
llvm-svn: 108517
2010-07-16 06:31:12 +00:00
Tobias Grosser
9c86be4570 LoopSimplify does not update domfrontier correctly.
This fixes PR7649.

llvm-svn: 108513
2010-07-16 05:59:45 +00:00
Tobias Grosser
97dc00d1d8 Add dump() to DominanceFrontier
llvm-svn: 108512
2010-07-16 05:59:39 +00:00
Jakob Stoklund Olesen
bcee53a2b8 Remove many calls to TII::isMoveInstr. Targets should be producing COPY anyway.
TII::isMoveInstr is going tobe completely removed.

llvm-svn: 108507
2010-07-16 04:45:42 +00:00
Dan Gohman
5e485c833f Use the source-order scheduler instead of the "fast" scheduler at -O0,
because it's more likely to keep debug line information in its original
order.

llvm-svn: 108496
2010-07-16 02:01:19 +00:00
Eric Christopher
5eef314caf Also revert 108422, it's causing some test failures.
Working on testcases for Owen.

llvm-svn: 108494
2010-07-16 01:36:12 +00:00
Dale Johannesen
facfe52bee The SelectionDAGBuilder's handling of debug info, on rare
occasions, caused code to be generated in a different order.
All cases I've seen involved float softening in the type
legalizer, and this could be perhaps be fixed there, but
it's better not to generate things differently in the first
place.  7797940 (6/29/2010..7/15/2010).

llvm-svn: 108484
2010-07-16 00:02:08 +00:00
Bill Wendling
756b0a4d45 Revert. This isn't the correct way to go.
llvm-svn: 108478
2010-07-15 23:42:21 +00:00
Dan Gohman
1705ac2740 Fix the order that SCEVExpander considers add operands in so that
it doesn't miss an opportunity to form a GEP, regardless of the
relative loop depths of the operands. This fixes rdar://8197217.

llvm-svn: 108475
2010-07-15 23:38:13 +00:00
Bill Wendling
991234752d Handle code gen for the unreachable instruction if it's the only instruction in
the function. We'll just turn it into a "trap" instruction instead.

The problem with not handling this is that it might generate a prologue without
the equivalent epilogue to go with it:

$ cat t.ll
define void @foo() {
entry:
  unreachable
}
$ llc -o - t.ll -relocation-model=pic -disable-fp-elim -unwind-tables
        .section        __TEXT,__text,regular,pure_instructions
        .globl  _foo
        .align  4, 0x90
_foo:                                   ## @foo
Leh_func_begin0:
## BB#0:                                ## %entry
        pushq   %rbp
Ltmp0:
        movq    %rsp, %rbp
Ltmp1:
Leh_func_end0:
...

The unwind tables then have bad data in them causing all sorts of problems.

Fixes <rdar://problem/8096481>.

llvm-svn: 108473
2010-07-15 23:32:40 +00:00
Evan Cheng
ffbae6ad52 Split -enable-finite-only-fp-math to two options:
-enable-no-nans-fp-math and -enable-no-infs-fp-math. All of the current codegen fp math optimizations only care whether the fp arithmetics arguments and results can never be NaN.

llvm-svn: 108465
2010-07-15 22:07:12 +00:00
Chris Lattner
e2f110cba5 fix the definitions of ConstTextCoalSection/ConstDataCoalSection
to keep "Text" in sync with the "pure instructions" section attribute.
Lack of this attribute was preventing the assembler from emitting
multibyte noops instructions for templates (and inlines, and other
coalesced stuff) and was causing the assembler to mismatch .o files.

This fixes rdar://8018335

llvm-svn: 108461
2010-07-15 21:22:00 +00:00
Chris Lattner
403b684f74 fix indentation and 80 cols
llvm-svn: 108460
2010-07-15 21:19:31 +00:00
Dan Gohman
de662ad8b0 Don't merge uses when they are targetting fixup sites with
different widths. In a use with a narrower fixup, formulae
may be wider than the fixup, in which case the high bits
aren't necessarily meaningful, so it isn't safe to reuse
them for uses with wider fixups.

This fixes PR7618, though the testcase is too large for a
reasonable regression test, since it heavily dependes on
hitting LSR's heuristics in a certain way.

llvm-svn: 108455
2010-07-15 20:24:58 +00:00
Chris Lattner
5e03b135cb fix the encoding of MMX_MOVFR642Qrr, it starts with 0xF2 not 0xF3,
this fixes rdar://8192860.  Unfortunately it can only be triggered
with llc because llvm-mc matches another (correctly encoded) version
of this, so no testcase.

llvm-svn: 108454
2010-07-15 20:13:34 +00:00
Dan Gohman
3c5c24ac18 Use dbgs() instead of errs() in a DEBUG.
llvm-svn: 108453
2010-07-15 20:12:42 +00:00
Bill Wendling
df6f653a39 Use std::vector instead of TargetRegisterInfo::FirstVirtualRegister.
llvm-svn: 108452
2010-07-15 20:04:36 +00:00
Dan Gohman
04768aa9a5 Teach ScalarEvolution how to fold trunc(undef) and anyext(undef) to undef.
This helps LSR behave more consistently on bugpoint-reduced testcases.

llvm-svn: 108451
2010-07-15 20:02:11 +00:00
Bill Wendling
f5525353b4 Use std::vector instead of TargetRegisterInfo::FirstVirtualRegister.
llvm-svn: 108450
2010-07-15 20:01:02 +00:00
Bill Wendling
5803639a36 Use std::vector instead of TargetRegisterInfo::FirstVirtualRegister. This time
make sure to allocate enough space in the std::vector.

llvm-svn: 108449
2010-07-15 19:58:14 +00:00
Bill Wendling
6dfc02e0fc Reserve a goodly amount of room for the vectors.
llvm-svn: 108448
2010-07-15 19:41:20 +00:00
Devang Patel
3028e38bd8 Fix crash reported in PR7653.
llvm-svn: 108441
2010-07-15 18:45:27 +00:00
Bill Wendling
c4701c4f64 Use std::vector instead of TargetRegisterInfo::FirstVirtualRegister.
llvm-svn: 108440
2010-07-15 18:43:09 +00:00
Bill Wendling
869257315b Use std::vector instead of TargetRegisterInfo::FirstVirtualRegister.
llvm-svn: 108438
2010-07-15 18:40:50 +00:00
Owen Anderson
cc5ef967da Speculatively revert r108429 to fix the clang self-host.
llvm-svn: 108436
2010-07-15 18:18:57 +00:00
Owen Anderson
565ac2758c Per Chris' suggestion, get rid of the select canonicalization and just add
the corresponding or-icmp-and pattern.  This has the added benefit of doing
the matching earlier, and thus being less susceptible to being confused by
earlier transforms.

llvm-svn: 108429
2010-07-15 17:24:23 +00:00
Owen Anderson
b9f325bab4 Remove unneeded check, and correct style.
llvm-svn: 108427
2010-07-15 16:38:22 +00:00
Dan Gohman
d75ba463e0 Watch out for a constant offset cancelling out a base register, forming
a zero. This situation arrises in Fortran code with induction variables
that start at 1 instead of 0. This fixes PR7651.

llvm-svn: 108424
2010-07-15 15:14:45 +00:00
Owen Anderson
01a2992a91 Reapply r108378, with bugfixes, testcase, and improved comment formatting.
This now passes LIT, nighty test, and llvm-gcc bootstrap on my machine.

llvm-svn: 108422
2010-07-15 15:00:23 +00:00
Gabor Greif
0b8d6a43c0 cache another dereferenced iterator
llvm-svn: 108421
2010-07-15 10:19:23 +00:00
Chris Lattner
44b03b850b revert bill's patches in an attempt to fix the buildbot.
llvm-svn: 108419
2010-07-15 06:51:46 +00:00
Nick Lewycky
933c0402bb This is a full sentence.
llvm-svn: 108418
2010-07-15 06:51:22 +00:00
Nick Lewycky
c4e3206edc Disable aliases on all platforms.
llvm-svn: 108417
2010-07-15 06:48:56 +00:00
Chris Lattner
2b2265a9c5 Fix PR7647, handling the case when 'To' ends up being
mutated by recursive simplification.  This also enhances
ReplaceAndSimplifyAllUses to actually do a real RAUW
at the end of it, which updates any value handles
pointing to "From" to start pointing to "To".  This
seems useful for debug info and random other VH users.

llvm-svn: 108415
2010-07-15 06:36:08 +00:00
Chris Lattner
63cfa4b8e0 make various clients of ReplaceAndSimplifyAllUses tolerate
it *changing* the things it replaces, not just causing them
to drop to null.  There is no functionality change yet, but 
this is required for a subsequent patch.

llvm-svn: 108414
2010-07-15 06:06:04 +00:00
Bill Wendling
5a80e10d56 Fix headers.
llvm-svn: 108413
2010-07-15 06:05:18 +00:00
Bill Wendling
491e6e24f7 Use std::vector instead of a hard-coded array. The length of that array could
get *very* large, but we only need it to be the size of the number of pregs.

llvm-svn: 108412
2010-07-15 06:04:38 +00:00
Bill Wendling
ffdbca76f9 Use std::vector instead of a hard-coded array. The length of that array could
get *very* large, but we only need it to be the size of thenumber of pregs.

llvm-svn: 108411
2010-07-15 05:56:32 +00:00
Eli Friedman
f7ae898f2b Revert r108401; it breaks bootstrap :(
llvm-svn: 108407
2010-07-15 05:09:31 +00:00
Eli Friedman
5d36d37a4a Add AssertingVH which makes PR7647 break consistently.
llvm-svn: 108401
2010-07-15 04:46:14 +00:00
Eli Friedman
fc1680a9af Random note about bswap.
llvm-svn: 108396
2010-07-15 02:20:38 +00:00
Chris Lattner
01c2381bd7 a more graceful fix for test/Other/inline-asm-newline-terminator.ll,
follow on to r103765

llvm-svn: 108390
2010-07-15 00:37:34 +00:00
Eli Friedman
ded29cd2dc Speculatively revert r108378; may be causing bootstrap failures.
llvm-svn: 108389
2010-07-15 00:33:00 +00:00
Jakob Stoklund Olesen
0a565bde90 Last COPY conversion.
llvm-svn: 108387
2010-07-14 23:58:21 +00:00
Bob Wilson
27e348cfa5 Remove restriction on NEON alignment values. Some of the NEON ld/st
instructions use different values (e.g., 2-byte or 4-byte alignment).
Also fix ARMInstPrinter to print these alignments as bits instead of bytes.

llvm-svn: 108386
2010-07-14 23:54:43 +00:00
Jakob Stoklund Olesen
e3aafe4988 Use TargetOpcode::COPY instead of X86-native register copy instructions when
lowering atomics. This will allow those copies to still be coalesced after
TII::isMoveInstr is removed.

llvm-svn: 108385
2010-07-14 23:50:27 +00:00
Eric Christopher
99de6c6eb6 80-col.
llvm-svn: 108381
2010-07-14 23:41:32 +00:00
Owen Anderson
4656b749f2 Add instcombine transforms to optimize tests of multiple bits of the same value into a single larger comparison.
llvm-svn: 108378
2010-07-14 23:33:51 +00:00
Dan Gohman
07ef07c202 Make the order in which variables are described in debug information
independent of the order that isel happens to visit the dbg_declare
intrinsics. This fixes a bug in which the formal arguments were
being printed in reverse order, now that fast isel is going bottom up.

llvm-svn: 108369
2010-07-14 23:08:16 +00:00
Chris Lattner
fa93b779db fix indentation
llvm-svn: 108368
2010-07-14 23:04:59 +00:00
Benjamin Kramer
da3e6cdb26 Don't pass StringRef by reference.
llvm-svn: 108366
2010-07-14 22:38:02 +00:00
Dan Gohman
9589865567 Properly restore DebugLoc after leaving the local constant area.
llvm-svn: 108364
2010-07-14 22:01:31 +00:00
Dan Gohman
4a92aee9d6 Just use getParent() instead of getModuleFromVal when the value is a Function.
llvm-svn: 108358
2010-07-14 21:12:44 +00:00
Dan Gohman
e91d5d0c36 Rename WriteConstantInt to WriteConstantInternal, to avoid confusion.
llvm-svn: 108357
2010-07-14 20:57:55 +00:00
Owen Anderson
5de6c42ebd Extend SimplifyCFG's common-destination folding heuristic to allow a single
"bonus" instruction to be speculatively executed.  Add a heuristic to
ensure we're not tripping up out-of-order execution by checking that this bonus
instruction only uses values that were already guaranteed to be available.

This allows us to eliminate the short circuit in (x&1)&&(x&2).

llvm-svn: 108351
2010-07-14 19:52:16 +00:00
Dan Gohman
8c1d1d0b27 Factor out metadata parsing into a separate function.
llvm-svn: 108343
2010-07-14 18:26:50 +00:00
Chris Lattner
2793cb1bd6 Merge lib/Target/X86/X86COFF.h into include/llvm/Support/COFF.h,
patch by Michael Spencer!

llvm-svn: 108342
2010-07-14 18:14:33 +00:00
Jim Grosbach
e2d1ecbe70 Improve 64-subtraction of immediates when parts of the immediate can fit
in the literal field of an instruction. E.g.,
long long foo(long long a) {
  return a - 734439407618LL;
}

rdar://7038284

llvm-svn: 108339
2010-07-14 17:45:16 +00:00
Dan Gohman
8e01a639c0 Delete fast-isel's trivial load optimization; it breaks debugging because
it can look past points where a debugger might modify user variables.

llvm-svn: 108336
2010-07-14 17:25:37 +00:00
Bob Wilson
f60d34bfad Add missing address register update to t2LDM_RET instruction.
Patch by Brian Lucas. PR7636.

llvm-svn: 108332
2010-07-14 16:02:13 +00:00
Duncan Sands
b0f45f192c Rather than using an ifdef on the target to zero out fields,
just use memset to zero the entire struct.

llvm-svn: 108330
2010-07-14 14:32:33 +00:00
Eli Friedman
7175d7558d A couple potential optimizations inspired by comment 4 in PR6773.
llvm-svn: 108328
2010-07-14 06:58:26 +00:00
Evan Cheng
f6478f489d Fix for PR7193 was overly conservative. The only case where sibcall callee
address cannot be allocated a register is in 32-bit mode where the first
three arguments are marked inreg. In that case EAX, EDX, and ECX will be
used for argument passing.

This fixes PR7610.

llvm-svn: 108327
2010-07-14 06:44:01 +00:00
Bob Wilson
34f481e895 Add support for NEON VMVN immediate instructions.
llvm-svn: 108324
2010-07-14 06:31:50 +00:00
Bob Wilson
298c5c46c1 The bits in the cmode field of 32-bit VMOV immediate instructions all depend
of the value of the immediate.

llvm-svn: 108323
2010-07-14 06:30:44 +00:00
Chris Lattner
38e6ecd9f1 revert r108320, I see the failures now...
llvm-svn: 108322
2010-07-14 06:16:35 +00:00
Chris Lattner
5822d6d579 reapply benjamin's instcombine patch, I don't see anything wrong with it and can't repro any problems with a manual self-host.
llvm-svn: 108320
2010-07-14 05:59:13 +00:00
Chris Lattner
25b9b8f2fc fix a bug found by a warning I added to clang this morning.
llvm-svn: 108309
2010-07-14 01:57:17 +00:00
Evan Cheng
72e40c4e08 Teach ProcessImplicitDefs to transform more COPY instructions into IMPLICIT_DEF (and subsequently eliminate them). This allows machine LICM to hoist IMPLICIT_DEF's. PR7620.
llvm-svn: 108304
2010-07-14 01:22:19 +00:00
Bob Wilson
0f581a998c Add an ARM-specific DAG combining to avoid redundant VDUPLANE nodes.
Radar 7373643.

llvm-svn: 108303
2010-07-14 01:22:12 +00:00
Dan Gohman
18711b19c9 Don't propagate debug locations to instructions for materializing
constants, since they may not be emited near the other instructions
which get the same line, and this confuses debug info.

llvm-svn: 108302
2010-07-14 01:07:44 +00:00
Bruno Cardoso Lopes
0616a418b6 Add AVX 256-bit compare instructions and a bunch of testcases
llvm-svn: 108286
2010-07-13 22:06:38 +00:00
Jakob Stoklund Olesen
04bbd415d6 Print VNInfo flags.
llvm-svn: 108277
2010-07-13 21:19:05 +00:00
Bob Wilson
7feb850d36 Use a target-specific VMOVIMM DAG node instead of BUILD_VECTOR to represent
NEON VMOV-immediate instructions.  This simplifies some things.

llvm-svn: 108275
2010-07-13 21:16:48 +00:00
Bruno Cardoso Lopes
7bc71d2d0a AVX 256-bit conversion instructions
Add the x86 VEX_L form to handle special cases where VEX_L must be set.

llvm-svn: 108274
2010-07-13 21:07:28 +00:00
Dale Johannesen
f84a7f2b4f In inline asm treat indirect 'X' constraint as 'm'.
This may not be right in all cases, but it's better
than asserting which it was doing before.  PR 7528.

llvm-svn: 108268
2010-07-13 20:17:05 +00:00
Kevin Enderby
c26ac60ca8 Added a check that pusha cannot be encoded in 64-bit mode.
llvm-svn: 108265
2010-07-13 20:05:41 +00:00
Jakob Stoklund Olesen
b1bf1bcc9e Add an assertion to make PR7542 fail consistently.
LiveInterval::overlapsFrom dereferences end() if it is called on an empty
interval.

It would be reasonable to just return false - an empty interval doesn't overlap
anything, but I want to know who is doing it first.

llvm-svn: 108264
2010-07-13 19:56:28 +00:00
Dan Gohman
c17f8b89de Add support for empty named metadata too. This isn't particularly
useful, but it is nice for consistency.

llvm-svn: 108262
2010-07-13 19:42:44 +00:00
Jakob Stoklund Olesen
3726c5f775 Fix LiveInterval::overlaps so it doesn't claim touching intervals overlap.
Also, one binary search is enough.

llvm-svn: 108261
2010-07-13 19:42:20 +00:00
Dan Gohman
2ac1d3a2c9 Add support for empty metadata nodes: !{}.
llvm-svn: 108259
2010-07-13 19:33:27 +00:00
Evan Cheng
069f1f7c9a Extend the r107852 optimization which turns some fp compare to code sequence using only i32 operations. It now optimize some f64 compares when fp compare is exceptionally slow (e.g. cortex-a8). It also catches comparison against 0.0.
llvm-svn: 108258
2010-07-13 19:27:42 +00:00
Evan Cheng
67743f2057 Add an ARM "feature". Cortex-a8 fp comparison is very slow (> 20 cycles).
llvm-svn: 108256
2010-07-13 19:21:50 +00:00
Evan Cheng
8cce7c7351 -enable-unsafe-fp-math should not imply -enable-finite-only-fp-math.
llvm-svn: 108254
2010-07-13 18:46:14 +00:00
Eric Christopher
f57bd9c94d Grammar.
llvm-svn: 108252
2010-07-13 18:27:13 +00:00
Duncan Sands
8864383748 Handle the case of a tail recursion in which the tail call is followed
by a return that returns a constant, while elsewhere in the function
another return instruction returns a different constant.  This is a
special case of accumulator recursion, so just generalize the existing
logic a bit.

llvm-svn: 108241
2010-07-13 15:41:41 +00:00
Gabor Greif
9772b3e74f rotate CallInst operands
with this commit the callee moves to the end of
the operand array (from the start) and the call
arguments now start at index 0 (formerly 1)

this ordering is now consistent with InvokeInst

this commit only flips the switch,
functionally it is equivalent to
r101465

I intend to commit several cleanups after a few
days of soak period

llvm-svn: 108240
2010-07-13 15:31:36 +00:00
Bob Wilson
8c1f6adf81 Move NEON "modified immediate" encode/decode into ARMAddressingModes.h to
avoid replicated code.

llvm-svn: 108227
2010-07-13 04:44:34 +00:00
Chris Lattner
ddb09ea6ad my work on adding segment registers to LEA missed the
disassembler.  Remove some code from the disassembler to
compensate, unbreaking disassembly of lea's.

llvm-svn: 108226
2010-07-13 04:23:55 +00:00
Bruno Cardoso Lopes
ae37153b05 Add AVX 256-bit packed logical forms
llvm-svn: 108224
2010-07-13 02:38:35 +00:00
Bruno Cardoso Lopes
495ae629bb Add AVX 256-bit unop arithmetic instructions
llvm-svn: 108223
2010-07-13 01:53:31 +00:00
Bruno Cardoso Lopes
185483638b Since AVX is a superset of all SSE versions, only use HasAVX for AVX instructions
llvm-svn: 108222
2010-07-13 00:38:47 +00:00
Jakob Stoklund Olesen
dd322a3f4f Don't add memory operands to storeRegToStackSlot / loadRegFromStackSlot results,
they already have one.

This fixes the himenobmtxpa miscompilation on ARM.

The PostRA scheduler got confused by the double memoperand and hoisted a stack
slot load above a store to the same slot.

llvm-svn: 108219
2010-07-13 00:23:30 +00:00
David Greene
d81591ee09 Move some SIMD fragment code into X86InstrFragmentsSIMD so that the
utility classes can be used from multiple files.  This will aid
transitioning to a new refactored x86 SIMD specification.

llvm-svn: 108213
2010-07-12 23:41:28 +00:00
Bruno Cardoso Lopes
852e3bf472 Add AVX 256 binary arithmetic instructions
llvm-svn: 108207
2010-07-12 23:04:15 +00:00
Bruno Cardoso Lopes
b021506033 More refactoring of basic SSE arith instructions. Open room for 256-bit instructions
llvm-svn: 108204
2010-07-12 22:41:32 +00:00
Daniel Dunbar
6b7349fa24 MC/AsmParser: Move ELF specific parser to ELFAsmParser.cpp.
llvm-svn: 108196
2010-07-12 21:23:32 +00:00
Daniel Dunbar
cb36453016 MC/AsmParser: Move Darwin specific parse to DarwinAsmParser.cpp.
llvm-svn: 108193
2010-07-12 20:51:51 +00:00
Dan Gohman
e9c4426bb0 Apply the SSE dependence idiom for SSE unary operations to
SD instructions too, in addition to SS instructions. And
add a comment about it.

llvm-svn: 108191
2010-07-12 20:46:04 +00:00
Daniel Dunbar
9144ed1e2e MC/AsmParser: Move .section parsing to Darwin specific parser.
llvm-svn: 108190
2010-07-12 20:42:34 +00:00
Daniel Dunbar
dea52ae42c MC/AsmParser: Move special section directive parsing to Darwin specific parser.
llvm-svn: 108187
2010-07-12 20:23:36 +00:00
Bob Wilson
33acb6130e Remove some code that doesn't appear to do anything. All the ARM call
instructions already have implicit defs of LR.  The comment suggests that
this is intended to fix something like pr6111, but it doesn't really do
that either.

llvm-svn: 108186
2010-07-12 20:22:45 +00:00
Daniel Dunbar
c02b92ed37 MC/AsmParser: Add a basic ELFAsmParser extension.
llvm-svn: 108185
2010-07-12 20:08:04 +00:00
Bruno Cardoso Lopes
a4889e6f93 Add AVX 256-bit MOVMSK forms
llvm-svn: 108184
2010-07-12 20:06:32 +00:00
Daniel Dunbar
f3e14374cb MC/AsmParser: Inline AsmParser::CreateSymbol into callers.
llvm-svn: 108183
2010-07-12 19:52:10 +00:00
Daniel Dunbar
d1c2da9d0b MC/AsmParser: Move .tbss and .zerofill parsing to Darwin specific parser.
llvm-svn: 108180
2010-07-12 19:37:35 +00:00
Daniel Dunbar
a1e5852feb MC/AsmParser: Move .desc parsing to Darwin specific parser.
llvm-svn: 108179
2010-07-12 19:22:53 +00:00
Daniel Dunbar
212b42f5ec MC/AsmParser: Move .lsym parsing to Darwin specific parser.
llvm-svn: 108176
2010-07-12 19:08:25 +00:00
Daniel Dunbar
50b931bbac MC/AsmParser: Move some misc. Darwin directive handling to DarwinAsmParser.
llvm-svn: 108174
2010-07-12 18:49:22 +00:00
Dan Gohman
5a42173004 Check begin!=end, rather than !begin.
llvm-svn: 108167
2010-07-12 18:12:35 +00:00
Daniel Dunbar
e3a98e546f MC/AsmParser: Add a DarwinAsmParser extension.
- Currently initialization is a bit of a hack, but harmless. We need to rework
   various parts of target initialization to clean this up.

llvm-svn: 108165
2010-07-12 18:12:02 +00:00
Rafael Espindola
4964bf75a4 Fix a typo and fit in 80 columns. Found by Bob Wilson.
llvm-svn: 108164
2010-07-12 18:11:17 +00:00
Daniel Dunbar
56e12eeae9 MC/AsmParser: Switch a bunch of directive parsing to use accessors.
llvm-svn: 108163
2010-07-12 18:03:11 +00:00
Dan Gohman
0af129aa1b Add a lint check for mismatched return types, inspired by PR6944.
llvm-svn: 108162
2010-07-12 18:02:04 +00:00
Daniel Dunbar
98d7990ac2 MCAsmParser: Pull some directive handling out into a helper class, and change
DirectiveMap to be based on MCAsmParserExtension.

llvm-svn: 108161
2010-07-12 17:54:38 +00:00
Daniel Dunbar
f93c614035 MC/AsmParser: Switch some directive parsing to use accessor methods.
llvm-svn: 108160
2010-07-12 17:45:27 +00:00
Daniel Dunbar
ffe3934e57 MC: Add MCAsmParserExtension, a base class for all the target/object specific
classes which want to extend the basic asm parser.

llvm-svn: 108158
2010-07-12 17:27:45 +00:00
Daniel Dunbar
fd54ea1239 MC: Move AsmParser::TokError to MCAsmParser().
llvm-svn: 108155
2010-07-12 17:18:45 +00:00
Daniel Dunbar
2be7d27677 MC: Move getLoc() to MCAsmLexer().
llvm-svn: 108154
2010-07-12 17:10:00 +00:00
Benjamin Kramer
cf8ad46899 Nope, still breaks the release selfhost bots :(
llvm-svn: 108153
2010-07-12 16:38:48 +00:00
Benjamin Kramer
e391789246 Reapply the "or" half of r108136, which seems to be less problematic.
llvm-svn: 108152
2010-07-12 16:15:48 +00:00
Gabor Greif
9f6b0059e4 cache result of operator*
llvm-svn: 108150
2010-07-12 15:48:26 +00:00
Dan Gohman
a383dfd81f Don't fast-isel an x87 comparison opcode, as fast-isel doesn't
support branching on x87 comparisons yet. This fixes PR7624.

llvm-svn: 108149
2010-07-12 15:46:30 +00:00
Benjamin Kramer
98c95e7743 Revert r108141 again, sigh.
llvm-svn: 108148
2010-07-12 14:42:04 +00:00
Gabor Greif
04d1ca9e95 cache result of operator*
llvm-svn: 108147
2010-07-12 14:15:58 +00:00
Gabor Greif
b2b6867582 cache result of operator*
llvm-svn: 108146
2010-07-12 14:15:10 +00:00
Gabor Greif
bf2470e6e9 cache result of operator*
llvm-svn: 108145
2010-07-12 14:14:03 +00:00
Gabor Greif
de1c22125f cache result of operator*
llvm-svn: 108144
2010-07-12 14:13:15 +00:00
Gabor Greif
cf2cac8ef4 cache results of operator*
llvm-svn: 108143
2010-07-12 14:12:11 +00:00
Gabor Greif
8159329bfb cache results of operator*
llvm-svn: 108142
2010-07-12 14:10:24 +00:00
Benjamin Kramer
c4f46375d3 Reapply 108136 with an ugly pasto fixed.
llvm-svn: 108141
2010-07-12 13:44:00 +00:00
Benjamin Kramer
e12b88fafe Move optimization to avoid redundant matching.
llvm-svn: 108140
2010-07-12 13:34:22 +00:00
Benjamin Kramer
d9bf737e62 Revert r108136 until I figure out why it broke selfhost.
llvm-svn: 108139
2010-07-12 12:35:49 +00:00
Gabor Greif
8f93852b68 cache dereferenced iterators
llvm-svn: 108138
2010-07-12 12:03:02 +00:00
Gabor Greif
fc666b2d76 recommit r108131 (hich has been backed out in r108135) with a fix
llvm-svn: 108137
2010-07-12 12:02:10 +00:00
Benjamin Kramer
f00a49ceff instcombine: fold (x & y) | (~x & z) and (x & y) ^ (~x & z) into ((y ^ z) & x) ^ z which is one instruction shorter. (PR6773)
before:
  %and = and i32 %y, %x
  %neg = xor i32 %x, -1
  %and4 = and i32 %z, %neg
  %xor = xor i32 %and4, %and

after:
  %xor1 = xor i32 %z, %y
  %and2 = and i32 %xor1, %x
  %xor = xor i32 %and2, %z

llvm-svn: 108136
2010-07-12 11:54:45 +00:00
Gabor Greif
1ae3047b14 back out r108131 (of TailDuplication.cpp) for now, it causes a buildbot failure
llvm-svn: 108135
2010-07-12 11:32:39 +00:00
Gabor Greif
f420d43bf6 cache dereferenced iterators
llvm-svn: 108134
2010-07-12 11:19:24 +00:00
Gabor Greif
95805d51b8 cache dereferenced iterators
llvm-svn: 108133
2010-07-12 10:59:23 +00:00
Gabor Greif
32f6368a27 cache dereferenced iterators
llvm-svn: 108132
2010-07-12 10:49:54 +00:00
Gabor Greif
5c94fddae4 cache dereferenced iterators
llvm-svn: 108131
2010-07-12 10:36:48 +00:00
Duncan Sands
f7b98e2b1e Convert some tab stops into spaces.
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Chandler Carruth
6b1b1c63b9 Add parentheses around an || to correct the logic. Also silences a GCC warning
that was actually useful here.

Chris, please double check that this is the correct interpretation. I was
pretty sure, and ran it by Nick as well.

llvm-svn: 108129
2010-07-12 06:47:05 +00:00
Chris Lattner
58dad00aa5 Path::isRootDirectory is unimplemented on Unix and not used,
remove it, fixing PR6909.

llvm-svn: 108125
2010-07-12 04:39:07 +00:00
Rafael Espindola
16319e45c6 Convert getLoadStoreRegOpcode to use a switch.
llvm-svn: 108123
2010-07-12 03:43:04 +00:00
Rafael Espindola
4c16632cdf Convert the last use of getPhysicalRegisterRegClass and remove it.
AggressiveAntiDepBreaker should not be using getPhysicalRegisterRegClass. An
instruction might be using a register that can only be replaced with one from
a subclass of getPhysicalRegisterRegClass.

With this patch we use getMinimalPhysRegClass. This is correct, but
conservative. We should check the uses of the register and select the
largest register class that can be used in all of them.

llvm-svn: 108122
2010-07-12 02:55:34 +00:00
Jakob Stoklund Olesen
cc60305c22 A basic block that only uses RFP registers still needs the FP_REG_KILL marker.
This fixes PR7375.

llvm-svn: 108120
2010-07-12 02:12:47 +00:00
Rafael Espindola
b29463e006 Don't use getPhysicalRegisterRegClass in PBQP. The existing checks that the
physical register can be allocated in the class of the virtual are sufficient.

I think that the test for virtual registers is more strict than it needs to be,
it should be possible to coalesce two virtual registers the class of one
is a subclass of the other.

llvm-svn: 108118
2010-07-12 01:45:38 +00:00
Chris Lattner
59bffe35a1 fix PR7311 by avoiding breaking casts when a bitcast from scalar->vector
is involved.

llvm-svn: 108117
2010-07-12 01:19:22 +00:00
Chris Lattner
c6f9c11878 make the prototypes for CreateMalloc and CreateFree more consistent. Patch
by Hans Vandierendonck from PR7605

llvm-svn: 108116
2010-07-12 00:57:28 +00:00
Rafael Espindola
0c1a9aa248 Convert the last getPhysicalRegisterRegClass in VirtRegRewriter.cpp to
getMinimalPhysRegClass. It was used to produce spills, and it is better to
use the most specific class if possible.

Update getLoadStoreRegOpcode to handle GR32_AD.

llvm-svn: 108115
2010-07-12 00:52:33 +00:00
Chris Lattner
baef771d17 if jump threading is able to infer interesting values on both
the LHS and RHS of an and/or instruction, don't multiply add
known predecessor values.  This fixes the crash on testcase
from PR7498

llvm-svn: 108114
2010-07-12 00:47:34 +00:00
Chris Lattner
d8288040c3 fix PR7429, a crash turning a load from a string into a float.
llvm-svn: 108113
2010-07-12 00:22:51 +00:00
Chris Lattner
a94ea82dac improve Path::makeUnique when mkstemp/mktemp are not available
patch by Lasse Kärkkäinen in PR7404.

llvm-svn: 108110
2010-07-12 00:09:55 +00:00
Chris Lattner
55bd17a388 change machinelicm to use MachineInstr::isSafeToMove. No
intended functionality change.

The avoidance of hoistiing implicitdef seems wrong though.

llvm-svn: 108109
2010-07-12 00:00:35 +00:00
Chris Lattner
bb04e40482 first part of JIT support for address of labels, part of PR7264,
patch by Yuri!

llvm-svn: 108107
2010-07-11 23:07:28 +00:00
Chris Lattner
666bfc3ab5 introduce WinCOFFObjectWriter, patch by Michael Spencer!
llvm-svn: 108103
2010-07-11 22:07:02 +00:00
Chris Lattner
f2c1a57940 introduce WinCOFFStreamer.cpp, patch by Michael Spencer!
llvm-svn: 108102
2010-07-11 22:05:00 +00:00
Nick Lewycky
9abc58b327 If it's safe to speculatively execute load(alloca) the it's safe to execute
load(gep(alloca)) where the gep is all-zeros. There's more we could do here but
this is a common case.

llvm-svn: 108101
2010-07-11 20:36:29 +00:00
Chris Lattner
656c2c8700 fix typo
llvm-svn: 108100
2010-07-11 19:42:53 +00:00
Jakob Stoklund Olesen
7af3eff94d RISC architectures get their memory operand folding for free.
The only folding these load/store architectures can do is converting COPY into a
load or store, and the target independent part of foldMemoryOperand already
knows how to do that.

llvm-svn: 108099
2010-07-11 19:19:13 +00:00
Jakob Stoklund Olesen
73e71c4703 Use target independent COPY instructions for the fake fextend and fround
operations in x87 code.

llvm-svn: 108098
2010-07-11 18:19:39 +00:00
Jakob Stoklund Olesen
c48892383f Remove redundant branch. Thanks, Anton!
llvm-svn: 108097
2010-07-11 17:17:35 +00:00
Jakob Stoklund Olesen
eeabe43059 Remove obsolete README_SSE note.
We are generating movaps for all XMM register copies, including scalar
floating point values. This is known to be at least as good as movss and movsd
for all known architectures up to and including Nehalem because it avoids a
partial register stall.

The SSEDomainFix pass will switch movaps to movdqa when appropriate (i.e., when
operands come from the integer unit). We don't now that switching movaps to
movapd has any benefit.

The same applies to andps -> pand.

llvm-svn: 108096
2010-07-11 17:13:42 +00:00
Jakob Stoklund Olesen
a28aa26057 Remove TargetInstrInfo::copyRegToReg entirely.
Targets must now implement TargetInstrInfo::copyPhysReg instead. There is no
longer a default implementation forwarding to copyRegToReg.

llvm-svn: 108095
2010-07-11 17:01:17 +00:00
Rafael Espindola
68bbc41d5e Make getPhysicalRegisterRegClass non-virtual. Should be able to remove it soon.
llvm-svn: 108094
2010-07-11 16:49:10 +00:00
Rafael Espindola
a6c4d25f0f Convert uses of getPhysicalRegisterRegClass in VirtRegRewriter.cpp.
The first one was used just to call isSafeToMoveRegClassDefs. In
general, using a more specific reg class is better, in practice only
x86 implements that method and the results are always the same.

The second one is in FindFreeRegister and is used to check if a register
is in a register class, a much more direct call to contains is better as
it should cover more cases and is faster.

llvm-svn: 108093
2010-07-11 16:45:17 +00:00
Jakob Stoklund Olesen
ecdef6c130 Replace copyRegToReg with copyPhysReg for SystemZ.
llvm-svn: 108092
2010-07-11 16:40:46 +00:00
Jakob Stoklund Olesen
040d64f18b Avoid SSE instructions in FastIsel when it is not available.
llvm-svn: 108091
2010-07-11 16:22:13 +00:00
Chandler Carruth
8425bffa25 Remove two other uses of ATTRIBUTE_UNUSED for variables only used within
assert()s, switching to void-casts. Removed an unneeded Compiler.h include as
a result. There are two other uses in LLVM, but they're not due to assert()s,
so I've left them alone.

llvm-svn: 108088
2010-07-11 08:18:12 +00:00
Jakob Stoklund Olesen
8b636d6456 Replace copyRegToReg with copyPhysReg for XCore.
llvm-svn: 108087
2010-07-11 07:56:13 +00:00
Jakob Stoklund Olesen
b8af51cebf Replace copyRegToReg with copyPhysReg for Sparc.
llvm-svn: 108086
2010-07-11 07:56:09 +00:00
Jakob Stoklund Olesen
8a62d7e134 Replace copyRegToReg with copyPhysReg for CellSPU.
llvm-svn: 108084
2010-07-11 07:31:03 +00:00
Jakob Stoklund Olesen
0b1e64c1d4 Replace copyRegToReg with copyPhysReg for PowerPC.
llvm-svn: 108083
2010-07-11 07:31:00 +00:00
Jakob Stoklund Olesen
84ac13069a Fix PIC16 comments referencing copyRegToReg.
llvm-svn: 108082
2010-07-11 07:30:57 +00:00
Jakob Stoklund Olesen
b15ffc7e90 Replace copyRegToReg with copyPhysReg for PIC16.
llvm-svn: 108081
2010-07-11 06:53:33 +00:00
Jakob Stoklund Olesen
fb3525531b Replace copyRegToReg with copyPhysReg for MSP430.
llvm-svn: 108080
2010-07-11 06:53:30 +00:00
Jakob Stoklund Olesen
beb86cfa27 Replace copyRegToReg with copyPhysReg for MBlaze.
llvm-svn: 108079
2010-07-11 06:53:27 +00:00
Jakob Stoklund Olesen
938e41c1fa Replace copyRegToReg with copyPhysReg for ARM.
llvm-svn: 108078
2010-07-11 06:33:54 +00:00
Jakob Stoklund Olesen
18e465659f Replace copyRegToReg with copyPhysReg for Blackfin.
llvm-svn: 108077
2010-07-11 05:44:34 +00:00
Jakob Stoklund Olesen
821d058fd2 X86InstrInfo::copyRegToReg is dead. Long live copyPhysReg!
llvm-svn: 108076
2010-07-11 05:44:30 +00:00
Jakob Stoklund Olesen
08fc7eaaa2 Use COPY in X86FastISel::X86SelectRet.
Don't try a cross-class copy. That is very unlikely anywy since return value
registers are usually register class friendly. (%EAX, %XMM0, etc).

llvm-svn: 108074
2010-07-11 05:17:02 +00:00
Jakob Stoklund Olesen
e2f74d400c Use COPY for fast-isel bitconvert, but don't create cross-class copies.
This doesn't change the behavior of SelectBitcast for X86.

llvm-svn: 108073
2010-07-11 05:16:54 +00:00
Rafael Espindola
84716579d4 Fix va_arg for doubles. With this patch VAARG nodes always contain the
correct alignment information, which simplifies ExpandRes_VAARG a bit.

The patch introduces a new alignment information to TargetLoweringInfo. This is
needed since the two natural candidates cannot be used:

* The 's' in target data: If this is set to the minimal alignment of any
  argument, getCallFrameTypeAlignment would return 4 for doubles on ARM for
  example.
* The getTransientStackAlignment method. It is possible for an architecture to
  have argument less aligned than what we maintain the stack pointer.

llvm-svn: 108072
2010-07-11 04:01:49 +00:00
Jakob Stoklund Olesen
4b39aa26df Use COPY for extracting ImplicitDef'ed values from fast-isel instructions.
This assumes that the registers can be copied which is probably a safe
assumption.

llvm-svn: 108070
2010-07-11 03:31:05 +00:00
Jakob Stoklund Olesen
57bbaf37c0 Use COPY in FastISel everywhere it is safe and trivial.
The remaining copyRegToReg calls actually check the return value (shock!), so we
cannot trivially replace them with COPY instructions.

llvm-svn: 108069
2010-07-11 03:31:00 +00:00
Jakob Stoklund Olesen
c1aca7464d Replace copyRegToReg with copyPhysReg for Mips.
llvm-svn: 108066
2010-07-11 01:08:31 +00:00
Jakob Stoklund Olesen
0fc69a96b7 Replace copyRegToReg with copyPhysReg for Alpha.
llvm-svn: 108065
2010-07-11 01:08:23 +00:00
Jakob Stoklund Olesen
b1c6191d3b Use COPY in targets
llvm-svn: 108063
2010-07-10 22:43:03 +00:00
Jakob Stoklund Olesen
f0d1bf23eb Replace copyRegToReg with COPY everywhere in lib/CodeGen except for FastISel.
llvm-svn: 108062
2010-07-10 22:42:59 +00:00
Jakob Stoklund Olesen
9b0f71f68f Only collect subreg extracting copies for later coalescing.
This also avoids fatal copies from physregs.

llvm-svn: 108061
2010-07-10 22:42:53 +00:00
Dan Gohman
d96f5d09bb Fix a bug in the code which re-inserts DBG_VALUE nodes after scheduling;
if a block is split (by a custom inserter), the insert point may be in a
different block than it was originally. This fixes 32-bit llvm-gcc
bootstrap builds, and I haven't been able to reproduce it otherwise.

llvm-svn: 108060
2010-07-10 22:42:31 +00:00
Duncan Sands
954c75c560 The accumulator tail recursion transform claims to work for any associative
operation, but the way it's implemented requires the operation to also be
commutative.  So add a check for commutativity (and tweak the corresponding
comments).  This makes no difference in practice since every associative
LLVM instruction is also commutative!  Here's an example to show the need
for commutativity: the accum_recursion.ll testcase calculates the factorial
function.  Before the transformation the result of a call is
  ((((1*1)*2)*3)...)*x
while afterwards it is
  (((1*x)*(x-1))...*2)*1
which clearly requires both associativity and commutativity of * to be equal
to the original.

llvm-svn: 108056
2010-07-10 20:31:42 +00:00
Jakob Stoklund Olesen
609d345349 Emit COPY instructions instead of using copyRegToReg in InstrEmitter,
ScheduleDAGEmit, TwoAddressLowering, and PHIElimination.

This switches the bulk of register copies to using COPY, but many less used
copyRegToReg calls remain.

llvm-svn: 108050
2010-07-10 19:08:25 +00:00
Jakob Stoklund Olesen
b1e88a2725 Don't emit st(0)/st(1) copies as FpMOV instructions. Use FpSET_ST? instead.
Based on a patch by Rafael Espíndola.

Attempt to make the FpSET_ST1 hack more robust, but we are still relying on
FpSET_ST0 preceeding it. This is only for supporting really weird x87 inline
asm.

We support:

  FpSET_ST0
  INLINEASM

  FpSET_ST0
  FpSET_ST1
  INLINEASM

with and without kills on the arguments. We don't support:

  FpSET_ST1
  FpSET_ST0
  INLINEASM

nor

  FpSET_ST1
  INLINEASM

Just Don't Do It!

llvm-svn: 108047
2010-07-10 17:42:34 +00:00
Dan Gohman
1ff6a10e31 Insert IMPLICIT_DEF instructions at the current insert position, not
at the end of the block.

llvm-svn: 108045
2010-07-10 13:55:45 +00:00
Chandler Carruth
1efbf423c5 Add parentheses yet again to satisfy GCC's warnings.
llvm-svn: 108043
2010-07-10 12:06:22 +00:00
Dan Gohman
fef30fcd5e Reapply bottom-up fast-isel, with several fixes for x86-32:
- Check getBytesToPopOnReturn().
 - Eschew ST0 and ST1 for return values.
 - Fix the PIC base register initialization so that it doesn't ever
   fail to end up the top of the entry block.

llvm-svn: 108039
2010-07-10 09:00:22 +00:00
Jakob Stoklund Olesen
bf7dddd5b7 An x86 function returns a floating point value in st(0), and we must make sure
it is popped, even if it is ununsed. A CopyFromReg node is too weak to represent
the required sideeffect, so insert an FpGET_ST0 instruction directly instead.

This will matter when CopyFromReg gets lowered to a generic COPY instruction.

llvm-svn: 108037
2010-07-10 04:04:25 +00:00
Devang Patel
118d642573 Update DBG_VALUE to refer appropriate stack slot in case of a spill.
llvm-svn: 108023
2010-07-09 21:48:31 +00:00
Bruno Cardoso Lopes
3b9d36bde7 Declare YMM subregisters in the right way! Thanks Jakob
llvm-svn: 108022
2010-07-09 21:46:19 +00:00
Bruno Cardoso Lopes
f4180a9a7b Add AVX 256-bit packed MOVNT variants
llvm-svn: 108021
2010-07-09 21:42:42 +00:00
Jakob Stoklund Olesen
ef941722c5 Remember the *_TC opcodes for load/store
llvm-svn: 108020
2010-07-09 21:27:55 +00:00
Bruno Cardoso Lopes
6ca8dc935c Add AVX 256-bit unpack and interleave
llvm-svn: 108017
2010-07-09 21:20:35 +00:00
Jakob Stoklund Olesen
c90bfdd01f Fix small bug in isMoveInstr -> COPY translation
llvm-svn: 108013
2010-07-09 20:55:49 +00:00
Jakob Stoklund Olesen
d7c882a505 Automatically fold COPY instructions into stack load/store.
llvm-svn: 108012
2010-07-09 20:43:13 +00:00
Jakob Stoklund Olesen
53d777f3bd Fix a few tests
llvm-svn: 108011
2010-07-09 20:43:09 +00:00
Jakob Stoklund Olesen
c99c720728 Remat uncoalescable COPY instrs
llvm-svn: 108010
2010-07-09 20:43:05 +00:00
Jim Grosbach
b591b3b48d In the presence of variable sized objects, allocate an emergency spill slot.
rdar://8131327

llvm-svn: 108008
2010-07-09 20:27:06 +00:00
Bill Wendling
07a0700418 Clarify what mysterious check means.
llvm-svn: 108005
2010-07-09 19:44:12 +00:00
Dan Gohman
0c7d7ee288 Fix MachineLICM to actually visit inner loops.
llvm-svn: 108001
2010-07-09 18:49:45 +00:00
Bruno Cardoso Lopes
3676e24b67 Start the support for AVX instructions with 256-bit %ymm registers. A couple of
notes:
- The instructions are being added with dummy placeholder patterns using some 256
  specifiers, this is not meant to work now, but since there are some multiclasses
  generic enough to accept them,  when we go for codegen, the stuff will be already
  there.
- Add VEX encoding bits to support YMM
- Add MOVUPS and MOVAPS in the first round
- Use "Y" as suffix for those Instructions: MOVUPSYrr, ...
- All AVX instructions in X86InstrSSE.td will move soon to a new X86InstrAVX
  file.

llvm-svn: 107996
2010-07-09 18:27:43 +00:00
Jakob Stoklund Olesen
ccd252ca08 Change TII::foldMemoryOperand API to require the machine instruction to be
inserted in a MBB, and return an already inserted MI.

This target API change is necessary to allow foldMemoryOperand to call
storeToStackSlot and loadFromStackSlot when folding a COPY to a stack slot
reference in a target independent way.

The foldMemoryOperandImpl hook is going to change in the same way, but I'll wait
until COPY folding is actually implemented. Most targets only fold copies and
won't need to specialize this hook at all.

llvm-svn: 107991
2010-07-09 17:29:08 +00:00
Gabor Greif
e0e7111f4e cache result of operator*
llvm-svn: 107990
2010-07-09 16:51:20 +00:00
Gabor Greif
0a544667f8 remove useless cast and fix typos in comment
llvm-svn: 107989
2010-07-09 16:42:04 +00:00
Gabor Greif
a2c75f904d cache result of operator*
llvm-svn: 107988
2010-07-09 16:39:02 +00:00
Bob Wilson
9e8c9204ef --- Reverse-merging r107947 into '.':
U    utils/TableGen/FastISelEmitter.cpp
--- Reverse-merging r107943 into '.':
U    test/CodeGen/X86/fast-isel.ll
U    test/CodeGen/X86/fast-isel-loads.ll
U    include/llvm/Target/TargetLowering.h
U    include/llvm/Support/PassNameParser.h
U    include/llvm/CodeGen/FunctionLoweringInfo.h
U    include/llvm/CodeGen/CallingConvLower.h
U    include/llvm/CodeGen/FastISel.h
U    include/llvm/CodeGen/SelectionDAGISel.h
U    lib/CodeGen/LLVMTargetMachine.cpp
U    lib/CodeGen/CallingConvLower.cpp
U    lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
U    lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
U    lib/CodeGen/SelectionDAG/FastISel.cpp
U    lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
U    lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
U    lib/CodeGen/SelectionDAG/InstrEmitter.cpp
U    lib/CodeGen/SelectionDAG/TargetLowering.cpp
U    lib/Target/XCore/XCoreISelLowering.cpp
U    lib/Target/XCore/XCoreISelLowering.h
U    lib/Target/X86/X86ISelLowering.cpp
U    lib/Target/X86/X86FastISel.cpp
U    lib/Target/X86/X86ISelLowering.h

llvm-svn: 107987
2010-07-09 16:37:18 +00:00