Commit Graph

13709 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
42e9c96392 Remove MachineRegisterInfo::getLastVirtReg(), it was giving wrong results
when no virtual registers have been allocated.

It was only used to resize IndexedMaps, so provide an IndexedMap::resize()
method such that

 Map.grow(MRI.getLastVirtReg());

can be replaced with the simpler

 Map.resize(MRI.getNumVirtRegs());

This works correctly when no virtuals are allocated, and it bypasses the to/from
index conversions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123130 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 21:58:20 +00:00
Jakob Stoklund Olesen
be97e906e0 Teach TargetRegisterInfo how to cram stack slot indexes in with the virtual and
physical register numbers.

This makes the hack used in LiveInterval official, and lets LiveInterval be
oblivious of stack slots.

The isPhysicalRegister() and isVirtualRegister() predicates don't know about
this, so when a variable may contain a stack slot, isStackSlot() should always
be tested first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 21:17:37 +00:00
Jakob Stoklund Olesen
43a566519b Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123125 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 19:45:45 +00:00
Tobias Grosser
3a723ab344 DominatorTree->print() now prints the status of the DFSNumbers correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123120 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 16:00:09 +00:00
Oscar Fuentes
2c5e0b8b98 Rewrite handling of LLVM_ENABLE_PIC. It was being processed after
config.h was generated, so it had no effect on it.

Thanks to arrowdodger for pointing out this and a tentative patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123119 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 14:34:39 +00:00
Jakob Stoklund Olesen
0804ead404 Simplify LiveDebugVariables by storing MachineOperand copies locations instead
of using a Location class with the same information.

When making a copy of a MachineOperand that was already stored in a
MachineInstr, it is necessary to clear the parent pointer on the copy. Otherwise
the register use-def lists become inconsistent.

Add MachineOperand::clearParent() to do that. An alternative would be a custom
MachineOperand copy constructor that cleared ParentMI. I didn't want to do that
because of the performance impact.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 05:33:21 +00:00
Jakob Stoklund Olesen
4314268128 Replace TargetRegisterInfo::printReg with a PrintReg class that also works without a TRI instance.
Print virtual registers numbered from 0 instead of the arbitrary
FirstVirtualRegister. The first virtual register is printed as %vreg0.
TRI::NoRegister is printed as %noreg.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 03:05:53 +00:00
Jakob Stoklund Olesen
994c727b57 Use IndexedMap for MachineRegisterInfo as well. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123106 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 03:05:46 +00:00
Jakob Stoklund Olesen
c7d67f90d3 Fix VirtRegMap to use TRI::index2VirtReg and TRI::virtReg2Index instead of
depending on TRI::FirstVirtualRegister.

Also use TRI::printReg instead of printing virtual registers directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123101 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 23:11:07 +00:00
Jakob Stoklund Olesen
b421c566f5 Use an IndexedMap for LiveVariables::VirtRegInfo.
Provide MRI::getNumVirtRegs() and TRI::index2VirtReg() functions to allow
iteration over virtual registers without depending on the representation of
virtual register numbers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123098 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 23:10:57 +00:00
Jakob Stoklund Olesen
56e4d89642 Do not talk about TargetRegisterInfo::FirstVirtualRegister.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123097 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 23:10:53 +00:00
Jakob Stoklund Olesen
358de24dc1 Use an IndexedMap for LiveOutRegInfo to hide its dependence on TargetRegisterInfo::FirstVirtualRegister.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123096 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 23:10:50 +00:00
Chris Lattner
2feee6454d fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123085 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 20:53:41 +00:00
Rafael Espindola
bea4626f93 First step in fixing PR8927:
Add a unnamed_addr bit to global variables and functions. This will be used
to indicate that the address is not significant and therefore the constant
or function can be merged with others.

If an optimization pass can show that an address is not used, it can set this.

Examples of things that can have this set by the FE are globals created to
hold string literals and C++ constructors.

Adding unnamed_addr to a non-const global should have no effect unless
an optimization can transform that global into a constant.

Aliases are not allowed to have unnamed_addr since I couldn't figure
out any use for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123063 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 16:42:36 +00:00
Chris Lattner
c3942eb95d make this file properly self contained.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123059 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 08:19:49 +00:00
Chris Lattner
b5fa5fcecc Revamp the ValueMapper interfaces in a couple ways:
1. Take a flags argument instead of a bool.  This makes
   it more clear to the reader what it is used for.
2. Add a flag that says that "remapping a value not in the
   map is ok".
3. Reimplement MapValue to share a bunch of code and be a lot
   more efficient.  For lookup failures, don't drop null values
   into the map.
4. Using the new flag a bunch of code can vaporize in LinkModules
   and LoopUnswitch, kill it.

No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 08:15:20 +00:00
Evan Cheng
55d4200336 Recognize inline asm 'rev /bin/bash, ' as a bswap intrinsic call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123048 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 01:24:27 +00:00
Evan Cheng
c36b7069b4 Do not model all INLINEASM instructions as having unmodelled side effects.
Instead encode llvm IR level property "HasSideEffects" in an operand (shared
with IsAlignStack). Added MachineInstrs::hasUnmodeledSideEffects() to check
the operand when the instruction is an INLINEASM.

This allows memory instructions to be moved around INLINEASM instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123044 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 23:50:32 +00:00
Devang Patel
6a6623c596 Do not include DataTypes.h in llvm-c/lto.h.
This means avoid using uint32_t. This patch reverts r112200 and fixes original  problem by fixing argument type in lto.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123038 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 22:26:25 +00:00
Evan Cheng
7c7e2da4aa Fix comment. INLINEASM node operand #3 is IsAlignStack bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123036 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:38:59 +00:00
Evan Cheng
30a343aeed DBG_VALUE does not have any side effects; it also makes no sense to mark it cheap as a copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123031 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:08:26 +00:00
Jay Foad
8e3914d12e Simplify the allocation and freeing of Users' operand lists, now that
every BranchInst has a fixed number of operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123027 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 20:29:02 +00:00
Jay Foad
43eaadeea5 Remove the "ugly" method BranchInst::setUnconditionalDest().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123026 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 20:26:51 +00:00
Bob Wilson
5e8b833707 Add ARM patterns to match EXTRACT_SUBVECTOR nodes.
Also fix an off-by-one in SelectionDAGBuilder that was preventing shuffle
vectors from being translated to EXTRACT_SUBVECTOR.
Patch by Tim Northover.

The test changes are needed to keep those spill-q tests from testing aligned
spills and restores.  If the only aligned stack objects are spill slots, we
no longer realign the stack frame.  Prior to this patch, an EXTRACT_SUBVECTOR
was legalized by loading from the stack, which created an aligned frame index.
Now, however, there is nothing except the spill slot in the stack frame, so
I added an aligned alloca.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122995 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 04:59:04 +00:00
Bob Wilson
6736e19f4c Change EXTRACT_SUBVECTOR to require a constant index.
We were never generating any of these nodes with variable indices, and there
was one legalizer function asserting on a non-constant index.  If we ever have
a need to support variable indices, we can add this back again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122993 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 04:58:56 +00:00
Evan Cheng
0521928ae7 Re-implement r122936 with proper target hooks. Now getMaxStoresPerMemcpy
etc. takes an option OptSize. If OptSize is true, it would return
the inline limit for functions with attribute OptSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122952 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 06:52:41 +00:00
Jakob Stoklund Olesen
8bfe50871f Add the SpillPlacement analysis pass.
This pass precomputes CFG block frequency information that can be used by the
register allocator to find optimal spill code placement.

Given an interference pattern, placeSpills() will compute which basic blocks
should have the current variable enter or exit in a register, and which blocks
prefer the stack.

The algorithm is ready to consume block frequencies from profiling data, but for
now it gets by with the static estimates used for spill weights.

This is a work in progress and still not hooked up to RegAllocGreedy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122938 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 01:21:53 +00:00
Bob Wilson
bfb7dd9e9e Revert svn 122743, removing the instcombine pass that was replaced by earlycse.
My i386 llvm-gcc nightly tester found a regression for
SingleSource/Benchmarks/McGill/chomp that a bisect blamed on 122743.
That seems strange but apparently the combination of earlycse and instcombine
did something bad.  Chris says he intended to remove the instcombine pass, so
let's go ahead and try that.  We'll see if there are any performance losses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:16:50 +00:00
Wesley Peck
4351bfbd4d Fix small bug in setDebugInfoAvailability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122886 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 17:01:57 +00:00
Chris Lattner
be478819cb Fix PR8906: -fno-builtin should disable loop-idiom recognition.
It forms memset and memcpy's, and will someday form popcount and
other stuff.  All of this is bad when compiling the implementation
of memset, memcpy, popcount, etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122854 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 01:03:32 +00:00
Jakob Stoklund Olesen
631ee4b89f Use the EdgeBundles analysis in X86FloatingPoint instead of recomputing CFG
bundles in the pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122833 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 21:10:11 +00:00
Jakob Stoklund Olesen
8dd070edc2 Turn the EdgeBundles class into a stand-alone machine CFG analysis pass.
The analysis will be needed by both the greedy register allocator and the
X86FloatingPoint pass. It only needs to be computed once when the CFG doesn't
change.

This pass is very fast, usually showing up as 0.0% wall time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122832 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 21:10:05 +00:00
Owen Anderson
19af2ed415 Give MachineFunctionAnalysis a getPassName() implementation to make timing reports prettier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122816 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 18:21:18 +00:00
Duncan Sands
c449a224bb These methods should be "const"; make them so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122809 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 12:52:29 +00:00
Owen Anderson
ab6acc6ecd Stub out a new updating interface to AliasAnalysis, allowing stateful analyses to be informed when
a pointer value has potentially become escaping.  Implementations can choose to either fall back to
conservative responses for that value, or may recompute their analysis to accomodate the change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122777 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 21:38:41 +00:00
Evan Cheng
cc3d8e3c22 Undo what looks like accidental removal of an instcombine pass in r122740.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122743 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 07:53:18 +00:00
Chris Lattner
db5f5e64fe Turn on earlycse by default. This seems to be a small performance
improvement in the generated code, and speeds up 'opt -std-compile-opts'
compile time on 176.gcc from 24.84s to 23.2s (about 7%).

This also resolves a specific code quality issue in rdar://7352081 which
was generating poor code for:

int t(int a, int b) {
  if (a & b & 1)
    return a & b;
  return 3;
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122740 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 06:19:09 +00:00
Nick Lewycky
9ad1cb59de Add spliceFunction to the CallGraph interface. This allows users to efficiently
update a callGraph when performing the common operation of splicing the body to
a new function and updating all callers (such as via RAUW).

No users yet, though this is intended for DeadArgumentElimination as part of
PR8887.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122728 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 03:19:35 +00:00
Chris Lattner
152096275a add a handy typedef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 03:16:20 +00:00
Chris Lattner
4f20c6d354 really get this working with a custom allocator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122722 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 01:38:29 +00:00
Chris Lattner
61a10a0dc9 Enhance ScopedHashTable to allow it to take an allocator argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122721 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 01:29:37 +00:00
Cameron Zwarich
832f61117d Add a new loop-instsimplify pass, with the intention of replacing the instance
of instcombine that is currently in the middle of the loop pass pipeline. This
commit only checks in the pass; it will hopefully be enabled by default later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122719 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 00:25:16 +00:00
Chris Lattner
9fc5cdf77c split dom frontier handling stuff out to its own DominanceFrontier header,
so that Dominators.h is *just* domtree.  Also prune #includes a bit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122714 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 22:09:33 +00:00
Chris Lattner
12be936cc9 sketch out a new early cse pass. No functionality yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122713 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 21:47:05 +00:00
Cameron Zwarich
86a582ddfb Remove an unused member function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122693 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 12:37:22 +00:00
Cameron Zwarich
94942cec11 Fix a typo in a variable name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122691 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 12:17:10 +00:00
Cameron Zwarich
63e07d72f8 Move a load into the only branch where it is used and eliminate a temporary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122690 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 10:50:14 +00:00
Cameron Zwarich
2a8c22aa68 Add the explanatory comment from r122680's commit message to the code itself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122689 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 10:40:14 +00:00
Cameron Zwarich
19feb4ca8a Tidy up indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122688 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 10:10:02 +00:00
Cameron Zwarich
a4d93162cb Fix a typo, which should also fix the failure on llvm-x86_64-linux-checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122687 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 10:06:44 +00:00
Cameron Zwarich
c9e152b778 Remove the #ifdef'd code for balancing the eval-link data structure. It doesn't
compile, and everyone's tests have shown it to be slower in practice, even for
quite large graphs.

I also hope to do an optimization that is only correct with the simpler data
structure, which would break this even further.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122684 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 07:53:49 +00:00
Cameron Zwarich
8252ad1351 Speed up dominator computation some more by optimizing bucket processing. When
naively implemented, the Lengauer-Tarjan algorithm requires a separate bucket
for each vertex. However, this is unnecessary, because each vertex is only
placed into a single bucket (that of its semidominator), and each vertex's
bucket is processed before it is added to any bucket itself.

Instead of using a bucket per vertex, we use a single array Buckets that has two
purposes. Before the vertex V with DFS number i is processed, Buckets[i] stores
the index of the first element in V's bucket. After V's bucket is processed,
Buckets[i] stores the index of the next element in the bucket to which V now
belongs, if any.

Reading from the buckets can also be optimized. Instead of processing the bucket
of V's parent at the end of processing V, we process the bucket of V itself at
the beginning of processing V. This means that the case of the root vertex can
be simplified somewhat. It also means that we don't need to look up the DFS
number of the semidominator of every node in the bucket we are processing,
since we know it is the current index being processed.

This is a 6.5% speedup running -domtree on test-suite + SPEC2000/2006, with
larger speedups of around 12% on the larger benchmarks like GCC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122680 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02 07:03:00 +00:00
Chris Lattner
0fd8ee4995 turn on memset idiom recognition by default. Though there are still lots of
limitations, this kicks in dozens of times in the 4 specfp2000 benchmarks, 
and hundreds of times in the int part.  It also kicks in hundreds of times 
in multisource.

This kicks in right before loop deletion, which has the pleasant effect of
deleting loops that *just* do a memset.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122664 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-01 20:39:18 +00:00
Daniel Dunbar
b2624eda5a MC/Mach-O/Thumb: Set the thumb bit in the symbol table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122630 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-29 14:14:06 +00:00
Rafael Espindola
b40a71fda1 Implement cfi_def_cfa. Also don't convert to dwarf reg numbers twice. Looks
like 6 is a fixed point of that and so the previous tests were OK :-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122614 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-29 01:42:56 +00:00
Rafael Espindola
fe024d0a62 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
2010-12-28 18:36:23 +00:00
Duncan Sands
19f14dcf6a 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
2010-12-28 18:01:19 +00:00
Duncan Sands
9bc6a90146 Small optimization to speed up replacementPreservesLCSSAForm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122600 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-28 18:00:24 +00:00
Rafael Espindola
245a1e2041 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
2010-12-28 05:39:27 +00:00
Rafael Espindola
5bba084253 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
2010-12-28 04:15:37 +00:00
Michael J. Spencer
4213618088 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
2010-12-28 01:49:21 +00:00
Michael J. Spencer
bf0184b684 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122588 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-28 01:49:10 +00:00
Michael J. Spencer
628467ef1f Support/PathV2: Implement has_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122587 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-28 01:49:01 +00:00
Rafael Espindola
bdc3167c08 Add support for .cfi_lsda.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122584 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-27 15:56:22 +00:00
Michael J. Spencer
9170a0f02d Support/PathV1: Deprecate GetRootDirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122580 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-27 03:21:41 +00:00
Rafael Espindola
3a83c40ab6 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
2010-12-27 00:36:05 +00:00
Benjamin Kramer
def548f9a0 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
2010-12-27 00:25:32 +00:00
Chris Lattner
a92ff91a96 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
2010-12-26 23:42:51 +00:00
Chris Lattner
c0d5496b8a 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
2010-12-26 22:49:25 +00:00
Rafael Espindola
d7c8ccae8e Add basic support for .cfi_personality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122566 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-26 20:20:31 +00:00
Chris Lattner
bb89710ddd move isBytewiseValue out to ValueTracking.h/cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122565 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-26 20:15:01 +00:00
Chris Lattner
b0db161f5b 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
2010-12-26 19:32:44 +00:00
Chris Lattner
687140c818 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
2010-12-25 20:37:57 +00:00
Michael J. Spencer
43ee29d418 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
2010-12-25 20:10:11 +00:00
Eric Christopher
7853ae1d97 Header warning patrol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122551 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-25 02:38:01 +00:00
Rafael Espindola
fea753b397 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
2010-12-24 21:22:02 +00:00
Andrew Trick
a75ce9f5d2 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
2010-12-24 07:10:19 +00:00
Andrew Trick
2da8bc8a5f 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
2010-12-24 05:03:26 +00:00
Andrew Trick
6e8f4c4048 whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 04:28:06 +00:00
Chris Lattner
036609bd7d Flag -> Glue, the ongoing saga
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122513 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 18:28:41 +00:00
Chris Lattner
29d8f0cae4 flags -> glue for selectiondag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122509 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 17:24:32 +00:00
Chris Lattner
a4359be032 sdisel flag -> glue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 17:13:18 +00:00
Jeffrey Yasskin
8e68c38735 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
2010-12-23 00:58:24 +00:00
Dan Gohman
df3ee64d79 Constify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122447 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 22:10:08 +00:00
Rafael Espindola
90a5a0cd7c 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
2010-12-22 21:51:29 +00:00
Rafael Espindola
33a38a1b5a Use references and simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 16:11:57 +00:00
Rafael Espindola
7a45903bf4 Don't relax org or align. They change size as the relaxation happens, but they
are not actually relaxed. For example, a section with only alignments will never
needs relaxation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 20:35:18 +00:00
Daniel Dunbar
e1feeb9da4 MC/Mach-O: Shuffle enums a bit to make it harder to inadvertently use the wrong
type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122334 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 15:26:45 +00:00
Duncan Sands
82fdab3358 Pull a few more simplifications out of instcombine (there are still
plenty left though!), in particular for multiplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122330 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 14:00:22 +00:00
Rafael Espindola
62b83b62f3 Layout one section until no relaxations are done and then move to the next
section.

This helps because in practice sections form a dag with debug sections pointing
to text sections. Finishing up the text sections first makes the debug section
relaxation trivial.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 04:22:09 +00:00
Chris Lattner
f1b4eafbfe rename MVT::Flag to MVT::Glue. "Flag" is a terrible name for
something that just glues two nodes together, even if it is
sometimes used for flags.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122310 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 02:38:05 +00:00
Jakob Stoklund Olesen
b907e8a2d4 Use IntEqClasses to compute connected components of live intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 00:48:17 +00:00
Jakob Stoklund Olesen
2a6899c539 Add ADT/IntEqClasses.h as a light-weight implementation of EquivalenceClasses.h.
This implementation already exists as ConnectedVNInfoEqClasses in
LiveInterval.cpp, and it seems to be generally useful to have a light-weight way
of forming equivalence classes of small integers.

IntEqClasses doesn't allow enumeration of the elements in a class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122293 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 00:04:46 +00:00
Owen Anderson
3b77f56194 Revert r122114 (CallbackVH observing use-list changes) because it caused severe slowdowns on the Linux self-host configuration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122279 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 22:28:03 +00:00
Bill Wendling
d7a0852464 This is still used and issuing an annoying warning. Don't deprecate something in
the library unless *all* uses have been converted over to the new form.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 21:14:18 +00:00
Duncan Sands
43ff68ded0 Add a new convenience pass for testing InstructionSimplify. Previously
it could only be tested indirectly, via instcombine, gvn or some other
pass that makes use of InstructionSimplify, which means that testcases
had to be carefully contrived to dance around any other transformations
that that pass did.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 20:54:37 +00:00
Michael J. Spencer
c41f4de754 Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122244 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 13:30:37 +00:00
Duncan Sands
0d7ce5ffa4 There is no need for isAssociative to take the type as an argument anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122242 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 13:10:23 +00:00
Duncan Sands
8e4f4390bc Discourage people from using isWeakForLinker when they should be using
mayBeOverridden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122241 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 10:57:01 +00:00
Chris Lattner
4d8455ea4d update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122212 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:56:59 +00:00
Nick Lewycky
9d38acb254 Use the new way of silencing this warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122195 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:57:14 +00:00
Nick Lewycky
476b242fe7 Add missing standard headers. Patch by Joerg Sonnenberger!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122193 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:43:38 +00:00
Chris Lattner
cc3029acdd add a version of IRBuilder::SetInsertPoint that takes an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122180 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 19:16:22 +00:00
Chris Lattner
43afe75ad0 remove dead header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122169 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 04:49:11 +00:00
Michael J. Spencer
c3207d8b5a Support/PathV1: Clarify deprecation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122159 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 22:23:24 +00:00
Michael J. Spencer
7385509101 Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 22:23:07 +00:00
Eric Christopher
9390983b08 Header warning patrol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122152 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 10:54:29 +00:00
Roman Divacky
7529b16410 Add support for lexing single quotes like 'c'.
This fixed 8615.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122150 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 08:56:37 +00:00
Owen Anderson
fffa863536 Revert r122143 through r122140, which collectively broke the LLVMC tests on
the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 07:37:18 +00:00
Rafael Espindola
3132780a2e Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 06:27:54 +00:00
Rafael Espindola
1ec5bd31fe Remove the MCObjectFormat class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 05:37:28 +00:00
Michael J. Spencer
47e8ae6324 Support/PathV1: Clarify deprecation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122143 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:13:54 +00:00
Michael J. Spencer
b9c767cce5 Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:13:36 +00:00
Rafael Espindola
d076482ab7 Revert 122011, 122012, 122013, 122023 adding back an important optimization.
I added a note, but suggestions on how to add a test are really welcome.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:57:21 +00:00
Rafael Espindola
bff66a86e6 Move some data to the TargetWriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:27:34 +00:00
Michael J. Spencer
b3127bb06a Support/PathV1: Deprecate getLast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:19:10 +00:00
Owen Anderson
a479b23256 Add support to CallbackVH to receive notification when a Value's use-list changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:07:15 +00:00
Jakob Stoklund Olesen
89cab93fe9 Pass a Banner argument to the machine code verifier both from
createMachineVerifierPass and MachineFunction::verify.

The banner is printed before the machine code dump, just like the printer pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:06:56 +00:00
Jakob Stoklund Olesen
8d12140437 Avoid dereferencing end() in collectInterferingVRegs() when there is no
interference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122108 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:16:38 +00:00
Jakob Stoklund Olesen
f428eb6c1b Enable loop splitting in RegAllocGreedy.
The heuristics split around the largest loop where the current register may be
allocated without interference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:16:32 +00:00
Bill Wendling
976ef86689 During local stack slot allocation, the materializeFrameBaseRegister function
may be called. If the entry block is empty, the insertion point iterator will be
the "end()" value. Calling ->getParent() on it (among others) causes problems.

Modify materializeFrameBaseRegister to take the machine basic block and insert
the frame base register at the beginning of that block. (It's very similar to
what the code does all ready. The only difference is that it will always insert
at the beginning of the entry block instead of after a previous materialization
of the frame base register. I doubt that that matters here.)

<rdar://problem/8782198>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122104 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:09:14 +00:00
Jakob Stoklund Olesen
d715e07efe Add more checks to IntervalMapOverlaps::advance() to ensure that advanceTo sees
monotonic keys.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122093 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 22:07:54 +00:00
Jakob Stoklund Olesen
5049ee5b11 It is allowed to call IntervalMap::const_iterator::advanceTo() with a key that
moves the iterator to end(), and it is valid to call it on end().

That means it is valid to call advanceTo() with any monotonic key sequence.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122092 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 22:07:51 +00:00
Michael J. Spencer
48c166bceb Fix 80 col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 21:32:47 +00:00
Michael J. Spencer
965841cfe4 Support/Path: Deprecate PathV1::isAbsolute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 21:21:31 +00:00
Jakob Stoklund Olesen
4aec85ae01 Fix crash when IntervalMapOverlaps::advanceTo moves past the last overlap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 19:18:38 +00:00
Benjamin Kramer
d53f3c864b Pass StringRefs by value, for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:19:06 +00:00
Jakob Stoklund Olesen
090100fdb1 Add MachineLoopRange comparators for sorting loop lists by number and by area.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122073 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:13:52 +00:00
Rafael Espindola
6024c97ffa Stub out explicit MCELFObjectTargetWriter interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 17:45:22 +00:00
Michael J. Spencer
cc2a8fefb6 Support: Rename Path.h to PathV1.h and add a new Path.h that includes both V1 and V2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122065 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 17:22:36 +00:00
Rafael Espindola
285b3e5b61 Move createELFObjectWriter to its own header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 16:59:53 +00:00
Chris Lattner
e27db74a60 improve switch formation to handle small range
comparisons formed by comparisons.  For example,
this:

void foo(unsigned x) {
  if (x == 0 || x == 1 || x == 3 || x == 4 || x == 6) 
    bar();
}

compiles into:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	cmpl	$6, %edi
	ja	LBB0_2
## BB#1:                                ## %entry
	movl	%edi, %eax
	movl	$91, %ecx
	btq	%rax, %rcx
	jb	LBB0_3

instead of:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	cmpl	$2, %edi
	jb	LBB0_4
## BB#1:                                ## %switch.early.test
	cmpl	$6, %edi
	ja	LBB0_3
## BB#2:                                ## %switch.early.test
	movl	%edi, %eax
	movl	$88, %ecx
	btq	%rax, %rcx
	jb	LBB0_4

This catches a bunch of cases in GCC, which look like this:

 %804 = load i32* @which_alternative, align 4, !tbaa !0
 %805 = icmp ult i32 %804, 2
 %806 = icmp eq i32 %804, 3
 %or.cond121 = or i1 %805, %806
 %807 = icmp eq i32 %804, 4
 %or.cond124 = or i1 %or.cond121, %807
 br i1 %or.cond124, label %.thread, label %808

turning this into a range comparison.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 06:20:15 +00:00
Daniel Dunbar
b87422778c MC/Mach-O: On second thought, use a custom hook for enabling aggressive
IsSymbolRefDifferenceFullyResolved, it turns out this does change behavior on
enough cases for x86-32 that I would rather wait a bit on it.
 - In practice, we will want to change this eventually because it only means we
   generate less relocations (it also eliminates the need for the horrible
   '.set' hack that Darwin requires in some places).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 05:50:29 +00:00
Daniel Dunbar
1f3662abba MC/ObjectWriter: Add a new IsSymbolRefDifferenceFullyResolved target format specific hook.
- Currently just has stub implementations for Mach-O, ELF, and COFF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122037 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 04:54:54 +00:00
Jakob Stoklund Olesen
ff2e9b4225 Provide LiveIntervalUnion::Query::checkLoopInterference.
This is a three-way interval list intersection between a virtual register, a
live interval union, and a loop. It will be used to identify interference-free
loops for live range splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 04:09:47 +00:00
Daniel Dunbar
5d2477cecf MC/Assembler: Strip out object writer arguments, now that it is always available
-- and remove FIXME asking for the same!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 02:45:59 +00:00
Daniel Dunbar
feb7ba3d9a MC/Assembler: Make the MCObjectWriter available through the lifetime of the
assembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122031 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 02:45:41 +00:00
Daniel Dunbar
7b62afac0a MC/Target: Remove HasScatteredSymbols target hook variable, which has been
superceded and was effectively dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 02:06:08 +00:00
Daniel Dunbar
8f714fedba MC/Expr: Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122023 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 02:05:45 +00:00
Daniel Dunbar
2d8e3e741f MC: Remove another dead MCAssembler argument, and update clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122013 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 01:07:35 +00:00
Daniel Dunbar
92c66c7bf9 MC: Remove dead MCAssembler argument -- Rafael, can you check the FIXME I added
here?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122012 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 01:07:31 +00:00
Daniel Dunbar
f249e5d5d7 Fix 80-col viola.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122010 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 01:07:25 +00:00
Jakob Stoklund Olesen
460ee0fd19 Add basic test exposing many bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121995 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 19:46:09 +00:00
Daniel Dunbar
5d05d9769e MC/Mach-O: Lift some MachObjectWriter arguments into the target specific
interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 17:21:02 +00:00
Daniel Dunbar
ae5abd595f MC/Mach-O: Stub out explicit MCMachObjectTargetWriter interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 16:09:19 +00:00
Daniel Dunbar
aa4b7dd13b MC/Mach-O: Move createMachObjectWriter into MCMachObjectWriter.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 16:08:33 +00:00
Michael J. Spencer
3ff9563c3e MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 03:29:14 +00:00
Daniel Dunbar
2761fc4270 MC: Move target specific fixup info descriptors to TargetAsmBackend instead of
the MCCodeEmitter, which seems like a better organization.
 - Also, cleaned up some magic constants while in the area.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 03:20:06 +00:00
Daniel Dunbar
745dacc91d MC: Make TargetAsmBackend available to the AsmStreamer.
- Treaty talks on the non-proliferation of MC objects broke down.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 03:05:59 +00:00
Daniel Dunbar
1d6547eb49 MC: Split MCFixupKindInfo out into its own header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121948 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 03:05:53 +00:00
Daniel Dunbar
9754ab010e MC: Remove a FIXME I no longer agree with.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 03:05:46 +00:00
Jakob Stoklund Olesen
cb9e08f328 Add IntervalMapOverlaps - An iterator for overlapping intervals in two
IntervalMaps.

The IntervalMaps can have different template parameters, but the KeyT and Traits
types must be the same.

Tests are forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 01:18:29 +00:00
Jakob Stoklund Olesen
ceadc01e91 Add MachineLoopRanges analysis.
A MachineLoopRange contains the intervals of slot indexes covered by the blocks
in a loop. This representation of the loop blocks is more efficient to compare
against interfering registers during register coalescing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 23:41:23 +00:00
Rafael Espindola
c42a7754bb Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121906 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 22:33:06 +00:00
Bob Wilson
0406356cd4 Add Neon VCVT instructions for f32 <-> f16 conversions.
Clang is now providing intrinsics for these and so we need to support them
in the backend.  Radar 8068427.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 22:14:12 +00:00
Jakob Stoklund Olesen
e69b4ab829 Add SlotIndexes::getMBBRange() to get the range of a basic block in a single
lookup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 20:40:22 +00:00
Wesley Peck
d364acd3d7 Adding target specific calling conventions to support the MBlaze GCC function
attributes "interrupt_handle" and "save_volatiles". Support for lowering these
correctly will be in an upcoming commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121888 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 20:14:09 +00:00
Dan Gohman
5034dd318a Move Value::getUnderlyingObject to be a standalone
function so that it can live in Analysis instead of
VMCore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121885 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 20:02:24 +00:00
Owen Anderson
47dbd429da Implement cleanups suggested by Daniel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121875 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 18:48:27 +00:00
Duncan Sands
fea3b218d6 Move Sub simplifications and additional Add simplifications out of
instcombine and into InstructionSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121861 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 14:07:39 +00:00
Rafael Espindola
2bf6afc277 Relax alignment fragments.
With this we don't need the EffectiveSize field anymore. Without that field
LayoutFragment only updates offsets and we don't need to invalidate the
current fragment when it is relaxed (only the ones following it).

This is also a very small improvement in the accuracy of the layout info as
we now use the after relaxation size immediately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 08:45:53 +00:00
Rafael Espindola
b35d56c2fe Generalize an assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 07:12:24 +00:00
Jakob Stoklund Olesen
b83ff84193 Introduce TargetRegisterInfo::getOverlaps(Reg), returning a list of all
registers that alias Reg, including itself. This is almost the same as the
existing getAliasSet() method, except for the inclusion of Reg.

The name matches the reflexive TRI::regsOverlap(x, y) relation.

It is very common to do stuff to a register and all its aliases:

  stuff(Reg)
  for (const unsigned *Alias = TRI->getAliasSet(Reg); *Alias; ++Alias)
    stuff(*Alias);

That can now be written as the simpler:

  for (const unsigned *Alias = TRI->getOverlaps(Reg); *Alias; ++Alias)
    stuff(*Alias);

This change requires a bit more constant space for the alias lists because Reg
is included and because the empty alias list cannot be shared any longer.

If the getAliasSet method is eventually removed, this space can be reclaimed by
sharing overlap lists. For instance, %rax and %eax have identical overlap sets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 23:03:42 +00:00
Jakob Stoklund Olesen
414e5023f8 Add TargetRegisterInfo::printReg() to pretty-print registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121780 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 18:53:39 +00:00
Jim Grosbach
4750020788 ARM Fixups relative to thumb functions need to have the low bit of the value
set for interworking to work properly. rdar://8755956

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121778 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 18:46:57 +00:00
Chris Lattner
2112bbc42d remove the dead (and terrible) llvm::RemoveSuccessor function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 06:51:55 +00:00
Jakob Stoklund Olesen
2ece4dead7 Remove debugging code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121738 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 00:37:52 +00:00
Dan Gohman
4a34cbd2b9 Introduce a new PartialAlias response for AliasAnalysis. For most
AliasAnalysis consumers, PartialAlias will be treated as MayAlias.

For AliasAnalysis chaining, MayAlias says "procede to the next analysis".
PartialAlias will be used to indicate that the query should terminate,
even though it didn't reach MustAlias or NoAlias.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 19:38:58 +00:00
Rafael Espindola
89b9372605 Fixed version of 121434 with no new memory leaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121471 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 07:39:47 +00:00
Daniel Dunbar
cdffa4fdc9 Mach-O/ARM: Add relocation type enumeration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121467 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 06:19:49 +00:00
Daniel Dunbar
a87d7ec234 Mach-O: Tweak field name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121465 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 06:19:39 +00:00
Nick Lewycky
c79637c3cd Remove dead header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121463 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 05:12:54 +00:00
Rafael Espindola
f7fd4aa261 Revert my previous patch to make the valgrind bots happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121461 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 04:01:09 +00:00
Rafael Espindola
1c952b9cc9 Initial support for the cfi directives. This is just enough to get
f:
        .cfi_startproc
        nop
        .cfi_endproc

assembled (on ELF).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 23:48:29 +00:00
Owen Anderson
05018c2f28 Fix an issue in some Thumb fixups, where the effective PC address needs to be 4-byte aligned when calculating
the offset.  Add a new fixup flag to represent this, and use it for the one fixups that I have a testcase for needing
this.  It's quite likely that the other Thumb fixups will need this too, and to have their fixup encoding logic
adjusted accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 20:27:52 +00:00
Michael J. Spencer
333ad3f2bf Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 17:37:32 +00:00
Michael J. Spencer
58fe86dc0e Support: Move c_str from SmallVector back to SmallString and add a free standing
templated c_str in Windows.h to replace it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 17:37:18 +00:00
Michael J. Spencer
61187dd0ad Support/FileSystem: Change file_status predicate functions that cannot fail to
return their result instead of an error_code. Also add some missing predicate
functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121380 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 17:37:02 +00:00
Michael J. Spencer
333fb04506 Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 17:36:48 +00:00
Lang Hames
35f4cf0474 Fixed some dependencies in RegAllocPBQP.h . Thanks to Borja Ferrer for pointing out this issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121292 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 22:15:32 +00:00
Devang Patel
44498a640d Add support to create debug info for functions and methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121281 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 20:42:44 +00:00
Devang Patel
0a2551de2c Add support to create class type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121279 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 20:18:20 +00:00
Andrew Trick
6b1207267f Generalize PostRAHazardRecognizer so it can be used in any pass for
both forward and backward scheduling. Rename it to
ScoreboardHazardRecognizer (Scoreboard is one word). Remove integer
division from the scoreboard's critical path.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 20:04:29 +00:00
Jakob Stoklund Olesen
cba2e06d52 Stub out RegAllocGreedy.
This new register allocator is initially identical to RegAllocBasic, but it will
receive all of the tricks that RegAllocBasic won't get.

RegAllocGreedy will eventually replace linear scan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 03:26:16 +00:00
Devang Patel
43c249cf1e Add support to create vector, array, enums etc...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 01:50:15 +00:00
Jim Grosbach
5be6d2af38 Let target asm backends see assembler flags as they go by. Use that to handle
thumb vs. arm mode differences in WriteNopData().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121219 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 01:16:55 +00:00
Devang Patel
94541efd92 Global variable does not need linkage name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121212 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 00:06:22 +00:00
Devang Patel
48f17ba2a6 Add support to create local variable's debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121211 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:58:00 +00:00
Rafael Espindola
4f4363a490 Layout each section independently. With the testcase in PR8711:
before:
        4 assembler - Number of assembler layout and relaxation steps
    78563 assembler - Number of emitted assembler fragments
  8693904 assembler - Number of emitted object file bytes
   271223 assembler - Number of evaluated fixups
330771677 assembler - Number of fragment layouts
     5958 assembler - Number of relaxed instructions
  2508361 mcexpr    - Number of MCExpr evaluations

real	0m26.123s
user	0m25.694s
sys	0m0.388s

after:

      4 assembler - Number of assembler layout and relaxation steps
  78563 assembler - Number of emitted assembler fragments
8693904 assembler - Number of emitted object file bytes
 271223 assembler - Number of evaluated fixups
 231507 assembler - Number of fragment layouts
   5958 assembler - Number of relaxed instructions
2508361 mcexpr    - Number of MCExpr evaluations

real	0m2.500s
user	0m2.113s
sys	0m0.273s

And yes, the outputs are identical :-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121207 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:32:26 +00:00
Devang Patel
fe58f95f36 Add support to create variables, structs etc.. using DIBuilder.
This is still work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:25:47 +00:00
Jakob Stoklund Olesen
da2fdcbb63 Fix begin() and end() on const IntervalMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:18:43 +00:00
Michael J. Spencer
1ff657312e Missed a spot removing Alarm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 18:50:33 +00:00
Michael J. Spencer
c20beb9cc5 Support: Remove Alarm. It is unused (via local grep and google code search).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 18:41:59 +00:00
Michael J. Spencer
12ccf67457 Support/PathV2: Remove const from bool return types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 18:12:07 +00:00
Michael J. Spencer
6511988cd4 Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121156 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 18:11:54 +00:00
Michael J. Spencer
a35c1b9431 Support: Remove DynamicLinker.h. It is unused and unimplemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121155 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 18:11:38 +00:00
Michael J. Spencer
5029159fbe Support/PathV2: Change most functions in the path namespace to return their work
via their return value instead of an out parameter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 17:04:04 +00:00
Jay Foad
40f8f6264d PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 08:25:19 +00:00
Michael J. Spencer
936671b2ea Support/PathV2: Remove the error_code return type from all functions in the path
namespace. None of them return anything except for success anyway. These will be
converted to returning their result soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 03:57:37 +00:00
Michael J. Spencer
ee271d8758 Support/PathV2: Move make_absolute from path to fs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121108 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 03:57:17 +00:00
Michael J. Spencer
ad8a14f24e Support/PathV2: Clarify and correct documentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 01:23:08 +00:00
Michael J. Spencer
1522fce477 Support/PathV2: Move current_path from path to fs and fix the Unix implementation.
Unix bug spotted by Dan Gohman.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 01:22:31 +00:00
Rafael Espindola
85f2ecc697 Sorry for such a large commit. The summary is that only MachO cares about the
actuall addresses in a .o file, so it is better to let the MachO writer compute
it.

This is good for two reasons. First, areas that shouldn't care about
addresses now don't have access to it. Second, the layout of each section
is independent. I should use this in a subsequent commit to speed it up.

Most of the patch is just removing the section address computation. The two
interesting parts are the change on how we handle padding in the end
of sections and how MachO can get the address of a-b when a and b are in
different sections.

Since now the expression evaluation normally doesn't know the section address,
it will think that a-b needs relocation and let the MachO writer know. Once
it has computed the section addresses, it calls back the expression evaluation
with the section addresses to resolve these expressions.

The remaining problem is the handling of padding. Currently it will create
a special alignment fragment at the end. Since that fragment doesn't update
the alignment of the section, it needs the real address to be computed.

Since now the layout will not compute a-b with a and b in different sections,
the only effect that the special alignment fragment has is update the
address size of the section. This can also be done by the MachO writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121076 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 00:27:36 +00:00
Rafael Espindola
22373b230a Use references to simplify the code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121050 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 22:30:54 +00:00
Rafael Espindola
179821ac1f Remove the instruction fragment to data fragment lowering since it was causing
freed data to be read. I will open a bug to track it being reenabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 19:08:48 +00:00
Rafael Espindola
0bbe0b440e Second try at making direct object emission produce the same results
as llc + llvm-mc. This time ELF is not changed and I tested that llvm-gcc
bootstrap on darwin10 using darwin9's assembler and linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 17:27:56 +00:00
Rafael Espindola
6d86492f5e Revert previous two patches while I try to find out how to make both
linux and darwin assemblers happy :-(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 15:35:15 +00:00
Rafael Espindola
2303c9dd69 Add an EmitAbsValue helper method and use it in cases where we want to be sure
that no relocations are used (on MochO).
Fixes llc producing different output from llc + llvm-mc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 14:53:14 +00:00
Frits van Bommel
03a83a3f41 Fix clang warning: "extra ';' inside a class [-pedantic]".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120998 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 10:48:11 +00:00
Michael J. Spencer
753cbbbd3c Support/FileSystem: Add directory_iterator implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 04:28:42 +00:00
Michael J. Spencer
e99bbd9ac3 Support/ADT: Move c_str() from SmallString to SmallVectorImpl. The Windows PathV2
implementation needs it for wchar_t and SmallVectorImpl in general.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120984 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 04:27:42 +00:00
Rafael Espindola
f8803fe417 Remove the getAddress getter, initialize Ordinal in the constructor and use
that on the ELF writer to detect a section we created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 03:48:09 +00:00
Rafael Espindola
ffd902bfb7 Add a getSymbolOffset method and use it in the ELF writer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120977 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 02:57:26 +00:00
Chris Lattner
cc10244d77 Fix PR8728, a miscompilation I recently introduced. When optimizing
memcpy's like:
  memcpy(A, B)
  memcpy(A, C)

we cannot delete the first memcpy as dead if A and C might be aliases.
If so, we actually get:

  memcpy(A, B)
  memcpy(A, A)

which is not correct to transform into:

  memcpy(A, A)

This patch was heavily influenced by Jakub Staszak's patch in PR8728, thanks
Jakub!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 01:48:06 +00:00
Chris Lattner
72c194a8be add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 01:01:28 +00:00
Rafael Espindola
db74aeadcd Remember the contents of leb and dwarfline fragments when relaxing. This avoids
having to evaluate the expression again when writing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 21:58:52 +00:00
Benjamin Kramer
fd6d53fbad APInt: microoptimize a few methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120912 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 18:05:36 +00:00
Benjamin Kramer
bd7d2622a2 Simplify APInt::getAllOnesValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120911 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 16:37:47 +00:00
Rafael Espindola
5d4918dbd1 There are two reasons why we might want to use
foo = a - b
.long foo
instead of just
.long a - b

First, on darwin9 64 bits the assembler produces the wrong result. Second,
if "a" is the end of the section all darwin assemblers (9, 10 and mc) will not
consider a - b to be a constant but will if the dummy foo is created.

Split how we handle these cases. The first one is something MC should take care
of. The second one has to be handled by the caller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120889 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 03:21:47 +00:00
Michael J. Spencer
470ae13be8 Support/FileSystem: Add status implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 00:32:40 +00:00
Michael J. Spencer
da3aaffcbb Support/SystemError: Make error_category and error_code auto-bool-conversion-safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120869 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 00:32:24 +00:00
Rafael Espindola
767b1be390 Next step: Only pad debug_line when the target is darwin. Add a FIXME to avoid
doing that if the target is darwin10 or newer.

This fixes
*) Direct object emission was producing objects without the workaround on
   darwin9.
*) Assembly printing was producing objects with the workaround on linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 00:31:13 +00:00
Jakob Stoklund Olesen
7a26aca73f Add IntervalMap::iterator::set{Start,Stop,Value} methods that allow limited
editing of the current interval.

These methods may cause coalescing, there are corresponding set*Unchecked
methods for editing without coalescing. The non-coalescing methods are useful
for applying monotonic transforms to all keys or values in a map without
accidentally coalescing transformed and untransformed intervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120829 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 19:02:00 +00:00
Michael J. Spencer
db04b39dad Support/FileSystem: Fix MinGW build. It doesn't have _chsize_s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120826 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 18:48:56 +00:00
Frits van Bommel
af72c62d4b Fix paste-o in ExtractValueInst::getIndexedType() comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120804 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 14:54:33 +00:00
Eric Christopher
481d402ab0 Apparently OS X 10.4 doesn't have __crashreporter_info__.
Try to fix building on the wayback machine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120801 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 07:45:22 +00:00
Rafael Espindola
2df042cb32 Make EmitIntValue more efficient and more like what we do for leb128. The
difference is much smaller (about 0.3s) but significant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120787 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 02:54:21 +00:00
Michael J. Spencer
3cb84ef65d Support/FileSystem: Add unique_file and exists implementations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120776 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 01:21:28 +00:00
Michael J. Spencer
f4e7b167a0 Support/FileSystem: Remove temp_directory_path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 01:21:04 +00:00
Chris Lattner
8d64989275 clarify comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120772 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 01:11:13 +00:00
Rafael Espindola
32a006e606 Try to resolve symbol differences early, and if successful create a plain
data fragment. This reduces the time to assemble the test in 8711 from 60s to
54s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120767 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 00:55:40 +00:00
Devang Patel
5113cdbfff It may not be an option to skip .debug_line if there are file reference in already emitted debug info. So, for now, emit dummy line table entry to make older linker and assemblers happy. This is not a new behavior, original AsmPrinter emitted similar line table entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 00:10:48 +00:00
Devang Patel
ee4854faf3 Use set directive for StartMinusEndExpr.
This is a fix for llvm-gcc-i386-darwin9 buildbot failure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 21:32:30 +00:00
Rafael Espindola
e23930543c Move EmitValueToOffset to the ObjectStreamer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120691 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 05:59:38 +00:00
Rafael Espindola
dedb045c32 Add EmitInstToFragment to the generic object streamer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120690 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 05:44:06 +00:00
Rafael Espindola
6db8a9f3fa The sections that the ELF object writer has to create are very simple and
contain only data. Handle them specially instead of using AddSectionToTheEnd.
This moves a hack from the generic assembler to the elf writer. It is also
a bit faster and should make other improvements easier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 03:09:06 +00:00
Chris Lattner
ec99c90ea5 tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120644 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 01:29:39 +00:00
Devang Patel
6a13ddbd9b If tehre are not any line entry then do not try to emit .debug_line section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 01:17:51 +00:00
Jakob Stoklund Olesen
0613516b16 Implement the first half of LiveDebugVariables.
Scan the MachineFunction for DBG_VALUE instructions, and replace them with a
data structure similar to LiveIntervals. The live range of a DBG_VALUE is
determined by propagating it down the dominator tree until a new DBG_VALUE is
found. When a DBG_VALUE lives in a register, its live range is confined to the
live range of the register's value.

LiveDebugVariables runs before coalescing, so DBG_VALUEs are not artificially
extended when registers are joined.

The missing half will recreate DBG_VALUE instructions from the intervals when
register allocation is complete.

The pass is disabled by default. It can be enabled with the temporary command
line option -live-debug-variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120636 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 00:37:37 +00:00
Rafael Espindola
6566e0a55e Remove unused argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120621 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 22:48:11 +00:00
Rafael Espindola
9f44724be0 Rename temporary symbols if they conflict with artificial symbols created
by the assembler. This was blocking parsing any large .s produced by clang for
example.

Fixes PR8596.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120603 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 20:46:11 +00:00
Michael J. Spencer
7dc7ac3cb2 Support/ADT/Twine: Add toNullTerminatedStringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120600 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 20:37:30 +00:00
Michael J. Spencer
5a7df60619 Support/PathV2: Split PathV2.h into PathV2.h and FileSystem.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120592 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 19:31:48 +00:00
Jay Foad
7a874ddda0 PR5207: Rename overloaded APInt methods set(), clear(), flip() to
setAllBits(), setBit(unsigned), etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120564 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 08:53:58 +00:00
Michael J. Spencer
9cf96e853e Support/PathV2: Remove is_valid. It was only added because Path had it, but
apparently it is unused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120540 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 02:48:43 +00:00
Dan Gohman
552a3c29dc Delete Path::appendSuffix's return value; it wasn't used anywhere, which
is fine since isn't really necessary to check isValid there anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 02:46:41 +00:00
Michael J. Spencer
dbfb56bebd Support/PathV2: Add remove_filename implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120513 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 00:52:28 +00:00
Evan Cheng
3d2125c9db Enable sibling call optimization of libcalls which are expanded during
legalization time. Since at legalization time there is no mapping from
SDNode back to the corresponding LLVM instruction and the return
SDNode is target specific, this requires a target hook to check for
eligibility. Only x86 and ARM support this form of sibcall optimization
right now.
rdar://8707777


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120501 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:55:39 +00:00
Michael J. Spencer
a42cf73c77 Support/PathV2: Implement reverse iteration and parent_path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120496 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:28:07 +00:00
Michael J. Spencer
63c133b67d Support/ADT/StringRef: Add find_last_of.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120495 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:27:35 +00:00