Commit Graph

76753 Commits

Author SHA1 Message Date
Michael J. Spencer 159970f733 Object: Add support for opening stdin.
llvm-svn: 141449
2011-10-08 00:17:58 +00:00
Michael J. Spencer 7eb8159927 Object: constize Archive.
llvm-svn: 141448
2011-10-08 00:17:45 +00:00
Jim Grosbach c87d60a58c Enable ARM mode VDUP(scalar) tests.
llvm-svn: 141447
2011-10-07 23:57:03 +00:00
Jim Grosbach d0637bfc68 ARM NEON assembly parsing and encoding for VDUP(scalar).
llvm-svn: 141446
2011-10-07 23:56:00 +00:00
Andrew Trick 7fb669ab48 LSR should only reuse phis that match its formula.
Fixes rdar://problem/5064068

llvm-svn: 141442
2011-10-07 23:46:21 +00:00
Eli Friedman 195464184e Fix APInt::operator*= so that it computes the correct result for large integers where there is unsigned overflow. Fix APFloat::toString so that it doesn't depend on the incorrect behavior in common cases (and computes the correct result in some rare cases). Fixes PR11086.
llvm-svn: 141441
2011-10-07 23:40:49 +00:00
Nick Lewycky 133a16871f Don't emit the symbol table entry for the .symtab_shndx section either.
llvm-svn: 141440
2011-10-07 23:29:53 +00:00
Nick Lewycky c6ac5f7388 Remove extraneous curlies. No functionality change.
llvm-svn: 141439
2011-10-07 23:28:32 +00:00
Jim Grosbach 6e5778f7b1 ARM prefix asmparser operand kind enums for readability.
llvm-svn: 141438
2011-10-07 23:24:09 +00:00
Bill Wendling 883ec97115 Take all of the invoke basic blocks and make the dispatch basic block their new
successor. Remove the old landing pad from their successor list, because it's
now the successor of the dispatch block. Now that the landing pad blocks are no
longer the destination of invokes, we can mark them as normal basic blocks
instead of landing pads.

This more closely resembles what the CFG is actually doing.

llvm-svn: 141436
2011-10-07 23:18:02 +00:00
Bill Wendling 6a37c64a47 Add a bool value to set the IsLandingPad flag to.
llvm-svn: 141435
2011-10-07 23:06:01 +00:00
Bill Wendling f9f5e455d4 Take the code that was emitted for the llvm.eh.dispatch.setup intrinsic and emit
it with the new SjLj emitter stuff. This way there's no need to emit that
kind-of-hacky intrinsic.

llvm-svn: 141419
2011-10-07 22:08:37 +00:00
Bill Wendling 7ecfbd90ef Thread the chain through the eh.sjlj.setjmp intrinsic, like it's documented to
do. This will be useful later on with the new SJLJ stuff.

llvm-svn: 141416
2011-10-07 21:25:38 +00:00
Nick Lewycky 8b02d36a23 Don't emit a shstrtabindex in the reserved range. Spotted by inspection and
patch by Cary Coutant!

llvm-svn: 141413
2011-10-07 20:58:24 +00:00
Nick Lewycky 4eb1143038 Clarify/fix typo. No functionality change.
llvm-svn: 141412
2011-10-07 20:56:23 +00:00
Jakob Stoklund Olesen 464fcc0035 Constrain both operands on MOVZX32_NOREXrr8.
This instruction is explicitly encoded without an REX prefix, so both
operands but be *_NOREX.

Also add an assertion to copyPhysReg() that fires when the MOV8rr_NOREX
constraints are not satisfied.

This fixes a miscompilation in 20040709-2 in the gcc test suite.

llvm-svn: 141410
2011-10-07 20:15:54 +00:00
Michael J. Spencer 5fd56b8302 Fix a few changes I missed.
llvm-svn: 141392
2011-10-07 19:52:41 +00:00
Michael J. Spencer cfb6cc7b14 Fix GCC again.
llvm-svn: 141389
2011-10-07 19:46:12 +00:00
Michael J. Spencer c1363cf21a Fix spelling in comment.
llvm-svn: 141386
2011-10-07 19:25:47 +00:00
Michael J. Spencer e5fd004719 Change relocation API to be per section. This time without breaking GCC.
llvm-svn: 141385
2011-10-07 19:25:32 +00:00
Jim Grosbach b8d9f51e4c Improve ARM assembly parser diagnostic for unexpected tokens.
Consider:
  mov r8, r11 fred

Previously, we issued the not very informative:
x.s:6:1: error: unexpected token in argument list

^

Now we generate:
x.s:5:14: error: unexpected token in argument list
  mov r8, r11 fred
              ^

llvm-svn: 141380
2011-10-07 18:27:04 +00:00
Bill Wendling 206d8a7f48 Revert 141376 and 141377 due to breaking the build.
--- Reverse-merging r141377 into '.':
U    tools/llvm-objdump/MachODump.cpp
--- Reverse-merging r141376 into '.':
U    include/llvm/Object/COFF.h
U    include/llvm/Object/ObjectFile.h
U    include/llvm-c/Object.h
U    tools/llvm-objdump/llvm-objdump.cpp
U    lib/Object/MachOObjectFile.cpp
U    lib/Object/COFFObjectFile.cpp
U    lib/Object/Object.cpp
U    lib/Object/ELFObjectFile.cpp

llvm-svn: 141379
2011-10-07 18:25:37 +00:00
David Greene 33f619971f Remove Multidefs
Multidefs are a bit unwieldy and incomplete.  Remove them in favor of
another mechanism, probably for loops.

Revert "Make Test More Thorough"
Revert "Fix a typo."
Revert "Vim Support for Multidefs"
Revert "Emacs Support for Multidefs"
Revert "Document Multidefs"
Revert "Add a Multidef Test"
Revert "Update Test for Multidefs"
Revert "Process Multidefs"
Revert "Parser Multidef Support"
Revert "Lexer Support for Multidefs"
Revert "Add Multidef Data Structures"

llvm-svn: 141378
2011-10-07 18:25:05 +00:00
Michael J. Spencer 350c71b2d8 Fix spelling in comment.
llvm-svn: 141377
2011-10-07 18:15:40 +00:00
Michael J. Spencer b0d61540cb Change relocation API to be per section.
llvm-svn: 141376
2011-10-07 18:15:25 +00:00
Evan Cheng 77f79a1a4f Jakob is the code owner of register allocation and TableGen.
llvm-svn: 141372
2011-10-07 17:26:38 +00:00
Evan Cheng 74db300f37 High bits of movmskp{s|d} and pmovmskb are known zero. rdar://10247336
llvm-svn: 141371
2011-10-07 17:21:44 +00:00
Bob Wilson 8decdc472f Reenable tail calls for iOS 5.0 and later.
llvm-svn: 141370
2011-10-07 17:17:49 +00:00
Bob Wilson bc1589945d Reenable use of divmod compiler_rt functions for iOS 5.0 and later.
llvm-svn: 141368
2011-10-07 16:59:21 +00:00
Matt Beaumont-Gay b7609cd35f Move default to top of switch
llvm-svn: 141366
2011-10-07 16:27:01 +00:00
Anton Korobeynikov 318d6bae80 Peephole optimization for ABS on ARM.
Patch by Ana Pazos!

llvm-svn: 141365
2011-10-07 16:15:08 +00:00
Duncan Sands c52af46484 Teach GVN to also propagate switch cases. For example, in this code
switch (n) {
    case 27:
      do_something(x);
    ...
  }
the call do_something(x) will be replaced with do_something(27).  In
gcc-as-one-big-file this results in the removal of about 500 lines of
bitcode (about 0.02%), so has about 1/10 of the effect of propagating
branch conditions.

llvm-svn: 141360
2011-10-07 08:29:06 +00:00
Craig Topper d9cfddc5cd Add X86 disassembler support for RDFSBASE, RDGSBASE, WRFSBASE, and WRGSBASE.
llvm-svn: 141358
2011-10-07 07:02:24 +00:00
Andrew Trick 35c9e51219 PostRA scheduler fix. Clear stale loop dependencies.
Fixes <rdar://problem/10235725>

llvm-svn: 141357
2011-10-07 06:33:09 +00:00
Andrew Trick 4ef158335b whitespace
llvm-svn: 141356
2011-10-07 06:27:02 +00:00
Craig Topper bf136764ae Add X86 disassembler support for XSAVE, XRSTOR, and XSAVEOPT.
llvm-svn: 141354
2011-10-07 05:53:50 +00:00
Craig Topper 5aebebe18d Revert part of r141274. Only need to change encoding for xchg %eax, %eax in 64-bit mode. This is because in 64-bit mode xchg %eax, %eax implies zeroing the upper 32-bits of RAX which makes it not a NOP. In 32-bit mode using NOP encoding is fine.
llvm-svn: 141353
2011-10-07 05:35:38 +00:00
Bill Wendling 8d50ea0f82 Use the correct vreg here.
llvm-svn: 141342
2011-10-06 23:41:14 +00:00
Bill Wendling b3d4678877 Generate the dispatch code for a 'thumb' function. This is very similar to the
others. They take the call site value. Determine if it's a proper value. And
then jumps to the correct call site via a jump table.

llvm-svn: 141341
2011-10-06 23:37:36 +00:00
Owen Anderson 6a5c150e9c Fix the check for nested IT instructions in the disassembler. We need to perform the check before adding the Thumb predicate, which pops on entry off the ITBlock queue.
llvm-svn: 141339
2011-10-06 23:33:11 +00:00
Eli Friedman 1456cd20b4 Remove the old atomic instrinsics. autoupgrade functionality is included with this patch.
llvm-svn: 141333
2011-10-06 23:20:49 +00:00
Bill Wendling 5626c66a89 Generate the dispatch table for ARM mode.
llvm-svn: 141327
2011-10-06 22:53:00 +00:00
Bill Wendling 030b58e5c9 Refactor some of the code that sets up the entry block for SjLj EH. No functionality change.
llvm-svn: 141323
2011-10-06 22:18:16 +00:00
Jim Grosbach 0947102623 Tidy up tests. Un-XFAIL file and mark individual tests as FIXME instead.
llvm-svn: 141321
2011-10-06 22:04:05 +00:00
Bill Wendling 31d973cde6 Use a thumb ORR instead of thumb2 ORR when in thumb-only mode. (Picky! Picky!)
Place the immediate to OR into a register so that it works.

llvm-svn: 141319
2011-10-06 21:51:21 +00:00
Jim Grosbach 4887469138 Fix and clean up tests. Un-XFAIL.
llvm-svn: 141318
2011-10-06 21:32:50 +00:00
Bill Wendling 362c1b01cc * Set the low bit of the return address when we are in thumb mode.
* Some code cleanup.

llvm-svn: 141317
2011-10-06 21:29:56 +00:00
Jim Grosbach ceb4c7523f Fix and clean up tests. Un-XFAIL.
llvm-svn: 141316
2011-10-06 21:28:30 +00:00
David Greene 7475ad05fa Fix List-of-List Processing
Fix VarListElementInit::resolveListElementReference to return a
partially resolved VarListElementInint in the case where full
resolution is not possible.  This allows TableGen to make forward
progress resolving certain complex list expressions.

llvm-svn: 141315
2011-10-06 21:20:46 +00:00
David Greene 74842740c0 Make Test More Thorough
Check that all ADD patters are processed.

Add a SUB test.

llvm-svn: 141314
2011-10-06 21:20:44 +00:00
Matt Beaumont-Gay 78f290c739 Fix -asserts build
llvm-svn: 141313
2011-10-06 20:59:09 +00:00
Justin Holewinski c8ab2c1d99 PTX: Implement signed division
llvm-svn: 141306
2011-10-06 20:00:33 +00:00
Benjamin Kramer f9389a361e Use StringSwitch.
llvm-svn: 141305
2011-10-06 18:53:43 +00:00
Benjamin Kramer a54985ee90 Simplify code. No functionality change.
llvm-svn: 141299
2011-10-06 18:23:56 +00:00
David Greene 2b724f65d5 Fix Typo
Compare the entire keyword string.

llvm-svn: 141295
2011-10-06 14:37:47 +00:00
Peter Collingbourne 7f7f2e9b76 s/tblgen/llvm-tblgen/g in a few missed places, including the tests
llvm-svn: 141294
2011-10-06 13:39:59 +00:00
Peter Collingbourne 51eaba7a54 Remove the Clang tblgen backends from LLVM.
llvm-svn: 141293
2011-10-06 13:21:42 +00:00
Torok Edwin 05dc9d6213 Don't require C bindings opcode numbers to be kept in sync.
They are not in sync now, for example Bitcast would show up as LLVMCall.
So instead introduce 2 functions that map to and from the opcodes in the C
bindings.

llvm-svn: 141290
2011-10-06 12:39:34 +00:00
Torok Edwin 1db48c0055 Add uwtable, returnstwice and nonlazybind to the C bindings also.
llvm-svn: 141289
2011-10-06 12:13:32 +00:00
Torok Edwin 1cd9aded85 ocaml/C bindings: type->isSized()
llvm-svn: 141288
2011-10-06 12:13:28 +00:00
Torok Edwin 60c40de81b add binding to read icmp predicate
llvm-svn: 141287
2011-10-06 12:13:20 +00:00
Torok Edwin fec812e1f1 ocaml/C bindings: getmdstring, add num_op, get_op should work on metadata too
llvm-svn: 141286
2011-10-06 12:13:11 +00:00
Torok Edwin 0d5f6ae881 C/OCaml API to retrieve struct name.
llvm-svn: 141285
2011-10-06 12:12:50 +00:00
Torok Edwin d43a5d76f4 ocaml bindings: add llvm_ipo based on IPO.h
llvm-svn: 141284
2011-10-06 12:12:27 +00:00
Torok Edwin ba1460adb6 add more tests for the OCaml bindings
llvm-svn: 141283
2011-10-06 12:12:12 +00:00
Craig Topper 23eb468b1f Fix assembling of xchg %eax, %eax to not use the NOP encoding of 0x90. This was done by creating a new register group that excludes AX registers. Fixes PR10345. Also added aliases for flipping the order of the operands of xchg <reg>, %eax.
llvm-svn: 141274
2011-10-06 06:44:41 +00:00
Evan Cheng d40ced666d Cosmetic change.
llvm-svn: 141269
2011-10-06 02:47:18 +00:00
Peter Collingbourne fb3d935649 Build system infrastructure for multiple tblgens.
llvm-svn: 141266
2011-10-06 01:51:51 +00:00
Bill Wendling 6134655f08 Add the MBBs before inserting the instructions. Doing it afterwards could lead
to an infinite loop because of the def-use chains.

Also use a frame load instead of store for the LD instruction.

llvm-svn: 141263
2011-10-06 00:53:33 +00:00
Jakob Stoklund Olesen 6e429a16fd Remove the TRI::getSubRegisterRegClass() hook.
This restores my karma after I added TRI::getSubClassWithSubReg().

Register constraints are applied 'backwards'.  Starting from the
register class required by an instruction operand, the correct question
is: 'How can I constrain the super-register register class so all its
sub-registers satisfy the instruction constraint?' The
getMatchingSuperRegClass() hook answers that.

We never need to go 'forwards': Starting from a super-register register
class, what register class are the sub-registers in?  The
getSubRegisterRegClass() hook did that.

llvm-svn: 141258
2011-10-06 00:08:27 +00:00
Cameron Zwarich 842f99a6ee Always merge profitable shifts on A9, not just when they have a single use.
llvm-svn: 141248
2011-10-05 23:39:02 +00:00
Cameron Zwarich 87aa18378e Remove a check from ARM shifted operand isel helper methods, which were blocking
merging an lsl #2 that has multiple uses on A9. This shift is free, so there is
no problem merging it in multiple places. Other unprofitable shifts will not be
merged.

llvm-svn: 141247
2011-10-05 23:38:50 +00:00
Bill Wendling f793e7ed5c Get the proper call site numbers for the landing pads. Also remove a magic
number (18) for the proper addressing mode.

llvm-svn: 141245
2011-10-05 23:28:57 +00:00
Bill Wendling dde44f95fa Add accessor method to check if the landing pad symbol has call site information.
llvm-svn: 141244
2011-10-05 23:26:10 +00:00
David Greene b6eb065ffc Fix a typo.
Fix the argument passed in the multidef example.

llvm-svn: 141243
2011-10-05 23:16:44 +00:00
David Greene 47a665e93e Prefix Template Arg Names with Multiclass Name
For consistency, prefix multiclass template arg names with the
multiclass name followed by "::" to avoid name clashes among
multiclass arguments and other entities in the multiclass.

llvm-svn: 141239
2011-10-05 22:42:54 +00:00
David Greene 4fff1e2f5e Vim Support for Multidefs
Add vim highlighting support for multidefs.

llvm-svn: 141238
2011-10-05 22:42:52 +00:00
David Greene 5d835cc5a0 Emacs Support for Multidefs
Add Emacs font-lock keyword support for multidefs.

llvm-svn: 141237
2011-10-05 22:42:51 +00:00
David Greene ce3852464a Document Multidefs
Provide documentation for multidefs, explaining in detail how they
work.

llvm-svn: 141236
2011-10-05 22:42:49 +00:00
David Greene 9bc27ec40f Update Test for Multidefs
Update the MultiPat.td test to create some defs via multidefs.

llvm-svn: 141235
2011-10-05 22:42:48 +00:00
David Greene 52a9cb8063 Add a Multidef Test
Add a simple test for multidefs.

llvm-svn: 141234
2011-10-05 22:42:47 +00:00
David Greene 2ac084dbb2 Process Multidefs
Process each multidef declared in a multiclass.  Iterate through the
list and instantiate a def in the multiclass for each item, resolving
the list item to the temporary iterator (possibly) used in the
multidef ObjectBody.  We then process each generated def in the normal
way.

llvm-svn: 141233
2011-10-05 22:42:45 +00:00
David Greene dd1eb61298 Parser Multidef Support
Add parser support to recognize multidefs.  No processing on the
multidef is done at this point.  The grammar is:

MultiDef = MULTIDEF ObjectName < Value, Declaration, Value > ObjectBody

The first Value must be resolveable to a list and the second Value
must be resolveable to an integer.  The Declaration is a temporary
value used as an iterator to refer to list items during processing.
It may be passed into the ObjectBody where it will be substituted with
the list value used to instantiate each def.

llvm-svn: 141232
2011-10-05 22:42:44 +00:00
David Greene dd88abaa97 Lexer Support for Multidefs
Add keyword support for multidefs.

llvm-svn: 141231
2011-10-05 22:42:35 +00:00
David Greene 87cf662fbd Add Multidef Data Structures
Add a set of data structures and members analogous to those used for
multiclass defs.  These will represent a new kind of multiclass def: a
multidef.  The idea behind the multidef is to process a list of items
and create a def record for each one inside the enclosing multiclass.
This allows the user to dynamically create a set of defs based on the
contents of a list.

llvm-svn: 141230
2011-10-05 22:42:17 +00:00
David Greene db44597494 Refactor Multiclass Def Processing
Move the code to instantiate a multiclass def, bind its arguments and
resolve its members into three helper functions.  These will be reused
to support a new kind of multiclass def: a multidef.

llvm-svn: 141229
2011-10-05 22:42:07 +00:00
Eli Friedman 3e3aecbc2c PR11061: Make simplifylibcalls fold strcmp("", x) correctly.
While I'm here, fix the related issue with strncmp, add some actual tests for strcmp and strncmp, and start using StringRef::compare for constant folding instead of using strcmp/strncmp so that the optimized IR isn't dependent on the host's implementation of strcmp.

llvm-svn: 141227
2011-10-05 22:27:16 +00:00
Bill Wendling 267f323d28 Modify the mapping from landing pad to call sites to accept more than one call
site.

llvm-svn: 141226
2011-10-05 22:24:35 +00:00
Bill Wendling c2d55b6e50 Add an ivar that maps a landing pad's EH symbol to the call sites that may jump
to the landing pad. This will be used by the back-end to generate the jump
tables for dispatching the arriving longjmp in sjlj eh.

llvm-svn: 141224
2011-10-05 22:20:38 +00:00
Bill Wendling e61c62533e Small refactoring. Cache the FunctionInfo->MBB into a local variable.
llvm-svn: 141221
2011-10-05 22:16:11 +00:00
Jakob Stoklund Olesen eb38bd8ced Fix sub-register operand verification.
PhysReg operands are not allowed to have sub-register indices at all.

For virtual registers with sub-reg indices, check that all registers in
the register class support the sub-reg index.

llvm-svn: 141220
2011-10-05 22:12:57 +00:00
Andrew Trick 3e8a576da1 Fixes PR11070 - assert in SCEV getConstantEvolvingPHIOperands.
llvm-svn: 141219
2011-10-05 22:06:53 +00:00
Bill Wendling db1633530a Fix comment to reflect the new EH stuff.
llvm-svn: 141218
2011-10-05 22:04:08 +00:00
Jakob Stoklund Olesen 3abead76ea Remove unused DstSubIdx argument.
llvm-svn: 141214
2011-10-05 21:22:53 +00:00
Jim Grosbach e7abae0442 Re-commit 141203, but much more conservative.
Just pull the instruction name, but don't change the order of anything
else. That keeps --debug happy and non-crashing, but doesn't change
how the worklist gets built.

llvm-svn: 141210
2011-10-05 20:53:43 +00:00
Jim Grosbach 8f9acfac89 Revert 141203. InstCombine is looping on unit tests.
llvm-svn: 141209
2011-10-05 20:44:29 +00:00
Jakob Stoklund Olesen f7957a9819 Simplify EXTRACT_SUBREG emission.
EXTRACT_SUBREG is emitted as %dst = COPY %src:sub, so there is no need to
constrain the %dst register class.  RegisterCoalescer will apply the
necessary constraints if it decides to eliminate the COPY.

The %src register class does need to be constrained to something with
the right sub-registers, though.  This is currently done manually with
COPY_TO_REGCLASS nodes.  They can possibly be removed after this patch.

llvm-svn: 141207
2011-10-05 20:26:40 +00:00
Jakob Stoklund Olesen ee9b576a2a Override TRI::getSubClassWithSubReg for X86.
There are fewer registers with sub_8bit sub-registers in 32-bit mode
than in 64-bit mode.  In 32-bit mode, sub_8bit behaves the same as
sub_8bit_hi.

llvm-svn: 141206
2011-10-05 20:26:33 +00:00
Rafael Espindola 79d0c4f4b0 Check for the returns_twice attribute in callsFunctionThatReturnsTwice. This
fixes PR11038, but there are still some cleanups to be done.

llvm-svn: 141204
2011-10-05 20:05:13 +00:00
Jim Grosbach e37e030137 Update InstCombine worklist after instruction transform is complete.
When updating the worklist for InstCombine, the Add/AddUsersToWorklist
functions may access the instruction(s) being added, for debug output for
example. If the instructions aren't yet added to the basic block, this
can result in a crash. Finish the instruction transformation before
adjusting the worklist instead.

rdar://10238555

llvm-svn: 141203
2011-10-05 20:05:00 +00:00
Justin Holewinski 664e9f55bf PTX: Fixup a case where getRegClassFor() should be used instead of custom code.
llvm-svn: 141199
2011-10-05 18:32:25 +00:00
Jakob Stoklund Olesen 8ff52c4135 Simplify INSERT_SUBREG emission.
The register class created by INSERT_SUBREG and SUBREG_TO_REG must be
legal and support the SubIdx sub-registers.

The new getSubClassWithSubReg() hook can compute that.

This may create INSERT_SUBREG instructions defining a larger register
class than the sub-register being inserted.  That is OK,
RegisterCoalescer will constrain the register class as needed when it
eliminates the INSERT_SUBREG instructions.

llvm-svn: 141198
2011-10-05 18:31:00 +00:00
Akira Hatanaka c6b742f98a Fix assertion string.
llvm-svn: 141197
2011-10-05 18:17:49 +00:00
Akira Hatanaka 426a804825 Make sure candidate for delay slot filler is not a return instruction.
llvm-svn: 141196
2011-10-05 18:16:09 +00:00
Dan Gohman 8218b8f6ae Make this test less sensitive to codegen optimizations.
llvm-svn: 141195
2011-10-05 18:13:08 +00:00
Akira Hatanaka 14e4149f4e Add RA to the set of registers that are defined if instruction is a call.
llvm-svn: 141194
2011-10-05 18:11:44 +00:00
Owen Anderson 10c5b12f99 Support a valid, but not very useful, encoding of CPSIE where none of the AIF bits are set.
llvm-svn: 141190
2011-10-05 17:16:40 +00:00
Andrew Trick ed39bb8efd Typo. Thanks Bob.
llvm-svn: 141188
2011-10-05 16:52:28 +00:00
Jakob Stoklund Olesen ccdfbfb5e5 Add a FIXME.
TwoAddressInstructionPass should annotate instructions with <undef>
flags when it lower REG_SEQUENCE instructions.  LiveIntervals should not
be in the business of modifying code (except for kill flags, perhaps).

llvm-svn: 141187
2011-10-05 16:51:21 +00:00
Duncan Sands 6e8129e127 Ensure OpCode is not used uninitialized.
llvm-svn: 141184
2011-10-05 15:13:13 +00:00
Duncan Sands 36ffaa809f Comment out a variable that is only used in commented out code.
llvm-svn: 141183
2011-10-05 15:12:44 +00:00
Duncan Sands b0e6d04a00 Remove a bunch of unused variables in the PTX backend (warned about by gcc-4.6).
llvm-svn: 141182
2011-10-05 15:11:08 +00:00
Duncan Sands efb31f3f3c Fix compilation when using gcc-4.6. Patch by wanders.
llvm-svn: 141178
2011-10-05 14:36:12 +00:00
Duncan Sands f4f47ccd12 GVN does simple propagation of conditions: when it sees a conditional
branch "br i1 %x, label %if_true, label %if_false" then it replaces
"%x" with "true" in places only reachable via the %if_true arm, and
with "false" in places only reachable via the %if_false arm.  Except
that actually it doesn't: if value numbering shows that %y is equal
to %x then, yes, %y will be turned into true/false in this way, but
any occurrences of %x itself are not transformed.  Fix this.  What's
more, it's often the case that %x is an equality comparison such as
"%x = icmp eq %A, 0", in which case every occurrence of %A that is
only reachable via the %if_true arm can be replaced with 0.  Implement
this and a few other variations on this theme.  This reduces the number
of lines of LLVM IR in "GCC as one big file" by 0.2%.  It has a bigger
impact on Ada code, typically reducing the number of lines of bitcode
by around 0.4% by removing repeated compiler generated checks.  Passes
the LLVM nightly testsuite and the Ada ACATS testsuite.

llvm-svn: 141177
2011-10-05 14:28:49 +00:00
Duncan Sands e90dd0587e Generalize GVN's conditional propagation logic slightly:
it's OK for the false/true destination to have multiple
predecessors as long as the extra ones are dominated by
the branch destination.

llvm-svn: 141176
2011-10-05 14:17:01 +00:00
NAKAMURA Takumi 9ebdf46b5a MipsDelaySlotFiller.cpp: Appease msvc to specify llvm::next() explicitly.
llvm-svn: 141174
2011-10-05 10:11:02 +00:00
Cameron Zwarich 2226b4be09 Add braces around something that throws me for a loop.
llvm-svn: 141173
2011-10-05 08:59:10 +00:00
Cameron Zwarich 6a7aa237cc There is no point in setting out-parameters for a ComplexPattern function when
it returns false, at least as far as I could tell by reading the code.

llvm-svn: 141172
2011-10-05 08:59:05 +00:00
Bill Wendling ad33c139ac Also update the EH with bitcode. I missed this earlier. Thanks to Duncan for pointing it out.
llvm-svn: 141169
2011-10-05 07:04:14 +00:00
Chandler Carruth f6567a131d Fix a broken assert found by -Wparentheses.
llvm-svn: 141168
2011-10-05 07:02:23 +00:00
Andrew Trick 887a111e31 Missing test case for r141164.
llvm-svn: 141166
2011-10-05 06:23:32 +00:00
Andrew Trick e9162f1ff8 Fix disabled SCEV analysis caused r141161 and add unit test.
I noticed during self-review that my previous checkin disabled some
analysis. Even with the reenabled analysis the test case runs in about
5ms. Without the fix, it will take several minutes at least.

llvm-svn: 141164
2011-10-05 05:58:49 +00:00
Eric Christopher c4b9b526ba Add more initializers to quiet a clang warning.
llvm-svn: 141163
2011-10-05 05:00:26 +00:00
Craig Topper b58a9665bd Change C++ style comments to C style comments in X86 disassembler. Patch from Joe Abbey.
llvm-svn: 141162
2011-10-05 03:29:32 +00:00
Andrew Trick 3a86ba767c Avoid exponential recursion in SCEV getConstantEvolvingPHI and EvaluateExpression.
Note to compiler writers: never recurse on multiple instruction
operands without memoization.
Fixes rdar://10187945. Was taking 45s, now taking 5ms.

llvm-svn: 141161
2011-10-05 03:25:31 +00:00
Akira Hatanaka 02e760add3 Insert space.
llvm-svn: 141158
2011-10-05 02:22:49 +00:00
Akira Hatanaka 8e532eb92f Do not examine variadic or implicit operands if instruction is a return (jr).
llvm-svn: 141157
2011-10-05 02:21:58 +00:00
Akira Hatanaka 0d7dfc0b1f Clean up function Filler::delayHasHazard.
llvm-svn: 141156
2011-10-05 02:18:58 +00:00
Akira Hatanaka 7b204688e7 Remove function Filler::insertCallUses.
Record the registers used and defined by a call in Filler::insertDefsUses.

llvm-svn: 141154
2011-10-05 02:04:17 +00:00
Akira Hatanaka d9c8aab894 Clean up Filler::findDelayInstr.
llvm-svn: 141152
2011-10-05 01:57:46 +00:00
Akira Hatanaka e7b0697412 Remove function Filler::isDelayFiller. Check if I is the same instruction that
filled the last delay slot visited.

llvm-svn: 141151
2011-10-05 01:30:09 +00:00
Akira Hatanaka 5d4e4ea3d5 Clean up Filler::runOnMachineBasicBlock. Change interface of
Filler::findDelayInstr.

llvm-svn: 141150
2011-10-05 01:23:39 +00:00
Akira Hatanaka 9e6034444a Define a statistic for the number of slots that were filled with useful
instructions (instructions that are not NOP).

llvm-svn: 141149
2011-10-05 01:19:13 +00:00
Akira Hatanaka 8b3666af1b Remove unnecessary check. isDelayFiller(MBB, I) will evaluate to true before
I->getDesc().hasDelaySlot() does.

llvm-svn: 141148
2011-10-05 01:15:31 +00:00
Akira Hatanaka 7d398636a2 Add comments and move assignment statement. If sawStore is true, sawLoad does
not have to be set.

llvm-svn: 141147
2011-10-05 01:09:37 +00:00
Akira Hatanaka b345b5c424 Correct description string of enable-mips-delay-filler.
llvm-svn: 141146
2011-10-05 01:06:57 +00:00
Bill Wendling 324be98a3c Look at the number of entries in the jump table and jump to a 'trap' block if
the value exceeds that number.

llvm-svn: 141143
2011-10-05 00:39:32 +00:00
Jakob Stoklund Olesen 3a541b046a Add TRI::getSubClassWithSubReg(RC, Idx) function.
This function is used to constrain a register class to a sub-class that
supports the given sub-register index.

For example, getSubClassWithSubReg(GR32, sub_8bit) -> GR32_ABCD.

The function will be used to compute register classes when emitting
INSERT_SUBREG and EXTRACT_SUBREG nodes and for register class inflation
of sub-register operations.

The version provided by TableGen is usually adequate, but targets can
override.

llvm-svn: 141142
2011-10-05 00:35:49 +00:00
Bill Wendling 202803e39c Checkpoint for SJLJ EH code.
This is a first pass at generating the jump table for the sjlj dispatch. It
currently generates something plausible, but hasn't been tested thoroughly.

llvm-svn: 141140
2011-10-05 00:02:33 +00:00
Jakob Stoklund Olesen d5d39bb098 Also add <imp-use,kill> flags for redefined super-registers.
For example:

  %vreg10:dsub_0<def,undef> = COPY %vreg1
  %vreg10:dsub_1<def> = COPY %vreg2

is rewritten as:

  %D2<def> = COPY %D0, %Q1<imp-def>
  %D3<def> = COPY %D1, %Q1<imp-use,kill>, %Q1<imp-def>

The first COPY doesn't care about the previous value of %Q1, so it
doesn't read that register.

The second COPY is a partial redefinition of %Q1, so it implicitly kills
and redefines that register.

This makes it possible to recognize instructions that can harmlessly
clobber the full super-register.  The write and don't read the
super-register.

llvm-svn: 141139
2011-10-05 00:01:48 +00:00
Jakob Stoklund Olesen 9d5bda9be1 Also add <def,undef> flags when coalescing sub-registers.
RegisterCoalescer can create sub-register defs when it is joining a
register with a sub-register.  Add <undef> flags to these new
sub-register defs where appropriate.

llvm-svn: 141138
2011-10-05 00:01:46 +00:00
Owen Anderson 0ca562ec4c Teach the MC to output code/data region marker labels in MachO and ELF modes. These are used by disassemblers to provide better disassembly, particularly on targets like ARM Thumb that like to intermingle data in the TEXT segment.
llvm-svn: 141135
2011-10-04 23:26:17 +00:00
Kevin Enderby 5dcda64338 Adding back support for printing operands symbolically to ARM's new disassembler
using llvm's public 'C' disassembler API now including annotations.

Hooked this up to Darwin's otool(1) so it can again print things like branch
targets for example this:
 blx _puts
instead of this:
 blx #-36
and includes support for annotations for branches to symbol stubs like:
 bl	0x40 @ symbol stub for: _puts
and annotations for pc relative loads like this:
 ldr	r3, #8 @ literal pool for: Hello, world!
Also again can print the expression encoded in the Mach-O relocation entries for
things like this:
 movt r0, :upper16:((_foo-_bar)+1234)

llvm-svn: 141129
2011-10-04 22:44:48 +00:00
Bill Wendling 3d11aa7e75 Create a mapping between the landing pad basic block and the call site index for later use.
llvm-svn: 141125
2011-10-04 22:00:35 +00:00
Jakob Stoklund Olesen 10f2de3261 Allow <undef> flags on def operands as well as uses.
The <undef> flag says that a MachineOperand doesn't read its register,
or doesn't depend on the previous value of its register.

A full register def never depends on the previous register value.  A
partial register def may depend on the previous value if it is intended
to update part of a register.

For example:

  %vreg10:dsub_0<def,undef> = COPY %vreg1
  %vreg10:dsub_1<def> = COPY %vreg2

The first copy instruction defines the full %vreg10 register with the
bits not covered by dsub_0 defined as <undef>.  It is not considered a
read of %vreg10.

The second copy modifies part of %vreg10 while preserving the rest.  It
has an implicit read of %vreg10.

This patch adds a MachineOperand::readsReg() method to determine if an
operand reads its register.

Previously, this was modelled by adding a full-register <imp-def>
operand to the instruction.  This approach makes it possible to
determine directly from a MachineOperand if it reads its register.  No
scanning of MI operands is required.

llvm-svn: 141124
2011-10-04 21:49:33 +00:00
Jim Grosbach 28a0bc5562 Tidy up formatting.
llvm-svn: 141123
2011-10-04 21:43:51 +00:00
Bill Wendling 0f7efaf956 Doxygen-ize comments. No functionality change.
llvm-svn: 141122
2011-10-04 21:25:01 +00:00
Daniel Dunbar 4dfad843e3 Remove unused web page.
llvm-svn: 141118
2011-10-04 21:17:19 +00:00
Jim Grosbach 4879f70ab9 Un-XFAIL file. Comment out individual failing instructions.
llvm-svn: 141117
2011-10-04 21:16:42 +00:00
Francois Pichet aec9739e16 Replace snprintf with raw_string_ostream.
llvm-svn: 141116
2011-10-04 21:08:56 +00:00
Jim Grosbach f3e1fc3f86 Tidy up formatting.
llvm-svn: 141115
2011-10-04 20:52:57 +00:00
Jim Grosbach 8a829e8ecb Un-XFAIL file. Fix incorrect CHECK lines. General format cleanup.
llvm-svn: 141114
2011-10-04 20:50:05 +00:00
Jim Grosbach 8bc8bfdcad Un-XFAIL file. Fix incorrect CHECK line. General format cleanup.
llvm-svn: 141113
2011-10-04 20:46:49 +00:00
Jim Grosbach 610aa62edc Tidy up formatting.
llvm-svn: 141111
2011-10-04 20:42:35 +00:00
Jim Grosbach 388c0f61e8 Un-XFAIL file. Fix incorrect CHECK line.
llvm-svn: 141110
2011-10-04 20:42:09 +00:00
Jim Grosbach 2644375abe Un-XFAIL the file. Disable only the individual tests that aren't working yet.
llvm-svn: 141108
2011-10-04 20:34:11 +00:00
Bill Wendling c56fe5e9bb Add method to determine if a begin label has a call site number associated with it.
llvm-svn: 141107
2011-10-04 20:31:56 +00:00
Jakob Stoklund Olesen b1147c4660 Properly use const_iterator.
This should unbreak the Windows build.

llvm-svn: 141105
2011-10-04 20:18:39 +00:00
Devang Patel 0a2fd00de5 Update cmake list.
llvm-svn: 141104
2011-10-04 19:38:16 +00:00
David Chisnall b24263ec49 Tell people using the tutorial how to make it actually work.
llvm-svn: 141103
2011-10-04 19:36:30 +00:00
David Greene 979697b630 Test Operand Arguments
Add a test to do list manipulation and pass the result as arguments.
This tests the new list element operator resolve code and provides an
example of using list manipulation to do instruction pattern
substitution.

llvm-svn: 141102
2011-10-04 18:55:40 +00:00
David Greene a8b8ab6b20 Allow Operator Arguments
When resolving an operator list element reference, resolve all
operator operands and try to fold the operator first.  This allows the
operator to collapse to a list which may then be indexed.

Before, it was not possible to do this:
class D<int a, int b> { ... }
class C<list<int> A> : D<A[0], A[1]>;
class B<list<int> b> : C<!foreach(...,b)>;

Now it is.

llvm-svn: 141101
2011-10-04 18:55:36 +00:00
Jim Grosbach 83e84faa8f Un-XFAIL the file. Disable only the individual tests that aren't working yet.
llvm-svn: 141099
2011-10-04 18:43:15 +00:00
Ted Kremenek 539f7b0493 Unbreak CMake build.
llvm-svn: 141097
2011-10-04 18:22:24 +00:00
Jim Grosbach 2d9eb707af Tidy up. Formatting.
llvm-svn: 141096
2011-10-04 17:49:45 +00:00
Devang Patel 8dfb65516b Put GCOVFile and other related interface in a common header so that llvm-cov tool can share it with GCOV writer.
llvm-svn: 141095
2011-10-04 17:24:48 +00:00
Francois Pichet b26b49ca63 Unbreak MSVC build.
llvm-svn: 141093
2011-10-04 16:28:07 +00:00
David Dean 41090ed753 Fix PR9833/PR11054 (patch provided by Patrik Hägglund)
llvm-svn: 141092
2011-10-04 16:26:41 +00:00
Jakob Stoklund Olesen 03efe84d0a Teach TableGen to infer missing register classes.
The set of register classes should be closed under sub-register
operations and intersections. That will allow the register allocator to
model combinations of constraints accurately.

This patch implements the easiest form of register class inference:  For
every register class, and for every sub-register SubIdx, the subset of
registers in RC that have a SubIdx sub-register should also be a register
class.

This does create some new register classes for the targets in the tree:

ARM gets a new QQQQPR_with_ssub_0.  This class was omitted from the .td
file on purpose because it only has two registers.  InstrEmitter and
RegisterCoalescer have safeguards against selecting too small register
classes, so it is harmless.

PowerPC gets a G8RC_with_sub_32 class because LR is not a sub_32
sub-register of LR8.  I think that might be an omission?

X86 puts RIP in the GR64 class, and since that register doesn't have
8-bit sub-registers, we get:

  GR64_with_sub_8bit
  GR64_TC_with_sub_8bit
  GR64_NOREX_with_sub_8bit
  GR64_TC_with_sub_8bit_hi

The various CodeGen classes have already been fixed so adding new
register classes should not affect compile time.

llvm-svn: 141084
2011-10-04 15:28:49 +00:00
Jakob Stoklund Olesen e25602696e Teach PPCInstrInfo to handle sub-classes.
This has already been done for most other targets.

llvm-svn: 141083
2011-10-04 15:28:47 +00:00
Jakob Stoklund Olesen 331534e5bb TableGen: Store all allocation orders together.
There is no need to keep the primary order separate.

llvm-svn: 141082
2011-10-04 15:28:44 +00:00
Jakob Stoklund Olesen bd92dc608d TableGen: Privatize CodeGenRegisterClass::TheDef and Name.
When TableGen starts creating its own register classes, the synthesized
classes won't have a Record reference.  All register classes must have a
name, though.

llvm-svn: 141081
2011-10-04 15:28:08 +00:00
Jakob Stoklund Olesen 54dd16240c TableGen: Don't add synthetic Records to the RecordKeeper.
The RecordKeeper could be shared by multiple target instances, causing
duplicate record errors.

llvm-svn: 141080
2011-10-04 15:27:53 +00:00
Che-Liang Chiou 67a16e2564 tblgen: add preprocessor as a separate mode
This patch adds a preprocessor that can expand nested for-loops for
saving some copy-n-paste in *.td files.

The preprocessor is not yet integrated with TGParser, and so it has
no direct effect on *.td inputs.  However, you may preprocess an td
input (and only preprocess it).

To test the proprecessor, type:
  tblgen -E -o $@ $<

llvm-svn: 141079
2011-10-04 15:14:51 +00:00
Nadav Rotem 3b309efe38 Set operation actions to legal types only.
llvm-svn: 141075
2011-10-04 12:05:35 +00:00
Nadav Rotem 04001625e4 Operations should be custom lowered only if their type is legal.
Test: CellSPU/v2i32.ll when running with -promote-elements
llvm-svn: 141074
2011-10-04 10:03:32 +00:00
Nick Lewycky 287682ead1 The product of two chrec's can always be represented as a chrec.
llvm-svn: 141066
2011-10-04 06:51:26 +00:00
Craig Topper f18c896337 Add support in the disassembler for ignoring the L-bit on certain VEX instructions. Mark instructions that have this behavior. Fixes PR10676.
llvm-svn: 141065
2011-10-04 06:30:42 +00:00
Andrew Trick 8de329a9fc LSR should avoid redundant edge splitting.
This handles the case in which LSR rewrites an IV user that is a phi and
splits critical edges originating from a switch.
Fixes <rdar://problem/6453893> LSR is not splitting edges "nicely"

llvm-svn: 141059
2011-10-04 03:50:44 +00:00
Andrew Trick 411842f98f whitespace
llvm-svn: 141058
2011-10-04 03:34:49 +00:00
Rafael Espindola 74e5a2a712 Remove last references to hotpatch.
llvm-svn: 141057
2011-10-04 03:08:43 +00:00
Peter Collingbourne b3334f9f43 Exclude libLLVMTableGen.a from the shared library
Unbreaks tools for --enable-shared build.

llvm-svn: 141052
2011-10-04 00:30:34 +00:00
Bill Wendling ac3fb4c078 Generic cleanup.
llvm-svn: 141050
2011-10-04 00:16:40 +00:00
Andrew Trick bf51f97c28 Unit test for r140919, loop unroll heuristics.
llvm-svn: 141049
2011-10-04 00:07:02 +00:00
Jim Grosbach b85400aa58 Tidy up. These tests are covered in the .s file tests now.
llvm-svn: 141047
2011-10-03 23:40:13 +00:00
Jim Grosbach e7fbce7acb ARM assembly parsing and encoding for VMOV immediate.
llvm-svn: 141046
2011-10-03 23:38:36 +00:00
Jim Grosbach 69e6f90eb2 Tidy up. 80 columns.
llvm-svn: 141043
2011-10-03 23:03:26 +00:00
Bill Wendling 1eab54f8ba Use the PC label ID rather than '1'. Add support for thumb-2, because I heard that some people use it.
llvm-svn: 141042
2011-10-03 22:44:15 +00:00
Bill Wendling 97a8695fff Don't carry over the dispatchsetup hack from the old system.
llvm-svn: 141040
2011-10-03 22:42:40 +00:00
Jim Grosbach 46b6646059 ARM parsing/encoding for VCMP/VCMPE.
llvm-svn: 141038
2011-10-03 22:30:24 +00:00
Nick Lewycky f66daac2f5 Fix typo in comments.
llvm-svn: 141032
2011-10-03 21:30:08 +00:00
Bill Wendling 374ee194f2 Check-pointing the new SjLj EH lowering.
This code will replace the version in ARMAsmPrinter.cpp. It creates a new
machine basic block, which is the dispatch for the return from a longjmp
call. It then shoves the address of that machine basic block into the correct
place in the function context so that the EH runtime will jump to it directly
instead of having to go through a compare-and-jump-to-the-dispatch bit. This
should be more efficient in the common case.

llvm-svn: 141031
2011-10-03 21:25:38 +00:00
Akira Hatanaka 6c71ef32be Move CHECK after entry label.
llvm-svn: 141030
2011-10-03 21:24:30 +00:00
Akira Hatanaka c3a6357ee3 Add support for 64-bit logical NOR.
llvm-svn: 141029
2011-10-03 21:23:18 +00:00
Akira Hatanaka 48a72ca0cb Add support for 64-bit count leading ones and zeros instructions.
llvm-svn: 141028
2011-10-03 21:16:50 +00:00
Bill Wendling 6f3e73d6ad Move the grabbing of the jump buffer into the caller function, eliminating the need for returning a std::pair.
llvm-svn: 141026
2011-10-03 21:15:28 +00:00
Jim Grosbach 4ab23b5273 ARM assembly parsing and encoding for VMRS/FMSTAT.
llvm-svn: 141025
2011-10-03 21:12:43 +00:00
Akira Hatanaka b1538f91dc Add support for 64-bit divide instructions.
llvm-svn: 141024
2011-10-03 21:06:13 +00:00
Devang Patel dbebc6f3f9 Add C api for Instruction->eraseFromParent().
llvm-svn: 141023
2011-10-03 20:59:18 +00:00
Jim Grosbach c3fc62b492 Update test for 141010.
llvm-svn: 141022
2011-10-03 20:58:08 +00:00