1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

11540 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
2d87d5139b Tell the register allocator about new unused virtual registers.
This allows the allocator to free any resources used by the virtual register,
including physical register assignments.

llvm-svn: 127560
2011-03-13 01:23:11 +00:00
Duncan Sands
0514e10276 Speculatively revert commit 127478 (jsjodin) in an attempt to fix the
llvm-gcc-i386-linux-selfhost and llvm-x86_64-linux-checks buildbots.
The original log entry:
Remove optimization emitting a reference insted of label difference, since
it can create more relocations. Removed isBaseAddressKnownZero method,
because it is no longer used.

llvm-svn: 127540
2011-03-12 13:07:37 +00:00
Jakob Stoklund Olesen
6d02ddbbc3 Include snippets in the live stack interval.
llvm-svn: 127530
2011-03-12 04:25:36 +00:00
Jakob Stoklund Olesen
1f9f236b8a Spill multiple registers at once.
Live range splitting can create a number of small live ranges containing only a
single real use. Spill these small live ranges along with the large range they
are connected to with copies. This enables memory operand folding and maximizes
the spill to fill distance.

Work in progress with known bugs.

llvm-svn: 127529
2011-03-12 04:17:20 +00:00
Jakob Stoklund Olesen
925b25d53d That's it, I am declaring this a failure of the C++03 STL.
There are too many compatibility problems with using mixed types in
std::upper_bound, and I don't want to spend 110 lines of boilerplate setting up
a call to a 10-line function. Binary search is not /that/ hard to implement
correctly.

I tried terminating the binary search with a linear search, but that actually
made the algorithm slower against my expectation. Most live intervals have less
than 4 segments. The early test against endIndex() does pay, and this version is
25% faster than plain std::upper_bound().

llvm-svn: 127522
2011-03-12 01:50:35 +00:00
Cameron Zwarich
39a49276db Fix the GCC test suite issue exposed by r127477, which was caused by stack
protector insertion not working correctly with unreachable code. Since that
revision was rolled out, this test doesn't actual fail before this fix.

llvm-svn: 127497
2011-03-11 21:51:56 +00:00
Owen Anderson
78afadfa5d Teach FastISel to support register-immediate-immediate instructions.
llvm-svn: 127496
2011-03-11 21:33:55 +00:00
Jan Sjödin
b58b9618ce Remove optimization emitting a reference insted of label difference, since it can create more relocations. Removed isBaseAddressKnownZero method, because it is no longer used.
llvm-svn: 127478
2011-03-11 19:37:02 +00:00
Andrew Trick
6aa37a4a2b Replace -dag-chain-limit flag with constant. It has survived a release cycle without being touched, so no longer needs to pollute the hidden-help text.
llvm-svn: 127468
2011-03-11 17:46:59 +00:00
John Wiegley
e1168a569b Fix use of CompEnd predicate to be standards conforming
The existing CompEnd predicate does not define a strict weak order as required
by the C++03 standard; therefore, its use as a predicate to std::upper_bound
is invalid. For a discussion of this issue, see
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#270

This patch replaces the asymmetrical comparison with an iterator adaptor that
achieves the same effect while being strictly standard-conforming by ensuring
an apples-to-apples comparison.

llvm-svn: 127462
2011-03-11 08:54:34 +00:00
Evan Cheng
d5d2d4a158 Avoid replacing the value of a directly stored load with the stored value if the load is indexed. rdar://9117613.
llvm-svn: 127440
2011-03-11 00:48:56 +00:00
Cameron Zwarich
206503113e Add an option to disable critical edge splitting in PHIElimination.
llvm-svn: 127398
2011-03-10 05:59:17 +00:00
Jakob Stoklund Olesen
92652a803f Change the Spiller interface to take a LiveRangeEdit reference.
This makes it possible to register delegates and get callbacks when the spiller
edits live ranges.

llvm-svn: 127389
2011-03-10 01:51:42 +00:00
Jakob Stoklund Olesen
70541686bf Make SpillIs an optional pointer. Avoid creating a bunch of temporary SmallVectors.
llvm-svn: 127388
2011-03-10 01:21:58 +00:00
Evan Cheng
a3a7a7e364 Re-commit 127368 and 127371. They are exonerated.
llvm-svn: 127380
2011-03-10 00:16:32 +00:00
Evan Cheng
d7a2008a55 Revert 127368 and 127371 for now.
llvm-svn: 127376
2011-03-09 23:53:17 +00:00
Evan Cheng
b717770dfe Change the definition of TargetRegisterInfo::getCrossCopyRegClass to be more
flexible.

If it returns a register class that's different from the input, then that's the
register class used for cross-register class copies.
If it returns a register class that's the same as the input, then no cross-
register class copies are needed (normal copies would do).
If it returns null, then it's not at all possible to copy registers of the
specified register class.

llvm-svn: 127368
2011-03-09 22:47:38 +00:00
Jakob Stoklund Olesen
4d0c9d0af7 Make physreg coalescing independent on the number of uses of the virtual register.
The damage done by physreg coalescing only depends on the number of instructions
the extended physreg live range covers. This fixes PR9438.

The heuristic is still luck-based, and physreg coalescing really should be
disabled completely. We need a register allocator with better hinting support
before that is possible.

Convert a test to FileCheck and force spilling by inserting an extra call. The
previous spilling behavior was dependent on misguided physreg coalescing
decisions.

llvm-svn: 127351
2011-03-09 19:27:06 +00:00
Andrew Trick
e529ddb2d7 Improve pre-RA-sched register pressure tracking for duplicate operands.
This helps cases like 2008-07-19-movups-spills.ll, but doesn't have an obvious impact on benchmarks

llvm-svn: 127347
2011-03-09 19:12:43 +00:00
Benjamin Kramer
4cf03850a2 Fix typo, make helper static.
llvm-svn: 127335
2011-03-09 16:19:12 +00:00
Benjamin Kramer
782cb6d68d Remove unused virtual dtor.
llvm-svn: 127331
2011-03-09 14:20:28 +00:00
Matt Beaumont-Gay
3e3b6cc819 Add a virtual dtor to Delegate to silence -Wnon-virtual-dtor
llvm-svn: 127311
2011-03-09 04:02:15 +00:00
Jakob Stoklund Olesen
eec325fc2f Add a LiveRangeEdit::Delegate protocol.
This will we used for keeping register allocator data structures up to date
while LiveRangeEdit is trimming live intervals.

llvm-svn: 127300
2011-03-09 00:57:29 +00:00
Jakob Stoklund Olesen
7905ed6549 Delete dead code.
llvm-svn: 127295
2011-03-09 00:07:39 +00:00
Jakob Stoklund Olesen
b8f5f15468 Delete dead code after rematerializing.
LiveRangeEdit::eliminateDeadDefs() will eventually be used by coalescing,
splitting, and spilling for dead code elimination. It can delete chains of dead
instructions as long as there are no dependency loops.

llvm-svn: 127287
2011-03-08 22:46:11 +00:00
Jakob Stoklund Olesen
b7aa589217 Fix the build for MSVC 9 whose upper_bound() wants to compare elements in the sorted array.
Patch by Olaf Krzikalla!

llvm-svn: 127264
2011-03-08 19:37:54 +00:00
Eric Christopher
d3c7e834e8 Fix some latent bugs if the nodes are unschedulable. We'd gotten away
with this before since none of the register tracking or nightly tests
had unschedulable nodes.

This should probably be refixed with a special default Node that just
returns some "don't touch me" values.

Fixes PR9427

llvm-svn: 127263
2011-03-08 19:35:47 +00:00
Oscar Fuentes
3faa2722ef Revert "Make a comparator's argument `const'. This fixes the build for
MSVC 9."

The "fix" was meaningless.

This reverts commit r127245.

llvm-svn: 127260
2011-03-08 19:26:21 +00:00
Benjamin Kramer
872abcc8a9 Reduce vector reallocations.
llvm-svn: 127254
2011-03-08 17:28:36 +00:00
Oscar Fuentes
27fc386e64 Make a comparator's argument `const'. This fixes the build for MSVC 9.
llvm-svn: 127245
2011-03-08 13:52:07 +00:00
Andrew Trick
fd853e8757 Further improvements to pre-RA-sched=list-ilp.
This change uses the MaxReorderWindow for both height and depth, which
tends to limit the negative effects of high register pressure.

llvm-svn: 127203
2011-03-08 01:51:56 +00:00
Jakob Stoklund Olesen
f9401745e0 Let shrinkToUses optionally return a list of now dead machine instructions.
llvm-svn: 127192
2011-03-07 23:29:10 +00:00
Jakob Stoklund Olesen
158af1f7e9 Make the UselessRegs argument optional in the LiveRangeEdit constructor.
llvm-svn: 127181
2011-03-07 22:42:16 +00:00
Cameron Zwarich
a1920d7f51 Move getRegPressureLimit() from TargetLoweringInfo to TargetRegisterInfo.
llvm-svn: 127175
2011-03-07 21:56:36 +00:00
Jakob Stoklund Olesen
68b2c1d239 Handle the special case of registers begin redefined by early-clobber defs.
In this case, the value need to be available at the load index instead of the
normal use index.

llvm-svn: 127167
2011-03-07 18:56:16 +00:00
Owen Anderson
11a49e845a Use the correct LHS type when determining the legalization of a shift's RHS type.
llvm-svn: 127163
2011-03-07 18:29:47 +00:00
Eric Christopher
1da11eb2ae Typo.
llvm-svn: 127131
2011-03-06 21:13:45 +00:00
NAKAMURA Takumi
6aa6938d66 lib/CodeGen/AsmPrinter/CMakeLists.txt: Fix CMake build, following up to r127099.
llvm-svn: 127114
2011-03-06 00:13:15 +00:00
Andrew Trick
ebbe4680ae Disable a couple of experimental heuristics to get the best results from the current implementation of -pre-RA-sched=list-ilp.
llvm-svn: 127113
2011-03-06 00:03:32 +00:00
Anton Korobeynikov
62e48532b9 Some first rudimentary support for ARM EHABI: print exception table in "text mode".
llvm-svn: 127099
2011-03-05 18:43:15 +00:00
Anton Korobeynikov
c746be3dc4 Add FrameSetup MI flags
llvm-svn: 127098
2011-03-05 18:43:04 +00:00
Jakob Stoklund Olesen
1d0ca5680a Work around a coalescer bug.
The coalescer can in very rare cases leave too large live intervals around after
rematerializing cheap-as-a-move instructions.

Linear scan doesn't really care, but live range splitting gets very confused
when a live range is killed by a ghost instruction.

I will fix this properly in the coalescer after 2.9 branches.

llvm-svn: 127096
2011-03-05 18:33:49 +00:00
Andrew Trick
2451bad445 Be explicit with abs(). Visual Studio workaround.
llvm-svn: 127075
2011-03-05 10:29:25 +00:00
Andrew Trick
dd4a20e7d7 Fix for -sched-high-latency-cycles in sched=list-ilp mode.
llvm-svn: 127071
2011-03-05 09:18:16 +00:00
Andrew Trick
d267891a21 Missing comment.
llvm-svn: 127068
2011-03-05 08:04:11 +00:00
Andrew Trick
7db197d209 Increased the register pressure limit on x86_64 from 8 to 12
regs. This is the only change in this checkin that may affects the
default scheduler. With better register tracking and heuristics, it
doesn't make sense to artificially lower the register limit so much.

Added -sched-high-latency-cycles and X86InstrInfo::isHighLatencyDef to
give the scheduler a way to account for div and sqrt on targets that
don't have an itinerary. It is currently defaults to 10 (the actual
number doesn't matter much), but only takes effect on non-default
schedulers: list-hybrid and list-ilp.

Added several heuristics that can be individually disabled for the
non-default sched=list-ilp mode. This helps us determine how much
better we can do on a given benchmark than the default
scheduler. Certain compute intensive loops run much faster in this
mode with the right set of heuristics, and it doesn't seem to have
much negative impact elsewhere. Not all of the heuristics are needed,
but we still need to experiment to decide which should be disabled by
default for sched=list-ilp.

llvm-svn: 127067
2011-03-05 08:00:22 +00:00
Jakob Stoklund Olesen
52420a0a1e Rework the global split cost calculation.
The global cost is the sum of block frequencies for spill code that must be
inserted because preferences weren't met.

llvm-svn: 127062
2011-03-05 03:28:51 +00:00
Jakob Stoklund Olesen
79944a508a Compute the constraints for global live range splitting from an interference pattern.
This simplifies the code and makes it faster too.

The interference patterns are saved for each candidate register. It will be
reused for actually executing the split. Work in progress.

llvm-svn: 127054
2011-03-05 01:10:31 +00:00
Jim Grosbach
372394916e Teach the register scavenger to take subregs into account when finding a free register.
llvm-svn: 127049
2011-03-05 00:20:19 +00:00
Eric Christopher
94626fc599 Improve readability with some whitespace!
llvm-svn: 127043
2011-03-04 22:47:12 +00:00
Jakob Stoklund Olesen
87b598dd85 Extract a method. No functional change.
llvm-svn: 127040
2011-03-04 22:11:11 +00:00
Jakob Stoklund Olesen
e3b9a00584 Go back to comparing spill weights when deciding if interference can be evicted.
It gives better results. Sometimes, a live range can be large and still have
high spill weight. Such a range should not be spilled.

llvm-svn: 127036
2011-03-04 21:32:50 +00:00
Jakob Stoklund Olesen
8b66caf12a Renumber slot indexes locally when possible.
Initially, slot indexes are quad-spaced. There is room for inserting up to 3
new instructions between the original instructions.

When we run out of indexes between two instructions, renumber locally using
double-spaced indexes. The original quad-spacing means that we catch up quickly,
and we only have to renumber a handful of instructions to get a monotonic
sequence. This is much faster than renumbering the whole function as we did
before.

llvm-svn: 127023
2011-03-04 19:43:38 +00:00
Jakob Stoklund Olesen
d99d8cfdf0 Number SlotIndexes uniformly without looking at the number of defs on each instruction.
You can't really predict how many indexes will be needed from the number of
defs, so let's keep it simple.

Also remove an extra empty index that was inserted after each basic block. It
was intended for live-out ranges, but it was never used that way.

llvm-svn: 127014
2011-03-04 18:51:09 +00:00
Jakob Stoklund Olesen
dfc9b0b15f Add SlotIndex statistics.
llvm-svn: 127007
2011-03-04 18:08:29 +00:00
Jakob Stoklund Olesen
c3193f4aa8 Tweak debug output. No functional changes.
llvm-svn: 127006
2011-03-04 18:08:26 +00:00
Duncan Sands
f6c9de94f8 Revert commit 126684 "Use the correct shift amount type". It is only the correct
type after type legalization has completed.  Before then it may simply not be big
enough to hold the shift amount, particularly on x86 which uses a very small type
for shifts (this issue broke stuff in the past which is why LegalizeTypes carefully
uses a large type for shift amounts).

llvm-svn: 127000
2011-03-04 14:28:59 +00:00
Andrew Trick
1478921dc0 Minor pre-RA-sched fixes and cleanup.
Fix the PendingQueue, then disable it because it's not required for
the current schedulers' heuristics.
Fix the logic for the unused list-ilp scheduler.

llvm-svn: 126981
2011-03-04 02:03:45 +00:00
Jakob Stoklund Olesen
3c64ea5ad2 Precompute block frequencies, pow() isn't free.
llvm-svn: 126975
2011-03-04 00:58:40 +00:00
Jakob Stoklund Olesen
5bc7a96cca Use an IndexedMap instead of a DenseMap for the live-out cache.
This speeds up updateSSA() so it only accounts for 5% of the live range
splitting time.

llvm-svn: 126972
2011-03-04 00:15:36 +00:00
Bill Wendling
6e6a0422eb There are times when the landing pad won't have a call to 'eh.selector' in
it. It's been assumed up til now that it would be in its immediate
successor. However, this isn't necessarily the case. It could be in one of its
successor's successors.

Modify the code to more thoroughly check for an 'eh.selector' call in
successors. It only looks at a successor if we get there as a result of an
unconditional branch.

Testcase ObjC/exceptions-4.m in r126968.

llvm-svn: 126969
2011-03-03 23:14:05 +00:00
Eli Friedman
26f5c96de3 Revert r123908; the code in question is completely untested and wrong.
llvm-svn: 126964
2011-03-03 22:33:23 +00:00
Devang Patel
a7b5a00033 Fix typo.
llvm-svn: 126962
2011-03-03 21:49:41 +00:00
Devang Patel
3c2bd93f9e Fix thinko in previous check-in.
Add comment.

llvm-svn: 126959
2011-03-03 20:08:10 +00:00
Devang Patel
4adbb350be llvm::Function argument count is not a good indicator of how many arugments does the function have at source level. If we need more space, just resize vector conservatively. This vector is only used once per function.
llvm-svn: 126957
2011-03-03 20:02:02 +00:00
Jim Grosbach
e4ef37b298 Allow a target to choose whether to prefer the scavenger emergency spill slot
be next to the frame pointer or the stack pointer.

llvm-svn: 126956
2011-03-03 20:01:52 +00:00
Jakob Stoklund Olesen
3511ad1023 Renumber slot indexes uniformly instead of spacing according to the number of defs.
There are probably much larger speedups to be had by renumbering locally instead
of looping over the whole function. For now, the greedy register allocator is
25% faster.

llvm-svn: 126926
2011-03-03 06:29:01 +00:00
Jakob Stoklund Olesen
d0930e03c1 Represent sentinel slot indexes with a null pointer.
This is much faster than using a pointer to a ManagedStatic object accessed with
a function call. The greedy register allocator is 5% faster overall just from
the SlotIndex default constructor savings.

llvm-svn: 126925
2011-03-03 05:40:04 +00:00
Jakob Stoklund Olesen
2e6407e9aa Avoid comparing invalid slot indexes, and assert that it doesn't happen.
The SlotIndex created by the default construction does not represent a position
in the function, and it doesn't make sense to compare it to other indexes.

llvm-svn: 126924
2011-03-03 05:18:19 +00:00
Jakob Stoklund Olesen
92d724fb69 Avoid comparing invalid slot indexes.
llvm-svn: 126922
2011-03-03 04:23:52 +00:00
Jakob Stoklund Olesen
2759a169ea Cache basic block bounds instead of asking SlotIndexes::getMBBRange all the time.
This speeds up the greedy register allocator by 15%.
DenseMap is not as fast as one might hope.

llvm-svn: 126921
2011-03-03 03:41:29 +00:00
Jakob Stoklund Olesen
09a1939164 Change the SplitEditor interface to a single instance can be shared for multiple splits.
llvm-svn: 126912
2011-03-03 01:29:13 +00:00
Jakob Stoklund Olesen
df789f852e Only run the updateSSA loop when we have actually seen multiple values.
When only a single value has been seen, new PHIDefs are never needed.

llvm-svn: 126911
2011-03-03 01:29:10 +00:00
Jakob Stoklund Olesen
31949ff3f8 Fix PHI handling in LiveIntervals::shrinkToUses().
We need to wait until we meet a PHIDef in its defining block before resurrecting
PHIKills in the predecessors.

This should unbreak the llvm-gcc-build-x86_64-darwin10-x-mingw32-x-armeabi bot.

llvm-svn: 126905
2011-03-03 00:20:51 +00:00
Bob Wilson
42e5d02b10 Avoid exponential blow-up when printing DAGs.
David Greene changed CannotYetSelect() to print the full DAG including multiple
copies of operands reached through different paths in the DAG.  Unfortunately
this blows up exponentially in some cases.  The depth limit of 100 is way too
high to prevent this -- I'm seeing a message string of 150MB with a depth of
only 40 in one particularly bad case, even though the DAG has less than 200
nodes.  Part of the problem is that the printing code is following chain
operands, so if you fail to select an operation with a chain, the printer will
follow all the chained operations back to the entry node.

llvm-svn: 126899
2011-03-02 23:38:06 +00:00
Jakob Stoklund Olesen
c5dc2c61fc Turn the Edit member into a pointer so it can change dynamically.
No functional change.

llvm-svn: 126898
2011-03-02 23:31:50 +00:00
Jakob Stoklund Olesen
9697ef837c Transfer simply defined values directly without recomputing liveness and SSA.
Values that map to a single new value in a new interval after splitting don't
need new PHIDefs, and if the parent value was never rematerialized the live
range will be the same.

llvm-svn: 126894
2011-03-02 23:05:19 +00:00
Jakob Stoklund Olesen
22469169cd Extract a method. No functional change.
llvm-svn: 126893
2011-03-02 23:05:16 +00:00
Stuart Hastings
a40e563e4e Can't introduce floating-point immediate constants after legalization.
Radar 9056407.

llvm-svn: 126864
2011-03-02 19:36:30 +00:00
Cameron Zwarich
bb1d033824 Fix some typos.
llvm-svn: 126829
2011-03-02 04:03:46 +00:00
Jakob Stoklund Olesen
6751d65fd6 Move extendRange() into SplitEditor and delete the LiveRangeMap class.
Extract the updateSSA() method from the too long extendRange().

LiveOutCache can be shared among all the new intervals since there is at most
one of the new ranges live out from each basic block.

llvm-svn: 126818
2011-03-02 01:59:34 +00:00
Nick Lewycky
6ad594dd20 Quiet a compiler warning about unused variable 'ExtVNI'.
llvm-svn: 126815
2011-03-02 01:43:30 +00:00
Evan Cheng
5275ba7f98 Catch more cases where 2-address pass should 3-addressify instructions. rdar://9002648.
llvm-svn: 126811
2011-03-02 01:08:17 +00:00
Jakob Stoklund Olesen
a6fd3b66b0 Rename mapValue to extendRange because that is its function now.
Simplify the signature - The return value and ParentVNI are no longer needed.

llvm-svn: 126809
2011-03-02 00:49:28 +00:00
Jakob Stoklund Olesen
200a74580c Simplify LiveIntervals::shrinkToUses() a bit by using the new extendInBlock().
llvm-svn: 126806
2011-03-02 00:33:03 +00:00
Jakob Stoklund Olesen
be281bb02c Fix typo.
llvm-svn: 126805
2011-03-02 00:33:01 +00:00
Jakob Stoklund Olesen
4d3c996555 Move LiveIntervalMap::extendTo into LiveInterval itself.
This method could probably be used by LiveIntervalAnalysis::shrinkToUses, and
now it can use extendIntervalEndTo() which coalesces ranges.

llvm-svn: 126803
2011-03-02 00:06:15 +00:00
Jakob Stoklund Olesen
4f3da0eab4 Delete dead code.
llvm-svn: 126801
2011-03-01 23:24:19 +00:00
Jakob Stoklund Olesen
15d9bf0424 Move the value map from LiveIntervalMap to SplitEditor.
The value map is currently not used, all values are 'complex mapped' and
LiveIntervalMap::mapValue is used to dig them out.

This is the first step in a series changes leading to the removal of
LiveIntervalMap. Its data structures can be shared among all the live intervals
created by a split, so it is wasteful to create a copy for each.

llvm-svn: 126800
2011-03-01 23:14:53 +00:00
Jakob Stoklund Olesen
13b552560b Delete dead code.
Local live range splitting is better driven by interference. This code was just
guessing.

llvm-svn: 126799
2011-03-01 23:14:50 +00:00
Jakob Stoklund Olesen
36e4edd585 Drop RAGreedy::trySpillInterferences().
This is a waste of time since we already know how to evict all interferences
which is a better approach anyway.

llvm-svn: 126798
2011-03-01 23:14:48 +00:00
Devang Patel
8233c58f5d If argument numbering is encoded in metadata then emit arguments' debug info in that order.
llvm-svn: 126794
2011-03-01 22:58:55 +00:00
Jakob Stoklund Olesen
ef6bec1ff5 Keep track of which stage produced a live range, and bypass earlier stages when revisiting.
This effectively disables the 'turbo' functionality of the greedy register
allocator where all new live ranges created by splitting would be reconsidered
as if they were originals.

There are two reasons for doing this, 1. It guarantees that the algorithm
terminates. Early versions were prone to infinite looping in certain corner
cases. 2. It is a 2x speedup. We can skip a lot of unnecessary interference
checks that won't lead to good splitting anyway.

The problem is that region splitting only gets one shot, so it should probably
be changed to target multiple physical registers at once.

Local live range splitting is still 'turbo' enabled. It only accounts for a
small fraction of compile time, so it is probably not necessary to do anything
about that.

llvm-svn: 126781
2011-03-01 21:10:07 +00:00
Duncan Sands
b0cd2d9a1e Add a few missed unary cases when legalizing vector results. Put some cases
in alphabetical order.

llvm-svn: 126745
2011-03-01 15:15:43 +00:00
Jim Grosbach
3b72823981 trailing whitespace.
llvm-svn: 126733
2011-03-01 01:39:05 +00:00
Jim Grosbach
fbdcd70f4b Generalize the register matching code in DAGISel a bit.
llvm-svn: 126731
2011-03-01 01:37:19 +00:00
Owen Anderson
22d34c260e Use the correct shift amount type.
llvm-svn: 126684
2011-02-28 21:10:10 +00:00
Owen Anderson
1614a324d9 Clean whitespace.
llvm-svn: 126683
2011-02-28 20:57:56 +00:00
Dan Gohman
91de965338 Delete the GEPSplitter experiment.
llvm-svn: 126671
2011-02-28 19:47:47 +00:00
Stuart Hastings
539d4e1460 Support for byval parameters on ARM. Will be enabled by a forthcoming
patch to the front-end.  Radar 7662569.

llvm-svn: 126655
2011-02-28 17:17:53 +00:00
Duncan Sands
b6f7dcb996 Legalize support for fpextend of vector. PR9309.
llvm-svn: 126574
2011-02-27 14:41:27 +00:00
Nadav Rotem
961627db07 Fix typos in the comments.
llvm-svn: 126565
2011-02-27 07:40:43 +00:00
Tobias Grosser
789fab6b30 Pass the graph to the DOTGraphTraits.getEdgeAttributes().
This follows the interface of getNodeAttributes.

llvm-svn: 126562
2011-02-27 04:11:03 +00:00
Benjamin Kramer
412ffed4f0 Add some DAGCombines for (adde 0, 0, glue), which are useful to optimize legalized code for large integer arithmetic.
1. Inform users of ADDEs with two 0 operands that it never sets carry
2. Fold other ADDs or ADDCs into the ADDE if possible

It would be neat if we could do the same thing for SETCC+ADD eventually, but we can't do that in target independent code.

llvm-svn: 126557
2011-02-26 22:48:07 +00:00
Jim Grosbach
d3d3996a4a Trailing whitespace.
llvm-svn: 126526
2011-02-25 22:53:20 +00:00
Owen Anderson
bd26993873 Allow targets to specify a the type of the RHS of a shift parameterized on the type of the LHS.
llvm-svn: 126518
2011-02-25 21:41:48 +00:00
Cameron Zwarich
974208a607 Roll out r126425 and r126450 to see if it fixes the failures on the buildbots.
llvm-svn: 126488
2011-02-25 16:30:32 +00:00
Jim Grosbach
61c746f927 Fix formatting of debug helper string.
llvm-svn: 126471
2011-02-25 03:59:03 +00:00
Cameron Zwarich
1a975ff395 Set NumSignBits to 1 if KnownZero/KnownOne are being zero extended. In theory it
is possible to do better if the high bit is set in either KnownZero/KnownOne, but
in practice NumSignBits is always 1 when we are zero extending because nothing
is known about that register.

llvm-svn: 126465
2011-02-25 01:11:01 +00:00
Cameron Zwarich
aa61fbeebb We only want to zero extend the existing information if the bit width is
actually larger.

llvm-svn: 126464
2011-02-25 01:10:55 +00:00
Jakob Stoklund Olesen
9d328484ce Try harder to get the hint by preferring to evict hint interference.
llvm-svn: 126463
2011-02-25 01:04:22 +00:00
Jakob Stoklund Olesen
4790d4c74b Tweak the register allocator priority queue some more.
New live ranges are assigned in long -> short order, but live ranges that have
been evicted at least once are deferred and assigned in short -> long order.

Also disable splitting and spilling for live ranges seen for the first time.

The intention is to create a realistic interference pattern from the heavy live
ranges before starting splitting and spilling around it.

llvm-svn: 126451
2011-02-24 23:21:36 +00:00
Nick Lewycky
35539486f0 Remove dead variable.
llvm-svn: 126450
2011-02-24 23:15:43 +00:00
Devang Patel
f2b2417c2c Enable DebugInfo support for COFF object files.
Patch by Nathan Jeffords!

llvm-svn: 126425
2011-02-24 21:04:00 +00:00
Nadav Rotem
ab7cf630f4 Enable support for vector sext and trunc:
Limit the folding of any_ext and sext  into the load operation to scalars.
Limit the active-bits trunc optimization to scalars.
Document vector trunc and vector sext in LangRef.

Similar to commit 126080 (for enabling zext).

llvm-svn: 126424
2011-02-24 21:01:34 +00:00
Rafael Espindola
3a1fd70006 Fix llvm-gcc bootstrap with gnu ld.
The problem was codegen guessing the wrong values and printing

	.section	.eh_frame,"aMS",@progbits,4

It is not clear at all if Codegen should try to guess, MC is the
one that should know the default flags.

llvm-svn: 126421
2011-02-24 20:18:01 +00:00
Devang Patel
e0f113c206 Do not use DIFactory.
llvm-svn: 126397
2011-02-24 18:49:30 +00:00
Cameron Zwarich
724eb8706a Merge information about the number of zero, one, and sign bits of live-out
registers at phis. This enables us to eliminate a lot of pointless zexts during
the DAGCombine phase. This fixes <rdar://problem/8760114>.

llvm-svn: 126380
2011-02-24 10:00:25 +00:00
Cameron Zwarich
af4779907f Add a getNumSignBits() method to APInt.
llvm-svn: 126379
2011-02-24 10:00:20 +00:00
Cameron Zwarich
e79a75febe Add a mechanism for invalidating the LiveOutInfo of a PHI, and use it whenever
a block is visited before all of its predecessors.

llvm-svn: 126378
2011-02-24 10:00:16 +00:00
Cameron Zwarich
5c9384705f Track blocks visited in reverse postorder.
llvm-svn: 126377
2011-02-24 10:00:13 +00:00
Cameron Zwarich
3d2f99227a Refactor the LiveOutInfo interface into a few methods on FunctionLoweringInfo
and make the actual map private.

llvm-svn: 126376
2011-02-24 10:00:08 +00:00
Cameron Zwarich
e49bf60392 Have isel visit blocks in reverse postorder rather than an undefined order. This
allows for the information propagated across basic blocks to be merged at phis.

llvm-svn: 126375
2011-02-24 10:00:04 +00:00
Jakob Stoklund Olesen
0f1be641db Use the same spill slot for all live ranges that descend form the same original
register.

This avoids some silly stack slot shuffling when both sides of a copy get
spilled.

llvm-svn: 126353
2011-02-24 01:07:55 +00:00
Devang Patel
e8ade74a52 Use DW_FORM_data2 for DW_AT_language and let users use DW_LANG_lo_user=0x8000 to DW_LANG_hi_user=0xffff range.
llvm-svn: 126339
2011-02-23 22:37:04 +00:00
Jakob Stoklund Olesen
5edc1f287b It is safe to ignore LastSplitPoint when the variable is not live out.
No code will be inserted after the split point anyway.

llvm-svn: 126319
2011-02-23 18:26:31 +00:00
Stuart Hastings
c0c38e8673 Omit private_extern declarations of extern symbols; followup to
r124468.  Patch by Rafael Avila de Espindola!

llvm-svn: 126297
2011-02-23 02:27:05 +00:00
Jakob Stoklund Olesen
17add01160 Keep track of how many times a live range has been dequeued, and prioritize new ranges.
When a large live range is evicted, it will usually be split when it comes
around again. By deferring evicted live ranges, the splitting happens at a time
when the interference pattern is more realistic. This prevents repeated
splitting and evictions.

llvm-svn: 126282
2011-02-23 00:56:56 +00:00
Jakob Stoklund Olesen
18a19b665c Fix a bug in determining if there is only a single interfering register.
llvm-svn: 126277
2011-02-23 00:29:55 +00:00
Jakob Stoklund Olesen
58efee5c3e Be more aggressive about evicting interference.
Use interval sizes instead of spill weights to determine if it is legal to evict
interference. A smaller interval can evict interference if all interfering live
ranges are larger.

Allow multiple interferences to be evicted as along as they are all larger than
the live range being allocated.

Spill weights are still used to select the preferred eviction candidate.

llvm-svn: 126276
2011-02-23 00:29:52 +00:00
Jakob Stoklund Olesen
505c6fac89 Change the RAGreedy register assignment order so large live ranges are allocated first.
This is based on the observation that long live ranges are more difficult to
allocate, so there is a better chance of solving the puzzle by handling the big
pieces first. The allocator will evict and split long alive ranges when they get
in the way.

RABasic is still using spill weights for its priority queue, so the interface to
the queue has been virtualized.

llvm-svn: 126259
2011-02-22 23:01:52 +00:00
Jakob Stoklund Olesen
5b9699abdd 80 Col.
llvm-svn: 126258
2011-02-22 23:01:49 +00:00
Cameron Zwarich
bde7e8b3e0 MachineConstantPoolValues are not uniqued, so they need to be freed if they
share entries. Add a DenseSet to MachineConstantPool for the MachineCPVs that
it owns.

This will hopefully fix the MC/ARM/elf-reloc-01.ll failure on the leaks bots.

llvm-svn: 126218
2011-02-22 08:54:30 +00:00
Andrew Trick
ec08eae0aa VirtRegRewriter assertion fix.
Apparently it's ok for multiple operands to "kill" the same register.
Fixes PR9237.

llvm-svn: 126190
2011-02-22 06:52:56 +00:00
Cameron Zwarich
c942ffcae4 Roll out r126169 and r126170 in an attempt to fix the selfhost bot.
llvm-svn: 126185
2011-02-22 03:24:52 +00:00
Cameron Zwarich
63ed1f4c67 Merge information about the number of zero, one, and sign bits of live-out registers
at phis. This enables us to eliminate a lot of pointless zexts during the DAGCombine
phase. This fixes <rdar://problem/8760114>.

llvm-svn: 126170
2011-02-22 00:46:27 +00:00
Cameron Zwarich
939fceef5b Have isel visit blocks in reverse postorder rather than an undefined order. This
allows for the information propagated across basic blocks to be merged at phis.

llvm-svn: 126169
2011-02-22 00:46:22 +00:00
Eric Christopher
de9e3eaf5f Revert r125960, it's breaking darwin10 bootstrap.
llvm-svn: 126163
2011-02-21 23:52:19 +00:00
Evan Cheng
f5f2a92f8f Add more debugging output.
llvm-svn: 126158
2011-02-21 23:39:48 +00:00
Devang Patel
d5c4589795 Revert r124611 - "Keep track of incoming argument's location while emitting LiveIns."
In other words, do not keep track of argument's location.  The debugger (gdb) is not prepared to see line table entries for arguments. For the debugger, "second" line table entry marks beginning of function body.
This requires some coordination with debugger to get this working. 
 - The debugger needs to be aware of prolog_end attribute attached with line table entries.
 - The compiler needs to accurately mark prolog_end in line table entries (at -O0 and at -O1+)

llvm-svn: 126155
2011-02-21 23:21:26 +00:00
Jakob Stoklund Olesen
508829f1d1 Add SplitKit::isOriginalEndpoint and use it to force live range splitting to terminate.
An original endpoint is an instruction that killed or defined the original live
range before any live ranges were split.

When splitting global live ranges, avoid creating local live ranges without any
original endpoints. We may still create global live ranges without original
endpoints, but such a range won't be split again, and live range splitting still
terminates.

llvm-svn: 126151
2011-02-21 23:09:46 +00:00
Stuart Hastings
d7ca2e5b61 Fix to correctly support attribute((section("__DATA, __common"))).
Radar 9012638.

llvm-svn: 126127
2011-02-21 17:27:17 +00:00
Nadav Rotem
1660c0bc25 Fix 9267; Add vector zext support.
The DAGCombiner folds the zext into complex load instructions. This patch
prevents this optimization on vectors since none of the supported targets
knows how to perform load+vector_zext in one instruction.

llvm-svn: 126080
2011-02-20 12:37:50 +00:00
Devang Patel
d7aee67937 Do not emit empty DW_TAG_lexical_block DIEs. In one test case, size of debug info reduced by almost 7%.
llvm-svn: 126009
2011-02-19 01:31:27 +00:00
Jakob Stoklund Olesen
e2833bf683 Give SplitAnalysis a VRM member to access VirtRegMap::getOriginal().
llvm-svn: 126005
2011-02-19 00:53:42 +00:00
Jakob Stoklund Olesen
45ba3718d4 Missed member rename for naming convention.
llvm-svn: 126003
2011-02-19 00:42:33 +00:00
Jakob Stoklund Olesen
69bc9ac5f7 This method belonged in VirtRegMap.
llvm-svn: 126002
2011-02-19 00:38:43 +00:00
Jakob Stoklund Olesen
6d746aa534 Separate timers for local and global splitting.
llvm-svn: 126001
2011-02-19 00:38:40 +00:00
Devang Patel
d63bce18da Do not lose debug info of an inlined function argument even if the argument is only used through GEPs.
This time with a fix that avoids using invalidated DenseMap iterator.

llvm-svn: 125984
2011-02-18 22:43:42 +00:00
Jakob Stoklund Olesen
0dd5f07ac0 Use VirtRegMap's Virt2SplitMap to keep track of the original live range before splitting.
All new virtual registers created for spilling or splitting point back to their original.

llvm-svn: 125980
2011-02-18 22:35:20 +00:00