Commit Graph

74691 Commits

Author SHA1 Message Date
Andrew Trick b72bbe2a92 Fix the LoopUnroller to handle nontrivial loops and partial unrolling.
These are not individual bug fixes. I had to rewrite a good chunk of
the unroller to make it sane. I think it was getting lucky on trivial
completely unrolled loops with no early exits. I included some fairly
simple unit tests for partial unrolling. I didn't do much stress
testing, so it may not be perfect, but should be usable now.

llvm-svn: 137190
2011-08-10 00:28:10 +00:00
Owen Anderson 8059f0cf8d Push GPRnopc through a large number of instruction definitions to tighten operand decoding.
llvm-svn: 137189
2011-08-10 00:03:03 +00:00
Eric Christopher 266141aceb Update comment.
llvm-svn: 137188
2011-08-10 00:02:39 +00:00
Eric Christopher 69adb3f980 clang is the new black.
llvm-svn: 137187
2011-08-09 23:59:05 +00:00
Jakob Stoklund Olesen b91e489923 Trim an unneeded header.
llvm-svn: 137184
2011-08-09 23:49:21 +00:00
Jakob Stoklund Olesen 6a14dc01ff Promote VMOVS to VMOVD when possible.
On Cortex-A8, we use the NEON v2f32 instructions for f32 arithmetic. For
better latency, we also send D-register copies down the NEON pipeline by
translating them to vorr instructions.

This patch promotes even S-register copies to D-register copies when
possible so they can also go down the NEON pipeline.  Example:

        vldr.32 s0, LCPI0_0
    loop:
        vorr    d1, d0, d0
    loop2:
        ...
        vadd.f32        d1, d1, d16

The vorr instruction looked like this after regalloc:

    %S2<def> = COPY %S0, %D1<imp-def>

Copies involving odd S-registers, and copies that don't define the full
D-register are left alone.

llvm-svn: 137182
2011-08-09 23:41:44 +00:00
Owen Anderson 92b942b1b5 Tighten operand checking of register-shifted-register operands.
llvm-svn: 137180
2011-08-09 23:33:27 +00:00
Bruno Cardoso Lopes 72323966c8 Add 256-bit support for v8i32, v4i64 and v4f64 ISD::SELECT. Fix PR10556
llvm-svn: 137179
2011-08-09 23:27:13 +00:00
Eli Friedman 753625397b Fix minor typo.
llvm-svn: 137177
2011-08-09 23:26:12 +00:00
Owen Anderson e008931bf6 Tighten operand checking on memory barrier instructions.
llvm-svn: 137176
2011-08-09 23:25:42 +00:00
NAKAMURA Takumi 4f041651dd VMCore/BasicBlock.cpp: Don't assume BasicBlock::iterator might end with a non-PHInode Instruction in successors.
Frontends(eg. clang) might pass incomplete form of IR, to step off the way beyond iterator end. In the case I had met, it took infinite loop due to meeting bogus PHInode.

Thanks to Jay Foad and John McCall.

llvm-svn: 137175
2011-08-09 23:13:05 +00:00
NAKAMURA Takumi 5b64b81088 Fix whitespace.
llvm-svn: 137174
2011-08-09 23:12:56 +00:00
Owen Anderson 3d2e0e9db6 Tighten operand checking on CPS instructions.
llvm-svn: 137172
2011-08-09 23:05:39 +00:00
Owen Anderson ecc4ffc941 Fix an oversight in the FixedLenDecoderEmitter where we weren't correctly checking the success result of custom decoder hooks on singleton decodings.
llvm-svn: 137171
2011-08-09 23:05:23 +00:00
Eli Friedman 59b66883ea Representation of 'atomic load' and 'atomic store' in IR.
llvm-svn: 137170
2011-08-09 23:02:53 +00:00
Owen Anderson 042619f97d Create a new register class for the set of all GPRs except the PC. Use it to tighten our decoding of BFI.
llvm-svn: 137168
2011-08-09 22:48:45 +00:00
Bruno Cardoso Lopes fc481959d2 Add v16i16 and v32i8 store patterns
llvm-svn: 137166
2011-08-09 22:39:53 +00:00
Chad Rosier a15e3aaaad Fix 80-column violations.
llvm-svn: 137163
2011-08-09 22:23:40 +00:00
Rafael Espindola 6463cfa36c Add missing file.
llvm-svn: 137162
2011-08-09 22:19:52 +00:00
Bruno Cardoso Lopes 6963062a99 Use fp unpack instructions to unpack int types. Until we have AVX2, this
is the best we can do for these patterns. This fix PR10554.

llvm-svn: 137161
2011-08-09 22:18:37 +00:00
Eli Friedman 4ef2426b87 Fix a couple ridiculous copy-paste errors. rdar://9914773 .
llvm-svn: 137160
2011-08-09 22:17:39 +00:00
Rafael Espindola 07f6091527 Add a C interface to PassManagerBuilder. It is missing the addExtension
functionality since in the C api a pass is created and added to a pass
manager in a single call.

llvm-svn: 137159
2011-08-09 22:17:34 +00:00
Jim Grosbach a317160348 Don't truncate MachO addresses.
Assigned symbol addresses get truncated to 32-bits, even on 64-bit platforms.
That's obviously bogus.
For example,

 .globl _foo
 .equ _foo, 0x987654321ULL


rdar://9922863

llvm-svn: 137158
2011-08-09 22:12:37 +00:00
Benjamin Kramer 406dc1755f ARM Disassembler: sign extend branch immediates.
Not sure about BLXi, but this is what the old disassembler did.

llvm-svn: 137156
2011-08-09 22:02:50 +00:00
Owen Anderson d151b09921 Silence an false-positive warning.
llvm-svn: 137154
2011-08-09 21:38:14 +00:00
Owen Anderson d770f6c110 Don't generate the old-style disassembler in CMake builds either.
llvm-svn: 137153
2011-08-09 21:36:11 +00:00
Benjamin Kramer de2c381331 The new ARM disassembler disassembles "bx lr" as a special BX_ret instruction so target specific analysis isn't needed anymore.
llvm-svn: 137151
2011-08-09 21:34:19 +00:00
Owen Anderson 982aa05017 Don't continue generating the old-style decoder file.
llvm-svn: 137150
2011-08-09 21:30:29 +00:00
Jim Grosbach 5e80abbb5d ARM fix typo in pre-indexed store lowering.
rdar://9915869

llvm-svn: 137148
2011-08-09 21:22:41 +00:00
Owen Anderson c7afd84322 Attempt to fix CMake build.
llvm-svn: 137147
2011-08-09 21:09:59 +00:00
Owen Anderson 7a2401dbf0 Tighten Thumb1 branch predicate decoding.
llvm-svn: 137146
2011-08-09 21:07:45 +00:00
Eli Friedman 84cd7927b9 First draft of the practical guide to atomics.
This is mostly descriptive of the intended state once atomic load and store have landed.  

llvm-svn: 137145
2011-08-09 21:07:10 +00:00
Owen Anderson e0152a73c2 Replace the existing ARM disassembler with a new one based on the FixedLenDecoderEmitter.
This new disassembler can correctly decode all the testcases that the old one did, though
some "expected failure" testcases are XFAIL'd for now because it is not (yet) as strict in
operand checking as the old one was.

llvm-svn: 137144
2011-08-09 20:55:18 +00:00
Bob Wilson f60d6df887 Put Darwin-specific code inside an __APPLE__ ifdef.
llvm-svn: 137137
2011-08-09 19:54:32 +00:00
Bill Wendling d7f41b7f66 Revert r137134. It breaks some code as Eli pointed out.
llvm-svn: 137135
2011-08-09 18:56:35 +00:00
Bill Wendling 84ec8f65d1 Print out the variable declaration only if it is a declaration. Otherwise, a
'static' variable will be emitted twice.
PR10081

llvm-svn: 137134
2011-08-09 18:31:50 +00:00
Jakob Stoklund Olesen 53910d6aae Inflate register classes after coalescing.
Coalescing can remove copy-like instructions with sub-register operands
that constrained the register class.  Examples are:

  x86: GR32_ABCD:sub_8bit_hi -> GR32
  arm: DPR_VFP2:ssub0 -> DPR

Recompute the register class of any virtual registers that are used by
less instructions after coalescing.

This affects code generation for the Cortex-A8 where we use NEON
instructions for f32 operations, c.f. fp_convert.ll:

  vadd.f32  d16, d1, d0
  vcvt.s32.f32  d0, d16

The register allocator is now free to use d16 for the temporary, and
that comes first in the allocation order because it doesn't interfere
with any s-registers.

llvm-svn: 137133
2011-08-09 18:19:41 +00:00
Bruno Cardoso Lopes bed48dc8ff Reapply a more appropriate solution than in r137114. AVX supports
v4f64 = sitofp v4i32. This fix PR10559.
Also add support for v4i32 = fptosi v4f64.

llvm-svn: 137128
2011-08-09 17:39:13 +00:00
Bruno Cardoso Lopes 24dd1d4a27 Revert r137114
llvm-svn: 137127
2011-08-09 17:39:01 +00:00
Justin Holewinski db05c2b963 PTX: Add initial support for device function calls
- Calls are supported on SM 2.0+ for function with no return values

llvm-svn: 137125
2011-08-09 17:36:31 +00:00
Jakob Stoklund Olesen da96006975 Move CalculateRegClass to MRI::recomputeRegClass.
This function doesn't have anything to do with spill weights, and MRI
already has functions for manipulating the register class of a virtual
register.

llvm-svn: 137123
2011-08-09 16:46:27 +00:00
Renato Golin faff512536 Emitting ARM build attributes and values as ULEB, rather than char.
llvm-svn: 137115
2011-08-09 09:50:10 +00:00
Bruno Cardoso Lopes ad3453cf2d Handle sitofp between v4f64 <- v4i32. Fix PR10559
llvm-svn: 137114
2011-08-09 05:48:01 +00:00
Bob Wilson de9ec45e5a Recognize the UNAME_RELEASE environment variable to match Darwin's uname.
When this variable is set, "uname -r" will return its value instead of the
real OS version.  Make this affect LLVM's triple for consistency.
<rdar://problem/9919167>

llvm-svn: 137111
2011-08-09 05:13:36 +00:00
Andrew Trick 5e0ee1c7f2 LoopUnroll looks like it has some stale code. Remove it to prove my sanity and avoid further confusion.
llvm-svn: 137106
2011-08-09 03:11:29 +00:00
Bruno Cardoso Lopes 1155b1eafa Add support for avx vector fextend
llvm-svn: 137105
2011-08-09 03:04:29 +00:00
Bruno Cardoso Lopes 0d0964d099 Add AVX versions of 128-bit sitofp and fptosi
llvm-svn: 137104
2011-08-09 03:04:25 +00:00
Bruno Cardoso Lopes 337a7fdb13 Rename and tidy up tests
llvm-svn: 137103
2011-08-09 03:04:23 +00:00
Bruno Cardoso Lopes 2fc107365b Add two patterns to match special vmovss and vmovsd cases. Also fix
the patterns already there to be more strict regarding the predicate.
This fixes PR10558

llvm-svn: 137100
2011-08-09 01:43:09 +00:00
Bill Wendling 55a09346ac There is only one instance of this placeholder being created. Just use that
instead of a vector.

llvm-svn: 137099
2011-08-09 01:17:10 +00:00
Bill Wendling def94edf69 Remove an instance where the 'unwind' instruction was created.
The 'unwind' instruction was acting essentially as a placeholder, because it
would be replaced at the end of this function by a branch to the "unwind
handler". The 'unwind' instruction is going away, so use 'unreachable' instead,
which serves the same purpose as a placeholder.

llvm-svn: 137098
2011-08-09 01:09:21 +00:00
Devang Patel 6c1ed31b3b Print variable's inline location in debug output.
llvm-svn: 137096
2011-08-09 01:03:35 +00:00
Devang Patel 3d6e38942d Provide method to print variable's extended name which includes inline location.
llvm-svn: 137095
2011-08-09 01:03:14 +00:00
Jakob Stoklund Olesen e7dddfd7f6 Rename member variables to follow coding standards.
No functional change.

llvm-svn: 137094
2011-08-09 01:01:27 +00:00
Bill Wendling 413bff1b3b Add missing attributes to the C++ backend's output.
llvm-svn: 137091
2011-08-09 00:47:30 +00:00
Bruno Cardoso Lopes af6a85484c Make LowerVSETCC aware of AVX types and add patterns to match them.
llvm-svn: 137090
2011-08-09 00:46:57 +00:00
Jakob Stoklund Olesen e1f5313bc7 Move the RegisterCoalescer private to its implementation file.
RegisterCoalescer.h still has the CoalescerPair class interface.

llvm-svn: 137088
2011-08-09 00:43:37 +00:00
Dan Gohman b24a1d29cb Tidy up these testcases to look more like real code does.
llvm-svn: 137085
2011-08-09 00:33:11 +00:00
Jakob Stoklund Olesen 4c9a2fb044 Refer to the RegisterCoalescer pass by ID.
A public interface is no longer needed since RegisterCoalescer is not an
analysis any more.

llvm-svn: 137082
2011-08-09 00:29:53 +00:00
Jim Grosbach cab35c0836 ARM parsing and encoding for LDRBT instruction.
Fix the instruction representation to correctly only allow post-indexed form.
Add tests.

llvm-svn: 137074
2011-08-08 23:28:47 +00:00
Owen Anderson 03ac20fc66 Thumb1 BL instructions encoding 22 bits of displacement, not 21.
llvm-svn: 137073
2011-08-08 23:25:22 +00:00
Bill Wendling d12cec8093 Indicate that there are changes if runOfFunction returns saying that there are.
Patch by Jingyue!

llvm-svn: 137072
2011-08-08 23:01:10 +00:00
Jim Grosbach 5838c0c47e ARM parsing and encoding for LDRB instruction.
llvm-svn: 137071
2011-08-08 22:37:06 +00:00
Jim Grosbach f6dbc3a57c Add FIXME.
llvm-svn: 137070
2011-08-08 22:11:33 +00:00
Jakob Stoklund Olesen c04a66b48e Implement isLoadFromStackSlotPostFE and isStoreToStackSlotPostFE for ARM.
They improve the verbose assembly.

llvm-svn: 137069
2011-08-08 21:45:32 +00:00
Bruno Cardoso Lopes c96953c12a Add support for several vector shifts operations while in AVX mode. Fix PR10581
llvm-svn: 137067
2011-08-08 21:31:08 +00:00
Jim Grosbach 95466ce63b ARM load/store label parsing.
Allow labels for load/store instructions when parsing. There's encoding
issues, still, so this doesn't work all the way through, yet.

llvm-svn: 137064
2011-08-08 20:59:31 +00:00
Jakob Stoklund Olesen daa2cad723 Hoist hasLoadFromStackSlot and hasStoreToStackSlot.
These the methods are target-independent since they simply scan the
memory operands.  They can live in TargetInstrInfoImpl.

llvm-svn: 137063
2011-08-08 20:53:24 +00:00
Owen Anderson c40303885b Fix encodings for Thumb ASR and LSR immediate operands. They encode the range 1-32, with 32 encoded as 0.
llvm-svn: 137062
2011-08-08 20:42:17 +00:00
Eli Friedman a27da98921 Fix up the patterns for SXTB, SXTH, UXTB, and UXTH so that they are correctly active without HasT2ExtractPack. PR10611.
llvm-svn: 137061
2011-08-08 19:49:37 +00:00
Benjamin Kramer 1afd89ae36 Pacify virtual dtor warnings and cmake buildbots.
llvm-svn: 137060
2011-08-08 19:09:02 +00:00
Benjamin Kramer c22d50e5c3 Add MCInstrAnalysis class. This allows the targets to specify own versions of MCInstrDescs functions.
- Add overrides for ARM.
- Teach llvm-objdump to use this instead of plain MCInstrDesc.

llvm-svn: 137059
2011-08-08 18:56:44 +00:00
Benjamin Kramer 4c0423bc8f llvm-objdump: disassembly enhancements
- Indent simple loops
- Print unreachable blocks as .byte directives

llvm-svn: 137058
2011-08-08 18:41:34 +00:00
Benjamin Kramer 5d173c0dab llvm-objdump: Use help of CFG to print assembly when --cfg is passed.
This way we can avoid printing unreachable code (data).

llvm-svn: 137057
2011-08-08 18:32:12 +00:00
Devang Patel fee7cedbc9 Simplify by creating parent first.
llvm-svn: 137056
2011-08-08 18:22:10 +00:00
Jakob Stoklund Olesen 4f0ace5674 Don't clobber pending ST regs when FP regs are killed.
X86FloatingPoint keeps track of pending ST registers for an upcoming
inline asm instruction with fixed stack register constraints.  It does
this by remembering which FP register holds the value that should appear
at a fixed stack position for the inline asm.

When that FP register is killed before the inline asm, make sure to
duplicate it to a scratch register, so the ST register still has a live
FP reference.

This could happen when the same FP register was copied to two ST
registers, or when a spill instruction is inserted between the ST copy
and the inline asm.

This fixes PR10602.

llvm-svn: 137050
2011-08-08 17:15:43 +00:00
Bill Wendling 49bfb12c46 Clean up the grammar for the landingpad instruction.
llvm-svn: 137042
2011-08-08 08:06:05 +00:00
Bill Wendling e632cb3600 Remove unnecessary space.
llvm-svn: 137041
2011-08-08 08:02:48 +00:00
Bill Wendling a503fc0494 Fix typo found by John.
llvm-svn: 137040
2011-08-08 07:58:58 +00:00
Chris Lattner c3e74cdf4d strengthen up an assertion: you can't create a constant struct
with an opaque struct type, it doesn't make sense.  This should
resolve PR10473.

llvm-svn: 137028
2011-08-07 04:18:48 +00:00
Jakob Stoklund Olesen 22f37a1eb1 Fix typo. Thanks, Andy!
llvm-svn: 137023
2011-08-06 18:20:24 +00:00
Andrew Trick 6d45a01b67 Made SCEV's UDiv expressions more canonical. When dividing a
recurrence, the initial values low bits can sometimes be ignored.

To take advantage of this, added FoldIVUser to IndVarSimplify to fold
an IV operand into a udiv/lshr if the operator doesn't affect the
result.

-indvars -disable-iv-rewrite now transforms

i = phi i4
i1 = i0 + 1
idx = i1 >> (2 or more)
i4 = i + 4

into

i = phi i4
idx = i0 >> ...
i4 = i + 4

llvm-svn: 137013
2011-08-06 07:00:37 +00:00
Jakob Stoklund Olesen d4bb1d43e8 Reject RS_Spill ranges from local splitting as well.
All new local ranges are marked as RS_New now, so there is no need to
attempt splitting of RS_Spill ranges any more.

llvm-svn: 137002
2011-08-05 23:50:33 +00:00
Jakob Stoklund Olesen 02cf10bdfd Only mark remainder intervals as RS_Spill after per-block splitting.
The local ranges created get to stay in the RS_New stage, just like for
local and region splitting.

This gives tryLocalSplit a bit more freedom the first time it sees one
of these new local ranges.

llvm-svn: 137001
2011-08-05 23:50:31 +00:00
Jakob Stoklund Olesen 0de95ef7f5 Remember to update LiveDebugVariables after per-block splitting.
llvm-svn: 136996
2011-08-05 23:10:40 +00:00
Jakob Stoklund Olesen cef5d8ff77 Extract per-block splitting into its own method.
No functional change.

llvm-svn: 136994
2011-08-05 23:04:18 +00:00
Jakob Stoklund Olesen cdf9ad9107 Delete getMultiUseBlocks and splitSingleBlocks.
These functions are no longer used, and they are easily replaced with a
loop calling shouldSplitSingleBlock and splitSingleBlock.

llvm-svn: 136993
2011-08-05 22:52:17 +00:00
Jakob Stoklund Olesen 58995bc551 Also use shouldSplitSingleBlock() in the fallback splitting mode.
Drop the use of SplitAnalysis::getMultiUseBlocks, there is no need to go
through a SmallPtrSet any more.

llvm-svn: 136992
2011-08-05 22:43:23 +00:00
Jakob Stoklund Olesen 8627ea91cb Split around single instructions to enable register class inflation.
Normally, we don't create a live range for a single instruction in a
basic block, the spiller does that anyway. However, when splitting a
live range that belongs to a proper register sub-class, inserting these
extra COPY instructions completely remove the constraints from the
remainder interval, and it may be allocated from the larger super-class.

The spiller will mop up these small live ranges if we end up spilling
anyway. It calls them snippets.

llvm-svn: 136989
2011-08-05 22:20:45 +00:00
Jim Grosbach 3d0b3a3a50 ARM load instruction shifted register index operands.
Parsing and encoding for shifted index operands for load instructions.

llvm-svn: 136986
2011-08-05 22:03:36 +00:00
Jim Grosbach c320c85261 ARM indexed load assembly parsing and encoding.
More parsing support for indexed loads. Fix pre-indexed with writeback
parsing for register offsets and handle basic post-indexed offsets.

llvm-svn: 136982
2011-08-05 21:28:30 +00:00
Jakob Stoklund Olesen 5122467b38 Detect proper register sub-classes.
Some instructions require restricted register classes, but most of the
time that doesn't affect register allocation. For example, some
instructions don't work with the stack pointer, but that is a reserved
register anyway.

Sometimes it matters, GR32_ABCD only has 4 allocatable registers. For
such a proper sub-class, the register allocator should try to enable
register class inflation since that makes more registers available for
allocation.

Make sure only legal super-classes are considered. For example, tGPR is
not a proper sub-class in Thumb mode, but in ARM mode it is.

llvm-svn: 136981
2011-08-05 21:28:14 +00:00
Jim Grosbach f0c95cadc7 ARM refactor indexed store instructions.
Refactor STR[B] pre and post indexed instructions to use addressing modes for
memory operands, which is necessary for assembly parsing and is more consistent
with the rest of the memory instruction definitions. Make some incremental
progress on refactoring away the mega-operand addrmode2 along the way, which
is nice.

llvm-svn: 136978
2011-08-05 20:35:44 +00:00
Jim Grosbach 0f2dd284e9 Add ARM LDR parsing tests.
llvm-svn: 136977
2011-08-05 20:33:39 +00:00
Jakob Stoklund Olesen d633abebf6 Fix liveness computations in BranchFolding.
The old code would look at kills and defs in one pass over the
instruction operands, causing problems with this code:

  %R0<def>, %CPSR<def,dead> = tLSLri %R5<kill>, 2, pred:14, pred:%noreg
  %R0<def>, %CPSR<def,dead> = tADDrr %R4<kill>, %R0<kill>, pred:14, %pred:%noreg

The last instruction kills and redefines %R0, so it is still live after
the instruction.

This caused a register scavenger crash when compiling 483.xalancbmk for
armv6. I am not including a test case because it requires too much bad
luck to expose this old bug.

First you need to convince the register allocator to use %R0 twice on
the tADDrr instruction, then you have to convince BranchFolding to do
something that causes it to run the register scavenger on he bad block.

<rdar://problem/9898200>

llvm-svn: 136973
2011-08-05 18:47:07 +00:00
Jim Grosbach a70fbfd577 ARM simplify the postidx_reg operand encoding.
The immediate portion of the operand is just a boolean (the 'U' bit indicating
add vs. subtract). Treat it as such.

llvm-svn: 136969
2011-08-05 16:11:38 +00:00
Jim Grosbach bafce840ff ARM use a dedicated printer for postidx_reg operands.
llvm-svn: 136968
2011-08-05 15:48:21 +00:00
Bob Wilson 8de11bab76 Add missing register constraint for some VLD3/VLD4 pseudo instructions.
<rdar://problem/9878189>

llvm-svn: 136962
2011-08-05 07:24:09 +00:00
Chandler Carruth 2536b51aae Silence unused variable warnings in release builds.
llvm-svn: 136956
2011-08-05 01:08:21 +00:00
Jason W Kim 239370cb3f Fix http://llvm.org/bugs/show_bug.cgi?id=10583\n - test for 1 and 2 byte fixups to be added
llvm-svn: 136954
2011-08-05 00:53:03 +00:00