oota-llvm.git
13 years agoImplement cfi_def_cfa_register.
Rafael Espindola [Wed, 29 Dec 2010 00:26:06 +0000 (00:26 +0000)]
Implement cfi_def_cfa_register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122612 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitial .cfi_offset implementation.
Rafael Espindola [Wed, 29 Dec 2010 00:09:59 +0000 (00:09 +0000)]
Initial .cfi_offset implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122611 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplify some code in MachineVerifier that was doing the correct thing, but not
Cameron Zwarich [Tue, 28 Dec 2010 23:45:38 +0000 (23:45 +0000)]
Simplify some code in MachineVerifier that was doing the correct thing, but not
in the most obvious way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122610 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't produce a "DW_CFA_advance_loc 0".
Rafael Espindola [Tue, 28 Dec 2010 23:38:03 +0000 (23:38 +0000)]
Don't produce a "DW_CFA_advance_loc 0".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122609 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert the optimization in r122596. It is correct for all current targets, but
Cameron Zwarich [Tue, 28 Dec 2010 23:02:56 +0000 (23:02 +0000)]
Revert the optimization in r122596. It is correct for all current targets, but
it relies on assumptions that may not be true in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122608 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMultiple SPARC backend fixes: added Y register; updated select_cc, subx, subxcc defs...
Venkatraman Govindaraju [Tue, 28 Dec 2010 20:39:17 +0000 (20:39 +0000)]
Multiple SPARC backend fixes: added Y register; updated select_cc, subx, subxcc defs/uses;
and fixed CustomInserter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122607 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIntegers are primitive types. Update the documentation to state this
Tobias Grosser [Tue, 28 Dec 2010 20:29:31 +0000 (20:29 +0000)]
Integers are primitive types. Update the documentation to state this

This was done for label, void, floating point, x86mmx, metadata,
just not integer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122606 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agosimplify this, isBytewiseValue handles the extra check. We still
Chris Lattner [Tue, 28 Dec 2010 18:53:48 +0000 (18:53 +0000)]
simplify this, isBytewiseValue handles the extra check.  We still
check for "multiple of a byte" in size to make it clear that the
>> 3 below is safe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122604 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoadd a note from llvmdev
Chris Lattner [Tue, 28 Dec 2010 18:45:02 +0000 (18:45 +0000)]
add a note from llvmdev

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122603 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement .cfi_remember_state and .cfi_restore_state.
Rafael Espindola [Tue, 28 Dec 2010 18:36:23 +0000 (18:36 +0000)]
Implement .cfi_remember_state and .cfi_restore_state.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122602 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClarify that InstructionSimplify only returns values that dominate the
Duncan Sands [Tue, 28 Dec 2010 18:01:19 +0000 (18:01 +0000)]
Clarify that InstructionSimplify only returns values that dominate the
original instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122601 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSmall optimization to speed up replacementPreservesLCSSAForm.
Duncan Sands [Tue, 28 Dec 2010 18:00:24 +0000 (18:00 +0000)]
Small optimization to speed up replacementPreservesLCSSAForm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122600 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCast away "comparison between signed and unsigned integer" warnings.
Benjamin Kramer [Tue, 28 Dec 2010 13:52:52 +0000 (13:52 +0000)]
Cast away "comparison between signed and unsigned integer" warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122598 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a signed/unsigned comparison warning.
Benjamin Kramer [Tue, 28 Dec 2010 13:05:13 +0000 (13:05 +0000)]
Fix a signed/unsigned comparison warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122597 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAvoid iterating every operand of an instruction in StrongPHIElimination, since
Cameron Zwarich [Tue, 28 Dec 2010 10:49:33 +0000 (10:49 +0000)]
Avoid iterating every operand of an instruction in StrongPHIElimination, since
we are only interested in the defs when discovering interferences.

This is a 28% speedup running StrongPHIElimination on 403.gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122596 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPacify the compiler. BestWeight cannot in fact be used uninitialized
Duncan Sands [Tue, 28 Dec 2010 10:07:15 +0000 (10:07 +0000)]
Pacify the compiler.  BestWeight cannot in fact be used uninitialized
in this function, but the compiler was warning that it might be when
doing a release build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122595 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix warning about size potentially being used uninitialized
Duncan Sands [Tue, 28 Dec 2010 10:02:42 +0000 (10:02 +0000)]
Fix warning about size potentially being used uninitialized
when doing a release build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122594 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSilence gcc warning about an unused variable when doing a release build.
Duncan Sands [Tue, 28 Dec 2010 09:41:15 +0000 (09:41 +0000)]
Silence gcc warning about an unused variable when doing a release build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122593 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRelax address updates in the eh_frame section.
Rafael Espindola [Tue, 28 Dec 2010 05:39:27 +0000 (05:39 +0000)]
Relax address updates in the eh_frame section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122591 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoStart adding basic support for emitting the call frame instructions.
Rafael Espindola [Tue, 28 Dec 2010 04:15:37 +0000 (04:15 +0000)]
Start adding basic support for emitting the call frame instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122590 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSupport/Path: Deprecate Path::hasMagicNumber and replace all uses with fs::has_magic.
Michael J. Spencer [Tue, 28 Dec 2010 01:49:21 +0000 (01:49 +0000)]
Support/Path: Deprecate Path::hasMagicNumber and replace all uses with fs::has_magic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122589 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix typo.
Michael J. Spencer [Tue, 28 Dec 2010 01:49:10 +0000 (01:49 +0000)]
Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122588 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSupport/PathV2: Implement has_magic.
Michael J. Spencer [Tue, 28 Dec 2010 01:49:01 +0000 (01:49 +0000)]
Support/PathV2: Implement has_magic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122587 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoChange an assertion to assert what the code actually relies upon.
Cameron Zwarich [Mon, 27 Dec 2010 22:08:42 +0000 (22:08 +0000)]
Change an assertion to assert what the code actually relies upon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122586 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix some issues Frits noticed, add AliasAnalysis as a dependency
Chris Lattner [Mon, 27 Dec 2010 18:39:08 +0000 (18:39 +0000)]
fix some issues Frits noticed, add AliasAnalysis as a dependency

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122585 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for .cfi_lsda.
Rafael Espindola [Mon, 27 Dec 2010 15:56:22 +0000 (15:56 +0000)]
Add support for .cfi_lsda.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122584 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMC/Mach-O/Thumb: Select appropriate relocation types for Thumb.
Daniel Dunbar [Mon, 27 Dec 2010 14:49:49 +0000 (14:49 +0000)]
MC/Mach-O/Thumb: Select appropriate relocation types for Thumb.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122583 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoLand a first cut at StrongPHIElimination. There are only 5 new test failures
Cameron Zwarich [Mon, 27 Dec 2010 10:08:19 +0000 (10:08 +0000)]
Land a first cut at StrongPHIElimination. There are only 5 new test failures
when running without the verifier, and I have not yet checked them to see if
the new results are still correct. There are more verifier failures, but they
all seem to be additional occurrences of verifier failures that occur with the
existing PHIElimination pass. There are a few obvious issues with the code:

1) It doesn't properly update the register equivalence classes during copy
insertion, and instead recomputes them before merging live intervals and
renaming registers. I wanted to keep this first patch simple for debugging
purposes, but it shouldn't be very hard to do this.

2) It doesn't mix the renaming and live interval merging with the copy insertion
process, which leads to a lot of virtual register churn. Virtual registers and
live intervals are created, only to later be merged into others. The code should
be smarter and only create a new virtual register if there is no existing
register in the same congruence class.

3) In one place the code uses a DenseMap per basic block, which is unnecessary
heap allocation. There should be an inline storage version of DenseMap.

I did a quick compile-time test of running llc on 403.gcc with and without
StrongPHIElimination. It is slightly slower with StrongPHIElimination, because
the small decrease in the coalescer runtime can't beat the increase in phi
elimination runtime. Perhaps fixing the above performance issues will narrow
the gap.

I also haven't yet run any tests of the quality of the generated code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122582 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd knowledge of phi-def and phi-kill valnos to MachineVerifier's predecessor
Cameron Zwarich [Mon, 27 Dec 2010 05:17:23 +0000 (05:17 +0000)]
Add knowledge of phi-def and phi-kill valnos to MachineVerifier's predecessor
valno verification. The "Different value live out of predecessor" check is
incorrect in the case of phi-def valnos, so just skip that check for phi-def
valnos and instead check that all of the valnos for predecessors have phi-kill.
Fixes PR8863.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122581 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSupport/PathV1: Deprecate GetRootDirectory.
Michael J. Spencer [Mon, 27 Dec 2010 03:21:41 +0000 (03:21 +0000)]
Support/PathV1: Deprecate GetRootDirectory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122580 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHandle reloc_riprel_4byte_movq_load. Should make the bots happy.
Rafael Espindola [Mon, 27 Dec 2010 02:03:24 +0000 (02:03 +0000)]
Handle reloc_riprel_4byte_movq_load. Should make the bots happy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122579 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for the same encodings of the personality function that gnu as
Rafael Espindola [Mon, 27 Dec 2010 00:36:05 +0000 (00:36 +0000)]
Add support for the same encodings of the personality function that gnu as
supports.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122577 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBuildLibCalls: Nuke EmitMemCpy, EmitMemMove and EmitMemSet. They are dead and superse...
Benjamin Kramer [Mon, 27 Dec 2010 00:25:32 +0000 (00:25 +0000)]
BuildLibCalls: Nuke EmitMemCpy, EmitMemMove and EmitMemSet. They are dead and superseded by IRBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122576 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplifyLibCalls: Use IRBuilder to simplify code.
Benjamin Kramer [Mon, 27 Dec 2010 00:16:46 +0000 (00:16 +0000)]
SimplifyLibCalls: Use IRBuilder to simplify code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122575 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agohave loop-idiom nuke instructions that feed stores that get removed.
Chris Lattner [Mon, 27 Dec 2010 00:03:23 +0000 (00:03 +0000)]
have loop-idiom nuke instructions that feed stores that get removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122574 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoimplement enough of the memset inference algorithm to recognize and insert
Chris Lattner [Sun, 26 Dec 2010 23:42:51 +0000 (23:42 +0000)]
implement enough of the memset inference algorithm to recognize and insert
memsets.  This is still missing one important validity check, but this is enough
to compile stuff like this:

void test0(std::vector<char> &X) {
  for (std::vector<char>::iterator I = X.begin(), E = X.end(); I != E; ++I)
    *I = 0;
}

void test1(std::vector<int> &X) {
  for (long i = 0, e = X.size(); i != e; ++i)
    X[i] = 0x01010101;
}

With:
 $ clang t.cpp -S -o - -O2 -emit-llvm | opt -loop-idiom | opt -O3 | llc

to:

__Z5test0RSt6vectorIcSaIcEE:            ## @_Z5test0RSt6vectorIcSaIcEE
## BB#0:                                ## %entry
subq $8, %rsp
movq (%rdi), %rax
movq 8(%rdi), %rsi
cmpq %rsi, %rax
je LBB0_2
## BB#1:                                ## %bb.nph
subq %rax, %rsi
movq %rax, %rdi
callq ___bzero
LBB0_2:                                 ## %for.end
addq $8, %rsp
ret
...
__Z5test1RSt6vectorIiSaIiEE:            ## @_Z5test1RSt6vectorIiSaIiEE
## BB#0:                                ## %entry
subq $8, %rsp
movq (%rdi), %rax
movq 8(%rdi), %rdx
subq %rax, %rdx
cmpq $4, %rdx
jb LBB1_2
## BB#1:                                ## %for.body.preheader
andq $-4, %rdx
movl $1, %esi
movq %rax, %rdi
callq _memset
LBB1_2:                                 ## %for.end
addq $8, %rsp
ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122573 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agostart using irbuilder to make mem intrinsics in a few passes.
Chris Lattner [Sun, 26 Dec 2010 22:57:41 +0000 (22:57 +0000)]
start using irbuilder to make mem intrinsics in a few passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122572 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoadd methods to IRBuilder to create memcpy/memset/memmove.
Chris Lattner [Sun, 26 Dec 2010 22:49:25 +0000 (22:49 +0000)]
add methods to IRBuilder to create memcpy/memset/memmove.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122571 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix .cfi_personality on 32 bit systems.
Rafael Espindola [Sun, 26 Dec 2010 22:47:37 +0000 (22:47 +0000)]
Fix .cfi_personality on 32 bit systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122570 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for @note. Patch by Jörg Sonnenberger.
Rafael Espindola [Sun, 26 Dec 2010 21:30:59 +0000 (21:30 +0000)]
Add support for @note. Patch by Jörg Sonnenberger.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122568 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agosketch more of this out.
Chris Lattner [Sun, 26 Dec 2010 20:45:45 +0000 (20:45 +0000)]
sketch more of this out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122567 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd basic support for .cfi_personality.
Rafael Espindola [Sun, 26 Dec 2010 20:20:31 +0000 (20:20 +0000)]
Add basic support for .cfi_personality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122566 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agomove isBytewiseValue out to ValueTracking.h/cpp
Chris Lattner [Sun, 26 Dec 2010 20:15:01 +0000 (20:15 +0000)]
move isBytewiseValue out to ValueTracking.h/cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122565 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoactually add the file...
Chris Lattner [Sun, 26 Dec 2010 19:39:38 +0000 (19:39 +0000)]
actually add the file...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122563 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoStart of a pass for recognizing memset and memcpy idioms.
Chris Lattner [Sun, 26 Dec 2010 19:32:44 +0000 (19:32 +0000)]
Start of a pass for recognizing memset and memcpy idioms.
No functionality yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122562 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplify code.
Benjamin Kramer [Sun, 26 Dec 2010 15:23:45 +0000 (15:23 +0000)]
Simplify code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122561 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix some sort of weird pasto
Chris Lattner [Sun, 26 Dec 2010 12:05:11 +0000 (12:05 +0000)]
fix some sort of weird pasto

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122560 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoadd a note
Chris Lattner [Sun, 26 Dec 2010 03:53:31 +0000 (03:53 +0000)]
add a note

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122559 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGeneralize a previous change, fixing PR8855 - an valid large immediate
Chris Lattner [Sat, 25 Dec 2010 21:36:35 +0000 (21:36 +0000)]
Generalize a previous change, fixing PR8855 - an valid large immediate
rejected by the mc assembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122557 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agodon't lose TD info
Chris Lattner [Sat, 25 Dec 2010 20:52:04 +0000 (20:52 +0000)]
don't lose TD info

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122556 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoswitch the inliner alignment enforcement stuff to use the
Chris Lattner [Sat, 25 Dec 2010 20:42:38 +0000 (20:42 +0000)]
switch the inliner alignment enforcement stuff to use the
getOrEnforceKnownAlignment function, which simplifies the code
and makes it stronger.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122555 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove getOrEnforceKnownAlignment out of instcombine into Transforms/Utils.
Chris Lattner [Sat, 25 Dec 2010 20:37:57 +0000 (20:37 +0000)]
Move getOrEnforceKnownAlignment out of instcombine into Transforms/Utils.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122554 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSupport/PathV1: Deprecate makeAbsolute and remove Unix impl because it annoys people.
Michael J. Spencer [Sat, 25 Dec 2010 20:10:11 +0000 (20:10 +0000)]
Support/PathV1: Deprecate makeAbsolute and remove Unix impl because it annoys people.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122553 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHeader warning patrol.
Eric Christopher [Sat, 25 Dec 2010 02:38:01 +0000 (02:38 +0000)]
Header warning patrol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122551 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a thinko pointed out by Frits van Bommel: looking through global variables in...
Benjamin Kramer [Fri, 24 Dec 2010 22:23:59 +0000 (22:23 +0000)]
Fix a thinko pointed out by Frits van Bommel: looking through global variables in isBytewiseValue is not safe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122550 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMerge IsFixupFullyResolved and IsSymbolRefDifferenceFullyResolved. We now
Rafael Espindola [Fri, 24 Dec 2010 21:22:02 +0000 (21:22 +0000)]
Merge IsFixupFullyResolved and IsSymbolRefDifferenceFullyResolved. We now
have a single point where targets test if a relocation is needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122549 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMemCpyOpt: Turn memcpys from a constant into a memset if possible.
Benjamin Kramer [Fri, 24 Dec 2010 21:17:12 +0000 (21:17 +0000)]
MemCpyOpt: Turn memcpys from a constant into a memset if possible.

This allows us to compile "int cst[] = {-1, -1, -1};" into
  movl  $-1, 16(%rsp)
  movq  $-1, 8(%rsp)
instead of
  movl  _cst+8(%rip), %eax
  movl  %eax, 16(%rsp)
  movq  _cst(%rip), %rax
  movq  %rax, 8(%rsp)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122548 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMC/Mach-O/ARM: Start handling some Thumb branches.
Daniel Dunbar [Fri, 24 Dec 2010 16:41:46 +0000 (16:41 +0000)]
MC/Mach-O/ARM: Start handling some Thumb branches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122547 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMinor cleanup related to my latest scheduler changes.
Andrew Trick [Fri, 24 Dec 2010 07:10:19 +0000 (07:10 +0000)]
Minor cleanup related to my latest scheduler changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122545 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a few cases where the scheduler is not checking for phys reg copies. The scheduli...
Andrew Trick [Fri, 24 Dec 2010 06:46:50 +0000 (06:46 +0000)]
Fix a few cases where the scheduler is not checking for phys reg copies. The scheduling node may have a NULL DAG node, yuck.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122544 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTrailing whitespace.
Jim Grosbach [Fri, 24 Dec 2010 05:06:32 +0000 (05:06 +0000)]
Trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122542 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoVarious bits of framework needed for precise machine-level selection
Andrew Trick [Fri, 24 Dec 2010 05:03:26 +0000 (05:03 +0000)]
Various bits of framework needed for precise machine-level selection
DAG scheduling during isel. Most new functionality is currently
guarded by -enable-sched-cycles and -enable-sched-hazard.

Added InstrItineraryData::IssueWidth field, currently derived from
ARM itineraries, but could be initialized differently on other targets.

Added ScheduleHazardRecognizer::MaxLookAhead to indicate whether it is
active, and if so how many cycles of state it holds.

Added SchedulingPriorityQueue::HasReadyFilter to allowing gating entry
into the scheduler's available queue.

ScoreboardHazardRecognizer now accesses the ScheduleDAG in order to
get information about it's SUnits, provides RecedeCycle for bottom-up
scheduling, correctly computes scoreboard depth, tracks IssueCount, and
considers potential stall cycles when checking for hazards.

ScheduleDAGRRList now models machine cycles and hazards (under
flags). It tracks MinAvailableCycle, drives the hazard recognizer and
priority queue's ready filter, manages a new PendingQueue, properly
accounts for stall cycles, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122541 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agowhitespace
Andrew Trick [Fri, 24 Dec 2010 04:28:06 +0000 (04:28 +0000)]
whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122539 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplify a check for implicit defs and remove a FIXME.
Cameron Zwarich [Fri, 24 Dec 2010 03:09:36 +0000 (03:09 +0000)]
Simplify a check for implicit defs and remove a FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122537 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIn llvm-mc parse a Hash token as a full line comment. Allows handling of
Kevin Enderby [Fri, 24 Dec 2010 00:12:02 +0000 (00:12 +0000)]
In llvm-mc parse a Hash token as a full line comment.  Allows handling of
preprocessed .s files and matches darwin gas.  rdar://8798690
Also fix a comment on the next line of AsmParser.cpp after this new code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122531 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse a StringSwitch<> instead of a manually constructed string matcher.
Jim Grosbach [Fri, 24 Dec 2010 00:03:39 +0000 (00:03 +0000)]
Use a StringSwitch<> instead of a manually constructed string matcher.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122530 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen determining if we can fold (x >> C1) << C2, the bits that we need to verify...
Owen Anderson [Thu, 23 Dec 2010 23:56:24 +0000 (23:56 +0000)]
When determining if we can fold (x >> C1) << C2, the bits that we need to verify are zero
are not the low bits of x, but the bits that WILL be the low bits after the operation completes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122529 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCode clean up. No functionality change.
Evan Cheng [Thu, 23 Dec 2010 23:54:17 +0000 (23:54 +0000)]
Code clean up. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122528 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove dead patterns.
Jim Grosbach [Thu, 23 Dec 2010 23:20:13 +0000 (23:20 +0000)]
Remove dead patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122524 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRecognize a few more documented register name aliases for ARM in the asm lexer.
Jim Grosbach [Thu, 23 Dec 2010 23:19:54 +0000 (23:19 +0000)]
Recognize a few more documented register name aliases for ARM in the asm lexer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122523 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRadar 8803471: Fix expansion of ARM BCCi64 pseudo instructions.
Bob Wilson [Thu, 23 Dec 2010 22:45:49 +0000 (22:45 +0000)]
Radar 8803471: Fix expansion of ARM BCCi64 pseudo instructions.
If the basic block containing the BCCi64 (or BCCZi64) instruction ends with
an unconditional branch, that branch needs to be deleted before appending
the expansion of the BCCi64 to the end of the block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122521 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDo not re-test for the existence of pthread.h.
Oscar Fuentes [Thu, 23 Dec 2010 21:27:22 +0000 (21:27 +0000)]
Do not re-test for the existence of pthread.h.

It was causing problems on the MinGW build. See PR8849.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122518 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoXFAIL vg_leak the new test as the rest.
Torok Edwin [Thu, 23 Dec 2010 21:22:09 +0000 (21:22 +0000)]
XFAIL vg_leak the new test as the rest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122517 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIt is possible for SimplifyCFG to cause PHI nodes to become redundant too late in...
Owen Anderson [Thu, 23 Dec 2010 20:57:35 +0000 (20:57 +0000)]
It is possible for SimplifyCFG to cause PHI nodes to become redundant too late in the optimization
pipeline to be caught by instcombine, and it's not feasible to catch them in SimplifyCFG because the
use-lists are in an inconsistent state at the point where it could know that it need to simplify them.
Instead, have CodeGenPrepare look for trivially redundant PHIs as part of its general cleanup effort.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122516 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFlag -> Glue, the ongoing saga
Chris Lattner [Thu, 23 Dec 2010 18:28:41 +0000 (18:28 +0000)]
Flag -> Glue, the ongoing saga

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122513 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoflags -> glue for selectiondag
Chris Lattner [Thu, 23 Dec 2010 17:24:32 +0000 (17:24 +0000)]
flags -> glue for selectiondag

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122509 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agosdisel flag -> glue.
Chris Lattner [Thu, 23 Dec 2010 17:13:18 +0000 (17:13 +0000)]
sdisel flag -> glue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122507 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agocontinue renaming flag -> glue.
Chris Lattner [Thu, 23 Dec 2010 17:03:20 +0000 (17:03 +0000)]
continue renaming flag -> glue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122506 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix OCaml bindings crash, PR8847.
Torok Edwin [Thu, 23 Dec 2010 15:49:26 +0000 (15:49 +0000)]
Fix OCaml bindings crash, PR8847.

See http://caml.inria.fr/mantis/view.php?id=4166
If we call only external functions from a module, then its 'let _' bindings
don't get executed, which means that the exceptions don't get registered for use
in the C code.
This in turn causes llvm_raise to call raise_with_arg() with a NULL pointer and
cause a segmentation fault.

The workaround is to declare all 'external' functions as 'val' in these .mli
files.

Also added a separate testcase (the testcase must call only external functions
for the bug to occur).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122497 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove/fix invalid README entries. The well thought out strcpy function doesn't retur...
Benjamin Kramer [Thu, 23 Dec 2010 15:32:07 +0000 (15:32 +0000)]
Remove/fix invalid README entries. The well thought out strcpy function doesn't return a pointer to the end of the string.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122496 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove some obsolete README items, add a new one off the top of my head.
Benjamin Kramer [Thu, 23 Dec 2010 15:07:02 +0000 (15:07 +0000)]
Remove some obsolete README items, add a new one off the top of my head.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122495 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReorganize ListScheduleBottomUp in preparation for modeling machine cycles and instru...
Andrew Trick [Thu, 23 Dec 2010 05:42:20 +0000 (05:42 +0000)]
Reorganize ListScheduleBottomUp in preparation for modeling machine cycles and instruction issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122491 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConverted LiveRegCycles to LiveRegGens. It's easier to work with and allows multiple...
Andrew Trick [Thu, 23 Dec 2010 04:16:14 +0000 (04:16 +0000)]
Converted LiveRegCycles to LiveRegGens. It's easier to work with and allows multiple nodes per cycle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122474 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIn CheckForLiveRegDef use TRI->getOverlaps.
Andrew Trick [Thu, 23 Dec 2010 03:43:21 +0000 (03:43 +0000)]
In CheckForLiveRegDef use TRI->getOverlaps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122473 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFixes PR8823: add-with-overflow-128.ll
Andrew Trick [Thu, 23 Dec 2010 03:15:51 +0000 (03:15 +0000)]
Fixes PR8823: add-with-overflow-128.ll
In the bottom-up selection DAG scheduling, handle two-address
instructions that read/write unspillable registers. Treat
the entire chain of two-address nodes as a single live range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122472 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPreserve the address space when generating bitcasts for MemTransferInst in ConvertToS...
Mon P Wang [Thu, 23 Dec 2010 01:41:32 +0000 (01:41 +0000)]
Preserve the address space when generating bitcasts for MemTransferInst in ConvertToScalarInfo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122462 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoChange all self assignments X=X to (void)X, so that we can turn on a
Jeffrey Yasskin [Thu, 23 Dec 2010 00:58:24 +0000 (00:58 +0000)]
Change all self assignments X=X to (void)X, so that we can turn on a
new gcc warning that complains on self-assignments and
self-initializations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122458 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDefault to armv7 instead of armv6.
Bill Wendling [Thu, 23 Dec 2010 00:49:18 +0000 (00:49 +0000)]
Default to armv7 instead of armv6.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122457 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTrailing whitespace.
Jim Grosbach [Wed, 22 Dec 2010 23:26:02 +0000 (23:26 +0000)]
Trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122456 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDAGCombine add (sext i1), X into sub X, (zext i1) if sext from i1 is illegal. The...
Benjamin Kramer [Wed, 22 Dec 2010 23:17:45 +0000 (23:17 +0000)]
DAGCombine add (sext i1), X into sub X, (zext i1) if sext from i1 is illegal.  The latter usually compiles into smaller code.

example code:
unsigned foo(unsigned x, unsigned y) {
  if (x != 0) y--;
  return y;
}

before:
  _foo:                           ## @foo
    cmpl  $1, 4(%esp)             ## encoding: [0x83,0x7c,0x24,0x04,0x01]
    sbbl  %eax, %eax              ## encoding: [0x19,0xc0]
    notl  %eax                    ## encoding: [0xf7,0xd0]
    addl  8(%esp), %eax           ## encoding: [0x03,0x44,0x24,0x08]
    ret                           ## encoding: [0xc3]

after:
  _foo:                           ## @foo
    cmpl  $1, 4(%esp)             ## encoding: [0x83,0x7c,0x24,0x04,0x01]
    movl  8(%esp), %eax           ## encoding: [0x8b,0x44,0x24,0x08]
    adcl  $-1, %eax               ## encoding: [0x83,0xd0,0xff]
    ret                           ## encoding: [0xc3]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122455 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInstCombine: creating selects from -1 and 0 is fine, they combine into a sext from i1.
Benjamin Kramer [Wed, 22 Dec 2010 23:12:15 +0000 (23:12 +0000)]
InstCombine: creating selects from -1 and 0 is fine, they combine into a sext from i1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122453 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoX86: Lower a select directly to a setcc_carry if possible.
Benjamin Kramer [Wed, 22 Dec 2010 23:09:28 +0000 (23:09 +0000)]
X86: Lower a select directly to a setcc_carry if possible.

  int test(unsigned long a, unsigned long b) { return -(a < b); }
compiles to
  _test:                              ## @test
    cmpq  %rsi, %rdi                  ## encoding: [0x48,0x39,0xf7]
    sbbl  %eax, %eax                  ## encoding: [0x19,0xc0]
    ret                               ## encoding: [0xc3]
instead of
  _test:                              ## @test
    xorl  %ecx, %ecx                  ## encoding: [0x31,0xc9]
    cmpq  %rsi, %rdi                  ## encoding: [0x48,0x39,0xf7]
    movl  $-1, %eax                   ## encoding: [0xb8,0xff,0xff,0xff,0xff]
    cmovael %ecx, %eax                ## encoding: [0x0f,0x43,0xc1]
    ret                               ## encoding: [0xc3]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122451 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd r122359 back now that the bug in MCDwarfLineAddrFragment fragment has been
Rafael Espindola [Wed, 22 Dec 2010 22:16:24 +0000 (22:16 +0000)]
Add r122359 back now that the bug in MCDwarfLineAddrFragment fragment has been
fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122448 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConstify.
Dan Gohman [Wed, 22 Dec 2010 22:10:08 +0000 (22:10 +0000)]
Constify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122447 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAssert that the AddrDelta expression is really constant and wrap it in a set
Rafael Espindola [Wed, 22 Dec 2010 22:04:28 +0000 (22:04 +0000)]
Assert that the AddrDelta expression is really constant and wrap it in a set
if we have a lame assembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122446 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen RegAllocGreedy decides to spill the interferences of the current register,
Jakob Stoklund Olesen [Wed, 22 Dec 2010 22:01:30 +0000 (22:01 +0000)]
When RegAllocGreedy decides to spill the interferences of the current register,
pick the victim with the lowest total spill weight.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122445 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInclude a shadow of the original CFG edges in the edge bundle graph.
Jakob Stoklund Olesen [Wed, 22 Dec 2010 22:01:28 +0000 (22:01 +0000)]
Include a shadow of the original CFG edges in the edge bundle graph.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122444 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRename NeedsSetToChangeDiffSize to HasAggressiveSymbolFolding which is a much
Rafael Espindola [Wed, 22 Dec 2010 21:51:29 +0000 (21:51 +0000)]
Rename NeedsSetToChangeDiffSize to HasAggressiveSymbolFolding which is a much
better name and matches what is used in the MachO writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122443 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMC/Mach-O/ARM: Don't try to use scattered relocs for BR24 fixups.
Daniel Dunbar [Wed, 22 Dec 2010 21:26:43 +0000 (21:26 +0000)]
MC/Mach-O/ARM: Don't try to use scattered relocs for BR24 fixups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122441 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd reduced test from 8845.
Rafael Espindola [Wed, 22 Dec 2010 21:15:13 +0000 (21:15 +0000)]
Add reduced test from 8845.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122438 91177308-0d34-0410-b5e6-96231b3b80d8