Commit Graph

5184 Commits

Author SHA1 Message Date
Philip Reames
78cc6fcb01 [Statepoints 2/4] Statepoint infrastructure for garbage collection: MI & x86-64 Backend
This is the second patch in a small series.  This patch contains the MachineInstruction and x86-64 backend pieces required to lower Statepoints.  It does not include the code to actually generate the STATEPOINT machine instruction and as a result, the entire patch is currently dead code.  I will be submitting the SelectionDAG parts within the next 24-48 hours.  Since those pieces are by far the most complicated, I wanted to minimize the size of that patch.  That patch will include the tests which exercise the functionality in this patch.  The entire series can be seen as one combined whole in http://reviews.llvm.org/D5683.

The STATEPOINT psuedo node is generated after all gc values are explicitly spilled to stack slots.  The purpose of this node is to wrap an actual call instruction while recording the spill locations of the meta arguments used for garbage collection and other purposes.  The STATEPOINT is modeled as modifing all of those locations to prevent backend optimizations from forwarding the value from before the STATEPOINT to after the STATEPOINT.  (Doing so would break relocation semantics for collectors which wish to relocate roots.)

The implementation of STATEPOINT is closely modeled on PATCHPOINT.  Eventually, much of the code in this patch will be removed.  The long term plan is to merge the functionality provided by statepoints and patchpoints.  Merging their implementations in the backend is likely to be a good starting point.

Reviewed by: atrick, ributzka



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223085 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 22:52:56 +00:00
David Blaikie
9611a1f8eb Remove some unnecessary vector::reserve/assign calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222959 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-29 18:13:42 +00:00
David Blaikie
e722713c0a Remove indirection of vector<T*> in favor of deque<T>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222958 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-29 18:13:39 +00:00
David Blaikie
c7d3454376 Use deque<T> rather than vector<T*> since it provides the same invalidation semantics (at least when removal is not needed) without the extra indirection/ownership complexity
Order matters for this container, it seems (using a forward_list and
replacing the original push_backs with emplace_fronts caused test
failures). I didn't look too deeply into why.

(& in retrospect, I might go back & change some of the forward_lists I
introduced to deques anyway - since most don't require removal, deque is
a more memory-friendly data structure (moderate locality while not
invalidating pointers))

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222950 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-29 07:04:51 +00:00
David Blaikie
71f69c81db Constify some things in preparation for CodeGenSubRegIndex to be stored by value in their container, removing the indirection
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222949 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-29 07:04:49 +00:00
Duncan P. N. Exon Smith
b60bcfde69 Revert "Simplify some more ownership using forward_list<T> rather than vector<unique_ptr<T>>"
This reverts commit r222935 and its follow-up r222938 ("Push unique_ptr
a bit further through some APIs and simplify some cleanup"), since it
causes bot failures (at least on Darwin):

http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/1391/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222943 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 23:00:22 +00:00
David Blaikie
5f95140d02 Reapply "Use std::map<K, V> rather than std::map<K, std::unique_ptr<V>>""
Just avoid using std::map::emplace since it's not implemented in
libstdc++ 4.7.

Reapplies r222937, reverted in r222939.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222940 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 22:15:06 +00:00
David Blaikie
833ccf86e5 Revert "Use std::map<K, V> rather than std::map<K, std::unique_ptr<V>>"
Seems libstdc++ on some buildbots is lacking std::map::emplace, which is
weird... reverting while I look into it.

This reverts commit r222937.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222939 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 22:01:06 +00:00
David Blaikie
47e9836165 Push unique_ptr a bit further through some APIs and simplify some cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222938 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 21:59:58 +00:00
David Blaikie
5a94a64542 Use std::map<K, V> rather than std::map<K, std::unique_ptr<V>>
Pointers and references to map elements are never invalidated (except on
removal, which isn't used here) so there's no need for the indirection
unless there's polymorphism at work.

A little const correctness had to be fixed, since the indirection
allowed some benign const violations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222937 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 21:37:54 +00:00
Duncan P. N. Exon Smith
54786a0936 Revert "Masked Vector Load and Store Intrinsics."
This reverts commit r222632 (and follow-up r222636), which caused a host
of LNT failures on an internal bot.  I'll respond to the commit on the
list with a reproduction of one of the failures.

Conflicts:
	lib/Target/X86/X86TargetTransformInfo.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222936 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 21:29:14 +00:00
David Blaikie
3ec563c51d Simplify some more ownership using forward_list<T> rather than vector<unique_ptr<T>>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222935 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 21:20:24 +00:00
David Blaikie
f1318cf60e Forgotten formatting from previous commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222934 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 21:20:22 +00:00
David Blaikie
841db2c1e4 Simplify ownership by using forward_list<T> rather than vector<unique_ptr<T>>
Since the elements were not polymorphic, the unique_ptr was only used to
avoid pointer invalidation on container resizes - might as well skip the
indirection and use a container with suitable invalidation semantics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222931 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 20:35:57 +00:00
Craig Topper
da08412bd0 Fix a few memory leaks in CodeGenRegBank.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222930 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 20:30:39 +00:00
Craig Topper
0c83952c2e Use unique_ptr to simplify deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222929 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 20:30:37 +00:00
Craig Topper
9fd6eebf92 Fix another memory leak in TableGen AsmMatcher by deleting CodeGenInstAliases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222912 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 05:01:21 +00:00
Craig Topper
44ebfb7f7c Use unique_ptr to fix some memory leaks in Tablegen AsmMatcherEmitter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222909 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 03:53:02 +00:00
Craig Topper
99a2170dab Use range-based for loops and const-correct a few things.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222908 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 03:53:00 +00:00
Sean Silva
6487f4bfe6 Add a small "usage:" comment at the top of not.cpp
Mostly pulled from Rafael's r185678 commit message.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222855 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 22:53:46 +00:00
Craig Topper
568f7e8228 Remove neverHasSideEffects support from TableGen CodeGenInstruction. Everyone should use hasSideEffects now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222809 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 04:11:14 +00:00
Craig Topper
68766c39f0 Remove unncessary check for Int_* and *_Int in AsmMatcherEmitter. These are all marked isCodeGenOnly these days.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222783 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 20:11:34 +00:00
Craig Topper
f78e333712 Use range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222782 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 20:11:31 +00:00
Craig Topper
5d7f978e91 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222781 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 20:11:29 +00:00
Craig Topper
a22c3effe1 Remove unused MaxSize variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222780 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 20:11:27 +00:00
Craig Topper
72f7001944 Move a vector instead of copying it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222779 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 20:11:25 +00:00
Craig Topper
170c95ff76 Replace a comment that says 'unreachable' with llvm_unreachable in TableGen AsmWriter output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222650 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 14:09:52 +00:00
Craig Topper
84d3252d1b Detect best type for some static index tables instead of just using uint32_t to reduce total data size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222643 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 02:08:35 +00:00
Craig Topper
e4d91ca81e Tablegen output formatting fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222633 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-23 09:40:10 +00:00
Elena Demikhovsky
ae1ae2c3a1 Masked Vector Load and Store Intrinsics.
Introduced new target-independent intrinsics in order to support masked vector loads and stores. The loop vectorizer optimizes loops containing conditional memory accesses by generating these intrinsics for existing targets AVX2 and AVX-512. The vectorizer asks the target about availability of masked vector loads and stores.
Added SDNodes for masked operations and lowering patterns for X86 code generator.
Examples:
<16 x i32> @llvm.masked.load.v16i32(i8* %addr, <16 x i32> %passthru, i32 4 /* align */, <16 x i1> %mask)
declare void @llvm.masked.store.v8f64(i8* %addr, <8 x double> %value, i32 4, <8 x i1> %mask)

Scalarizer for other targets (not AVX2/AVX-512) will be done in a separate patch.

http://reviews.llvm.org/D6191



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222632 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-23 08:07:43 +00:00
Craig Topper
2b76e1afc5 Reduce size of some tables in tablegen register info output.
Primarily done by using SequenceToOffsetTable to reduce the register pressure set tables and then sizing the indices into the tables appropriately. Size a few other table entries based on content as well. Reduces X86RegisterInfo.o by ~9k.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222621 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-22 18:30:18 +00:00
Craig Topper
9130e76923 Add extra new line and remove some trailing whitespace from tablegen RegisterInfo output file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222508 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 05:58:14 +00:00
Craig Topper
2bf028b74d Remove unnecessary extra spaces from tablegen register info output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222411 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-20 05:22:35 +00:00
Craig Topper
8a3ec67879 Use array_lengthof instead of sizeof(array)/sizeof(element) in a tablegen output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222410 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-20 05:22:32 +00:00
David Blaikie
5401ba7099 Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool>
This is to be consistent with StringSet and ultimately with the standard
library's associative container insert function.

This lead to updating SmallSet::insert to return pair<iterator, bool>,
and then to update SmallPtrSet::insert to return pair<iterator, bool>,
and then to update all the existing users of those functions...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222334 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 07:49:26 +00:00
David Blaikie
1d4f28c6bc Remove StringMap::GetOrCreateValue in favor of StringMap::insert
Having two ways to do this doesn't seem terribly helpful and
consistently using the insert version (which we already has) seems like
it'll make the code easier to understand to anyone working with standard
data structures. (I also updated many references to the Entry's
key and value to use first() and second instead of getKey{Data,Length,}
and get/setValue - for similar consistency)

Also removes the GetOrCreateValue functions so there's less surface area
to StringMap to fix/improve/change/accommodate move semantics, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222319 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 05:49:42 +00:00
Peter Collingbourne
fb44491356 Teach llvm-build to avoid touching LibraryDependencies.inc unless the contents
change. This saves us from rebuilding llvm-config each time we reconfigure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222308 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 03:34:20 +00:00
David Blaikie
8f4a49f41a Make StringSet::insert return pair<iterator, bool> like other self-associative containers
StringSet is still a bit dodgy in that it exposes the raw iterator of
the StringMap parent, which exposes the weird detail that StringSet
actually has a 'value'... but anyway, this is useful for a handful of
clients that want to reference the newly inserted/persistent string data
in the StringSet/Map/Entry/thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222302 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 02:56:00 +00:00
David Blaikie
9e092ac163 Revert "Improve memory ownership/management in TableGen by unique_ptrifying TreePattern's Tree member."
This reverts commit r222183.

Broke on the MSVC buildbots due to MSVC not producing default move
operations - I'd fix it immediately but just broke my build system a
bit, so backing out until I have a chance to get everything going again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222187 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 22:55:41 +00:00
David Blaikie
3941c30371 Improve memory ownership/management in TableGen by unique_ptrifying TreePattern's Tree member.
The next step is to actually use unique_ptr in TreePatternNode's
Children vector. That will be more intrusive, and may not work,
depending on exactly how these things are handled (I have a bad
suspicion things are shared more than they should be, making this more
DAG than tree - but if it's really a tree, unique_ptr should suffice)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222183 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 22:16:55 +00:00
Craig Topper
a5babc8a31 Move register class name strings to a single array in MCRegisterInfo to reduce static table size and number of relocation entries.
Indices into the table are stored in each MCRegisterClass instead of a pointer. A new method, getRegClassName, is added to MCRegisterInfo and TargetRegisterInfo to lookup the string in the table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222118 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 05:50:14 +00:00
David Blaikie
6141b4a113 Turn a leaked object into a stack variable instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222046 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 21:53:50 +00:00
Bill Schmidt
6536b834f8 Change order of tablegen generated fast-isel instruction code to be
based on instruction complexity

The order that tablegen fast-isel instruction code is generated is
currently based on the text of the predicate (using string
less-than). This patch changes this to instead use the instruction
complexity. Because the complexities are not unique a C++ multimap is
used instead of a map.

This fixes the problem where code with no predicate always comes out
first (the empty string always compares as less than all other
strings) thus making the code with predicates dead code. See the FMUL
code in PPCFastISel.cpp for an example. It also more closely matches
the normal codegen ordering. Some error checking in the tablegen
fast-isel code is fixed as well.

Patch by Bill Seurer.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222038 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 21:05:45 +00:00
David Blaikie
de67e5c3fb Fix nested namespace with decltype to hopefully work with MSVC
Build failed here:
http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/14629/steps/build_Lld/logs/stdio

So I'm taking a shot in the dark that MSVC (whatever version that is)
can't cope with nested name specifiers with a decltype prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221931 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 21:56:57 +00:00
David Blaikie
bea87dad5e Use unique_ptr to handle ownership of TreePatterns in CodeGenDAGPatterns::PatternFragments
We might be able to use unique_ptr to handle ownership of the
TreePatternNodes too - looking into that next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221928 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 21:40:02 +00:00
Matt Arsenault
a735d521e7 Make TreePattern::error use Twine
The underlying error function already uses a Twine,
and most of the uses build up strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221740 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-11 23:48:11 +00:00
Rafael Espindola
9272305648 MCAsmParserExtension has a copy of the MCAsmParser. Use it.
Base classes were storing a second copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221667 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-11 05:18:41 +00:00
Michael J. Spencer
58206dd147 Use findProgramByName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221221 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 01:29:59 +00:00
Rafael Espindola
3ada4ec04c Handle ASAN_OPTIONS and UBSAN_OPTIONS in TestingConfig.py
Currently they are passed to tests of llvm itself, but not, for example, lld.

With this patch the options are visible in every test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221198 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-03 23:04:56 +00:00
Rafael Espindola
86156e8997 refactor duplicated code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221191 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-03 22:17:49 +00:00