Commit Graph

21997 Commits

Author SHA1 Message Date
Rafael Espindola
a300b8d7e4 Use size_type in the interface exposed by SmallVector.
This matches std::vector and should avoid unnecessary masking to 32 bits
when calling them on o 64 bits system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223365 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 14:40:35 +00:00
Elena Demikhovsky
73ae1df82c Masked Load / Store Intrinsics - the CodeGen part.
I'm recommiting the codegen part of the patch.
The vectorizer part will be send to review again.

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@223348 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 09:40:44 +00:00
Jean-Daniel Dupas
206b84f324 Add mach-o LC_RPATH support to llvm-objdump
Summary: Add rpath load command support in Mach-O object and update llvm-objdump to use it.

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6512

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223343 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 07:37:02 +00:00
Matt Arsenault
459e595697 Allow target to specify prefix for labels
Use the MCAsmInfo instead of the DataLayout, and allow
specifying a custom prefix for labels specifically. HSAIL
requires that labels begin with @, but global symbols with &.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223323 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 00:06:57 +00:00
Rafael Espindola
55d5ea3be3 Split the set of identified struct types into opaque and non-opaque ones.
The non-opaque part can be structurally uniqued. To keep this to just
a hash lookup, we don't try to unique cyclic types.

Also change the type mapping algorithm to be optimistic about a type
not being recursive and only create a new type when proven to be wrong.
This is not as strong as trying to speculate that we can keep the source
type, but is simpler (no speculation to revert) and more powerfull
than what we had before (we don't copy non-recursive types at least).

I initially wrote this to try to replace the name based type merging.
It is not strong enough to replace it, but is is a useful addition.

With this patch the number of named struct types is a clang lto bootstrap goes
from 49674 to 15986.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223278 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 22:36:37 +00:00
Roman Divacky
788af07d5d Change the name to be in style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223255 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 18:39:44 +00:00
Rafael Espindola
eee41dbb65 Ask the module for its the identified types.
When lazy reading a module, the types used in a function will not be visible to
a TypeFinder until the body is read.

This patch fixes that by asking the module for its identified struct types.
If a materializer is present, the module asks it. If not, it uses a TypeFinder.

This fixes pr21374.

I will be the first to say that this is ugly, but it was the best I could find.

Some of the options I looked at:

* Asking the LLVMContext. This could be made to work for gold, but not currently
  for ld64. ld64 will load multiple modules into a single context before merging
  them. This causes us to see types from future merges. Unfortunately,
  MappedTypes is not just a cache when it comes to opaque types. Once the
  mapping has been made, we have to remember it for as long as the key may
  be used. This would mean moving MappedTypes to the Linker class and having
  to drop the Linker::LinkModules static methods, which are visible from C.

* Adding an option to ignore function bodies in the TypeFinder. This would
  fix the PR by picking the worst result. It would work, but unfortunately
  we are currently quite dependent on the upfront type merging. I will
  try to reduce our dependency, but it is not clear that we will be able
  to get rid of it for now.

The only clean solution I could think of is making the Module own the types.
This would have other advantages, but it is a much bigger change. I will
propose it, but it is nice to have this fixed while that is discussed.

With the gold plugin, this patch takes the number of types in the LTO clang
binary from 52817 to 49669.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223215 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 07:18:23 +00:00
Duncan P. N. Exon Smith
59c9cb75d2 ADT: Rename argument in emplace_back_impl
Rename a functor argument in r223201 from `emplace` to `construct` to
reduce confusion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223212 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 05:53:24 +00:00
Duncan P. N. Exon Smith
ba2915d05c ADT: Add SmallVector<>::emplace_back(): fixup
Add missing `void` return type from `!LLVM_HAS_VARIADIC_TEMPLATES` case
in r223201.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223202 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 04:49:16 +00:00
Duncan P. N. Exon Smith
fe03508abd ADT: Add SmallVector<>::emplace_back()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223201 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 04:45:09 +00:00
NAKAMURA Takumi
61372ea958 GCRelocateOperands: Try to appease msc17.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223192 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 02:40:24 +00:00
Peter Collingbourne
bb660fc192 Prologue support
Patch by Ben Gamari!

This redefines the `prefix` attribute introduced previously and
introduces a `prologue` attribute.  There are a two primary usecases
that these attributes aim to serve,

  1. Function prologue sigils

  2. Function hot-patching: Enable the user to insert `nop` operations
     at the beginning of the function which can later be safely replaced
     with a call to some instrumentation facility

  3. Runtime metadata: Allow a compiler to insert data for use by the
     runtime during execution. GHC is one example of a compiler that
     needs this functionality for its tables-next-to-code functionality.

Previously `prefix` served cases (1) and (2) quite well by allowing the user
to introduce arbitrary data at the entrypoint but before the function
body. Case (3), however, was poorly handled by this approach as it
required that prefix data was valid executable code.

Here we redefine the notion of prefix data to instead be data which
occurs immediately before the function entrypoint (i.e. the symbol
address). Since prefix data now occurs before the function entrypoint,
there is no need for the data to be valid code.

The previous notion of prefix data now goes under the name "prologue
data" to emphasize its duality with the function epilogue.

The intention here is to handle cases (1) and (2) with prologue data and
case (3) with prefix data.

References
----------

This idea arose out of discussions[1] with Reid Kleckner in response to a
proposal to introduce the notion of symbol offsets to enable handling of
case (3).

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073235.html

Test Plan: testsuite

Differential Revision: http://reviews.llvm.org/D6454

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223189 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 02:08:38 +00:00
Lang Hames
5ab94e7135 [MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223183 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 00:51:19 +00:00
Pete Cooper
dfc69d2c27 Use a typed enum instead of 'unsigned char' for packed field. NFC.
This makes it easier to debug Twine as the 'Kind' fields now show their enum values in lldb and not escaped characters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223178 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 23:34:23 +00:00
Eric Christopher
9643005b50 Make sure that the TargetOptions operator== is checking the
full contents of the class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223159 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 21:57:15 +00:00
Philip Reames
301256d436 Restructure some assertion checking based on post commit feedback by Aaron and Tom.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223150 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 21:01:48 +00:00
Roman Divacky
2664ea938f Introduce CPUStringIsValid() into MCSubtargetInfo and use it for ARM .cpu parsing.
Previously .cpu directive in ARM assembler didnt switch to the new CPU and
therefore acted as a nop. This implemented real action for .cpu and eg. 
allows to assembler FreeBSD kernel with -integrated-as.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223147 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 20:03:22 +00:00
Reid Kleckner
efcedf94c4 cmake: Remove MAXPATHLEN define as autoconf does not provide it
Presumably it was added to the CMake system when MAXPATHLEN was still
used by code built for Windows. Currently only lib/Support/Path.inc uses
MAXPATHLEN, and it should be available on all Unices.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223139 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 18:59:08 +00:00
Reid Kleckner
cda6894e68 Remove '#undef const' from config.h.cmake to sync with autoconf
This define was removed from config.h.in when Rafael removed our use of
libtool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223138 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 18:58:38 +00:00
Philip Reames
d021bb8003 [Statepoints 3/4] Statepoint infrastructure for garbage collection: SelectionDAGBuilder
This is the third patch in a small series.  It contains the CodeGen support for lowering the gc.statepoint intrinsic sequences (223078) to the STATEPOINT pseudo machine instruction (223085).  The change also includes the set of helper routines and classes for working with gc.statepoints, gc.relocates, and gc.results since the lowering code uses them.  

With this change, gc.statepoints should be functionally complete.  The documentation will follow in the fourth change, and there will likely be some cleanup changes, but interested parties can start experimenting now.

I'm not particularly happy with the amount of code or complexity involved with the lowering step, but at least it's fairly well isolated.  The statepoint lowering code is split into it's own files and anyone not working on the statepoint support itself should be able to ignore it.  

During the lowering process, we currently spill aggressively to stack. This is not entirely ideal (and we have plans to do better), but it's functional, relatively straight forward, and matches closely the implementations of the patchpoint intrinsics.  Most of the complexity comes from trying to keep relocated copies of values in the same stack slots across statepoints.  Doing so avoids the insertion of pointless load and store instructions to reshuffle the stack.  The current implementation isn't as effective as I'd like, but it is functional and 'good enough' for many common use cases.  

In the long term, I'd like to figure out how to integrate the statepoint lowering with the register allocator.  In principal, we shouldn't need to eagerly spill at all.  The register allocator should do any spilling required and the statepoint should simply record that fact.  Depending on how challenging that turns out to be, we may invest in a smarter global stack slot assignment mechanism as a stop gap measure.  

Reviewed by: atrick, ributzka





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223137 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 18:50:36 +00:00
Tom Stellard
fcf4242b9b Triple: Add AMDHSA operating system type
This operating system type represents the AMD HSA runtime,
and will be required by the R600 backend in order to generate
correct code for this runtime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223124 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 16:45:47 +00:00
Charlie Turner
364f2f3fcf Emit Tag_ABI_FP_denormal correctly in fast-math mode.
The default ARM floating-point mode does not support IEEE 754 mode exactly. Of
relevance to this patch is that input denormals are flushed to zero. The way in
which they're flushed to zero depends on the architecture,

  * For VFPv2, it is implementation defined as to whether the sign of zero is
    preserved.
  * For VFPv3 and above, the sign of zero is always preserved when a denormal
    is flushed to zero.

When FP support has been disabled, the strategy taken by this patch is to
assume the software support will mirror the behaviour of the hardware support
for the target *if it existed*. That is, for architectures which can only have
VFPv2, it is assumed the software will flush to positive zero. For later
architectures it is assumed the software will flush to zero preserving sign.

Change-Id: Icc5928633ba222a4ba3ca8c0df44a440445865fd

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223110 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 08:22:29 +00:00
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
Philip Reames
204e21b51a [Statepoints 1/4] Statepoint infrastructure for garbage collection: IR Intrinsics
The statepoint intrinsics are intended to enable precise root tracking through the compiler as to support garbage collectors of all types. The addition of the statepoint intrinsics to LLVM should have no impact on the compilation of any program which does not contain them. There are no side tables created, no extra metadata, and no inhibited optimizations.

A statepoint works by transforming a call site (or safepoint poll site) into an explicit relocation operation. It is the frontend's responsibility (or eventually the safepoint insertion pass we've developed, but that's not part of this patch series) to ensure that any live pointer to a GC object is correctly added to the statepoint and explicitly relocated. The relocated value is just a normal SSA value (as seen by the optimizer), so merges of relocated and unrelocated values are just normal phis. The explicit relocation operation, the fact the statepoint is assumed to clobber all memory, and the optimizers standard semantics ensure that the relocations flow through IR optimizations correctly.

This is the first patch in a small series.  This patch contains only the IR parts; the documentation and backend support will be following separately.  The entire series can be seen as one combined whole in http://reviews.llvm.org/D5683.

Reviewed by: atrick, ributzka





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223078 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 21:18:12 +00:00
Jingyue Wu
b043278834 [NVPTX] Do not emit .weak symbols for NVPTX
Summary:
".weak" symbols cannot be consumed by ptxas (PR21685). This patch makes the
weak directive in MCAsmPrinter customizable, and disables emitting ".weak"
symbols for NVPTX.

Test Plan: weak-linkage.ll

Reviewers: jholewinski

Reviewed By: jholewinski

Subscribers: majnemer, jholewinski, llvm-commits

Differential Revision: http://reviews.llvm.org/D6455

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223077 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 21:16:17 +00:00
Pete Cooper
fcf3609fd7 Use C++ typed enums instead of 'unsigned char' for MCInst Kind. NFC.
This makes it much easier to see the value of operands in the debugger.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223060 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 18:46:43 +00:00
Rafael Espindola
d9788e9372 Partial revert of r222986.
The explicit set of destination types is not fully redundant when lazy loading
since the TypeFinder will not find types used only in function bodies.

This keeps the logic to drop the name of mapped types since it still helps
with avoiding further renaming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223043 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 16:32:20 +00:00
Akira Hatanaka
ca780b4578 [stack protector] Set edge weights for newly created basic blocks.
This commit fixes a bug in stack protector pass where edge weights were not set
when new basic blocks were added to lists of successor basic blocks.

Differential Revision: http://reviews.llvm.org/D5766


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222987 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 04:27:03 +00:00
Rafael Espindola
7a551b7c6d Change how we keep track of which types are in the dest module.
Instead of keeping an explicit set, just drop the names of types we choose
to map to some other type.

This has the advantage that the name of the unused will not cause the context
to rename types on module read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222986 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 04:15:59 +00:00
Hans Wennborg
066fdfa0dd Revert r222965 "Make MultiClass::DefPrototypes own their Records to fix memory leaks."
The bots started failing with the error below. I suspect this revision was the cause.

FAILED: /home/bb/bin/g++47   -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3 -DNDEBUG -Ilib/TableGen -I/home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen -Iinclude -I/home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include    -fno-exceptions -fno-rtti -MMD -MT lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o -MF "lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o.d" -o lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o -c /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tempbuf.h:62:0,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:64,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/algorithm:63,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/StringRef.h:13,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGLexer.h:17,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.h:17,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:14:
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_construct.h: In instantiation of 'void std::_Construct(_T1*, _Args&& ...) [with _T1 = std::unique_ptr<llvm::Record>; _Args = {const std::unique_ptr<llvm::Record, std::default_delete<llvm::Record> >&}]':
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_uninitialized.h:77:3:   required from 'static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const std::unique_ptr<llvm::Record>*, std::vector<std::unique_ptr<llvm::Record> > >; _ForwardIterator = std::unique_ptr<llvm::Record>*; bool _TrivialValueTypes = false]'
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_uninitialized.h:119:41:   required from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const std::unique_ptr<llvm::Record>*, std::vector<std::unique_ptr<llvm::Record> > >; _ForwardIterator = std::unique_ptr<llvm::Record>*]'
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_uninitialized.h:260:63:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const std::unique_ptr<llvm::Record>*, std::vector<std::unique_ptr<llvm::Record> > >; _ForwardIterator = std::unique_ptr<llvm::Record>*; _Tp = std::unique_ptr<llvm::Record>]'
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_vector.h:310:9:   required from 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::unique_ptr<llvm::Record>; _Alloc = std::allocator<std::unique_ptr<llvm::Record> >]'
/home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/TableGen/Record.h:1664:8:   required from 'constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = std::basic_string<char>&; _U2 = llvm::MultiClass; <template-parameter-2-3> = void; _T1 = std::basic_string<char>; _T2 = llvm::MultiClass]'
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_pair.h:273:72:   required from 'constexpr std::pair<typename std::__decay_and_strip<_T1>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = std::basic_string<char>&; _T2 = llvm::MultiClass; typename std::__decay_and_strip<_T2>::__type = llvm::MultiClass; typename std::__decay_and_strip<_T1>::__type = std::basic_string<char>]'
/home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:2295:78:   required from here
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_construct.h:77:7: error: use of deleted function 'std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = llvm::Record; _Dp = std::default_delete<llvm::Record>]'
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/memory:86:0,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/STLExtras.h:25,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:14,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/Support/SourceMgr.h:19,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.h:19,
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:14:
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/unique_ptr.h:262:7: error: declared here
ninja: build stopped: subcommand failed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222970 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-30 00:43:50 +00:00
Craig Topper
a1fa859a92 Make MultiClass::DefPrototypes own their Records to fix memory leaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222965 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-30 00:19:28 +00:00
Craig Topper
2935bbc520 Make RecordKeeper::addClass/addDef take unique_ptrs instead of creating one internally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222948 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-29 05:52:51 +00:00
Duncan P. N. Exon Smith
9416f9c57d DebugIR: Delete -debug-ir
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222945 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-29 03:15:47 +00:00
Saleem Abdulrasool
e395d7421d Support: remove some variable names
If built with -Wunused-variable, clang objects to the declarations due to the
unused variable; drop the names.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222944 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-29 00:10:26 +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
Tim Northover
402b6fdf9d Stop using ArrayRef of a const type.
I *think* this is what the GCC bots are complaining about.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222905 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-27 21:29:20 +00:00
Tim Northover
d7a4f74f15 AArch64: treat [N x Ty] as a block during procedure calls.
The AAPCS treats small structs and homogeneous floating (or vector) aggregates
specially, and guarantees they either get passed as a contiguous block of
registers, or prevent any future use of those registers and get passed on the
stack.

This concept can fit quite neatly into LLVM's own type system, mapping an HFA
to [N x float] and so on, and small structs to [N x i64]. Doing so allows
front-ends to emit AAPCS compliant code without having to duplicate the
register counting logic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222903 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-27 21:02:42 +00:00
Will Newton
e40dbd6233 Widen ELFYAML relocation type to 32 bits
The current 8 bits is sufficient for ELF32 targets but ELF64 requires
32 bits. Add a test for AArch64 that exposes the issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222898 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-27 17:20:48 +00:00
Lang Hames
7032f3cbe4 [MCJIT] Replace JITEventListener::anchor (temporarily removed in r222861), and
move GDBRegistrationListener into ExecutionEngine to avoid layering violation.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222864 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-27 01:41:16 +00:00
Lang Hames
daed11e664 [MCJIT] Remove JITEventListener's anchor until I can determine the right place
to put it. This should unbreak the Mips bots.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222861 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-27 00:15:28 +00:00
Lang Hames
216e532dc1 [MCJIT] Reapply r222828 and r222810-r222812 with fix for MSVC move-op issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222840 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 16:54:40 +00:00
Aaron Ballman
19afe67157 Reverting r222828 and r222810-r222812 as they broke the build on Windows.
http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/11753

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222833 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 15:27:39 +00:00
Will Newton
87a2f3751c Update AArch64 ELF relocations to ABI 1.0
This mostly entails adding relocations, however there are a couple of
changes to existing relocations:

1. R_AARCH64_NONE is defined to be zero rather than 256

R_AARCH64_NONE has been defined to be zero for a long time elsewhere
e.g. binutils and glibc since the submission of the AArch64 port in
2012 so this is required for compatibility.

2. R_AARCH64_TLSDESC_ADR_PAGE renamed to R_AARCH64_TLSDESC_ADR_PAGE21

I don't think there is any way for relocation names to leak out of LLVM
so this should not break anything.

Tested with check-all with no regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222821 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 10:49:18 +00:00
Will Newton
e98441590b Update ARM ELF relocations to ABI 2.09
Add R_ARM_IRELATIVE.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222817 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 10:36:03 +00:00
Lang Hames
7acaefabf6 [MCJIT] Clean up RuntimeDyld's quirky object-ownership/modification scheme.
Previously, when loading an object file, RuntimeDyld (1) took ownership of the
ObjectFile instance (and associated MemoryBuffer), (2) potentially modified the
object in-place, and (3) returned an ObjectImage that managed ownership of the
now-modified object and provided some convenience methods. This scheme accreted
over several years as features were tacked on to RuntimeDyld, and was both
unintuitive and unsafe (See e.g. http://llvm.org/PR20722).

This patch fixes the issue by removing all ownership and in-place modification
of object files from RuntimeDyld. Existing behavior, including debugger
registration, is preserved.

Noteworthy changes include:

(1) ObjectFile instances are now passed to RuntimeDyld by const-ref.
(2) The ObjectImage and ObjectBuffer classes have been removed entirely, they
    existed to model ownership within RuntimeDyld, and so are no longer needed.
(3) RuntimeDyld::loadObject now returns an instance of a new class,
    RuntimeDyld::LoadedObjectInfo, which can be used to construct a modified
    object suitable for registration with the debugger, following the existing
    debugger registration scheme.
(4) The JITRegistrar class has been removed, and the GDBRegistrar class has been
    re-written as a JITEventListener.

This should fix http://llvm.org/PR20722 .



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222810 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 06:53:26 +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
Richard Smith
e2fc38a1e5 Try to make the modules buildbot happy again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222808 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 03:44:47 +00:00
Craig Topper
c0dae440e6 Replace neverHasSideEffects=1 with hasSideEffects=0 in all .td files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222801 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 00:46:26 +00:00
Cameron McInally
9f4bb0420d [AVX512] Add 512b integer shift by variable intrinsics and patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222786 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 20:41:51 +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
Chandler Carruth
a87c35420b Revert r220349 to re-instate r220277 with a fix for PR21330 -- quite
clearly only exactly equal width ptrtoint and inttoptr casts are no-op
casts, it says so right there in the langref. Make the code agree.

Original log from r220277:
Teach the load analysis to allow finding available values which require
inttoptr or ptrtoint cast provided there is datalayout available.
Eventually, the datalayout can just be required but in practice it will
always be there today.

To go with the ability to expose available values requiring a ptrtoint
or inttoptr cast, helpers are added to perform one of these three casts.

These smarts are necessary to finish canonicalizing loads and stores to
the operational type requirements without regressing fundamental
combines.

I've added some test cases. These should actually improve as the load
combining and store combining improves, but they may fundamentally be
highlighting some missing combines for select in addition to exercising
the specific added logic to load analysis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222739 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 08:20:27 +00:00
Simon Atanasyan
c5e9bf54c7 [Object][Mips] Return address of MIPS symbol with cleared microMIPS indicator bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222726 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 05:57:55 +00:00
Rafael Espindola
7fe9d46f39 Remove the unused FindUsedTypes pass.
It was dead since r134829.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222684 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 20:53:26 +00:00
Rafael Espindola
468d2fc5ca Add and use Type::subtypes. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222682 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 20:44:36 +00:00
Colin LeMahieu
9f1b025b31 Adding const iterator to MCInst. http://reviews.llvm.org/D6359
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222661 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 16:50:40 +00:00
Yaron Keren
de089dd0c6 Added comment about llvm_execute_on_thread waiting for thread to complete.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222654 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 14:51:41 +00:00
Simon Atanasyan
39e9ec3049 [Mips] Update MIPS relocations list
No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222651 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 14:17:33 +00:00
Duncan P. N. Exon Smith
5deb1bf97f Support: Add *cast_or_null<> for pointer wrappers
Fill in omission of `cast_or_null<>` and `dyn_cast_or_null<>` for types
that wrap pointers (e.g., smart pointers).

Type traits need to be slightly stricter than for `cast<>` and
`dyn_cast<>` to resolve ambiguities with simple types.

There didn't seem to be any unit tests for pointer wrappers, so I tested
`isa<>`, `cast<>`, and `dyn_cast<>` while I was in there.

This only supports pointer wrappers with a conversion to `bool` to check
for null.  If in the future it's useful to support wrappers without such
a conversion, it should be a straightforward incremental step to use the
`simplify_type` machinery for the null check.  In that case, the unit
tests should be updated to remove the `operator bool()` from the
`pointer_wrappers::PTy`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222644 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 03:13:02 +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
Simon Pilgrim
53a43d38df Tidied up target triple OS detection. NFC
Use Triple::isOS*() helper functions where possible.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222622 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-22 19:12:10 +00:00
Gerolf Hoflehner
5182ad54b2 [InstCombine] Re-commit of r218721 (Optimize icmp-select-icmp sequence)
Fixes the self-host fail. Note that this commit activates dominator
analysis in the combiner by default (like the original commit did).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222590 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 23:36:44 +00:00
Tim Northover
9d5d711f65 Split ELF relocation defintions into per-architecture .def files
This should allow the list of relocations for a particular
architecture to be kept in a single header rather than duplicated
whenever we need to enumerate all the relocations.

Patch by Will Newton.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222565 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 20:16:02 +00:00
Manman Ren
b179c6a5e5 Debug Info: revert r222195, r222210 and r222239.
This is no longer needed after David's fix at r222377 + r222485.
rdar://18958417


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222563 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 19:55:23 +00:00
Rafael Espindola
0b835fc95f Add params() to FunctionType. NFC.
While at it, also use makeArrayRef in elements().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222556 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 19:03:35 +00:00
Rafael Espindola
633e9689bf Add and use a helper elements() to StructType. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222553 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 18:53:05 +00:00
Rafael Espindola
093aa456a3 Fix formatting. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222545 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 18:05:55 +00:00
Hao Liu
09ad94decb DAGCombiner: Allow the DAGCombiner to combine multiple FDIVs with the same divisor info FMULs by the reciprocal.
E.g., ( a / D; b / D ) -> ( recip = 1.0 / D; a * recip; b * recip)

A hook is added to allow the target to control whether it needs to do such combine.

Reviewed in http://reviews.llvm.org/D6334


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222510 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 06:39:58 +00:00
Rafael Espindola
ed46a2c2aa Fix a silly bug in StreamingMemoryObject.cpp.
The logic for detecting EOF was wrong and would fail if we ever requested
more than 16k past the last read position.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222505 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 05:15:41 +00:00
Lang Hames
d90eb5527c [MCJIT] Remove JITEventListener::NotifyFreeingMachineCode. This method is dead
now that the old JIT has been removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222494 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 01:57:09 +00:00
Lang Hames
604171664c [MCJIT] Remove JITEventListener::NotifyFunctionEmitted - this method is dead
now that the legacy JIT has been removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222453 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-20 21:16:16 +00:00
Michael Ilseman
deb068a5cb Update template specialization to reflect API changes.
po_iterator_storage's insertEdge was updated to reflect the API
changes from many of our insert methods in r222334, however the
template specialization for external storage was not updated. This
updates the specialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222446 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-20 19:33:30 +00:00
Saleem Abdulrasool
06f9f40a1e ADT: windows itanium targets msvcrt.dll
Update the isOSMSVCRT to correctly identify that windows-itanium uses
msvcrt.dll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222389 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 21:55:31 +00:00
Matthias Braun
c754d5815d Introduce register dump helper
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222379 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 19:46:11 +00:00
David Majnemer
f47d325eec AliasSetTracker: UnknownInsts should contribute to the refcount
AliasSetTracker::addUnknown may create an AliasSet devoid of pointers
just to contain an instruction if no suitable AliasSet already exists.
It will then AliasSet::addUnknownInst and we will be done.

However, it's possible for addUnknown to choose an existing AliasSet to
addUnknownInst.
If this were to occur, we are in a bit of a pickle: removing pointers
from the AliasSet can cause the entire AliasSet to become destroyed,
taking our unknown instructions out with them.

Instead, keep track whether or not our AliasSet has any unknown
instructions.

This fixes PR21582.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222338 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 09:41:05 +00:00
David Blaikie
c58082616a Add missing header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222337 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 08:12:55 +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
Hao Liu
eb52f383c2 [SeparateConstOffsetFromGEP] Allow SeparateConstOffsetFromGEP pass to lower GEPs.
If LowerGEP is enabled, it can lower a GEP with multiple indices into GEPs with a single index
or arithmetic operations. Lowering GEPs can always extract structure indices. Lowering GEPs can
also give use more optimization opportunities. It can benefit passes like CSE, LICM and CGP.

Reviewed in http://reviews.llvm.org/D5864


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222328 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 06:24:44 +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
2dea1fe38d Expose LLVM version string via macro in llvm-config.h, and modify Go bindings
to make use of it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222307 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 03:34:17 +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
Rafael Espindola
28b45aa83e Use a memcpy so that type based alias analysis sees the change.
The other option would be to do something like

if (that.isSingleWord())
  VAL = that.VAL;
else
  pVal = that.pVal

This bug was causing 86TTI::getIntImmCost to be miscompiled in a LTO
bootstrap in stage2, causing the build of stage3 to fail.

LLVM is getting quiet good at exploiting this. Not sure if there is anything
a sanitizer could do to help

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222294 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 01:02:22 +00:00
Rui Ueyama
6272b8c4be llvm-readobj: teach it how to dump COFF base relocation table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222289 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 00:18:07 +00:00
Kostya Serebryany
f82e60f03d Introduce llvm::SplitAllCriticalEdges
Summary:
move the code from BreakCriticalEdges::runOnFunction()
into a separate utility function llvm::SplitAllCriticalEdges()
so that it can be used independently.
No functionality change intended.

Test Plan: check-llvm

Reviewers: nlewycky

Reviewed By: nlewycky

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6313

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222288 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 00:17:31 +00:00
Justin Bogner
d3635f07ed Fix an inaccurate comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222267 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 22:17:30 +00:00
Duncan P. N. Exon Smith
5d8a792eac IR: Sink MDNode::Hash down to GenericMDNode::Hash
Part of PR21532.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222212 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 02:20:29 +00:00
Duncan P. N. Exon Smith
023c72e64a IR: Move MDNode operands from the back to the front
Having the operands at the back prevents subclasses from safely adding
fields.  Move them to the front.

Instead of replicating the custom `malloc()`, `free()` and `DestroyFlag`
logic that was there before, overload `new` and `delete`.

I added calls to a new `GenericMDNode::dropAllReferences()` in
`LLVMContextImpl::~LLVMContextImpl()`.  There's a maze of callbacks
happening during teardown, and this resolves them before we enter
the destructors.

Part of PR21532.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222211 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 01:56:14 +00:00
Michael J. Spencer
b9f39bcc82 Support ELF files of unknown type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222208 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 01:14:25 +00:00
Duncan P. N. Exon Smith
2c38b004d9 IR: Split MDNode into GenericMDNode and MDNodeFwdDecl
Split `MDNode` into two classes:

  - `GenericMDNode`, which is uniquable (and for now, always starts
    uniqued).  Once `Metadata` is split from the `Value` hierarchy, this
    class will lose the ability to RAUW itself.

  - `MDNodeFwdDecl`, which is used for the "temporary" interface, is
    never uniqued, and isn't managed by `LLVMContext` at all.

I've left most of the guts in `MDNode` for now, but I'll incrementally
move things to the right places (or delete the functionality, as
appropriate).

Part of PR21532.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222205 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 00:37:17 +00:00
Manman Ren
b05098b884 Debug Info: In DIBuilder, the context field of a global variable is updated to
use DIScopeRef.

A paired commit at clang will follow to show cases where we will use an
identifer for the context of a global variable.

rdar://18958417


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222195 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 00:29:08 +00:00
Duncan P. N. Exon Smith
66a2b0564e IR: Simplify uniquing for MDNode
Change uniquing from a `FoldingSet` to a `DenseSet` with custom
`DenseMapInfo`.  Unfortunately, this doesn't save any memory, since
`DenseSet<T>` is a simple wrapper for `DenseMap<T, char>`, but I'll come
back to fix that later.

I used the name `GenericDenseMapInfo` to the custom `DenseMapInfo` since
I'll be splitting `MDNode` into two classes soon: `MDNodeFwdDecl` for
temporaries, and `GenericMDNode` for everything else.

I also added a non-debug-info reduced version of a type-uniquing test
that started failing on an earlier draft of this patch.

Part of PR21532.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222191 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 23:28:21 +00:00
Reid Kleckner
8083adcaca Revert "ADT: correctly report isMSVCEnvironment for windows itanium"
This reverts commit r222180.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222188 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 22:55:59 +00:00
Saleem Abdulrasool
2bd09db07f ADT: correctly report isMSVCEnvironment for windows itanium
The itanium environment on Windows uses MSVC and is a MSVC environment.  Report
this correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222180 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 22:13:26 +00:00
Rafael Espindola
c4fe4e9681 Factor common code it Linker::init.
The TypeFinder was not being used in one of the constructors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222172 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 20:51:01 +00:00
Rafael Espindola
d5b5eb6c97 Revert commits r222146 and r222137.
They were producing the wrong result if NumBits == BitsInWord. The old mask
produced -1, the new mask 0.

This should fix the 32 bit bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222166 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 19:26:40 +00:00
Rafael Espindola
95764ec6ed Fix GraphTraits for "const CallGraphNode *" and "const CallGraph *"
The specializations were broken. For example,

void foo(const CallGraph *G) {
  auto I = GraphTraits<const CallGraph *>::nodes_begin(G);
  auto K = I++;

  ...
}

or

void bar(const CallGraphNode *N) {
  auto I = GraphTraits<const CallGraphNode *>::nodes_begin(G);
  auto K = I++;

  ....
}

would not compile.

Patch by Speziale Ettore!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222149 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 17:51:45 +00:00
Rafael Espindola
29e8a627ba Avoid undefined behavior by masking the shift amount.
Should hopefully fix the mips bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222146 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 17:43:27 +00:00
Rafael Espindola
6e61dd242b Use a more canonical way of computing a mask with N trailing 1s. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222137 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 15:46:21 +00:00
Oliver Stannard
8f832fce3b [Thumb1] Re-write emitThumbRegPlusImmediate
This was motivated by a bug which caused code like this to be
miscompiled:
  declare void @take_ptr(i8*)
  define void @test() {
    %addr1.32 = alloca i8
    %addr2.32 = alloca i32, i32 1028
    call void @take_ptr(i8* %addr1)
    ret void
  }

This was emitting the following assembly to get the value of %addr1:
  add r0, sp, #1020
  add r0, r0, #8
However, "add r0, r0, #8" is not a valid Thumb1 instruction, and this
could not be assembled. The generated object file contained this,
resulting in r0 holding SP+8 rather tha SP+1028:
  add r0, sp, #1020
  add r0, sp, #8

This function looked like it could have caused miscompilations for
other combinations of registers and offsets (though I don't think it is
currently called with these), and the heuristic it used did not match
the emitted code in all cases.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222125 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 11:18:10 +00:00
David Majnemer
a18e46cbc9 Object, COFF: Tighten the object file parser
We were a little lax in a few areas:
- We pretended that import libraries were like any old COFF file, they
  are not.  In fact, they aren't really COFF files at all, we should
  probably grow some specialized functionality to handle them smarter.
- Our symbol iterators were more than happy to attempt to go past the
  end of the symbol table if you had a symbol with a bad list of
  auxiliary symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222124 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 11:17:17 +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