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

47 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
987cd08002 Extract parts of RAGreedy::splitAroundRegion as SplitKit methods.
This gets rid of some of the gory splitting details in RAGreedy and
makes them available to future SplitKit clients.

Slightly generalize the functionality to support multi-way splitting.
Specifically, SplitEditor::splitLiveThroughBlock() supports switching
between different register intervals in a block.

llvm-svn: 135307
2011-07-15 21:47:57 +00:00
Chandler Carruth
c83eb00361 Remove an unused variable in NDEBUG (found with -Wunused-variable).
llvm-svn: 130688
2011-05-02 05:49:01 +00:00
Jakob Stoklund Olesen
e0ec7ed462 Add a SlotIndexes::insertMachineInstrInMaps to insert the instruction after any null indexes.
This makes a difference if a live interval is referring to a deleted
instruction. It can be important to insert an instruction before or after a
deleted instruction to avoid interference.

llvm-svn: 130686
2011-05-02 05:29:56 +00:00
Jakob Stoklund Olesen
a1ffedb740 Skip a binary search when possible.
llvm-svn: 129293
2011-04-11 20:01:44 +00:00
Jakob Stoklund Olesen
731b0d77a2 Use std::unique instead of a SmallPtrSet to ensure unique instructions in UseSlots.
This allows us to always keep the smaller slot for an instruction which is what
we want when a register has early clobber defines.

Drop the UsingInstrs set and the UsingBlocks map. They are no longer needed.

llvm-svn: 128886
2011-04-05 15:18:18 +00:00
Jakob Stoklund Olesen
78d65c6632 Stop caching basic block index ranges now that SlotIndexes can keep up.
llvm-svn: 128821
2011-04-04 15:32:15 +00:00
Jakob Stoklund Olesen
024a1de4ae Use basic block numbers as indexes when mapping slot index ranges.
This is more compact and faster than using DenseMap.

llvm-svn: 128763
2011-04-02 06:03:31 +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
61af2752b1 Symbolize the default instruction distance.
llvm-svn: 127013
2011-03-04 18:36:51 +00:00
Jakob Stoklund Olesen
728fffc159 Deferred SlotIndex renumbering was a good idea but never used.
llvm-svn: 127008
2011-03-04 18:08:32 +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
2a12e5adba Optimize SlotIndex equality tests.
IndexListEntries have unique indexes, so it is not necessary to dereference
pointers to them.

llvm-svn: 126923
2011-03-03 05:18:15 +00:00
Jakob Stoklund Olesen
22bdcea2fd Assert if anybody tries to put a slot index on a DBG_VALUE instruction.
llvm-svn: 123323
2011-01-12 21:27:45 +00:00
Jakob Stoklund Olesen
1fc1f0c4a0 Add SlotIndexes::getMBBRange() to get the range of a basic block in a single
lookup.

llvm-svn: 121893
2010-12-15 20:40:22 +00:00
Jakob Stoklund Olesen
54b6cd6d38 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.

llvm-svn: 120636
2010-12-02 00:37:37 +00:00
Jakob Stoklund Olesen
313b78d28e Insert two blank SlotIndexes between basic blocks instead of just one.
This is the first small step towards using closed intervals for liveness instead
of the half-open intervals we're using now.

We want to be able to distinguish between a SlotIndex that represents a variable
being live-out of a basic block, and an index representing a variable live-in to
its successor.

That requires two separate indexes between blocks. One for live-outs and one for
live-ins.

With this change, getMBBEndIdx(MBB).getPrevSlot() becomes stable so it stays
greater than any instructions inserted at the end of MBB.

llvm-svn: 118747
2010-11-11 00:19:20 +00:00
Jakob Stoklund Olesen
3eb4a7b12d Delete unused function.
llvm-svn: 118743
2010-11-10 23:56:02 +00:00
Chris Lattner
ee8dea6453 Rename alignof -> alignOf to avoid irritating C++'0x compilers,
PR8423, patch by nobled.

llvm-svn: 117774
2010-10-30 05:14:01 +00:00
Owen Anderson
46990c17f7 Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
registration/creation, please send the testcase to me directly.

llvm-svn: 116820
2010-10-19 17:21:58 +00:00
Jakob Stoklund Olesen
af7994784c Remove SlotIndex::PHI_BIT. It is no longer used by anything.
llvm-svn: 114779
2010-09-25 00:45:18 +00:00
Jakob Stoklund Olesen
794b5e00d7 Terminator gaps were unused. Might as well delete them.
llvm-svn: 114776
2010-09-24 23:58:56 +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
Owen Anderson
f2fea95f2f Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
aadd8a89ca Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
b9762c07cb Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Lang Hames
304ecc0487 Render MachineFunctions to HTML pages, with options to render register
pressure estimates and liveness alongside.

Still experimental.

llvm-svn: 108698
2010-07-19 15:22:28 +00:00
Lang Hames
67f0ebc5c6 Added a support for inserting new MBBs into the numbering.
Unlike insertMachineInstrInMaps this does not guarantee live intervals will
remain correct. The caller will need to manually update intervals to account
for the changes made to the CFG.

llvm-svn: 107958
2010-07-09 09:19:23 +00:00
Jakob Stoklund Olesen
ab1145ea8e Handle unindexed instructions in SlotIndices.
SlotIndexes::insertMachineInstrInMaps would crash when trying to insert an
instruction imediately after an unmapped debug value.

llvm-svn: 107504
2010-07-02 19:54:45 +00:00
Chris Lattner
0768c834fe remove some unneeded errorhandling stuff.
llvm-svn: 100703
2010-04-07 22:44:07 +00:00
Chris Lattner
844634a807 include densemap.h explicitly and rearrange #includes.
llvm-svn: 100216
2010-04-02 20:20:04 +00:00
Lang Hames
91b4cae53c Changed the definition of an "invalid" slot to include the empty & tombstone values, but not zero.
llvm-svn: 95631
2010-02-09 00:41:23 +00:00
Lang Hames
64d9eb0c06 Changed slot index ranges for MachineBasicBlocks to be exclusive of endpoint.
This fixes an in-place update bug where code inserted at the end of basic blocks may not be covered by existing intervals which were live across the entire block. It is also consistent with the way ranges are specified for live intervals.

llvm-svn: 91859
2009-12-22 00:11:50 +00:00
Lang Hames
cd218ab335 Fixed use of phi param in SlotIndex constructors.
llvm-svn: 91790
2009-12-19 23:32:32 +00:00
Chris Lattner
521f59a9f5 Lang verified that SlotIndex is "pod like" even though it isn't a pod.
llvm-svn: 91423
2009-12-15 07:27:58 +00:00
Chris Lattner
587962c667 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
Lang Hames
2e0183a8a6 Fixed call to wrong constructor.
llvm-svn: 89059
2009-11-17 07:19:50 +00:00
Lang Hames
8b2d2c7537 Added an API to the SlotIndexes pass to allow new instructions to be inserted into the numbering.
PreAllocSplitting is now using this API to insert code.

llvm-svn: 88725
2009-11-14 00:02:51 +00:00
Lang Hames
3126c532b2 Moved some ManagedStatics out of the SlotIndexes header.
llvm-svn: 86446
2009-11-08 08:49:59 +00:00
Daniel Dunbar
14465c444c Fix class -> struct tag.
llvm-svn: 86416
2009-11-07 23:21:30 +00:00
Lang Hames
b5bff25ba7 Update some globals to use ManagedStatic.
llvm-svn: 86342
2009-11-07 05:50:28 +00:00
Lang Hames
aa433cb422 Tidied some ugliness in the SlotIndex default constructor.
llvm-svn: 86097
2009-11-05 01:18:31 +00:00
Lang Hames
f53fc0aa85 Removed an assert which was causing significant slowdowns in debug builds.
This assert was very conservative to begin with (the error condition is well
covered by tests elsewhere in the code) so we won't miss much by removing it.

llvm-svn: 86088
2009-11-05 00:52:28 +00:00
Lang Hames
2b16464904 Handle empty/tombstone keys for LiveIndex more cleanly. Check for index sanity when constructing index list entries.
llvm-svn: 86049
2009-11-04 21:24:15 +00:00
Lang Hames
c42888e42a Another spurious friend declaration removed.
llvm-svn: 85997
2009-11-04 01:52:40 +00:00
Lang Hames
b63bef3da7 Removed an unnecessary friend declaration and some crufty comments from IndexListEntry.
llvm-svn: 85995
2009-11-04 01:34:22 +00:00
Lang Hames
deed780bc6 The Indexes Patch.
This introduces a new pass, SlotIndexes, which is responsible for numbering
instructions for register allocation (and other clients). SlotIndexes numbering
is designed to match the existing scheme, so this patch should not cause any
changes in the generated code.

For consistency, and to avoid naming confusion, LiveIndex has been renamed
SlotIndex.

The processImplicitDefs method of the LiveIntervals analysis has been moved
into its own pass so that it can be run prior to SlotIndexes. This was
necessary to match the existing numbering scheme.

llvm-svn: 85979
2009-11-03 23:52:08 +00:00