Commit Graph

81 Commits

Author SHA1 Message Date
Alexander Kornienko
cd52a7a381 Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
Apparently, the style needs to be agreed upon first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240390 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 09:49:53 +00:00
Alexander Kornienko
cf0db29df2 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
  -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
  llvm/lib/


Thanks to Eugene Kosov for the original patch!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240137 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19 15:57:42 +00:00
Aaron Ballman
d898d31ebc Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229335 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-15 22:00:20 +00:00
Craig Topper
4ba844388c [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14 00:51:57 +00:00
Craig Topper
9f998de891 [C++11] Add 'override' keyword to virtual methods that override their base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203220 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 09:26:03 +00:00
Benjamin Kramer
d628f19f5d [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.
Remove the old functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202636 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 12:27:27 +00:00
Andrew Trick
c0173e6f9f Down-scale slot index distance to save bits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187438 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30 19:59:19 +00:00
Andrew Trick
c0c9205811 whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187437 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30 19:59:15 +00:00
David Blaikie
453f4f0130 Use only explicit bool conversion operators
BitVector/SmallBitVector::reference::operator bool remain implicit since
they model more exactly a bool, rather than something else that can be
boolean tested.

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

One behavior change (YAMLParser) was made, though no test case is
included as I'm not sure how to reach that code path. Essentially any
comparison of llvm::yaml::document_iterators would be invalid if neither
iterator was at the end.

This helped uncover a couple of bugs in Clang - test cases provided for
those in a separate commit along with similar changes to `operator bool`
instances in Clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181868 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-15 07:36:59 +00:00
Lang Hames
64362272b6 Add support for index resources (for a SlotIndex) to be relinquished.
When the SlotIndexes pass was introduced it was intended to support insertion
of code during register allocation. Removal of code was a minor consideration
(and raised the question of what to do about dangling SlotIndex objects pointing
to the erased index), so I opted to keep all indexes around indefinitely and
simply null out those that weren't being used.

Nowadays people are moving more code around (e.g. via HandleMove), which means
more zombie indexes. I want to start killing off indexes when we're done with
them to reclaim the resources they use up.
 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179834 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19 04:31:49 +00:00
Jakob Stoklund Olesen
768ed8b8c3 No really, don't use end().
Clearly, this function is never actually called with the last
instruction in the function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176708 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08 18:36:36 +00:00
Jakob Stoklund Olesen
e77b6ceb02 Avoid creating a SlotIndex from the end() iterator.
No test case, spotted by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176705 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08 18:08:54 +00:00
Cameron Zwarich
349cf34998 Add SlotIndexes::repairIndexesInRange(), which repairs SlotIndexes after adding
and removing instructions. The implementation seems more complicated than it
needs to be, but I couldn't find something simpler that dealt with all of the
corner cases.

Also add a call to repairIndexesInRange() from repairIntervalsInRange().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 06:46:41 +00:00
Cameron Zwarich
5954fc6050 Make SlotIndex::getEntry() return unsigned to match IndexListEntry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175600 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 06:46:39 +00:00
Cameron Zwarich
1fc88933e6 Renumber SlotIndexes locally when a new block is inserted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174937 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12 03:49:22 +00:00
Cameron Zwarich
4e08e35e96 Fix some problems with the updating of SlotIndexes after adding a new MBB. In
particular, holes were being left between two blocks after splitting an edge.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174868 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-11 09:24:42 +00:00
Cameron Zwarich
f5844a7515 Fix the unused but nearly correct method SlotIndexes::insertMBBInMaps() and add
support for updating SlotIndexes to MachineBasicBlock::SplitCriticalEdge(). This
calls renumberIndexes() every time; it should be improved to only renumber
locally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174851 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-10 23:29:54 +00:00
Chandler Carruth
edf315cd71 Provide a common half-open interval map info implementation, and just
re-use that for SlotIndexes. This way other users who want half-open
semantics can share the implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171158 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-27 11:29:17 +00:00
Chandler Carruth
255f89faee Sort the #include lines for the include/... tree with the script.
AKA: Recompile *ALL* the source code!

This one went much better. No manual edits here. I spot-checked for
silliness and grep-checked for really broken edits and everything seemed
good. It all still compiles. Yell if you see something that looks goofy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169133 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 17:02:12 +00:00
Sylvestre Ledru
c8e41c5917 Fix a typo (the the => the)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160621 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 08:51:15 +00:00
Chandler Carruth
39c2a3d219 Remove dead infrastructure for building DenseMaps with a SlotIndex as
the key -- they are now stored in an IntervalMap.

I noticed this while looking into PR12652.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159745 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-05 11:40:23 +00:00
Benjamin Kramer
d9b0b02561 Fix typos found by http://github.com/lyda/misspell-check
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157885 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-02 10:20:22 +00:00
Jakob Stoklund Olesen
a0b0219a9e Remove more dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-25 18:01:30 +00:00
Benjamin Kramer
0b5ad0b9d9 Remove unused PointerLikeTypeTraits for IndexListEntry.
It set NumLowBitAvailable = 3 which may not be true on all platforms.  We only
ever use 2 bits (the default) so this assumption can be safely removed

Should fix PR12612.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155288 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-21 16:05:27 +00:00
Francois Pichet
d2bfce15d4 Unbreak the MSVC build, that next() thing again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154916 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-17 09:37:32 +00:00
Lang Hames
613dfb219c SlotIndexes used to store the index list in a crufty custom linked-list. I can't
for the life of me remember why I wrote it this way, but I can't see any good
reason for it now. This patch replaces the custom linked list with an ilist.

This change should preserve the existing numberings exactly, so no generated code
should change (if it does, file a bug!).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154904 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-17 04:15:51 +00:00
Jakob Stoklund Olesen
741981adf3 Move getBundleStart() into MachineInstrBundle.h.
This allows the function to be inlined, and makes it suitable for use in
getInstructionIndex().

Also provide a const version. C++ is great for touch typing practice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151782 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:26:01 +00:00
Jakob Stoklund Olesen
b62fbc5e46 Instructions inside a bundle have the same number as the bundle itself.
SlotIndexes are not assigned to instructions inside bundles, but it is
still valid to look up the index of those instructions.

The reverse getInstructionFromIndex() will return the first instruction
in the bundle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151672 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 23:52:31 +00:00
Lang Hames
ac597ecfbc Add a check to make sure we don't assign slot indexes for instructions inside bundles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 04:33:48 +00:00
Jakob Stoklund Olesen
c4a2715a54 Drop ZeroIndex and InvalidIndex.
They are not used any more. Simply use SlotIndex() to get an invalid
index.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149727 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-04 00:11:06 +00:00
Jakob Stoklund Olesen
2aad2f6e60 Detect when a value is undefined on an edge to a landing pad.
Consider this code:

int h() {
  int x;
  try {
    x = f();
    g();
  } catch (...) {
    return x+1;
  }
  return x;
}

The variable x is undefined on the first edge to the landing pad, but it
has the f() return value on the second edge to the landing pad.

SplitAnalysis::getLastSplitPoint() would assume that the return value
from f() was live into the landing pad when f() throws, which is of
course impossible.

Detect these cases, and treat them as if the landing pad wasn't there.
This allows spill code to be inserted after the function call to f().

<rdar://problem/10664933>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147912 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-11 02:07:05 +00:00
Benjamin Kramer
da69f3b357 Simplify more DenseMap.find users.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147550 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 21:41:24 +00:00
Jakob Stoklund Olesen
2debd48ca7 Rename SlotIndexes to match how they are used.
The old naming scheme (load/use/def/store) can be traced back to an old
linear scan article, but the names don't match how slots are actually
used.

The load and store slots are not needed after the deferred spill code
insertion framework was deleted.

The use and def slots don't make any sense because we are using
half-open intervals as is customary in C code, but the names suggest
closed intervals.  In reality, these slots were used to distinguish
early-clobber defs from normal defs.

The new naming scheme also has 4 slots, but the names match how the
slots are really used.  This is a purely mechanical renaming, but some
of the code makes a lot more sense now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144503 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13 20:45:27 +00:00
Nick Lewycky
5fa301bfa9 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 21:07:46 +00:00
Jakob Stoklund Olesen
b4ddedce59 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135307 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 21:47:57 +00:00
Chandler Carruth
79142427a0 Remove an unused variable in NDEBUG (found with -Wunused-variable).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130688 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-02 05:49:01 +00:00
Jakob Stoklund Olesen
8e33095cd4 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130686 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-02 05:29:56 +00:00
Jakob Stoklund Olesen
3d32202748 Skip a binary search when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129293 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 20:01:44 +00:00
Jakob Stoklund Olesen
a2948ef5ac 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128886 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-05 15:18:18 +00:00
Jakob Stoklund Olesen
6c8afd728e Stop caching basic block index ranges now that SlotIndexes can keep up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128821 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-04 15:32:15 +00:00
Jakob Stoklund Olesen
a122eaaee2 Use basic block numbers as indexes when mapping slot index ranges.
This is more compact and faster than using DenseMap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128763 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-02 06:03:31 +00:00
Jakob Stoklund Olesen
979869c28e 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127023 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 19:43:38 +00:00
Jakob Stoklund Olesen
bee41501fa Symbolize the default instruction distance.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127013 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 18:36:51 +00:00
Jakob Stoklund Olesen
beb9a1f9fd Deferred SlotIndex renumbering was a good idea but never used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127008 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 18:08:32 +00:00
Jakob Stoklund Olesen
f37712f486 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126925 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-03 05:40:04 +00:00
Jakob Stoklund Olesen
a97ff8a027 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126924 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-03 05:18:19 +00:00
Jakob Stoklund Olesen
acf9f48c5e Optimize SlotIndex equality tests.
IndexListEntries have unique indexes, so it is not necessary to dereference
pointers to them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126923 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-03 05:18:15 +00:00
Jakob Stoklund Olesen
a5f1a900df Assert if anybody tries to put a slot index on a DBG_VALUE instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123323 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 21:27:45 +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
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