Commit Graph

71884 Commits

Author SHA1 Message Date
Justin Holewinski 498f703d84 PTX: support for select
- selection of SELP instruction
- new selp.ll test

Patch by Dan Bailey

llvm-svn: 130357
2011-04-28 00:19:55 +00:00
Justin Holewinski e7d272e68b PTX: mov fix and rounding correction for cvt
- fix typo in MOV
- correct fp rounding on CVT
- new cvt.ll test

Patch by Dan Bailey

llvm-svn: 130356
2011-04-28 00:19:54 +00:00
Justin Holewinski f6880019d1 PTX: support for fneg
- selection of FNEG instruction
- new fneg.ll test

Patch by Dan Bailey

llvm-svn: 130355
2011-04-28 00:19:53 +00:00
Justin Holewinski 99e03f1943 PTX: support for zext loads and trunc stores
- expansion of EXTLOAD and TRUNCSTORE instructions

Patch by Dan Bailey

llvm-svn: 130354
2011-04-28 00:19:52 +00:00
Justin Holewinski 18e6ac83ea PTX: support for bitwise operations on predicates
- selection of bitwise preds (AND, OR, XOR)
- new bitwise.ll test

Patch by Dan Bailey

llvm-svn: 130353
2011-04-28 00:19:51 +00:00
Justin Holewinski 638f0eb116 PTX: patch to AsmPrinter
- immediate value cast as long not int
- handles initializer for constant array

Patch by Dan Bailey

llvm-svn: 130352
2011-04-28 00:19:50 +00:00
Andrew Trick 1e34241abd Reverting r130340 in the unlikely event that it's responsible for a llvm-gcc stage2 compiler error.
llvm-svn: 130350
2011-04-28 00:13:59 +00:00
Eli Friedman 8bd572fc58 fast-isel sret. We actually don't need to do anything special on x86. :) rdar://problem/9303592 .
llvm-svn: 130348
2011-04-27 23:58:52 +00:00
Johnny Chen c3c7001844 Add tests for A8.6.110 NOP.
llvm-svn: 130345
2011-04-27 23:29:21 +00:00
Rafael Espindola ce83fc3463 Remove unnecessary argument.
llvm-svn: 130343
2011-04-27 23:17:57 +00:00
Rafael Espindola 08704349da Rename getPersonalityPICSymbol to getCFIPersonalitySymbol, document it, and
give it a bit more responsibility. Also implement it for MachO.

If hacked to use cfi, 32 bit MachO will produce

.cfi_personality 155, L___gxx_personality_v0$non_lazy_ptr

and 64 bit will produce

.cfi_presonality ___gxx_personality_v0

The general idea is that .cfi_personality gets passed the final symbol. It is
up to codegen to produce it if using indirect representation (like 32 bit
MachO), but it is up to MC to decide which relocations to create.

llvm-svn: 130341
2011-04-27 23:08:15 +00:00
Andrew Trick 29ac7b8858 Fixes PR9730: indvars: An asserting value handle still pointed to this value
Modified LinearFunctionTestReplace to push the condition on the dead
list instead of eagerly deleting it. This can cause unnecessary
IV rewrites, which should have no effect on codegen and will not be an
issue once we stop generating canonical IVs.

llvm-svn: 130340
2011-04-27 23:00:03 +00:00
Devang Patel 77dc541b00 Simplify handling of variables with complex address (i.e. blocks variables)
llvm-svn: 130339
2011-04-27 22:45:24 +00:00
Eli Friedman 406c471b69 Make the fast-isel code for literal 0.0 a bit shorter/faster, since 0.0 is common. rdar://problem/9303592 .
llvm-svn: 130338
2011-04-27 22:41:55 +00:00
Eli Friedman 121d27e9e4 Remove unused function.
llvm-svn: 130337
2011-04-27 22:21:02 +00:00
NAKAMURA Takumi 8513d4236c docs/doxygen.css: Tweak style for readability.
A few styles are brought from http://llvm.org/test-doxygen/api/api.css

llvm-svn: 130333
2011-04-27 21:53:35 +00:00
Rafael Espindola 3989776770 Fix indentation.
llvm-svn: 130331
2011-04-27 21:29:52 +00:00
Kevin Enderby 886894cb70 Fix a bug in the case that there is no add or subtract symbol and the offset
value is zero so it does not add a NULL expr operand.

llvm-svn: 130330
2011-04-27 21:02:27 +00:00
Dan Gohman 5394c70d1e Teach BasicAA about arm.neon.vld1 and vst1.
llvm-svn: 130327
2011-04-27 20:44:28 +00:00
Devang Patel e3745fdcf3 Revert r130178. It turned out to be not the optimal path to emit complex location expressions.
llvm-svn: 130326
2011-04-27 20:29:27 +00:00
Evan Cheng 9808d31b9e If converter was being too cute. It look for root BBs (which don't have
successors) and use inverse depth first search to traverse the BBs. However
that doesn't work when the CFG has infinite loops. Simply do a linear
traversal of all BBs work just fine.

rdar://9344645

llvm-svn: 130324
2011-04-27 19:32:43 +00:00
Dan Gohman 39b3a1ef7f When analyzing functions known to only access argument pointees,
only check arguments with pointer types. Update the documentation
of IntrReadArgMem reflect this.

While here, add support for TBAA tags on intrinsic calls.

llvm-svn: 130317
2011-04-27 18:39:03 +00:00
Andrew Trick 7d1eea86d9 Corrects an old, old typo in a case that doesn't seem to be reached in practice.
llvm-svn: 130316
2011-04-27 18:17:36 +00:00
Devang Patel 12bf0ab4b5 Simplify cfg inserts a call to trap when unreachable code is detected. Assign DebugLoc to this new trap instruction.
llvm-svn: 130315
2011-04-27 17:59:27 +00:00
Jakob Stoklund Olesen 71d3b895ba Also add <imp-def> operands for defined and dead super-registers when rewriting.
We cannot rely on the <imp-def> operands added by LiveIntervals in all cases as
demonstrated by the test case.

llvm-svn: 130313
2011-04-27 17:42:31 +00:00
Rafael Espindola 27c0c9bb87 Factor a bit of code to MCStreamer::EmitLabel. Keep track of the last
non private symbol. This will be use for handling

foo:
  .cfi_startproc
  ...

On OS X where we have to create a foo.eh symbol.

llvm-svn: 130305
2011-04-27 15:21:19 +00:00
Duncan Sands 085ad3b81a Stop trying to have instcombine preserve LCSSA form: this was not
effective in avoiding recomputation of LCSSA form; the widespread
use of instsimplify (which looks through phi nodes) means it was
not preserving LCSSA form anyway; and instcombine is no longer
scheduled in the middle of the loop passes so this doesn't matter
anymore.

llvm-svn: 130301
2011-04-27 10:55:12 +00:00
Andrew Trick 01eff820ae Test case and comment for PR9633.
llvm-svn: 130294
2011-04-27 05:42:17 +00:00
Nick Lewycky 6fac9bcf67 Use static inline to do the right thing when built in C99 mode. Of course,
C89 doesn't have an inline keyword.

llvm-svn: 130279
2011-04-27 03:22:17 +00:00
Eli Friedman bcc6914146 Refactor out code to fast-isel a memcpy operation with a small constant
length.  (I'm planning to use this to implement byval.)

llvm-svn: 130274
2011-04-27 01:45:07 +00:00
Rafael Espindola ae124da625 Force some values to be absolute and align based on the FDE pointers size. A small
step towards using .cfi_* on OS X.

llvm-svn: 130273
2011-04-27 01:43:49 +00:00
Eli Friedman 0eea0293d9 Fix an edge case involving branches in fast-isel on x86.
rdar://problem/9303306 .

llvm-svn: 130272
2011-04-27 01:34:27 +00:00
Andrew Trick 759ba0802d Fix for PR9633 [indvars] Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Added a type check in ScalarEvolution::computeSCEVAtScope to handle the case in which operands of an
AddRecExpr in the current scope are folded.

llvm-svn: 130271
2011-04-27 01:21:25 +00:00
Chris Lattner 7aab2799ae Enhance memdep to return clobber relation between noalias loads when
an earlier load could be widened to encompass a later load.  For example,
if we see:

  X = load i8* P, align 4
  Y = load i8* (P+3), align 1

and we have a 32-bit native integer type, we can widen the former load
to i32 which then makes the second load redundant.  GVN can't actually
do anything with this load/load relation yet, so this isn't testable, but 
it is the next step to resolving PR6627, and a fairly general class of 
"merge neighboring loads" missed optimizations.

llvm-svn: 130250
2011-04-26 22:42:01 +00:00
Jakob Stoklund Olesen eef2327360 Add a safe-guard against repeated splitting for some rare cases.
The number of blocks covered by a live range must be strictly decreasing when
splitting, otherwise we can't allow repeated splitting.

llvm-svn: 130249
2011-04-26 22:33:12 +00:00
Chris Lattner 32dc9bd1bb use AA::isMustAlias to simplify some calls.
llvm-svn: 130248
2011-04-26 21:53:34 +00:00
Chris Lattner 6b96621a8a remove support for llvm.invariant.end from memdep. It is a
work-in-progress that is not progressing, and it has issues.

llvm-svn: 130247
2011-04-26 21:50:51 +00:00
Evan Cheng 1355bbdd11 Be careful about scheduling nodes above previous calls. It increase usages of
more callee-saved registers and introduce copies. Only allows it if scheduling
a node above calls would end up lessen register pressure.

Call operands also has added ABI restrictions for register allocation, so be
extra careful with hoisting them above calls.

rdar://9329627

llvm-svn: 130245
2011-04-26 21:31:35 +00:00
Evan Cheng dbb86b8108 This test should be in MC. It breaks with changes to scheduling / register allocation so it's being removed.
llvm-svn: 130243
2011-04-26 21:09:04 +00:00
Chris Lattner 029afe4787 make a couple of changes to the standard pass pipeline:
1. Only run the early (in the module pass pipe) instcombine/simplifycfg
   if the "unit at a time" passes they are cleaning up after runs.

2. Move the "clean up after the unroller" pass to the very end of the
   function-level pass pipeline.  Loop unroll uses instsimplify now,
   so it doesn't create a ton of trash.  Moving instcombine later allows
   it to clean up after opportunities are exposed by GVN, DSE, etc.

3. Introduce some phase ordering tests for things that are specifically
   intended to be simplified by the full optimizer as a whole.

This resolves PR2338, and is progress towards PR6627, which will be 
generating code that looks similar to test2.

llvm-svn: 130241
2011-04-26 20:45:33 +00:00
Chris Lattner 1b06c71668 Transform: "icmp eq (trunc (lshr(X, cst1)), cst" to "icmp (and X, mask), cst"
when X has multiple uses.  This is useful for exposing secondary optimizations,
but the X86 backend isn't ready for this when X has a single use.  For example,
this can disable load folding.

This is inching towards resolving PR6627.

llvm-svn: 130238
2011-04-26 20:18:20 +00:00
Chris Lattner 31b106d7dd some random cleanups, no functionality change.
llvm-svn: 130237
2011-04-26 20:02:45 +00:00
Chris Lattner 6320840583 add an m_ConstantInt matching predicate that binds to a uint64_t, and add an m_OneUse()
predicate that matches if the subexpr has a single use.

llvm-svn: 130235
2011-04-26 19:50:39 +00:00
Jim Grosbach d4b733e4d8 ARM and Thumb2 support for atomic MIN/MAX/UMIN/UMAX loads.
rdar://9326019

llvm-svn: 130234
2011-04-26 19:44:18 +00:00
Rafael Espindola a4fa5ce911 Print the label if we will use it in debug_frame.
llvm-svn: 130232
2011-04-26 19:26:53 +00:00
Devang Patel ba5fbf17df Refactor code. Keep dwarf register operation selection logic at one place.
llvm-svn: 130231
2011-04-26 19:06:18 +00:00
Jakob Stoklund Olesen 3b7b7bcc7f Use the new TRI->getLargestLegalSuperClass hook to constrain register class inflation.
This has two effects: 1. We never inflate to a larger register class than what
the sub-target can handle. 2. Completely unconstrained virtual registers get the
largest possible register class.

llvm-svn: 130229
2011-04-26 18:52:36 +00:00
Jakob Stoklund Olesen 803a200077 Add a TRI::getLargestLegalSuperClass hook to provide an upper limit on register class inflation.
The hook will be used by the register allocator when recomputing register
classes after removing constraints.

Thumb1 code doesn't allow anything larger than tGPR, and x86 needs to ensure
that the spill size doesn't change.

llvm-svn: 130228
2011-04-26 18:52:33 +00:00
Benjamin Kramer 1d4c835089 Force a triple on this test to unbreak windows buildbots.
llvm-svn: 130226
2011-04-26 18:47:43 +00:00
Devang Patel b5ea255fb4 Fix an off by one error while accessing complex address element of a DIVariable.
This worked untill now because stars are aligned (i.e. num of complex address elments are always 0 or 2+ and when it is 2+ at least two elements are access together)

llvm-svn: 130225
2011-04-26 18:24:39 +00:00
Chris Lattner eb045f9c02 Improve the bail-out predicate to really only kick in when phi
translation fails.  We were bailing out in some cases that would
cause us to miss GVN'ing some non-local cases away.

llvm-svn: 130206
2011-04-26 17:41:02 +00:00
Dan Gohman 7da91aee83 Fast-isel support for simple inline asms.
llvm-svn: 130205
2011-04-26 17:18:34 +00:00
Oscar Fuentes 638aaecc4d Honor LLVM_BUILD_RUNTIME.
llvm-svn: 130199
2011-04-26 14:55:27 +00:00
Rafael Espindola 580eebaa20 Add test for PR9743.
llvm-svn: 130198
2011-04-26 14:17:42 +00:00
Duncan Sands d4ea3ec87f Another example of a static table that wasn't marked static.
llvm-svn: 130193
2011-04-26 07:30:10 +00:00
Chris Lattner 189ca1498f don't emit the symbol name twice for local bss and common
symbols.  For example, don't emit:
        .comm   _i,4,2                  ## @i
                                        ## @i

instead emit:
        .comm   _i,4,2                  ## @i

llvm-svn: 130192
2011-04-26 06:14:13 +00:00
Nick Lewycky 68d2218978 Add cmakefiles to build profile_rt.so!
llvm-svn: 130191
2011-04-26 05:48:41 +00:00
Evan Cheng 2f64754031 Fix typo
llvm-svn: 130190
2011-04-26 04:57:37 +00:00
Rafael Espindola 80cb3cb1d6 Print all the moves at a given label instead of just the first one.
Remove previous DwarfCFI hack.

llvm-svn: 130187
2011-04-26 03:58:56 +00:00
Nick Lewycky c58d293a6f Rename everything to follow LLVM style ... I think.
Add support for switch and indirectbr edges. This works by densely numbering
all blocks which have such terminators, and then separately numbering the
possible successors. The predecessors write down a number, the successor knows
its own number (as a ConstantInt) and sends that and the pointer to the number
the predecessor wrote down to the runtime, who looks up the counter in a
per-function table.

Coverage data should now be functional, but I haven't tested it on anything
other than my 2-file synthetic test program for coverage.

llvm-svn: 130186
2011-04-26 03:54:16 +00:00
Rafael Espindola 3584ab6cc6 No relocation produces a SLEB or ULEB, make sure they are handled in MC.
llvm-svn: 130181
2011-04-26 02:17:58 +00:00
Chris Lattner 6f83d06ffa Enhance MemDep: When alias analysis returns a partial alias result,
return it as a clobber.  This allows GVN to do smart things.

Enhance GVN to be smart about the case when a small load is clobbered
by a larger overlapping load.  In this case, forward the value.  This
allows us to compile stuff like this:

int test(void *P) {
  int tmp = *(unsigned int*)P;
  return tmp+*((unsigned char*)P+1);
}

into:

_test:                                  ## @test
	movl	(%rdi), %ecx
	movzbl	%ch, %eax
	addl	%ecx, %eax
	ret

which has one load.  We already handled the case where the smaller
load was from a must-aliased base pointer.

llvm-svn: 130180
2011-04-26 01:21:15 +00:00
Devang Patel cae2fbd6fc Let dwarf writer allocate extra space in the debug location expression. This space, if requested, will be used for complex addresses of the Blocks' variables.
llvm-svn: 130178
2011-04-26 00:12:46 +00:00
Devang Patel 2606f4d6d2 Rename a local variable.
llvm-svn: 130171
2011-04-25 23:05:21 +00:00
Devang Patel 8ce24133fd Rename a method to match what it really does.
s/addVariableAddress/addFrameVariableAddress/g

llvm-svn: 130170
2011-04-25 23:02:17 +00:00
Devang Patel 2688e4aba6 Do not drop a variable's complex address if it is not based on frame base.
Observed this while reading code, so I do not have a test case handy here.

llvm-svn: 130167
2011-04-25 22:52:55 +00:00
Dan Gohman 6acd95b3c1 Fix an iterator invalidation bug.
llvm-svn: 130166
2011-04-25 22:48:29 +00:00
Eric Christopher 238a21f2d5 Make this test disable fast isel as it's not needed.
llvm-svn: 130165
2011-04-25 22:39:46 +00:00
Chris Lattner f5ba0415df mark a large static table static. Pointed out by Michael Ilseman!
llvm-svn: 130160
2011-04-25 22:14:33 +00:00
Chris Lattner 50686bf55c Improve adherence to general style, use "foo_t &x" instead of "foo_t& x"
llvm-svn: 130153
2011-04-25 21:02:12 +00:00
Chris Lattner 63e9190f71 allow adding a FoldingSetNodeID to a FastFoldingSetNode, resolving PR9499,
patch by Johannes Schaub!

llvm-svn: 130151
2011-04-25 20:58:50 +00:00
Chris Lattner 6e29892430 add a missed bitfield instcombine.
llvm-svn: 130137
2011-04-25 18:44:26 +00:00
Akira Hatanaka 0e7ee666b7 Lower BlockAddress node when relocation-model is static.
llvm-svn: 130131
2011-04-25 17:10:45 +00:00
Devang Patel 734f2218ac A dbg.declare may not be in entry block, even if it is referring to an incoming argument. However, It is appropriate to emit DBG_VALUE referring to this incoming argument in entry block in MachineFunction.
llvm-svn: 130129
2011-04-25 16:33:52 +00:00
Benjamin Kramer ba446cc12a Make tests more useful.
lit needs a linter ...

llvm-svn: 130126
2011-04-25 10:12:01 +00:00
Chandler Carruth 9b73c8e293 Remove some hard coded CR-LFs. Some of these were the entire files, one of
these was just one line of a file. Explicitly set the eol-style property on the
files to try and ensure this fix stays.

llvm-svn: 130125
2011-04-25 07:11:23 +00:00
Duncan Sands 56ca6292dc Fix comment typo. Noticed by Liu.
llvm-svn: 130120
2011-04-25 06:21:43 +00:00
Rafael Espindola a076199e71 Simplify the logic. Noticed by aKor.
llvm-svn: 130116
2011-04-24 19:55:34 +00:00
Rafael Espindola 5c54ecc9af Synchronize the conditions for producing a .cfi_startproc and a .cfi_endproc.
Fixes PR9787.

llvm-svn: 130115
2011-04-24 19:00:34 +00:00
Sebastian Redl 5519ff9d4e Fix Target/ARM/Thumb1FrameLowering.h header guard.
llvm-svn: 130097
2011-04-24 15:47:01 +00:00
Sebastian Redl 1b86ea80bb Give MC/MCDisassembler/Disassembler.h a header guard.
llvm-svn: 130096
2011-04-24 15:46:56 +00:00
Sebastian Redl b8a62aa3c9 Give SplitKit.h a header guard.
llvm-svn: 130095
2011-04-24 15:46:51 +00:00
Sebastian Redl 76e34f0175 Give ImmutableIntervalMap.h an include guard.
llvm-svn: 130094
2011-04-24 15:46:46 +00:00
Jay Foad f7adb3204e Fix an assert to check exactly what it says.
llvm-svn: 130093
2011-04-24 14:30:00 +00:00
Mikhail Glushenkov acb5f8ecf7 Add a TODO.
llvm-svn: 130092
2011-04-24 14:17:41 +00:00
Mikhail Glushenkov 06655d4a61 Regenerate.
llvm-svn: 130091
2011-04-24 14:17:37 +00:00
Mikhail Glushenkov f08209382a Remove all references to plugins from the LLVMC docs.
llvm-svn: 130090
2011-04-24 14:17:32 +00:00
Jay Foad dbf81d8ddf PR9214: Convert the DIBuilder API to use ArrayRef.
llvm-svn: 130086
2011-04-24 10:11:03 +00:00
Jay Foad 1a180156b6 Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Jay Foad 72e705ed94 Like the coding standards say, do not use "using namespace std".
llvm-svn: 130054
2011-04-23 09:06:00 +00:00
Benjamin Kramer 3db054650b Silence an overzealous uninitialized variable warning from GCC.
llvm-svn: 130053
2011-04-23 08:21:06 +00:00
Andrew Trick 76dca78cb4 Accidental function name mangling.
llvm-svn: 130050
2011-04-23 04:08:15 +00:00
Andrew Trick 0ed5778a1e Thumb2 and ARM add/subtract with carry fixes.
Fixes Thumb2 ADCS and SBCS lowering: <rdar://problem/9275821>.
t2ADCS/t2SBCS are now pseudo instructions, consistent with ARM, so the
assembly printer correctly prints the 's' suffix.

Fixes Thumb2 adde -> SBC matching to check for live/dead carry flags.

Fixes the internal ARM machine opcode mnemonic for ADCS/SBCS.
Fixes ARM SBC lowering to check for live carry (potential bug).

llvm-svn: 130048
2011-04-23 03:55:32 +00:00
Andrew Trick 3260c9df4e Comment edit.
llvm-svn: 130047
2011-04-23 03:27:19 +00:00
Andrew Trick 1a1f8d4640 whitespace
llvm-svn: 130046
2011-04-23 03:24:11 +00:00
NAKAMURA Takumi aa3d6242cf docs: Introduce cascading style <div> and <p> continued on <h[2-5]>.
<h2>Section Example</h2>
<div> <!-- h2+div is applied -->
<p>Section preamble.</p>

<h3>Subsection Example</h3>
<p> <!-- h3+p is applied -->
Subsection body
</p>

<!-- End of section body -->
</div>

FIXME: Care H5 better.
llvm-svn: 130040
2011-04-23 00:30:22 +00:00
NAKAMURA Takumi 576273cf56 test/CodeGen/X86/shrink-compare.ll: Relax expressions for Win64.
llvm-svn: 130039
2011-04-23 00:15:45 +00:00
Owen Anderson dd450b86cf Teach FastISel to deal with instructions that have two immediate operands.
llvm-svn: 130033
2011-04-22 23:38:06 +00:00
Devang Patel 1d6bbd41aa Let front-end tie subprogram declaration with subprogram definition directly.
llvm-svn: 130028
2011-04-22 23:10:17 +00:00
Eric Christopher 2ee5b37ab6 Fix comment.
llvm-svn: 130027
2011-04-22 23:08:45 +00:00
Jakob Stoklund Olesen 032891b718 Always compare the cost of region splitting with the cost of per-block splitting.
Sometimes it is better to split per block, and we missed those cases.

llvm-svn: 130025
2011-04-22 22:47:40 +00:00
Mikhail Glushenkov 91956aba03 The .inc file is auto-generated and must not be edited by hand.
llvm-svn: 130021
2011-04-22 22:05:29 +00:00
Chris Lattner 6d277517d1 Recommit the fix for rdar://9289512 with a couple tweaks to
fix bugs exposed by the gcc dejagnu testsuite:
1. The load may actually be used by a dead instruction, which
   would cause an assert.
2. The load may not be used by the current chain of instructions,
   and we could move it past a side-effecting instruction. Change
   how we process uses to define the problem away.

llvm-svn: 130018
2011-04-22 21:59:37 +00:00
Johnny Chen 57c892860e Disassembly of A8.6.59 LDR (literal) Encoding T1 (16-bit thumb instruction) should
print out ldr, not ldr.n.

rdar://problem/9267772

llvm-svn: 130008
2011-04-22 19:12:43 +00:00
Benjamin Kramer 341c11da3b DAGCombine: fold "(zext x) == C" into "x == (trunc C)" if the trunc is lossless.
On x86 this allows to fold a load into the cmp, greatly reducing register pressure.
  movzbl	(%rdi), %eax
  cmpl	$47, %eax
->
  cmpb	$47, (%rdi)

This shaves 8k off gcc.o on i386. I'll leave applying the patch in README.txt to Chris :)

llvm-svn: 130005
2011-04-22 18:47:44 +00:00
Devang Patel ad45d911bb Do not leak argument's DbgVariables.
llvm-svn: 130004
2011-04-22 18:09:57 +00:00
Devang Patel 3c39ec2933 Add asserts.
llvm-svn: 129995
2011-04-22 16:44:29 +00:00
Benjamin Kramer 4c81624735 X86: Try to use a smaller encoding by transforming (X << C1) & C2 into (X & (C2 >> C1)) & C1. (Part of PR5039)
This tends to happen a lot with bitfield code generated by clang. A simple example for x86_64 is
uint64_t foo(uint64_t x) { return (x&1) << 42; }
which used to compile into bloated code:
	shlq	$42, %rdi               ## encoding: [0x48,0xc1,0xe7,0x2a]
	movabsq	$4398046511104, %rax    ## encoding: [0x48,0xb8,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00]
	andq	%rdi, %rax              ## encoding: [0x48,0x21,0xf8]
	ret                             ## encoding: [0xc3]

with this patch we can fold the immediate into the and:
	andq	$1, %rdi                ## encoding: [0x48,0x83,0xe7,0x01]
	movq	%rdi, %rax              ## encoding: [0x48,0x89,0xf8]
	shlq	$42, %rax               ## encoding: [0x48,0xc1,0xe0,0x2a]
	ret                             ## encoding: [0xc3]

It's possible to save another byte by using 'andl' instead of 'andq' but I currently see no way of doing
that without making this code even more complicated. See the TODOs in the code.

llvm-svn: 129990
2011-04-22 15:30:40 +00:00
Frits van Bommel 366353b037 Comment out some unused parameter names to silence out-of-tree -Wunused warnings.
llvm-svn: 129988
2011-04-22 11:36:45 +00:00
Eric Christopher ae95ad1935 Use enums for constant values.
llvm-svn: 129984
2011-04-22 06:34:01 +00:00
Eric Christopher 22a19816f6 Make the file format strings a little prettier for mach-o.
llvm-svn: 129980
2011-04-22 04:08:58 +00:00
Eric Christopher 1dd335de65 Add MachOObjectFile.cpp to cmake.
llvm-svn: 129978
2011-04-22 04:06:24 +00:00
Eric Christopher bafb9347dd Hook in mach-o object files into Object interface.
llvm-svn: 129976
2011-04-22 03:50:50 +00:00
Eric Christopher 3509d2dc95 Add support for 64-bit object files to Path.
llvm-svn: 129975
2011-04-22 03:50:19 +00:00
Eric Christopher 7b015c7598 Add an ObjectFile implementation for mach-o.
Patch by Patrick Walton!

llvm-svn: 129974
2011-04-22 03:19:48 +00:00
Eric Christopher 5c896f71ec 80-col fix.
llvm-svn: 129973
2011-04-22 03:07:06 +00:00
NAKAMURA Takumi 6e43e6fad0 include/llvm/Target/TargetAsmInfo.h: Fix a warning.
llvm-svn: 129972
2011-04-22 01:56:59 +00:00
Evan Cheng c0d2004e3c In Thumb2 mode, lower frame indix references to:
add <rd>, sp, #<imm8>
ldr <rd>, [sp, #<imm8>]
When the offset from sp is multiple of 4 and in range of 0-1020.
This saves code size by utilizing 16-bit instructions.

rdar://9321541

llvm-svn: 129971
2011-04-22 01:42:52 +00:00
Evan Cheng 8ea3af47bd Typo
llvm-svn: 129970
2011-04-22 01:40:20 +00:00
Chandler Carruth bab81b9797 Delete the other unused variable in this function. Sorry I missed this
the first time through.

llvm-svn: 129969
2011-04-22 01:29:18 +00:00
Chandler Carruth ea41470726 Remove an unused variable from a function. This is a likely cut-paste-o.
Silences GCC warning.

I wonder why Clang doesn't warn on this...

llvm-svn: 129968
2011-04-22 01:21:06 +00:00
Bill Wendling c14d7322ee Branch folding is folding a landing pad into a regular BB.
An exception is thrown via a call to _cxa_throw, which we don't expect to
return. Therefore, the "true" part of the invoke goes to a BB that has
'unreachable' as its only instruction. This is lowered into an empty MachineBB.
The landing pad for this invoke, however, is directly after the "true" MBB.
When the empty MBB is removed, the landing pad is directly below the BB with the
invoke call. The unconditional branch is removed and then the two blocks are
merged together.

The testcase is too big for a regression test.
<rdar://problem/9305728>

llvm-svn: 129965
2011-04-22 01:07:09 +00:00
Bob Wilson 23c28ee17e Define Neon load/store intrinsics for Clang as macros instead of functions.
This is needed so the front-end can see "aligned" attributes on the type
for the pointer arguments.  Radar 9311427.

llvm-svn: 129964
2011-04-22 00:37:01 +00:00
Rafael Espindola 5395f44fe8 Compute the size of the FDE encoding instead of hard coding it. Update
X8664_ELFTargetObjectFile::getFDEEncoding to match reality.

llvm-svn: 129959
2011-04-22 00:08:43 +00:00
Rafael Espindola 6aea59268a Remove unused argument.
llvm-svn: 129955
2011-04-21 23:39:26 +00:00
Rafael Espindola ea61f22dd3 Don't pass address spaces to EmitULEB128IntValue.
llvm-svn: 129953
2011-04-21 23:26:40 +00:00
Devang Patel 94ad6ac13c Fix DWARF description of Q registers.
llvm-svn: 129952
2011-04-21 23:22:35 +00:00
Devang Patel 3712c14be9 Fix DWARF description of S registers.
llvm-svn: 129947
2011-04-21 22:48:26 +00:00
Devang Patel 6d1e4e9646 Add DW_OP_bit_piece.
llvm-svn: 129945
2011-04-21 22:26:13 +00:00
Devang Patel 2266aa84a1 Refactor.
llvm-svn: 129938
2011-04-21 21:07:35 +00:00
Devang Patel be22131c28 Test case for r129922
llvm-svn: 129934
2011-04-21 20:16:43 +00:00
Jay Foad 5514afe6b2 PR9214: Convert Metadata API to use ArrayRef.
llvm-svn: 129932
2011-04-21 19:59:31 +00:00
Matt Beaumont-Gay 70597d4e50 Don't recycle loop variables.
llvm-svn: 129928
2011-04-21 19:46:23 +00:00
Jakob Stoklund Olesen 6a663b8dc8 Allow allocatable ranges from global live range splitting to be split again.
These intervals are allocatable immediately after splitting, but they may be
evicted because of later splitting. This is rare, but when it happens they
should be split again.

The remainder intervals that cannot be allocated after splitting still move
directly to spilling.

SplitEditor::finish can optionally provide a mapping from new live intervals
back to the original interval indexes returned by openIntv().

Each original interval index can map to multiple new intervals after connected
components have been separated. Dead code elimination may also add existing
intervals to the list.

The reverse mapping allows the SplitEditor client to treat the new intervals
differently depending on the split region they came from.

llvm-svn: 129925
2011-04-21 18:38:15 +00:00
Rafael Espindola c3dc486752 Fix relative relocations. This is sufficient for running the rust testsuite with
MC :-)

llvm-svn: 129923
2011-04-21 18:36:50 +00:00
Devang Patel 46bda61a81 As per ARM docs, register Dx is described as DW_OP_regx(256+x) in DWARF.
llvm-svn: 129922
2011-04-21 17:51:06 +00:00
Devang Patel 28f2719d83 Add comment in output stream.
llvm-svn: 129921
2011-04-21 17:50:24 +00:00
Daniel Dunbar 6309828206 Revert r1296656, "Fix rdar://9289512 - not folding load into compare at -O0...",
which broke a couple GCC test suite tests at -O0.

llvm-svn: 129914
2011-04-21 16:14:46 +00:00
Justin Holewinski d74d88a861 PTX: Expand useable register space
llvm-svn: 129913
2011-04-21 16:08:02 +00:00
Che-Liang Chiou 14c48e5d66 ptx: fix parameter ordering
This patch depends on the prior fix r129908 that changes to use std::find,
rather than std::binary_search, on unordered array.

Patch by Dan Bailey

llvm-svn: 129909
2011-04-21 10:56:58 +00:00
Che-Liang Chiou cdc51569ee ptx: PTXMachineFunctionInfo no longer sort registers and so should not use std::binary_search
llvm-svn: 129908
2011-04-21 10:16:20 +00:00
Jakob Stoklund Olesen 6b3396fbd2 Don't allow per-register spill size and alignment.
These values were not used for anything. Spill size and alignment is a property
of the register class, not the register.

llvm-svn: 129906
2011-04-21 03:43:21 +00:00
Nick Lewycky 8411b5511e In gcov profiling, give all functions an extra unified return block. This is
necessary since gcov counts transitions between blocks. It can't see if you've
run every line in a straight-line function, so we add an edge for it to notice.

llvm-svn: 129905
2011-04-21 03:18:00 +00:00
Nick Lewycky ed749d8c94 Fix think-o: emit all 8 bytes of the EOF marker. Also reflow a line in a
comment for 80 columns.

llvm-svn: 129904
2011-04-21 02:48:39 +00:00
Nick Lewycky 8e0a38f88a Add independent controls for whether GCOV profiling should emit .gcno files or
instrument the program to emit .gcda.
TODO: we should emit slightly different .gcda files when .gcno emission is off.

llvm-svn: 129903
2011-04-21 01:56:25 +00:00
Nick Lewycky 364c04ae01 Fix typo in comment.
llvm-svn: 129902
2011-04-21 01:54:08 +00:00
NAKAMURA Takumi 3ad2828811 docs/llvm.css: Introduce cascading style <div> and <p> continued on <h[2-5]>. For now, it is applied in AliasAnalysis.html and ReleaseNotes.html.
<h2>Section Example</h2>
<div> <!-- h2+div is applied -->
<p>Section preamble.</p>

<h3>Subsection Example</h3>
<p> <!-- h3+p is applied -->
Subsection body
</p>

<!-- End of section body -->
</div>

llvm-svn: 129901
2011-04-21 01:52:00 +00:00
NAKAMURA Takumi 590ba6195b docs/Passes.html: Fix a garbage.
llvm-svn: 129900
2011-04-21 01:32:19 +00:00
Nick Lewycky f735b7b845 Structs have elements not parameters. I'm surprised this ever compiled...
llvm-svn: 129888
2011-04-20 22:52:37 +00:00
Evan Cheng 5f1ba4cd2d Remove -use-divmod-libcall. Let targets opt in when they are available.
llvm-svn: 129884
2011-04-20 22:20:12 +00:00
Jakob Stoklund Olesen 86e53ced08 Add debug output for rematerializable instructions.
llvm-svn: 129883
2011-04-20 22:14:20 +00:00
Jakob Stoklund Olesen 90d79bdcd2 Permit remat when a virtual register has multiple defs.
TII::isTriviallyReMaterializable() shouldn't depend on any properties of the
register being defined by the instruction. Rematerialization is going to create
a new virtual register anyway.

llvm-svn: 129882
2011-04-20 22:14:17 +00:00
Cameron Zwarich ca4c633489 Fix another case of <rdar://problem/9184212> that only occurs with code
generated by llvm-gcc, since llvm-gcc uses 2 i64s for passing a 4 x float
vector on ARM rather than an i64 array like Clang.

llvm-svn: 129878
2011-04-20 21:48:38 +00:00
Cameron Zwarich 76dfa226cf The bitcast case here is actually handled uniformly earlier in the function, so
delete it.

llvm-svn: 129877
2011-04-20 21:48:34 +00:00
Cameron Zwarich 4cd9a4a975 Cleanup some code to better use an early return style in preparation for adding
more cases.

llvm-svn: 129876
2011-04-20 21:48:16 +00:00
Stuart Hastings 1b06a10d62 Un-XFAIL this test for ARM. <rdar://problem/7662569>
llvm-svn: 129875
2011-04-20 21:47:45 +00:00
Eli Friedman c93d399eed Revert r129846; it's breaking a buildbot. See
http://google1.osuosl.org:8011/builders/llvm-x86_64-linux-checks/builds/825/steps/test.llvm.stage2/logs/st.ll

llvm-svn: 129869
2011-04-20 19:00:08 +00:00
Jakob Stoklund Olesen 0e34c1dfac Prefer cheap registers for busy live ranges.
On the x86-64 and thumb2 targets, some registers are more expensive to encode
than others in the same register class.

Add a CostPerUse field to the TableGen register description, and make it
available from TRI->getCostPerUse. This represents the cost of a REX prefix or a
32-bit instruction encoding required by choosing a high register.

Teach the greedy register allocator to prefer cheap registers for busy live
ranges (as indicated by spill weight).

llvm-svn: 129864
2011-04-20 18:19:48 +00:00
Stuart Hastings 7850af6ea0 Excise unintended hunk in 129858. <rdar://problem/7662569>
llvm-svn: 129862
2011-04-20 18:09:26 +00:00
Stuart Hastings 45fe3c38c5 ARM byval support. Will be enabled by another patch to the FE. <rdar://problem/7662569>
llvm-svn: 129858
2011-04-20 16:47:52 +00:00
Daniel Dunbar 8991d611fd sys/Host: Change getHostTriple() to return the full Darwin version on OS X.
llvm-svn: 129852
2011-04-20 15:44:33 +00:00
Justin Holewinski 7d8895e767 PTX: Add intrinsics to list of built-in intrinsics, which allows them to be
used by Clang.  To help Clang integration, the PTX target has been split
     into two targets: ptx32 and ptx64, depending on the desired pointer size.

- Add GCCBuiltin class to all intrinsics
- Split PTX target into ptx32 and ptx64

llvm-svn: 129851
2011-04-20 15:37:17 +00:00
Rafael Espindola ed16477cb9 Behave like gnu as when a relocation crosses sections.
llvm-svn: 129850
2011-04-20 14:01:45 +00:00
Che-Liang Chiou 6586f84685 ptx: add integer div and rem instruction
Patched by Dan Bailey

llvm-svn: 129848
2011-04-20 09:28:55 +00:00
Che-Liang Chiou 5a952b3c67 ptx: add floating-point comparison to setp
Patched by Dan Bailey

llvm-svn: 129847
2011-04-20 09:28:20 +00:00
Che-Liang Chiou 49160f9a71 ptx: fix parameter ordering
Patched by Dan Bailey

llvm-svn: 129846
2011-04-20 09:27:19 +00:00
Nick Lewycky 4dae63e35b This should always be signed chars, so use int8_t. This fixes a miscompile when
llvm is built with unsigned chars where an immediate such as 0xff would be zero
extended to 64-bits, turning "cmp $0xff,%eax" into
"cmp $0xffffffffffffffff,%eax".

llvm-svn: 129845
2011-04-20 03:19:42 +00:00
Rafael Espindola e473aaf540 Remove unused arguments.
llvm-svn: 129844
2011-04-20 03:08:09 +00:00
Eric Christopher bcaedb5ce0 Rewrite the expander for umulo/smulo to remember to sign extend the input
manually and pass all (now) 4 arguments to the mul libcall. Add a new
ExpandLibCall for just this (copied gratuitously from type legalization).

Fixes rdar://9292577

llvm-svn: 129842
2011-04-20 01:19:45 +00:00
Daniel Dunbar c7f2f14478 llc: Fix a refacto, .loc support didn't work before 10.6.
llvm-svn: 129841
2011-04-20 00:47:19 +00:00
Sean Callanan d897f39797 Made the MC disassembler check before accessing
MCInst operands for ARM.  This allows it to be
more tolerant of malformed MCInsts or incorrect
instruction metadata.

llvm-svn: 129840
2011-04-20 00:43:34 +00:00
Daniel Dunbar cd01ed5bd6 ADT/Triple: Renambe isOSX... methods to isMacOSX for consistency with the OS
triple component.

llvm-svn: 129838
2011-04-20 00:14:25 +00:00
Johnny Chen dc62e59776 Fix typo in the comment.
llvm-svn: 129837
2011-04-19 23:58:52 +00:00
Daniel Dunbar 924699845a ADT/Triple: Drop support for -osx style triples, we are going with -macosx
instead.

llvm-svn: 129836
2011-04-19 23:55:20 +00:00
Daniel Dunbar 0854f347d2 ADT/Triple: Add support for Triple::MacOSX per feedback from Chris, will remove
Triple::OSX once Clang has moved.

llvm-svn: 129833
2011-04-19 23:34:12 +00:00
Daniel Dunbar 2b9b0e3748 ADT/Triple: Move a variety of clients to using isOSDarwin() and isOSWindows()
predicates.

llvm-svn: 129816
2011-04-19 21:14:45 +00:00
Daniel Dunbar 163a0966a9 ADT/Triple: Add isOSDarwin() and isOSWindows() helper functions.
llvm-svn: 129815
2011-04-19 21:12:05 +00:00
Daniel Dunbar 3c0fbce10b ADT/Triple: Fix Triple::getArchNameForAssembler to support OSX and iOS
enumeration values.

llvm-svn: 129814
2011-04-19 21:07:03 +00:00
Daniel Dunbar 100455a3c8 Target/X86: Eliminate uses of getDarwinVers().
llvm-svn: 129813
2011-04-19 21:04:12 +00:00
Daniel Dunbar 44b530369d Target/X86: Add getTargetTriple() accessor.
llvm-svn: 129812
2011-04-19 21:01:47 +00:00
Daniel Dunbar e3de896b5e Target/PPC: Kill off DarwinVers, which is now dead.
llvm-svn: 129811
2011-04-19 20:59:24 +00:00
Daniel Dunbar f954a0f028 Target/PPC: Eliminate a use of getDarwinVers().
llvm-svn: 129810
2011-04-19 20:57:03 +00:00
Daniel Dunbar a37aab2515 Target/PPC: Add a TargetTriple field.
llvm-svn: 129809
2011-04-19 20:54:28 +00:00
Chris Lattner f5f4439265 add a helper method.
llvm-svn: 129806
2011-04-19 20:47:57 +00:00
Daniel Dunbar ed3d5496dc llc: Eliminate a use of getDarwinMajorNumber().
- As before, there is a minor semantic change here (evidenced by the test
   change) for Darwin triples that have no version component. I debated changing
   the default behavior of isOSVersionLT, but decided it made more sense for
   triples to be explicit.

llvm-svn: 129805
2011-04-19 20:46:13 +00:00
Daniel Dunbar 9483bb6bf3 Target: Eliminate a use of getDarwinMajorNumber().
llvm-svn: 129803
2011-04-19 20:44:08 +00:00
Daniel Dunbar 4a7783b0c2 CodeGen: Eliminate a use of getDarwinMajorNumber().
- There is a minor semantic change here (evidenced by the test change) for
   Darwin triples that have no version component. I debated changing the default
   behavior of isOSVersionLT, but decided it made more sense for triples to be
   explicit.

llvm-svn: 129802
2011-04-19 20:32:39 +00:00
Daniel Dunbar 0b654f4299 ADT/Triple: Add helper function for OS X version checks.
llvm-svn: 129801
2011-04-19 20:30:10 +00:00
Daniel Dunbar 78f5241504 ADT/Triple: Add isOSVersionLT helper function.
llvm-svn: 129800
2011-04-19 20:30:07 +00:00
Daniel Dunbar 99f904c72d ADT/Triple: Generalize and simplify getDarwinNumber to just be getOSVersion.
llvm-svn: 129799
2011-04-19 20:24:34 +00:00
Daniel Dunbar d74bac70c4 ADT/Triple: Add support for more explicit "osx" and "ios" OS names.
llvm-svn: 129798
2011-04-19 20:19:27 +00:00
Stuart Hastings 468086d5e1 Delete unnecessary variable. <rdar://problem/7662569>
llvm-svn: 129796
2011-04-19 20:09:38 +00:00
Eric Christopher c721b0db6d Remove some duplicate op action entries and reorganize.
llvm-svn: 129781
2011-04-19 18:49:19 +00:00
Bob Wilson 0858c3aaed This patch combines several changes from Evan Cheng for rdar://8659675.
Making use of VFP / NEON floating point multiply-accumulate / subtraction is
difficult on current ARM implementations for a few reasons.
1. Even though a single vmla has latency that is one cycle shorter than a pair
   of vmul + vadd, a RAW hazard during the first (4? on Cortex-a8) can cause
   additional pipeline stall. So it's frequently better to single codegen
   vmul + vadd.
2. A vmla folowed by a vmul, vmadd, or vsub causes the second fp instruction to
   stall for 4 cycles. We need to schedule them apart.
3. A vmla followed vmla is a special case. Obvious issuing back to back RAW
   vmla + vmla is very bad. But this isn't ideal either:
     vmul
     vadd
     vmla
   Instead, we want to expand the second vmla:
     vmla
     vmul
     vadd
   Even with the 4 cycle vmul stall, the second sequence is still 2 cycles
   faster.

Up to now, isel simply avoid codegen'ing fp vmla / vmls. This works well enough
but it isn't the optimial solution. This patch attempts to make it possible to
use vmla / vmls in cases where it is profitable.

A. Add missing isel predicates which cause vmla to be codegen'ed.
B. Make sure the fmul in (fadd (fmul)) has a single use. We don't want to
   compute a fmul and a fmla.
C. Add additional isel checks for vmla, avoid cases where vmla is feeding into
   fp instructions (except for the #3 exceptional case).
D. Add ARM hazard recognizer to model the vmla / vmls hazards.
E. Add a special pre-regalloc case to expand vmla / vmls when it's likely the
   vmla / vmls will trigger one of the special hazards.

Enable these fp vmlx codegen changes for Cortex-A9.

llvm-svn: 129775
2011-04-19 18:11:57 +00:00
Bob Wilson d04a83f8f2 Add -mcpu=cortex-a9-mp. It's cortex-a9 with MP extension. rdar://8648637.
llvm-svn: 129774
2011-04-19 18:11:52 +00:00
Bob Wilson a2881ee8a4 Avoid some 's' 16-bit instruction which partially update CPSR
(and add false dependency) when it isn't dependent on last CPSR defining
instruction. rdar://8928208

llvm-svn: 129773
2011-04-19 18:11:49 +00:00
Bob Wilson df612ba006 Avoid write-after-write issue hazards for Cortex-A9.
Add a avoidWriteAfterWrite() target hook to identify register classes that
suffer from write-after-write hazards. For those register classes, try to avoid
writing the same register in two consecutive instructions.

This is currently disabled by default.  We should not spill to avoid hazards!
The command line flag -avoid-waw-hazard can be used to enable waw avoidance.

llvm-svn: 129772
2011-04-19 18:11:45 +00:00
Bob Wilson 3e5944d96b Some single-precision VFP instructions can execute in either the VPF or Neon
pipelines, at least on Cortex-A9.

llvm-svn: 129771
2011-04-19 18:11:38 +00:00
Bob Wilson f33715e554 Improvements for the Cortex-A9 scheduling itineraries.
llvm-svn: 129770
2011-04-19 18:11:36 +00:00
Eli Friedman ee92a6b332 Add support for FastISel'ing varargs calls.
llvm-svn: 129765
2011-04-19 17:22:22 +00:00