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

36700 Commits

Author SHA1 Message Date
Sanjiv Gupta
8a971a1dc5 Reapply things reverted back in 97220, with the fixed test case.
llvm-svn: 97228
2010-02-26 17:59:28 +00:00
Dan Gohman
e382448355 movl is a cheaper way to materialize 0 without clobbering EFLAGS than movabsq.
llvm-svn: 97227
2010-02-26 16:49:27 +00:00
Richard Osborne
fe30a8a2c1 Fix XCoreTargetLowering::isLegalAddressingMode() to handle VoidTy.
Previously LoopStrengthReduce would sometimes be unable to find
a legal formula, causing an assertion failure.

llvm-svn: 97226
2010-02-26 16:44:51 +00:00
Chandler Carruth
78f5a17a0c Revert r97211 and r97213 to get the build green again.
llvm-svn: 97220
2010-02-26 08:43:09 +00:00
Sanjiv Gupta
56ab10dfb2 Currently in LLVM, names of libcalls are assigned during TargetLowering
object construction. There is no provision to change them when the 
code for a function generated. 
So we have to change these names while printing assembly.

llvm-svn: 97213
2010-02-26 07:31:15 +00:00
Sanjiv Gupta
7caf38490a Before converting an operand to mem, check if it is legal to do so.
llvm-svn: 97211
2010-02-26 07:27:35 +00:00
Dan Gohman
e794389ad0 Delete a bunch of redundant predicates.
llvm-svn: 97201
2010-02-26 01:14:30 +00:00
Bill Wendling
720095c22c Fix comments.
llvm-svn: 97200
2010-02-26 01:12:52 +00:00
Bill Wendling
173d797171 Add another (and hopefully the last) exception case, where once we recalculate
the alignment requirement, if it no longer makes the TType base offset overflow
into extra bytes, then we need to pad to those bytes ourselves.

llvm-svn: 97196
2010-02-26 00:43:54 +00:00
Bill Wendling
6c6c5e70e3 And should use the correct variable.
llvm-svn: 97193
2010-02-26 00:24:25 +00:00
Bill Wendling
30d82f42c4 Got assertion check backwards.
llvm-svn: 97192
2010-02-26 00:22:42 +00:00
Bill Wendling
788d3707a8 Catch a corner case where adding the padding to the "TType base offset" field
will eliminate the need for padding in the "Call site table length". E.g., if
we have this:

    GCC_except_table1:
    Lexception1:
        .byte   0xff  ## @LPStart Encoding = omit
        .byte   0x9b  ## @TType Encoding = indirect pcrel sdata4
        .byte   0x7f  ## @TType base offset
        .byte   0x03  ## Call site Encoding = udata4
        .byte   0x89  ## Call site table length

with padding of 1. We want to emit the padding like this:
 
    GCC_except_table1:
    Lexception1:
        .byte   0xff  ## @LPStart Encoding = omit
        .byte   0x9b  ## @TType Encoding = indirect pcrel sdata4
        .byte   0xff  ## @TType base offset
        .space  1,0   ## Padding
        .byte   0x03  ## Call site Encoding = udata4
        .byte   0x89  ## Call site table length

and not with padding on the "Call site table length" entry.

llvm-svn: 97183
2010-02-25 23:52:44 +00:00
Chris Lattner
8cb1dc746d rewrite OptimizeGlobalAddressOfMalloc to fix PR6422, some bugs
introduced when mallocinst was eliminated. 

llvm-svn: 97178
2010-02-25 22:33:52 +00:00
Bill Wendling
dd2bd801a2 Make comment more meaningful.
llvm-svn: 97169
2010-02-25 21:19:47 +00:00
Dan Gohman
17447493ea Fix ExpandVectorBuildThroughStack for the case where the
operands are themselves vectors. Based on a patch by
Micah Villmow for PR6338.

llvm-svn: 97165
2010-02-25 20:30:49 +00:00
Johnny Chen
47fd2a4774 Added the following 32-bit Thumb instructions for disassembly only: SMC, RFE,
and SRS.

llvm-svn: 97164
2010-02-25 20:25:24 +00:00
Johnny Chen
8737e46553 Added the 32-bit Thumb instructions (BXJ) for disassembly only.
llvm-svn: 97163
2010-02-25 19:05:29 +00:00
Johnny Chen
b05edcba36 Added the 32-bit Thumb instructions (MRS and MSR) for disassembly only.
llvm-svn: 97159
2010-02-25 18:46:43 +00:00
Kevin Enderby
11cce486ac This is a patch to the assembler frontend to detect when aligning a text
section with TextAlignFillValue and calls EmitCodeAlignment() instead of
calling EmitValueToAlignment().  This allows x86 assembly code to be aligned
with optimal nops.

llvm-svn: 97158
2010-02-25 18:46:04 +00:00
Daniel Dunbar
7448368e5b Fix TextAlignFillValue in a few places
llvm-svn: 97151
2010-02-25 18:07:10 +00:00
Johnny Chen
30a910f458 Added the following 16-bit Thumb instructions for disassembly only: YIELD, WFE,
WFI, SEV, SETEND.

llvm-svn: 97149
2010-02-25 17:51:03 +00:00
Dan Gohman
a15e497d94 Teach the constant folder about union types.
llvm-svn: 97142
2010-02-25 16:45:19 +00:00
Dan Gohman
f42f098d1d Remove code which assumes it knows how vectors are stored in memory.
llvm-svn: 97141
2010-02-25 16:05:33 +00:00
Dan Gohman
084112437d Revert r97064. Duncan pointed out that bitcasts are defined in
terms of store and load, which means bitcasting between scalar
integer and vector has endian-specific results, which undermines
this whole approach.

llvm-svn: 97137
2010-02-25 15:20:39 +00:00
Nick Lewycky
3fb5927aea Make the side-numbering of instructions used by metadata (which is needed to
keep track of instructions that return void) per-function. This fixes PR5278.

This breaks backwards compatibility with the metadata format. That's okay
because we haven't released the metadata bitcode yet.

llvm-svn: 97132
2010-02-25 08:30:17 +00:00
Dan Gohman
52ed61204b Make LoopSimplify change conditional branches in loop exiting blocks
which branch on undef to branch on a boolean constant for the edge
exiting the loop. This helps ScalarEvolution compute trip counts for
loops.

Teach ScalarEvolution to recognize single-value PHIs, when safe, and
ForgetSymbolicName to forget such single-value PHI nodes as apprpriate
in ForgetSymbolicName.

llvm-svn: 97126
2010-02-25 06:57:05 +00:00
Nick Lewycky
c443274bc1 Dump the presence of attached metadata even if we don't know what it is. This
format is not parsable, even if the module is legal. To get parsable output,
dump the module instead of the function or smaller, since metadata kind are
attached to the module (not the context).

llvm-svn: 97124
2010-02-25 06:53:04 +00:00
Nick Lewycky
e0601cb7f8 Modernize comment.
llvm-svn: 97121
2010-02-25 06:39:10 +00:00
Nick Lewycky
772e9deb48 Correct whitespace.
llvm-svn: 97120
2010-02-25 06:38:51 +00:00
Sanjiv Gupta
11798e6c79 Each field of auxiliary debug entry is only 1 byte long.
llvm-svn: 97108
2010-02-25 03:54:49 +00:00
Johnny Chen
bbe3592817 Added tNOP for disassembly only.
llvm-svn: 97105
2010-02-25 03:28:51 +00:00
Dan Gohman
8a2f0a6cd1 Truncate from i64 to i32 is "free" on x86-32, because it involves
just discarding one of the registers.

llvm-svn: 97100
2010-02-25 03:04:36 +00:00
Scott Michel
54b21d97ec Revert this patch for the time being. Needs more testing.
llvm-svn: 97099
2010-02-25 02:32:54 +00:00
Johnny Chen
13b9bd479f Added tSVC and tTRAP for disassembly only.
llvm-svn: 97098
2010-02-25 02:21:11 +00:00
Scott Michel
e76255b080 Large stack frame patch for the CellSPU: handle stack frames that exceed 8176
(511*16) bytes register displacement (D-form).

NOTE: This is a potential headache, given the SPU's local core limitations,
allowing the software developer to commit stack overrun suicide unknowingly.
Also, large SPU stack frames will cause code size explosion. But, one presumes
that the software developer knows what they're doing...

Contributed by Kalle.Raiskila@nokia.com, edited slightly before commit.

llvm-svn: 97091
2010-02-25 01:53:17 +00:00
Bill Wendling
1be1ea831e MC'ize padding when padding the ULEB128 value.
llvm-svn: 97087
2010-02-25 00:24:52 +00:00
Bill Wendling
e22e8b7621 LLVM puts padding bytes in the __gcc_except_tab section after the
GCC_except_table label but before the Lexception, which the FDE references.
This causes problems as the FDE does not point to the start of an LSDA chunk.

Use an unnormalized uleb128 for the call-site table length that includes the
padding.

llvm-svn: 97078
2010-02-24 23:34:35 +00:00
Chris Lattner
5ca790deef clean up various VT manipulations, patch by Micah Villmow! PR6337
llvm-svn: 97072
2010-02-24 22:44:06 +00:00
Jakob Stoklund Olesen
2b93d17560 Create a stack frame on ARM when
- Function uses all scratch registers AND
- Function does not use any callee saved registers AND
- Stack size is too big to address with immediate offsets.

In this case a register must be scavenged to calculate the address of a stack
object, and the scavenger needs a spare register or emergency spill slot.

llvm-svn: 97071
2010-02-24 22:43:17 +00:00
Bob Wilson
4ffb88d388 Check for comparisons of +/- zero when optimizing less-than-or-equal and
greater-than-or-equal SELECT_CCs to NEON vmin/vmax instructions.  This is
only allowed when UnsafeFPMath is set or when at least one of the operands
is known to be nonzero.

llvm-svn: 97065
2010-02-24 22:15:53 +00:00
Dan Gohman
424e8f22d0 Make getTypeSizeInBits work correctly for array types; it should return
the number of value bits, not the number of bits of allocation for in-memory
storage.

Make getTypeStoreSize and getTypeAllocSize work consistently for arrays and
vectors.

Fix several places in CodeGen which compute offsets into in-memory vectors
to use TargetData information.

This fixes PR1784.

llvm-svn: 97064
2010-02-24 22:05:23 +00:00
Chris Lattner
75062cedf7 convert cycle checker to smallptrset, add comments and make it
more elegant.

llvm-svn: 97059
2010-02-24 21:34:04 +00:00
Chris Lattner
fbafa903b5 revert david's patch which does not even build.
llvm-svn: 97057
2010-02-24 21:25:08 +00:00
David Greene
68c9ece3da Use a SmallPtrSet as suggested by Chris.
llvm-svn: 97056
2010-02-24 20:59:49 +00:00
Wesley Peck
63932c105a Adding function "lookupGCCName" to MBlazeIntrinsicInfo
Adding the function "lookupGCCName" to the MBlazeIntrinsicInfo
class to support the Clang MicroBlaze target.

Additionally, minor fixes which remove some unused PIC code 
(PIC is not supported yet in the MicroBlaze backend) and
removed some unused variables.

llvm-svn: 97054
2010-02-24 20:16:27 +00:00
Johnny Chen
41ab970549 Added Vector Swap (VSWPd and VSWPq) instructions for disassembly only.
A8.6.405

llvm-svn: 97052
2010-02-24 20:06:07 +00:00
Dan Gohman
4d65bd9c6a ConstantFoldInstOperands can theoretically return null if it
didn't fold anything.

llvm-svn: 97049
2010-02-24 19:31:47 +00:00
Dan Gohman
fa19b098dc Simplify this code; these casts aren't necessary.
llvm-svn: 97048
2010-02-24 19:31:06 +00:00
Jakob Stoklund Olesen
249caada0e Stay away from str <undef> in ARMLoadStoreOpt. This pass does not understand
<undef> operands, and can cause scavenger failures when it translates
<kill,undef> to <kill>.

llvm-svn: 97046
2010-02-24 18:57:08 +00:00
Johnny Chen
71bf8b1466 Fixed typo of opcodestr, should be "vst1", not "vld1".
llvm-svn: 97044
2010-02-24 18:00:40 +00:00
Dan Gohman
6aacf4728c Convert a few more backedge-taken count functions to use BackedgeTakenInfo.
llvm-svn: 97042
2010-02-24 17:31:30 +00:00
Daniel Dunbar
24c99e027e Speculatively revert r97011, "Re-apply 96540 and 96556 with fixes.", again in
the hopes of fixing PPC bootstrap.

llvm-svn: 97040
2010-02-24 17:05:47 +00:00
Daniel Dunbar
8adb7774dc Reapply r97010, the speculative revert failed.
llvm-svn: 97036
2010-02-24 08:48:04 +00:00
Daniel Dunbar
8b33ce41d0 Speculatively revert r97010, "Add an argument to PHITranslateValue to specify
the DominatorTree. ...", in hopes of restoring poor old PPC bootstrap.

llvm-svn: 97027
2010-02-24 06:55:22 +00:00
Dan Gohman
c0c6077fed 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.

llvm-svn: 97025
2010-02-24 06:52:40 +00:00
Dan Gohman
c97d42a5d5 Fix indentation.
llvm-svn: 97024
2010-02-24 06:46:09 +00:00
Chris Lattner
52a02205d8 Change the scheduler from adding nodes in allnodes order
to adding them in a determinstic order (bottom up from 
the root) based on the structure of the graph itself.

This updates tests for some random changes, interesting
bits: CodeGen/Blackfin/promote-logic.ll no longer crashes.
I have no idea why, but that's good right?

CodeGen/X86/2009-07-16-LoadFoldingBug.ll also fails, but
now compiles to have one fewer constant pool entry, making
the expected load that was being folded disappear.  Since it
is an unreduced mass of gnast, I just removed it.

This fixes PR6370

llvm-svn: 97023
2010-02-24 06:11:37 +00:00
Chandler Carruth
541c3f0bcc Remove an unused variable. Was this intentional?
llvm-svn: 97022
2010-02-24 06:09:03 +00:00
Chris Lattner
b1b5df8a16 add node #'s to debug dumps.
llvm-svn: 97019
2010-02-24 04:24:44 +00:00
Johnny Chen
c31a44dd8b Added for disassembly VST1 (multiple single elements) which stores elements to
memory from three or four registers and VST2 (multiple two-element structures)
which stores to memory from two double-spaced registers.

A8.6.391 & A8.6.393

llvm-svn: 97018
2010-02-24 02:57:20 +00:00
Jim Grosbach
3eacf455a0 handle very large call frames when require SPAdj != 0 for Thumb1
llvm-svn: 97013
2010-02-24 02:15:43 +00:00
Jim Grosbach
6f72657d6e LowerCall() should always do getCopyFromReg() to reference the stack pointer.
Machine instruction selection is much happier when operands are in virtual
registers.

llvm-svn: 97012
2010-02-24 01:43:03 +00:00
Evan Cheng
5787cd9349 Re-apply 96540 and 96556 with fixes.
llvm-svn: 97011
2010-02-24 01:42:31 +00:00
Bob Wilson
437d85dd57 Add an argument to PHITranslateValue to specify the DominatorTree. If this
argument is non-null, pass it along to PHITranslateSubExpr so that it can
prefer using existing values that dominate the PredBB, instead of just
blindly picking the first equivalent value that it finds on a uselist.
Also when the DominatorTree is specified, have PHITranslateValue filter
out any result that does not dominate the PredBB.  This is basically just
refactoring the check that used to be in GetAvailablePHITranslatedSubExpr
and also in GVN.

Despite my initial expectations, this change does not affect the results
of GVN for any testcases that I could find, but it should help compile time.
Before this change, if PHITranslateSubExpr picked a value that does not
dominate, PHITranslateWithInsertion would then insert a new value, which GVN
would later determine to be redundant and would replace.  By picking a good
value to begin with, we save GVN the extra work of inserting and then
replacing a new value.

llvm-svn: 97010
2010-02-24 01:39:00 +00:00
Jakob Stoklund Olesen
a946f9eb7d DIV8r must define %AX since X86DAGToDAGISel::Select() sometimes uses it
instead of %AL/%AH.

llvm-svn: 97006
2010-02-24 00:39:35 +00:00
Chris Lattner
80c14ff96b make selectnodeto set the nodeid to -1. This makes it more akin to
creating a new node then replacing uses.

llvm-svn: 97000
2010-02-23 23:01:35 +00:00
Jakob Stoklund Olesen
3406ec2f57 Remember to handle sub-registers when moving imp-defs to a rematted instruction.
llvm-svn: 96995
2010-02-23 22:44:02 +00:00
Jakob Stoklund Olesen
cf29251712 Keep track of phi join registers explicitly in LiveVariables.
Previously, LiveIntervalAnalysis would infer phi joins by looking for multiply
defined registers. That doesn't work if the phi join is implicitly defined in
all but one of the predecessors.

llvm-svn: 96994
2010-02-23 22:43:58 +00:00
Evan Cheng
d1d1755a44 Fix rev 96389 by restricting the xform to mask that's either signbit or max signed value.
llvm-svn: 96990
2010-02-23 21:51:54 +00:00
Kevin Enderby
69d643ba20 This is the second patch to allow x86 code to be aligned with optimal nops.
With the compiler changed to use EmitCodeAlignment() it does change the
functionality.  But X86 assembly code assembled with llvm-mc does not change
its output.  For that we will eventually change the assembler frontend to
detect a '.align x, 0x90' when used in a section that 'hasInstructions' and use
EmitCodeAlignment, but will wait until we have better target hooks.

llvm-svn: 96988
2010-02-23 21:41:24 +00:00
Richard Osborne
92fb0be76b Don't mark call instruction as a barrier.
llvm-svn: 96983
2010-02-23 21:08:11 +00:00
Johnny Chen
7e4227c8e1 Added for disassembly VLD1 (multiple single elements) which loads memory into
three or four registers and VLD2 (multiple two-element structures) which loads
memory into two double-spaced registers.

A8.6.307 & A8.6.310

llvm-svn: 96980
2010-02-23 20:51:23 +00:00
Nicolas Geoffray
8b11b7ce2b Use the module's context instead of the global context.
llvm-svn: 96977
2010-02-23 19:42:44 +00:00
Chris Lattner
74715dd299 no need to override IsLegalToFold, the base implementation
disables load folding at -O0.

llvm-svn: 96973
2010-02-23 19:33:11 +00:00
Chris Lattner
f6e9f39042 fix a bug in findNonImmUse (used by IsLegalToFold) where nodes with
no id's would cause early exit allowing IsLegalToFold to return true
instead of false, producing a cyclic dag.

This was striking the new isel because it isn't using SelectNodeTo yet,
which theoretically is just an optimization.

llvm-svn: 96972
2010-02-23 19:32:27 +00:00
Chris Lattner
4d568129c4 Print node ID's in dumps and views if set.
llvm-svn: 96971
2010-02-23 19:31:18 +00:00
Wesley Peck
94cdac52e5 Adding the MicroBlaze backend.
The MicroBlaze is a highly configurable 32-bit soft-microprocessor for
use on Xilinx FPGAs. For more information see:
http://www.xilinx.com/tools/microblaze.htm
http://en.wikipedia.org/wiki/MicroBlaze

The current LLVM MicroBlaze backend generates assembly which can be
compiled using the an appropriate binutils assembler.

llvm-svn: 96969
2010-02-23 19:15:24 +00:00
Chris Lattner
45a2c36ddc use OutStreamer.EmitCodeAlignment for alignment in the text
segment.

llvm-svn: 96967
2010-02-23 18:46:22 +00:00
Chris Lattner
405e4a1d63 genericize MCAsmStreamer::EmitCodeAlignment to support other targets
so that it doesn't break them when the code generator starts using it.

llvm-svn: 96966
2010-02-23 18:44:31 +00:00
Richard Osborne
eb0446c12a ECALLF, ECALLT shouldn't be marked as barriers.
llvm-svn: 96964
2010-02-23 18:29:49 +00:00
Kevin Enderby
c11390f758 This is the first patch to put the needed bits in place to eventually allow code
to be aligned with optimal nops.  This patch does not change any functionality
and when the compiler is changed to use EmitCodeAlignment() it should also not
change the resulting output.  Once the compiler change is made and everything
looks good the next patch with the table of optimal X86 nops will be added to
WriteNopData() changing the output.  There are many FIXMEs in this patch which
will be removed when we have better target hooks (coming soon I hear).

llvm-svn: 96963
2010-02-23 18:26:34 +00:00
Richard Osborne
9abd3b3ca7 Mark unconditional branches as barriers. Found using -verify-machineinstrs
llvm-svn: 96960
2010-02-23 18:13:38 +00:00
David Greene
dad0944642 Speed up cycle checking significantly by caching results.
llvm-svn: 96956
2010-02-23 17:37:50 +00:00
Dan Gohman
b3bf4992c5 Don't do (X != Y) ? X : Y -> X for floating-point values; it doesn't
handle NaN properly.

Do (X une Y) ? X : Y  -> X if one of X and Y is not zero.

llvm-svn: 96955
2010-02-23 17:17:57 +00:00
Jim Grosbach
0525cd8596 Spelling. s/suppor /support /
llvm-svn: 96954
2010-02-23 17:16:27 +00:00
Dan Gohman
5a6b9ad7db Remove the code which constant-folded ptrtoint(inttoptr(x)+c) to
getelementptr. Despite only doing so in the case where x is a known
array object and c can be converted to an index within range, this
could still be invalid if c is actually the address of an object
allocated outside of LLVM. Also, SCEVExpander, the original motivation
for this code, has since been improved to avoid inttoptr+ptroint in
more cases.

llvm-svn: 96950
2010-02-23 16:35:41 +00:00
Richard Osborne
ff660d72eb Remove unused lowering function LowerJumpTable
llvm-svn: 96943
2010-02-23 14:17:20 +00:00
Richard Osborne
7387249531 Lower BR_JT on the XCore to a jump into a series of jump instructions.
llvm-svn: 96942
2010-02-23 13:25:07 +00:00
Mikhail Glushenkov
3cd3e0df5f Input files with empty suffixes must be passed to linker.
llvm-svn: 96927
2010-02-23 09:05:21 +00:00
Mikhail Glushenkov
ce7b3292dd Temporary disable response files.
They are giving us problems on Mac.

llvm-svn: 96925
2010-02-23 09:05:10 +00:00
Mikhail Glushenkov
c47f951a86 Implement order-preserving option forwarding.
Needed to correctly handle things like 'llvmc -framework Foo foo.o -framework
Bar bar.o' - before this commit all '-framework' options would've been grouped
together in the beginning.

Due to our dependence on CommandLine this turned out to be a giant hack; we will
migrate away from CommandLine eventually.

llvm-svn: 96922
2010-02-23 09:04:57 +00:00
Mikhail Glushenkov
232ae779ee Correct option forwarding: initial implementation.
Does not work, but the infrastructure changes are in place.

llvm-svn: 96920
2010-02-23 09:04:44 +00:00
Mikhail Glushenkov
d030cced3d New experimental/undocumented feature: 'works_on_empty'.
For now, just enough support to make -filelist work.

llvm-svn: 96918
2010-02-23 09:04:28 +00:00
Chris Lattner
e7f90b31ad disable two patterns that are using non-sensical result pattern types.
llvm-svn: 96903
2010-02-23 07:21:15 +00:00
Chris Lattner
684559d2ef remove a confused pattern that is trying to match an address
then use it as an MMX register (!?).

llvm-svn: 96901
2010-02-23 07:16:12 +00:00
Chris Lattner
03b5f3e853 remove a bunch of dead named arguments in input patterns,
though some look dubious afaict, these are all ok.

llvm-svn: 96899
2010-02-23 06:54:29 +00:00
Chris Lattner
4fb7a4c1c2 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

llvm-svn: 96894
2010-02-23 06:09:57 +00:00
Bob Wilson
b3640f8018 Update memdep when load PRE inserts a new load, and add some debug output.
I don't have a small testcase for this.

llvm-svn: 96890
2010-02-23 05:55:00 +00:00
Chris Lattner
8a5eea0929 reapply my cellspu changes with a fix to not break the old isel.
llvm-svn: 96885
2010-02-23 05:30:43 +00:00
Dan Gohman
f1ac231d17 Revert 96854, 96852, and 96849, unbreaking test/CodeGen/CellSPU/i64ops.ll.
llvm-svn: 96871
2010-02-23 02:33:29 +00:00
Chris Lattner
42f0bd1d2c 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.

llvm-svn: 96859
2010-02-23 02:07:48 +00:00
Johnny Chen
9077a6f901 Added versions of VCGE, VCGT, VCLE, and VCLT NEON instructions which compare to
(immediate #0) for disassembly only.

A8.6.283, A8.6.285, A8.6.287, A8.6.290

llvm-svn: 96856
2010-02-23 01:42:58 +00:00
Chris Lattner
cffb96542a fix hte last cellspu failure.
llvm-svn: 96854
2010-02-23 01:37:39 +00:00
Chris Lattner
0872bdfb41 hack around more crimes in instruction selection.
llvm-svn: 96852
2010-02-23 01:33:17 +00:00
Chris Lattner
c175e45976 the cell backend is making all sorts of unsafe and incorrect assumptions
about ownership and update policies.  It isn't clear why it is doing all
this lowering at isel time instead of in legalize.  This fixes fcmp64.ll

llvm-svn: 96849
2010-02-23 01:20:00 +00:00
Johnny Chen
b35408e8df Added VCEQ (immediate #0) NEON instruction for disassembly only.
A8.6.281

llvm-svn: 96838
2010-02-23 00:33:12 +00:00
Jakob Stoklund Olesen
890a5e50fc Dead code elimination
llvm-svn: 96837
2010-02-23 00:28:53 +00:00
Jeffrey Yasskin
d5509ca6a2 Fix viewCFG on Linux.
llvm-svn: 96834
2010-02-23 00:04:53 +00:00
Evan Cheng
d9816ef946 Instcombine constant folding can normalize gep with negative index to index with large offset. When instcombine objsize checking transformation sees these geps where the offset seemingly point out of bound, it should just return "i don't know" rather than asserting.
llvm-svn: 96825
2010-02-22 23:34:00 +00:00
Jim Grosbach
c4ab116a90 Updated version of r96634 (which was reverted due to failing 176.gcc and
126.gcc nightly tests. These failures uncovered latent bugs that machine DCE
could remove one half of a stack adjust down/up pair, causing PEI to assert.
This update fixes that, and the tests now pass.

llvm-svn: 96822
2010-02-22 23:10:38 +00:00
Jim Grosbach
4aea6e93c8 Clean up a bit and fix for when SPAdj != 0
llvm-svn: 96818
2010-02-22 22:54:55 +00:00
Jim Grosbach
8ae3bf1f1e The predicate index isn't fixed, so scan for it to make sure we get the proper
value.

Thumb2 uses the tADJCALLSTACK* instructions, and doesn't need t2 versions, so
remove the FIXME entry.

llvm-svn: 96817
2010-02-22 22:47:46 +00:00
Dan Gohman
97481fb5e0 Canonicalize ConstantInts to the right operand of commutative
operators.

The test difference is just due to the multiplication operands
being commuted (and thus requiring a more elaborate match). In
optimized code, that expression would be folded.

llvm-svn: 96816
2010-02-22 22:43:23 +00:00
Chris Lattner
4b14d5146f remove dupes now.
llvm-svn: 96811
2010-02-22 22:15:05 +00:00
Chris Lattner
d9ac0d21f4 move #includes earlier.
llvm-svn: 96810
2010-02-22 22:14:47 +00:00
Daniel Dunbar
2097684f80 MC/Mach-O: Remove non-sensical comment, and add a missing AddValueSymbols call.
llvm-svn: 96809
2010-02-22 22:08:57 +00:00
Dan Gohman
90cc88c00f Minor formatting cleanup.
llvm-svn: 96808
2010-02-22 22:07:27 +00:00
Dan Gohman
0a0f1d2ee2 Use Instruction::isCommutative instead of duplicating it.
llvm-svn: 96807
2010-02-22 22:05:18 +00:00
Johnny Chen
0e6c232f0e Added SEL, SXTB16, SXTAB16, UXTAB16, SMMULR, SMMLAR, SMMLSR, SMUAD, and SMUSD,
for disassembly only.

llvm-svn: 96806
2010-02-22 21:50:40 +00:00
Bob Wilson
e075edf725 Erase deleted instructions from GVN's ValueTable. This fixes assertion
failures from ValueTable::verifyRemoved() when using -debug.

llvm-svn: 96805
2010-02-22 21:39:41 +00:00
Johnny Chen
bdb1fdccfb Added a bunch of instructions for disassembly only:
o signed/unsigned add/subtract
o signed/unsigned halving add/subtract
o unsigned sum of absolute difference [and accumulate]
o signed/unsigned saturate
o signed multiply accumulate/subtract [long] dual

llvm-svn: 96795
2010-02-22 18:50:54 +00:00
Arnold Schwaighofer
8427969f9c 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.

llvm-svn: 96783
2010-02-22 16:18:09 +00:00
Dan Gohman
2575392bf1 Remove unused variables and parameters.
llvm-svn: 96780
2010-02-22 04:11:59 +00:00
Dan Gohman
835086ef52 Fix various doxygen warnings.
llvm-svn: 96779
2010-02-22 04:10:52 +00:00
Dan Gohman
733388cdcf Fix a typo in a comment.
llvm-svn: 96778
2010-02-22 04:09:26 +00:00
Dan Gohman
dcc3634e46 Constant-fold certain comparisons with infinity and negative infinity.
llvm-svn: 96777
2010-02-22 04:06:03 +00:00
Dan Gohman
c281a5da15 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.

llvm-svn: 96775
2010-02-22 04:03:39 +00:00
Dan Gohman
c44dee5fbd When emitting an instruction which depends on both a post-incremented
induction variable value and a loop-variant value, don't force the
insert position to be at the post-increment position, because it may
not be dominated by the loop-variant value. This fixes a
use-before-def problem noticed on PPC.

llvm-svn: 96774
2010-02-22 03:59:54 +00:00
Dan Gohman
8c51905154 This cast<Instruction> is unnecessary.
llvm-svn: 96771
2010-02-22 02:07:36 +00:00
Chris Lattner
a739bef2eb 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.

llvm-svn: 96768
2010-02-22 00:28:59 +00:00
Daniel Dunbar
a6d1ef6ee9 MC/X86: Add stub AsmBackend.
llvm-svn: 96763
2010-02-21 21:54:14 +00:00
Daniel Dunbar
b6b58bff88 MC: Sketch registry support for target specific assembler backends.
llvm-svn: 96762
2010-02-21 21:53:53 +00:00
Anton Korobeynikov
0b402e1a61 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.

llvm-svn: 96755
2010-02-21 20:28:15 +00:00
Duncan Sands
23f728e995 Remove a bunch of duplicated code, where there was one version taking a std::ostream
and another taking a raw_ostream, but otherwise identical.  Use raw_ostream everywhere.

llvm-svn: 96746
2010-02-21 19:15:19 +00:00
Jakob Stoklund Olesen
3a434bf60d Enable assertion to detect cyclic valno references.
This changes the stack overflow in PR6363 to an assertion failure.

llvm-svn: 96744
2010-02-21 18:51:48 +00:00
Anton Korobeynikov
fe0d6453ec IT turns out that during jumpless setcc lowering eq and ne were swapped.
This fixes PR6348

llvm-svn: 96734
2010-02-21 12:28:58 +00:00
Chris Lattner
b328c57aa4 fix and un-xfail X86/vec_ss_load_fold.ll
llvm-svn: 96720
2010-02-21 04:53:34 +00:00
Johnny Chen
abea29dc85 Undo r96654. The printing of ARM shift instructions in canonical forms can be
handled in ARMInstPrinter.cpp.

And added PLD/PLDW/PLI (Preload Data/Instruction) for disassembly only.

llvm-svn: 96719
2010-02-21 04:42:01 +00:00
Chris Lattner
fe81834e6e 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.

llvm-svn: 96715
2010-02-21 03:17:59 +00:00
Chris Lattner
ce7be2638a Eliminate some uses of immAllOnes, just use -1, it does
the same thing and is more efficient for the matcher.

llvm-svn: 96712
2010-02-21 03:12:16 +00:00
Dan Gohman
220c2212c1 Rename getSDiv to getExactSDiv to reflect its behavior in cases where
the division would have a remainder.

llvm-svn: 96693
2010-02-19 19:35:48 +00:00
Dan Gohman
9db0689627 Check for overflow when scaling up an add or an addrec for
scaled reuse.

llvm-svn: 96692
2010-02-19 19:32:49 +00:00
Bob Wilson
df432a30b2 Revert 96634. It causes assertion failures for 126.gcc and 176.gcc in
the armv6 nightly tests.

llvm-svn: 96691
2010-02-19 18:59:53 +00:00
Dan Gohman
39b7e5961e Add a comment.
llvm-svn: 96688
2010-02-19 18:49:22 +00:00
Charles Davis
a64fc8c41b Add support for the 'alignstack' attribute to the x86 backend. Fixes PR5254.
Also, FileCheck'ize a test.

llvm-svn: 96686
2010-02-19 18:17:13 +00:00
Dan Gohman
9268d67079 Teach ScalarEvolution how to compute a tripcount for a loop with
true or false as its exit condition. These are usually eliminated by
SimplifyCFG, but the may be left around during a pass which wishes
to preserve the CFG.

llvm-svn: 96683
2010-02-19 18:12:07 +00:00
Bob Wilson
c03fbf812d Revert Anton's most recent EH patch (r96637), since it breaks a lot of
ARM and Thumb tests.

llvm-svn: 96680
2010-02-19 17:10:59 +00:00
Duncan Sands
5d5cce2e19 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

llvm-svn: 96672
2010-02-19 11:30:41 +00:00
Dale Johannesen
0f58c73229 recommit 96626, evidence that it broke things appears
to be spurious

llvm-svn: 96662
2010-02-19 07:14:22 +00:00
Johnny Chen
2a3db5ee3d Added entries for ASR, LSL, LSR, ROR, and RRX so that the disassembler prints
out the canonical form (A8.6.98) instead of the pseudo-instruction as provided
via MOVs.

DBG_ARM_DISASM=YES llvm-mc -triple=arm-unknown-unknown --disassemble
0xc0 0x00 0xa0 0xe1
Opcode=29 Name=ASR Format=ARM_FORMAT_LDMISCFRM
 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0 
-------------------------------------------------------------------------------------------------
| 1: 1: 1: 0| 0: 0: 0: 1| 1: 0: 1: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 1: 0: 0| 0: 0: 0: 0|
-------------------------------------------------------------------------------------------------

	asr	r0, r0, #1

llvm-svn: 96654
2010-02-19 02:12:06 +00:00
Dale Johannesen
d73b81bf12 Revert 96626, which causes build failure on ppc Darwin.
llvm-svn: 96653
2010-02-19 01:54:37 +00:00
Evan Cheng
32031f7404 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

llvm-svn: 96640
2010-02-19 00:34:39 +00:00
Anton Korobeynikov
8aaa04a614 Use the same encoding for EH stuff uniformly on all MachO targets.
This hopefulyl should unbreak EH on PPC/Darwin.

llvm-svn: 96637
2010-02-19 00:29:36 +00:00
Jim Grosbach
53ef05fa82 Radar 7636153. In the presence of large call frames, it's not sufficient
for ARM to just check if a function has a FP to determine if it's safe
to simplify the stack adjustment pseudo ops prior to eliminating frame
indices. Allow targets to override the default behavior and does so for ARM
and Thumb2.

llvm-svn: 96634
2010-02-19 00:16:24 +00:00
Dan Gohman
58199e30dc When determining the set of interesting reuse factors, consider
strides in foreign loops. This helps locate reuse opportunities
with existing induction variables in foreign loops and reduces
the need for inserting new ones. This fixes rdar://7657764.

llvm-svn: 96629
2010-02-19 00:05:23 +00:00
Dan Gohman
2f0615ee5e Indvars needs to explicitly notify ScalarEvolution when it is replacing
a loop exit value, so that if a loop gets deleted, ScalarEvolution
isn't stick holding on to dangling SCEVAddRecExprs for that loop. This
fixes PR6339.

llvm-svn: 96626
2010-02-18 23:26:33 +00:00
Johnny Chen
8d67f1d58d Added LDRD_PRE/POST & STRD_PRE/POST for disassembly only.
llvm-svn: 96619
2010-02-18 22:31:18 +00:00
Talin
cd8428c41f replaceUsesOfWithOnConstant implementation for unions.
llvm-svn: 96616
2010-02-18 21:43:45 +00:00
Dan Gohman
f0d7b5df4b Hoist this loop-invariant logic out of the loop.
llvm-svn: 96614
2010-02-18 21:34:02 +00:00
Jakob Stoklund Olesen
5b9d14b55e Always normalize spill weights, also for intervals created by spilling.
Moderate the weight given to very small intervals.

The spill weight given to new intervals created when spilling was not
normalized in the same way as the original spill weights calculated by
CalcSpillWeights. That meant that restored registers would tend to hang around
because they had a much higher spill weight that unspilled registers.

This improves the runtime of a few tests by up to 10%, and there are no
significant regressions.

llvm-svn: 96613
2010-02-18 21:33:05 +00:00
Dan Gohman
34b5cb7deb Make CodePlacementOpt detect special EH control flow by
checking whether AnalyzeBranch disagrees with the CFG
directly, rather than looking for EH_LABEL instructions.
EH_LABEL instructions aren't always at the end of the
block, due to FP_REG_KILL and other things. This fixes
an infinite loop compiling MultiSource/Benchmarks/Bullet.

llvm-svn: 96611
2010-02-18 21:25:53 +00:00
Devang Patel
5c67cb332e Destroy MDNodes gracefully while deleting llvm context.
llvm-svn: 96609
2010-02-18 20:53:16 +00:00
Dale Johannesen
fe3e4e29e3 Generate DBG_VALUE from dbg.value intrinsics. These currently
comes out as comments but will eventually generate DWARF.

llvm-svn: 96601
2010-02-18 18:51:15 +00:00
Sanjiv Gupta
7534497c21 Remap the call sites of a shared function in interrupt line functions.
llvm-svn: 96591
2010-02-18 18:00:35 +00:00
Sanjiv Gupta
49c6de3b78 Re-factoring.
llvm-svn: 96589
2010-02-18 17:32:25 +00:00
Duncan Sands
b7bb8ab12e Uniformize the way these options are printed. Requested by
Russell Wallace.

llvm-svn: 96580
2010-02-18 14:37:52 +00:00
Duncan Sands
80083e741f Remove terminating dot in description. Inconsistency pointed
out by Russell Wallace.

llvm-svn: 96579
2010-02-18 14:10:41 +00:00
Duncan Sands
ca05b607b7 Refer to -help instead of --help since this is what tools themselves say.
Also, have tools output -help-hidden rather than refer to --help-hidden,
for consistency, and likewise adjust documentation.  This doesn't change
every mention of --help, only those which seemed clearly safe.

llvm-svn: 96578
2010-02-18 14:08:13 +00:00
Chris Lattner
43912e2c46 add a missing type cast.
llvm-svn: 96574
2010-02-18 06:33:42 +00:00
Bob Wilson
84fc0200bd Use NEON vmin/vmax instructions for floating-point selects.
Radar 7461718.

llvm-svn: 96572
2010-02-18 06:05:53 +00:00
Johnny Chen
2ef74d0ad2 Added LDRSBT, LDRHT, LDRSHT for disassembly only. And fixed encoding errors
of AI3ldsbpo, AI3ldhpo, and AI3ldshpo in ARMInstrFormats.td in the process.

llvm-svn: 96565
2010-02-18 03:27:42 +00:00
Evan Cheng
9af06dfc83 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"

llvm-svn: 96556
2010-02-18 02:13:50 +00:00
Johnny Chen
7f0bf276c2 Added for disassembly only the variants of DMB, DSB, and ISB.
llvm-svn: 96540
2010-02-18 00:19:08 +00:00
Daniel Dunbar
2f311d34fb MC/Mach-O: Update fixup values for change to X86 offsets.
llvm-svn: 96532
2010-02-17 23:45:16 +00:00
Bob Wilson
400e59ba21 Remove the NEON N2VSInt instruction class: it's only used in one place and
since it has no pattern, there's not much point in distinguishing an "N2VS"
class for intrinsics anyway.

llvm-svn: 96525
2010-02-17 22:42:54 +00:00
Johnny Chen
69bbc8c81b Added CLREX (Clear-Exclusive) for disassembly only.
A8.6.30

llvm-svn: 96523
2010-02-17 22:37:58 +00:00
Bob Wilson
ea55421ec2 More cleanup for NEON:
* Use "S" abbreviation for scalar single FP registers in class and pattern
names, instead of keeping the "D" (for "double") abbreviation and tacking on
an "s" elsewhere in the name.
* Move the scalar single FP register classes and patterns to be more
consistent with other definitions in the file.
* Rename "VNEGf32d" definition to "VNEGfd" for consistency.
* Deleted the N2VDIntsPat pattern; N2VSPat is good enough.

llvm-svn: 96521
2010-02-17 22:23:11 +00:00
Johnny Chen
6b8a65b0e0 Added RFE for disassembly only.
B6.1.8 RFE Return From Exception loads the PC and the CPSR from the word at the
specified address and the following word respectively.

llvm-svn: 96519
2010-02-17 21:39:10 +00:00
David Greene
d93fb1f15d Make the non-temporal bit "significant" in MemSDNodes so they aren't
CSE'd or otherwise combined with temporal MemSDNodes.

llvm-svn: 96505
2010-02-17 20:21:42 +00:00
Jakob Stoklund Olesen
1b593e1b45 Remember to define super registers in mips calls.
llvm-svn: 96504
2010-02-17 20:18:50 +00:00
Daniel Dunbar
92e99d82a2 Add Regex::sub, for doing regular expression substitution with backreferences.
llvm-svn: 96503
2010-02-17 20:08:42 +00:00
Jakob Stoklund Olesen
e7862f29ec Dead code elimination.
llvm-svn: 96496
2010-02-17 19:13:56 +00:00
Chris Lattner
5f903139fa "Fix and issue in SparcAsmPrinter where multiple identical .LLGETPCHn symbols could be emitted in the same file (it was uniqued by block number, but not by function number). " Patch by Nathan Keynes!
llvm-svn: 96495
2010-02-17 18:57:19 +00:00
Chris Lattner
2ec1f1a54a move isOnlyReachableByFallthrough out of MachineBasicBlock into AsmPrinter,
and add a sparc implementation that knows about delay slots.  Patch by
Nathan Keynes!

llvm-svn: 96492
2010-02-17 18:52:56 +00:00
Chris Lattner
f95f8a8c7c add a note, from PR5100
llvm-svn: 96490
2010-02-17 18:42:24 +00:00
Sanjiv Gupta
313cec0425 Added routine to clone the body of a function and maintain a map of already
cloned functions.

llvm-svn: 96485
2010-02-17 18:11:29 +00:00
Duncan Sands
e2bc75b41e Pacify gcc-4.5, which warns (correctly) that these switches have
cases that are not part of the enum.

llvm-svn: 96477
2010-02-17 14:52:22 +00:00
Sanjiv Gupta
da2298ee21 Added a function to clone locals of a function.( which for pic16 are globals
with mangled names).

llvm-svn: 96465
2010-02-17 06:48:50 +00:00
Sanjiv Gupta
581ae3d134 Removed header files from .h by adding forward decls.
Renamed PIC16FrameOverlay namespace to PIC16OVERLAY.
Renamed PIC16FrameOverlay class to PIC16Overlay.

llvm-svn: 96463
2010-02-17 06:46:23 +00:00
Johnny Chen
3107d9d344 Added BFI for disassembly only.
A8.6.18  BFI - Bitfield insert (Encoding A1)

llvm-svn: 96462
2010-02-17 06:31:48 +00:00
Chris Lattner
955ce23e27 sink special case "cannotyetselect" for intrinsics out of the
tblgen splatted code into the implementation.

llvm-svn: 96460
2010-02-17 06:28:22 +00:00
Chris Lattner
735a4efeff rename and document some arguments so I don't have to keep
reverse engineering what they are.

llvm-svn: 96456
2010-02-17 06:07:47 +00:00
Anton Korobeynikov
5a321b42ea Use pointer-wide encoding for LSDA and FDE on Darwin.
Hopefully, this will fix the remaining issues seen there.

llvm-svn: 96454
2010-02-17 05:53:11 +00:00
Lang Hames
b477072a21 Removed an early out which was causing the PBQP allocator to not compute live-in sets or run the rewriter.
llvm-svn: 96450
2010-02-17 03:42:51 +00:00
Dan Gohman
1cc421b590 Fix SCEVExpander's existing PHI reuse checking to recognize the
case where there are loop-invariant instructions somehow left
inside the loop, and in a position where they won't dominate
the IV increment position.

llvm-svn: 96448
2010-02-17 02:39:31 +00:00
Devang Patel
0f421b8fc5 Before setting scope end marker, pay attention to scope begin marker and existing scope end marker, if any. Scope must begin before it ends and nested inlined scope do not truncate surrounding scope.
llvm-svn: 96445
2010-02-17 02:20:34 +00:00
Chris Lattner
e93c85eb5e daniel remembered why this was needed.
llvm-svn: 96440
2010-02-17 01:55:54 +00:00
Chris Lattner
ff307a48c2 add a comment explaining why darwin/i386 uses ## as a comment.
It's not clear why this is really required, but it was explicitly
added in r48808 with no real explanation or rdar #.

llvm-svn: 96438
2010-02-17 01:38:01 +00:00
Sanjiv Gupta
6e98127ab8 Initial implementation of PIC16 Cloner pass.
This pass is supposed to be run on the linked .bc module.
It traveses the module call graph twice. Once starting from the main function
and marking each reached function as "ML". Again, starting from the ISR
and cloning any reachable function that was marked as "ML". After cloning
the function, it remaps all the call sites in IL functions to call the
cloned functions. 

Currently only marking is being done.

llvm-svn: 96435
2010-02-17 01:11:53 +00:00
Dan Gohman
2a4208c74e Fold bswap(undef) to undef.
llvm-svn: 96432
2010-02-17 00:54:58 +00:00
Dan Gohman
82f46afcdd Delete some unneeded casts.
llvm-svn: 96429
2010-02-17 00:42:19 +00:00
Dan Gohman
493a1fcbe0 Don't attempt to divide INT_MIN by -1; consider such cases to
have overflowed.

llvm-svn: 96428
2010-02-17 00:41:53 +00:00
Dan Gohman
d35c563d80 Make the operand and format specifier match, and print all
64 bits, fixing a variety of problems.

llvm-svn: 96421
2010-02-17 00:37:20 +00:00
Bob Wilson
532656cffc Wrap lines to 80 columns and generally try to clean up whitespace and
indentation.  No functional changes.

llvm-svn: 96418
2010-02-17 00:31:29 +00:00
Bill Wendling
964b01232c Make error statement more personal.
llvm-svn: 96410
2010-02-16 22:47:14 +00:00
Chris Lattner
0d35c68d5c fix rdar://7653908, a crash on a case where we would fold a load
into a roundss intrinsic, producing a cyclic dag.  The root cause
of this is badness handling ComplexPattern nodes in the old dagisel
that I noticed through inspection.  Eliminate a copy of the of the
code that handled ComplexPatterns by making EmitChildMatchCode call
into EmitMatchCode.

llvm-svn: 96408
2010-02-16 22:35:06 +00:00
Bob Wilson
ed0eab5843 Handle tGPR register class in a few more places. This fixes some llvm-gcc
build failures due to my fix for pr6111.

llvm-svn: 96402
2010-02-16 22:01:59 +00:00
Johnny Chen
7171461638 Add SMC (Secure Monitor Call) system instruction for disassembly only.
llvm-svn: 96401
2010-02-16 21:59:54 +00:00
Dale Johannesen
f31a06506f Really reserve R2 on PPC Darwin. PR 6314.
llvm-svn: 96399
2010-02-16 21:53:27 +00:00
Devang Patel
bebe8e55dc Use line and column number to distinguish two lexical blocks at the same level.
llvm-svn: 96395
2010-02-16 21:39:34 +00:00
Jim Grosbach
2acf602672 80 column cleanup
llvm-svn: 96393
2010-02-16 21:23:02 +00:00
Evan Cheng
ee44d6a752 Look for SSE and instructions of this form: (and x, (build_vector c1,c2,c3,c4)).
If there exists a use of a build_vector that's the bitwise complement of the mask,
then transform the node to
(and (xor x, (build_vector -1,-1,-1,-1)), (build_vector ~c1,~c2,~c3,~c4)).

Since this transformation is only useful when 1) the given build_vector will
become a load from constpool, and 2) (and (xor x -1), y) matches to a single
instruction, I decided this is appropriate as a x86 specific transformation.
rdar://7323335

llvm-svn: 96389
2010-02-16 21:09:44 +00:00
Jim Grosbach
0c678d7b17 Remove trailing whitespace
llvm-svn: 96388
2010-02-16 21:07:46 +00:00
Bob Wilson
86dded571f Rename SuccessorNumber to GetSuccessorNumber.
llvm-svn: 96387
2010-02-16 21:06:42 +00:00
David Greene
c10133139e Add support for emitting non-temporal stores for DAGs marked
non-temporal.  Fix from r96241 for botched encoding of MOVNTDQ.

Add documentation for !nontemporal metadata.

Add a simpler movnt testcase.

llvm-svn: 96386
2010-02-16 20:50:18 +00:00
Jim Grosbach
0c8c072ddf Update Thumb2 to not use CarryDefIsUnused or CarryDefIsUsed predicates, but
to have the predicate on the pattern itself instead. Support for the new
ISel. Remove definitions of CarryDefIsUnused and CarryDefIsUsed since they are
no longer used anywhere.

llvm-svn: 96384
2010-02-16 20:42:29 +00:00
Jim Grosbach
27e3b55717 Remove redundant setting of Defs. CPSR is already marked by the block level set of Defs.
llvm-svn: 96383
2010-02-16 20:35:59 +00:00
Dan Gohman
e2da5181db Refactor rewriting for PHI nodes into a separate function.
llvm-svn: 96382
2010-02-16 20:25:07 +00:00
Jim Grosbach
872d6b21aa First step in eliminating the CarryDefIsUnused and CarryDefIsUsed predicates.
They won't work with the new ISel mechanism, as Requires predicates are no
longer allowed to reference the node being selected. Moving the predicate to
the patterns instead solves the problem.

This patch handles ARM mode. Thumb2 will follow.

llvm-svn: 96381
2010-02-16 20:17:57 +00:00
Johnny Chen
900ebc03c5 Added for disassembly the following instructions:
o Store Return State (SRSW, SRS)
o Load/Store Coprocessor (LDC/STC and friends)
o MSR (immediate)

llvm-svn: 96380
2010-02-16 20:04:27 +00:00
Bob Wilson
a866c660db Split critical edges as needed for load PRE.
llvm-svn: 96378
2010-02-16 19:51:59 +00:00
Bob Wilson
1115365fcf Refactor to share code to find the position of a basic block successor in the
terminator's list of successors.

llvm-svn: 96377
2010-02-16 19:49:17 +00:00
Dan Gohman
815d966a5a Fix whitespace.
llvm-svn: 96372
2010-02-16 19:42:34 +00:00
Kenneth Uildriks
13195c9525 Function attributes have index ~0, not 0
llvm-svn: 96370
2010-02-16 19:28:02 +00:00
Bob Wilson
94eef3fc13 Fix pr6111: Avoid using the LR register for the target address of an indirect
branch in ARM v4 code, since it gets clobbered by the return address before
it is used.  Instead of adding a new register class containing all the GPRs
except LR, just use the existing tGPR class.

llvm-svn: 96360
2010-02-16 17:24:15 +00:00
Duncan Sands
e9a13a3c60 Introduce isOpaqueTy and use it rather than isa<OpaqueType>. Also, move some
methods to try to have the type predicates be more logically positioned.

llvm-svn: 96349
2010-02-16 14:50:09 +00:00
Duncan Sands
1b33dd3c83 There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy().  Convert most instances of the first form to the second form.
Requested by Chris.

llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Benjamin Kramer
32ff92be51 Minor warning fixes (semicolons, newline at EOF).
llvm-svn: 96343
2010-02-16 10:25:04 +00:00
Chris Lattner
2507e6b51f mark all the generated node predicates 'const'.
llvm-svn: 96337
2010-02-16 07:26:36 +00:00
Chris Lattner
b29b154904 make pcrel immediate values relative to the start of the field,
not the end of the field, fixing rdar://7651978

llvm-svn: 96330
2010-02-16 05:03:17 +00:00
Sanjiv Gupta
29190e6398 The code section for an ISR has a specific address.
Currently, whether a function is ISR or not is encoded in the section attribute for that function.

llvm-svn: 96322
2010-02-16 03:41:07 +00:00
Dale Johannesen
622053fec3 Handle DBG_VALUE mixed with labels when doing PHI
elimination.  Before a DBG_VALUE could affect codegen.
The solution here is imperfect and not final.

llvm-svn: 96318
2010-02-16 01:57:28 +00:00
Rafael Espindola
8962ca0e05 Drop support for the InReg attribute on the ppc backend. This was used by
llvm-gcc but has been replaced with pad argument which don't need any
special backend support.

llvm-svn: 96312
2010-02-16 01:50:18 +00:00
Dan Gohman
d19ecedc40 Split the main for-each-use loop again, this time for GenerateTruncates,
as it also peeks at which registers are being used by other uses. This
makes LSR less sensitive to use-list order.

llvm-svn: 96308
2010-02-16 01:42:53 +00:00
Dale Johannesen
b410c3010b Reapply 96294; now that I've gotten around to looking
at older buildbot messages, I see the failure predates
this patch.

llvm-svn: 96307
2010-02-16 01:27:47 +00:00
Bill Wendling
7734240a2a Apply patch from http://llvm.org/bugs/attachment.cgi?id=4136 now that PR5004 is
finished.

llvm-svn: 96304
2010-02-16 00:58:02 +00:00
Dale Johannesen
df6f49fc2d Something broke. Hard to believe it was this patch
but it's harder to believe it's the other candidate,
so reverting.  Temporarily I hope.

llvm-svn: 96303
2010-02-16 00:43:58 +00:00
Dan Gohman
7d5c463d8e When reusing an existing PHI node in a loop, be even more
strict about the requirements.

llvm-svn: 96301
2010-02-16 00:20:08 +00:00
Bob Wilson
c85ee6018a Put repeated empty pattern into the AQI instruction class.
We could almost use a multiclass for the signed/unsigned instructions, but
there are only 6 of them so I guess it's not worth it.

llvm-svn: 96297
2010-02-15 23:43:47 +00:00
Evan Cheng
df9a8c9d49 Fix a memory leak. Patch by Nicolas Geoffray.
llvm-svn: 96295
2010-02-15 23:16:53 +00:00
Dale Johannesen
16ec2c06bc More handling of DBG_VALUE.
llvm-svn: 96294
2010-02-15 23:05:03 +00:00
Anton Korobeynikov
56e593f08e Add missed entry to cmake build list file
llvm-svn: 96292
2010-02-15 22:55:13 +00:00
Anton Korobeynikov
26310a84b1 Use ttype encoding consistently
llvm-svn: 96290
2010-02-15 22:38:25 +00:00
Anton Korobeynikov
e759b33cf5 Fix a silly darwin-only typo introduced during merge.
llvm-svn: 96289
2010-02-15 22:38:10 +00:00
Anton Korobeynikov
ef1862e256 Move TLOF implementations to libCodegen to resolve layering violation.
llvm-svn: 96288
2010-02-15 22:37:53 +00:00
Anton Korobeynikov
559e34c5fc It turns out that we emitted completely wrong common EH frame since the early beginning! The "z" CIE augmentation mark indicates that there is an extra word containing the size of augmentation section. However, even for frames w/o any augmentation data we emitted size uleb! (this is the case of "unwinding through C code"). Thus frame moves information was emitterd completely wrong.
llvm-svn: 96287
2010-02-15 22:36:41 +00:00
Anton Korobeynikov
4d16d87eb1 Add suffix for stubs, so we won't have name clashes with private symbols.
llvm-svn: 96286
2010-02-15 22:36:26 +00:00
Anton Korobeynikov
dccd240998 Preliminary patch to improve dwarf EH generation - Hooks to return Personality / FDE / LSDA / TType encoding depending on target / options (e.g. code model / relocation model) - MCIzation of Dwarf EH printer to use encoding information - Stub generation for ELF target (needed for indirect references) - Some other small changes here and there
llvm-svn: 96285
2010-02-15 22:35:59 +00:00
Nick Lewycky
b38ae458a4 Teach the verifier to check the condition on a branch and ensure that it has
'i1' type.

llvm-svn: 96282
2010-02-15 22:09:09 +00:00
Jakob Stoklund Olesen
143339a43a Fix PR6300.
A virtual register can be used before it is defined in the same MBB if the MBB
is part of a loop. Teach the implicit-def pass about this case.

llvm-svn: 96279
2010-02-15 22:03:29 +00:00
Nick Lewycky
a21f060918 Fix crash in VerifyType when checking Contexts. Because there may not be a
Module (we were called with verifyFunction and an unowned Function) we can't
rely on Mod->getContext().

llvm-svn: 96275
2010-02-15 21:52:04 +00:00
Nick Lewycky
1dcde6b319 Don't try to materialize a function that isn't materializable anyways. This
fixes a crash using FPM on a Function that isn't owned by a Module.

llvm-svn: 96273
2010-02-15 21:27:56 +00:00
Nick Lewycky
1357e1c99a A function with no Module owner isn't materializable. This fixes F->dump() for
functions not embedded within modules.

llvm-svn: 96272
2010-02-15 21:27:20 +00:00
Daniel Dunbar
d01423cec1 Simplify.
llvm-svn: 96269
2010-02-15 21:08:22 +00:00
Chris Lattner
d7470aa340 revert r96241. It breaks two regression tests, isn't documented,
and the testcase needs improvement.

llvm-svn: 96265
2010-02-15 20:53:01 +00:00
Chris Lattner
a8505609fe fix PR6305 by handling BlockAddress in a helper function
called by jump threading.

llvm-svn: 96263
2010-02-15 20:47:49 +00:00
Evan Cheng
b5fe25544c Split SelectionDAGISel::IsLegalAndProfitableToFold to
IsLegalToFold and IsProfitableToFold. The generic version of the later simply checks whether the folding candidate has a single use.

This allows the target isel routines more flexibility in deciding whether folding makes sense. The specific case we are interested in is folding constant pool loads with multiple uses.

llvm-svn: 96255
2010-02-15 19:41:07 +00:00
David Greene
ba8bac644b Add support for emitting non-temporal stores for DAGs marked
non-temporal.

llvm-svn: 96241
2010-02-15 17:02:56 +00:00
David Greene
4f983d569c Add non-temporal flags and remove an assumption of default arguments.
llvm-svn: 96240
2010-02-15 17:00:31 +00:00
David Greene
1b3d9eece5 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96239
2010-02-15 16:57:43 +00:00
David Greene
fcf8375377 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96238
2010-02-15 16:57:13 +00:00
David Greene
196564c820 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96237
2010-02-15 16:57:02 +00:00
David Greene
b503e48b12 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96236
2010-02-15 16:56:53 +00:00
David Greene
ea559af89a Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96235
2010-02-15 16:56:34 +00:00
David Greene
725287f422 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96234
2010-02-15 16:56:22 +00:00
David Greene
118edab4c9 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96233
2010-02-15 16:56:10 +00:00
David Greene
47a10d2053 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96232
2010-02-15 16:55:58 +00:00
David Greene
3bb90b9985 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96231
2010-02-15 16:55:37 +00:00
David Greene
1efa05ab91 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96230
2010-02-15 16:55:24 +00:00
David Greene
b3a7357944 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96229
2010-02-15 16:55:07 +00:00
David Greene
75cc8f80a6 Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96228
2010-02-15 16:53:33 +00:00
David Greene
dd3a290ebf Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96227
2010-02-15 16:49:52 +00:00
David Greene
0ed0396052 Add non-temporal flags to MachineMemOperand.
llvm-svn: 96226
2010-02-15 16:48:31 +00:00
Duncan Sands
2acaf3609c Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Andrew Lenharth
87e914773e Fix changes from r75027
llvm-svn: 96220
2010-02-15 15:00:44 +00:00
Dan Gohman
adc600ceb5 When testing whether a given SCEV depends on a temporary symbolic
name, test whether the SCEV itself is that temporary symbolic name,
in addition to checking whether the symbolic name appears as a
possibly-indirect operand.

llvm-svn: 96216
2010-02-15 10:28:37 +00:00
Chris Lattner
ba70b52fe6 no need to add the instruction count anymore.
llvm-svn: 96212
2010-02-15 06:38:41 +00:00
Chris Lattner
bd65f192f2 enhance raw_svector_ostream::write_impl to work with unbuffered streams,
which may call write_impl on things that are not the usual buffer.

llvm-svn: 96209
2010-02-15 02:18:26 +00:00
Chris Lattner
eeadc240f2 make PadToColumn return the stream so you can use:
OS.PadToColumn(42) << "foo";

llvm-svn: 96208
2010-02-15 02:17:50 +00:00
Dale Johannesen
c23d94e163 Ignore DBG_VALUE in a couple more places.
llvm-svn: 96207
2010-02-15 01:45:47 +00:00
Dan Gohman
6c0fdcea5e When restoring a saved insert location, check to see if the saved
insert location has become an "inserted" instruction since the time
it was saved. If so, advance to the first non-"inserted" instruction.

llvm-svn: 96203
2010-02-15 00:21:43 +00:00
Chris Lattner
f036c806b3 mark "addr" as having type "iPTR", eliminating some type comparisons
in hte generated dag isel fil.

llvm-svn: 96193
2010-02-14 21:53:19 +00:00
Dan Gohman
c954fc3333 Fix whitespace.
llvm-svn: 96179
2010-02-14 18:51:39 +00:00
Dan Gohman
900be69752 Fix a comment.
llvm-svn: 96178
2010-02-14 18:51:20 +00:00
Dan Gohman
de32b2fac0 When complicated expressions are broken down into subexpressions
with multiplication by constants distributed through, occasionally
those subexpressions can include both x and -x. For now, if this
condition is discovered within LSR, just prune such cases away,
as they won't be profitable. This fixes a "zero allocated in a
base register" assertion failure.

llvm-svn: 96177
2010-02-14 18:50:49 +00:00
Sanjiv Gupta
318fdf4e39 fixes to pagesel/banksel inserter.
1. restore these across direct/indirect calls.
2. restore pagesel for any macros with gotos.

llvm-svn: 96175
2010-02-14 18:27:42 +00:00
Anton Korobeynikov
3461f67cee Forgot to commit the header
llvm-svn: 96174
2010-02-14 18:25:41 +00:00
Chris Lattner
42c8f96141 follow-on to PR6280
llvm-svn: 96172
2010-02-14 18:20:09 +00:00
Anton Korobeynikov
9436d20d76 Drop winmcasminfo and use normal AT&T COFF for all windows targets.
Otherwise AT&T asm printer is used with non-compatible MCAsmInfo and
there is no way to override this behaviour.

llvm-svn: 96165
2010-02-14 15:19:54 +00:00
Johnny Chen
475f273d63 Try to factorize the specification of saturating add/subtract operations a bit,
as suggested by Bob Wilson.

llvm-svn: 96153
2010-02-14 06:32:20 +00:00
Dan Gohman
dbffcb6c92 Actually, this code doesn't have to be quite so conservative in
the no-TLI case. But it should still default to declining the
transformation.

llvm-svn: 96152
2010-02-14 03:21:49 +00:00
Dan Gohman
4d5f3b74e4 In rememberInstruction, if the value being remembered is the
current insertion point, advance the current insertion point.
This avoids a use-before-def situation in a testcase extracted
from clang which is difficult to reduce to a reasonable-sized
regression test.

llvm-svn: 96151
2010-02-14 03:12:47 +00:00
Dan Gohman
47756a8549 Simplify this code; no need for a custom subclass if it doesn't need
to override anything from the parent class.

llvm-svn: 96150
2010-02-14 02:48:58 +00:00
Dan Gohman
3b065f43af Don't attempt aggressive post-inc uses if TargetLowering is not available,
because profitability can't be sufficiently approximated.

llvm-svn: 96148
2010-02-14 02:45:21 +00:00
John McCall
5089836939 Make LSR not crash if invoked without target lowering info, e.g. if invoked
from opt.

llvm-svn: 96135
2010-02-13 23:40:16 +00:00
Eric Christopher
96f3c4222f Fix a problem where we had bitcasted operands that gave us
odd offsets since the bitcasted pointer size and the offset pointer
size are going to be different types for the GEP vs base object.

llvm-svn: 96134
2010-02-13 23:38:01 +00:00
Chris Lattner
b9c4a15ad5 teach the encoder to handle pseudo instructions like FP_REG_KILL,
encoding them into nothing.

llvm-svn: 96110
2010-02-13 19:16:53 +00:00
Chris Lattner
23368e55d7 remove dead code.
llvm-svn: 96109
2010-02-13 19:07:06 +00:00
Daniel Dunbar
e6679afaa7 MCAssembler: Fix pcrel relocations. Oh and,
--
ddunbar@ozzy:tmp$ clang -m32 -integrated-as hello.c && ./a.out
hello world!
--

llvm-svn: 96096
2010-02-13 09:45:59 +00:00
Daniel Dunbar
c05a38a3d3 MC/Mach-O: Start emitting fixups/relocations for instructions.
llvm-svn: 96095
2010-02-13 09:29:02 +00:00
Daniel Dunbar
7a1fd21459 MCAssembler: Switch MCAsmFixup to storing MCFixupKind instead of just a size.
llvm-svn: 96094
2010-02-13 09:28:54 +00:00
Daniel Dunbar
8e9044353a MCAssembler: Sink fixup list into MCDataFragment.
llvm-svn: 96093
2010-02-13 09:28:43 +00:00
Daniel Dunbar
95ae012b0e MCAssembler: Switch MCFillFragment to only taking constant values. Symbolic expressions can always be emitted as data + fixups.
llvm-svn: 96092
2010-02-13 09:28:32 +00:00
Daniel Dunbar
cc282ba52e MC/Mach-O: Implement EmitValue using data fragments + fixups instead of fill fragment.
llvm-svn: 96091
2010-02-13 09:28:22 +00:00
Daniel Dunbar
481e926468 MCAssembler: Start applying fixups in the data section.
llvm-svn: 96090
2010-02-13 09:28:15 +00:00
Daniel Dunbar
a699e834fb MCAssembler: Add assorted dump() methods.
llvm-svn: 96089
2010-02-13 09:28:03 +00:00
Daniel Dunbar
1581cae46f X86: Move extended MCFixupKinds into X86FixupKinds.h
llvm-svn: 96088
2010-02-13 09:27:52 +00:00
Chris Lattner
0874dc6dab Split some code out to a helper function (FindReusablePredBB)
and add a doxygen comment.

Cache the phi entry to avoid doing tons of 
PHINode::getBasicBlockIndex calls in the common case.

On my insane testcase from re2c, this speeds up CGP from
617.4s to 7.9s (78x).

llvm-svn: 96083
2010-02-13 05:35:08 +00:00
Chris Lattner
9c797fdf1d Speed up codegen prepare from 3.58s to 0.488s.
llvm-svn: 96081
2010-02-13 05:01:14 +00:00
Chris Lattner
975da20868 PHINode::getBasicBlockIndex is O(n) in the number of inputs
to a PHI, avoid it in the common case where the BB occurs
in the same index for multiple phis.  This speeds up CGP on
an insane testcase from 8.35 to 3.58s.

llvm-svn: 96080
2010-02-13 04:24:19 +00:00
Chris Lattner
1a067d53b0 iterate over preds using PHI information when available instead of
using pred_begin/end.  It is much faster.

llvm-svn: 96079
2010-02-13 04:15:26 +00:00
Chris Lattner
9be0b06335 speed up CGP a bit by scanning predecessors through phi operands
instead of with pred_begin/end.

llvm-svn: 96078
2010-02-13 04:04:42 +00:00
Chris Lattner
8530ba626c add encoder support and tests for rdtscp
llvm-svn: 96076
2010-02-13 03:42:24 +00:00
Johnny Chen
f252f7cf0d Add SETEND and BXJ instructions for disassembly only.
llvm-svn: 96075
2010-02-13 02:51:09 +00:00
Sean Callanan
0bc10793b0 Added the rdtscp instruction to the x86 instruction
tables.

llvm-svn: 96073
2010-02-13 02:06:11 +00:00
Jakob Stoklund Olesen
0a65533a38 Fix PR6283.
When coalescing with a physreg, remember to add imp-def and imp-kill when
dealing with sub-registers.

Also fix a related bug in VirtRegRewriter where substitutePhysReg may
reallocate the operand list on an instruction and invalidate the reg_iterator.
This can happen when a register is mentioned twice on the same instruction.

llvm-svn: 96072
2010-02-13 02:06:10 +00:00
Dan Gohman
25722fd3fc Fix a pruning heuristic which implicitly assumed that SmallPtrSet is
deterministically sorted.

llvm-svn: 96071
2010-02-13 02:06:02 +00:00
Evan Cheng
6eb7ff5bbf Teach MachineFrameInfo to track maximum alignment while stack objects are being
created. This ensures it's updated at all time. It means targets which perform
dynamic stack alignment would know whether it is required and whether frame
pointer register cannot be made available register allocation.
This is a fix for rdar://7625239. Sorry, I can't create a reasonably sized test
case.

llvm-svn: 96069
2010-02-13 01:56:41 +00:00
Jakob Stoklund Olesen
8ce1b3d280 Enable the inlinehint attribute in the Inliner.
Functions explicitly marked inline will get an inlining threshold slightly
more aggressive than the default for -O3. This means than -O3 builds are
mostly unaffected while -Os builds will be a bit bigger and faster.

The difference depends entirely on how many 'inline's are sprinkled on the
source.

In the CINT2006 suite, only these tests are significantly affected under -Os:

               Size   Time
471.omnetpp   +1.63% -1.85%
473.astar     +4.01% -6.02%
483.xalancbmk +4.60%  0.00%

Note that 483.xalancbmk runs too quickly to give useful timing results.

llvm-svn: 96066
2010-02-13 01:51:53 +00:00
Sean Callanan
9806eade6e Fixed encodings for invlpg, invept, and invvpid.
llvm-svn: 96065
2010-02-13 01:48:34 +00:00
Daniel Dunbar
09733841aa MC/AsmParser: Attempt to constant fold expressions up-front. This ensures we avoid fixups for obvious cases like '-(16)'.
llvm-svn: 96064
2010-02-13 01:28:07 +00:00
Johnny Chen
727c71d8ac Added a bunch of saturating add/subtract instructions for disassembly only.
llvm-svn: 96063
2010-02-13 01:21:01 +00:00
Chris Lattner
d4fe983f23 rip out the 'heinous' x86 MCCodeEmitter implementation.
We still have the templated X86 JIT emitter, *and* the
almost-copy in X86InstrInfo for getting instruction sizes.

llvm-svn: 96059
2010-02-13 00:49:29 +00:00
Chris Lattner
5b01ab848c remove special cases for vmlaunch, vmresume, vmxoff, and swapgs
fix swapgs to be spelled right.

llvm-svn: 96058
2010-02-13 00:41:14 +00:00
Bob Wilson
5d66f81412 Besides removing phi cycles that reduce to a single value, also remove dead
phi cycles.  Adjust a few tests to keep dead instructions from being optimized
away.  This (together with my previous change for phi cycles) fixes Apple
radar 7627077.

llvm-svn: 96057
2010-02-13 00:31:44 +00:00
Dan Gohman
1e93b1c022 Override dominates and properlyDominates for SCEVAddRecExpr, as a
SCEVAddRecExpr doesn't necessarily dominate blocks merely dominated
by all of its operands. This fixes an abort compiling 403.gcc.

llvm-svn: 96056
2010-02-13 00:19:39 +00:00
Daniel Dunbar
4ef0be5df5 MC/X86: Push immediate operands as immediates not expressions when possible.
llvm-svn: 96055
2010-02-13 00:17:21 +00:00
Jeffrey Yasskin
963eee9ee1 Make PassRegistrar thread-safe since it can be modified by code running in
separate LLVMContexts.

llvm-svn: 96051
2010-02-13 00:03:17 +00:00
Chris Lattner
1d25e3978d Remove special cases for [LM]FENCE, MONITOR and MWAIT from
encoder and decoder by using new MRM_ forms.

llvm-svn: 96048
2010-02-12 23:54:57 +00:00
Chris Lattner
4170bb81da implement the rest of correct x86-64 encoder support for
rip-relative addresses, and add a testcase.

llvm-svn: 96040
2010-02-12 23:24:09 +00:00
Dale Johannesen
08f0ab42b8 Add the problem I just hacked around in 96015/96020.
The solution there produces correct code, but is seriously
deficient in several ways.

llvm-svn: 96039
2010-02-12 23:16:24 +00:00
Chris Lattner
946403d05f give MCCodeEmitters access to the current MCContext.
llvm-svn: 96038
2010-02-12 23:12:47 +00:00
Jeffrey Yasskin
72e77cf286 Make JIT::runFunction clean up the generated stub function.
Patch by Shivram K!

llvm-svn: 96037
2010-02-12 23:05:31 +00:00
Chris Lattner
e90d092fd7 implement infrastructure to support fixups for rip-rel
addressing.  This isn't complete because I need an MCContext
to generate new MCExprs.

llvm-svn: 96036
2010-02-12 23:00:36 +00:00
Johnny Chen
d36727232c Add YIELD, WFE, WFI, and SEV instructions for disassembly only.
Plus add two formats: MiscFrm and ThumbMiscFrm.  Some of the for disassembly
only instructions are changed from Pseudo Format to MiscFrm Format.

llvm-svn: 96032
2010-02-12 22:53:19 +00:00
Chris Lattner
0a7654c7c9 pull the rip-relative addressing mode case up early.
llvm-svn: 96031
2010-02-12 22:47:55 +00:00
Chris Lattner
3df1321651 fixme resolved!
llvm-svn: 96029
2010-02-12 22:39:06 +00:00
Chris Lattner
1e01ac75bc start producing reloc_pcrel_4byte/reloc_pcrel_1byte for calls.
llvm-svn: 96028
2010-02-12 22:36:47 +00:00
Chris Lattner
f1f926247f enhance the immediate field encoding to know whether the immediate
is pc relative or not, mark call and branches as pcrel.

llvm-svn: 96026
2010-02-12 22:27:07 +00:00
Evan Cheng
c2084b74bb Load / store multiple instructions cannot load / store sp. Sorry, can't come up with a reasonable test case.
llvm-svn: 96023
2010-02-12 22:17:21 +00:00
Dale Johannesen
d52ea2ffc6 This should have gone in with 26015, see comments there.
llvm-svn: 96020
2010-02-12 22:00:40 +00:00
Johnny Chen
a56964de27 Add halfword multiply accumulate long SMLALBB/BT/TB/TT for disassembly only.
llvm-svn: 96019
2010-02-12 21:59:23 +00:00
Dale Johannesen
ea96b2974f When save/restoring CR at prolog/epilog, in a large
stack frame, the prolog/epilog code was using the same
register for the copy of CR and the address of the save slot.  Oops.
This is fixed here for Darwin, sort of, by reserving R2 for this case.
A better way would be to do the store before the decrement of SP,
which is safe on Darwin due to the red zone.

SVR4 probably has the same problem, but I don't know how to fix it;
there is no red zone and R2 is already used for something else.
I'm going to leave it to someone interested in that target.

Better still would be to rewrite the CR-saving code completely;
spilling each CR subregister individually is horrible code.

llvm-svn: 96015
2010-02-12 21:35:34 +00:00
Chris Lattner
2265d6280b Add support for a union type in LLVM IR. Patch by Talin!
llvm-svn: 96011
2010-02-12 20:49:41 +00:00
Johnny Chen
0f2837db87 Add SWP (Swap) and SWPB (Swap Byte) for disassembly only.
llvm-svn: 96010
2010-02-12 20:48:24 +00:00
Evan Cheng
3e15f48df5 Also recognize armv6t2-* and armv5te-* triplets.
llvm-svn: 96008
2010-02-12 20:39:35 +00:00
Dan Gohman
cdb2e784ff Fix a case of mismatched types in an Add that turned up in 447.dealII.
llvm-svn: 96007
2010-02-12 20:39:25 +00:00
Evan Cheng
c75a237988 Add ARM bitcode file magic.
llvm-svn: 96006
2010-02-12 20:13:44 +00:00
Dan Gohman
cbf5771473 Reapply 95979, a compile-time speedup, now that the bug it exposed is fixed.
llvm-svn: 96005
2010-02-12 19:35:25 +00:00
Dan Gohman
006952d39d Fix this code to avoid dereferencing an end() iterator in
offset distributions it doesn't expect.

llvm-svn: 96002
2010-02-12 19:20:37 +00:00