1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

10415 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
a94deec1c0 Revert r111394. It was too aggressive.
We must complete the DFS, otherwise we might miss needed phi-defs, and
prematurely color live ranges with a non-dominating value.

This is not a big deal since we get to color more of the CFG and the next
mapValue call will be faster.

llvm-svn: 111397
2010-08-18 20:06:05 +00:00
Jakob Stoklund Olesen
221c0b3c75 Aggressively prune the DFS when inserting phi-defs.
llvm-svn: 111394
2010-08-18 19:00:11 +00:00
Jakob Stoklund Olesen
b6491ab1f6 Add the LiveIntervalMap class. Don't hook it up yet.
LiveIntervalMap maps values from a parent LiveInterval to a child interval that
is a strict subset. It will create phi-def values as needed to preserve the
VNInfo SSA form in the child interval.

This leads to an algorithm very similar to the one in SSAUpdaterImpl.h, but with
enough differences that the code can't be reused:

- We don't need to manipulate PHI instructions.
- LiveIntervals have kills.
- We have MachineDominatorTree.
- We can use df_iterator.

llvm-svn: 111393
2010-08-18 19:00:08 +00:00
Bill Wendling
a055bae65f Improve whitespace.
llvm-svn: 111384
2010-08-18 18:41:13 +00:00
Jim Grosbach
b517fe948f Add hook for re-using virtual base registers for local stack slot access.
Nothing fancy, just ask the target if any currently available base reg
is in range for the instruction under consideration and use the first one
that is. Placeholder ARM implementation simply returns false for now.

ongoing saga of rdar://8277890

llvm-svn: 111374
2010-08-18 17:57:37 +00:00
Jakob Stoklund Olesen
32dcf0e7a9 Preserve subregs on PHI source operands. Patch by Krister Wombell!
llvm-svn: 111366
2010-08-18 16:09:47 +00:00
Jim Grosbach
ff8f931bbf Add materialization of virtual base registers for frame indices allocated into
the local block. Resolve references to those indices to a new base register.
For simplification and testing purposes, a new virtual base register is
allocated for each frame index being resolved. The result is truly horrible,
but correct, code that's good for exercising the new code paths.

Next up is adding thumb1 support, which should be very simple. Following that
will be adding base register re-use and implementing a reasonable ARM
heuristic for when a virtual base register should be generated at all.

llvm-svn: 111315
2010-08-17 22:41:55 +00:00
Dale Johannesen
535ca58e85 Make fast scheduler handle asm clobbers correctly.
PR 7882.  Follows suggestion by Amaury Pouly, thanks.

llvm-svn: 111306
2010-08-17 22:17:24 +00:00
Evan Cheng
aea9870136 PHI elimination shouldn't require machineloopinfo since it's used at -O0. Move the requirement to LiveIntervalAnalysis instead. Note this does not change the number of times machineloopinfo is computed.
llvm-svn: 111285
2010-08-17 21:00:37 +00:00
Evan Cheng
4cbb884ce2 Machine CSE preserves CFG. Pass manager was freeing machineloopinfo after machine cse before.
llvm-svn: 111281
2010-08-17 20:57:42 +00:00
Jim Grosbach
23003dc92f silence warning
llvm-svn: 111274
2010-08-17 20:21:30 +00:00
Jim Grosbach
4597437c58 Add hook to examine an instruction referencing a frame index to determine
whether to allocate a virtual frame base register to resolve the frame
index reference in it. Implement a simple version for ARM to aid debugging.

In LocalStackSlotAllocation, scan the function for frame index references
to local frame indices and ask the target whether to allocate virtual
frame base registers for any it encounters. Purely infrastructural for
debug output. Next step is to actually allocate base registers, then add
intelligent re-use of them.

rdar://8277890

llvm-svn: 111262
2010-08-17 18:13:53 +00:00
Evan Cheng
4223d274ca Move the decision logic whether it's a good idea to split a critical edge to clients. Also fixed an erroneous check. An edge is only a back edge when the from and to blocks are in the same loop.
llvm-svn: 111256
2010-08-17 17:43:50 +00:00
Evan Cheng
677a57e76a Fix debug message.
llvm-svn: 111250
2010-08-17 17:15:14 +00:00
Eric Christopher
2bf87a1c77 Fix typo.
llvm-svn: 111223
2010-08-17 01:30:33 +00:00
Evan Cheng
0163d059e4 PHI elimination should not break back edge. It can cause some significant code placement issues. rdar://8263994
good:
LBB0_2:
  mov     r2, r0
  . . .
  mov     r1, r2
  bne     LBB0_2

bad:
LBB0_2:
  mov     r2, r0
  . . .
@ BB#3:
  mov     r1, r2
  b       LBB0_2

llvm-svn: 111221
2010-08-17 01:20:36 +00:00
Jim Grosbach
9e252e854d tidy up. remove unused local.
llvm-svn: 111206
2010-08-16 23:26:09 +00:00
Jim Grosbach
ea414d3999 Better handle alignment requirements for local objects in pre-regalloc frame
mapping. Have the local block track its alignment requirement, and then
apply that when the block itself is allocated. Previously, offsets could
get adjusted in PEI to be different, relative to one another, than the
block allocation thought they would be, which defeats the point of doing
the allocation this way. Continuing rdar://8277890

llvm-svn: 111197
2010-08-16 22:30:41 +00:00
Eli Friedman
fb8b05726f Until uleb/sleb are MC-ized, add a hack to make them work with ELF object
emission.

llvm-svn: 111177
2010-08-16 20:08:40 +00:00
Jim Grosbach
33f86ffe9f track local frame size in MFI, not local to the pass, since PEI needs it.
llvm-svn: 111164
2010-08-16 18:06:15 +00:00
Jakob Stoklund Olesen
c3183a6ad4 Remove unused functions.
llvm-svn: 111156
2010-08-16 17:18:20 +00:00
Ted Kremenek
8091488511 Update CMake build.
llvm-svn: 111063
2010-08-14 01:55:09 +00:00
Jim Grosbach
a4d3174cba Add a local stack object block allocation pass. This is still an
experimental pass that allocates locals relative to one another before
register allocation and then assigns them to actual stack slots as a block
later in PEI. This will eventually allow targets with limited index offset
range to allocate additional base registers (not just FP and SP) to
more efficiently reference locals, as well as handle situations where
locals cannot be referenced via SP or FP at all (dynamic stack realignment
together with variable sized objects, for example). It's currently
incomplete and almost certainly buggy. Work in progress.

Disabled by default and gated via the -enable-local-stack-alloc command
line option.

rdar://8277890

llvm-svn: 111059
2010-08-14 00:15:52 +00:00
Jakob Stoklund Olesen
44b77ea344 Clean up the Spiller.h interface.
The earliestStart argument is entirely specific to linear scan allocation, and
can be easily calculated by RegAllocLinearScan.

Replace std::vector with SmallVector.

llvm-svn: 111055
2010-08-13 22:56:53 +00:00
Jakob Stoklund Olesen
70604cb116 Implement splitting inside a single block.
When a live range is contained a single block, we can split it around
instruction clusters. The current approach is very primitive, splitting before
and after the largest gap between uses.

llvm-svn: 111043
2010-08-13 21:18:48 +00:00
Jim Grosbach
4f58c74300 tidy up whitespace a bit
llvm-svn: 111019
2010-08-13 16:55:08 +00:00
Jakob Stoklund Olesen
d802c303fd Let LiveInterval::addRange extend existing ranges, it will verify that value
numbers match. The old check could accidentally leave holes in openli.

Also let useIntv add all ranges for the phi-def value inserted by
enterIntvAtEnd. This works as long at the value mapping is established in
enterIntvAtEnd.

llvm-svn: 110995
2010-08-13 01:05:26 +00:00
Jakob Stoklund Olesen
7bac4bf66d Remember to actually update SplitAnalysis statistics now that we have a fancy
function to do it.

llvm-svn: 110994
2010-08-13 01:05:23 +00:00
Jakob Stoklund Olesen
2dc2440b42 Handle an empty dupli.
This can happen if the original interval has been broken into two disconnected
parts. Ideally, we should be able to detect when the graph is disconnected and
create separate intervals, but that code is not implemented yet.

Example:

Two basic blocks are both branching to a loop header. Our interval is defined in
both basic blocks, and live into the loop along both edges.

We decide to split the interval around the loop. The interval is split into an
inside part and an outside part. The outside part now has two disconnected
segments, one in each basic block.

If we later decide to split the outside interval into single blocks, we get one
interval per basic block and an empty dupli for the remainder.

llvm-svn: 110976
2010-08-12 23:02:57 +00:00
Jakob Stoklund Olesen
f8957964f7 Update the SplitAnalysis statistics as uses are moved from curli to the new
split intervals. THis means the analysis can be used for multiple splits as long
as curli doesn't shrink.

llvm-svn: 110975
2010-08-12 23:02:55 +00:00
Jakob Stoklund Olesen
1337aa8e38 Also recompute HasPHIKill flags in LiveInterval::RenumberValues.
If a phi-def value were removed from the interval, the phi-kill flags are no
longer valid.

llvm-svn: 110949
2010-08-12 20:38:03 +00:00
Jakob Stoklund Olesen
cbb21e8c0e Remove trailing whitespace.
llvm-svn: 110944
2010-08-12 20:01:23 +00:00
Jakob Stoklund Olesen
d3e41f910a Clean up debug output.
llvm-svn: 110940
2010-08-12 18:50:55 +00:00
Jakob Stoklund Olesen
886eebfa6f Implement single block splitting.
Before spilling a live range, we split it into a separate range for each basic
block where it is used. That way we only get one reload per basic block if the
new smaller ranges can allocate to a register.

This type of splitting is already present in the standard spiller.

llvm-svn: 110934
2010-08-12 17:07:14 +00:00
Jakob Stoklund Olesen
ccf528b792 Fix a FIXME. The SlotIndex::Slot enum should be private.
llvm-svn: 110826
2010-08-11 16:50:17 +00:00
Bill Wendling
c8117e507d Turn optimize compares back on with fix. We needed to test that a machine op was
a register before checking if it was defined.

llvm-svn: 110733
2010-08-10 21:38:11 +00:00
Jakob Stoklund Olesen
e0262a6e24 Give up on register class recalculation when the register is used with subreg
operands. We don't currently have a hook to provide "the largest super class of
A where all registers' getSubReg(subidx) is valid and in B".

llvm-svn: 110730
2010-08-10 21:16:16 +00:00
Dan Gohman
9abea56ce4 Revert r110718; it broke clang-i386-darwin9.
llvm-svn: 110726
2010-08-10 20:49:33 +00:00
Jakob Stoklund Olesen
6036d58c40 Avoid editing the current live interval during remat.
The live interval may be used for a spill slot as well, and that spill slot
could be shared by split registers. We cannot shrink it, even if we know the
current register won't need the spill slot in that range.

llvm-svn: 110721
2010-08-10 20:45:07 +00:00
Jakob Stoklund Olesen
d3f939d7a2 More debug spew
llvm-svn: 110720
2010-08-10 20:45:01 +00:00
Bill Wendling
0acc8f8a02 Turn optimize cmps on by default so that we can get some testing by the nightly
ARM testers.

llvm-svn: 110718
2010-08-10 20:23:02 +00:00
Devang Patel
9b12559c4f Do not forget debug info for enums. Use named mdnode to keep track of these types.
llvm-svn: 110712
2010-08-10 20:01:20 +00:00
Jakob Stoklund Olesen
245a1faf76 Implement register class inflation.
When splitting a live range, the new registers have fewer uses and the
permissible register class may be less constrained. Recompute the register class
constraint from the uses of new registers created for a split. This may let them
be allocated from a larger set, possibly avoiding a spill.

llvm-svn: 110703
2010-08-10 18:37:40 +00:00
Jakob Stoklund Olesen
e51a747336 Recalculate the spill weight and allocation hint for virtual registers created
during live range splitting.

llvm-svn: 110686
2010-08-10 17:07:22 +00:00
Devang Patel
84f48b5483 Handle TAG_constant for integers.
llvm-svn: 110656
2010-08-10 07:11:13 +00:00
Bill Wendling
eb1b0564a7 Update CMake...sorry for the breakage.
llvm-svn: 110654
2010-08-10 05:16:06 +00:00
Devang Patel
8edc7575a4 Simplify.
llvm-svn: 110653
2010-08-10 04:12:17 +00:00
Devang Patel
191ed4c41d Drop "const". It does not add value here.
llvm-svn: 110652
2010-08-10 04:09:06 +00:00
Evan Cheng
7aaf83ba17 Add missing null check reported by Amaury Pouly.
llvm-svn: 110649
2010-08-10 02:39:45 +00:00
Devang Patel
ef61383343 Do not include file static variable in pubnames list.
Refactor and simplify code to avoid redundant checks.

llvm-svn: 110642
2010-08-10 01:37:23 +00:00