Commit Graph

1921 Commits

Author SHA1 Message Date
Benjamin Kramer
15df8bebdc [APInt] Remove special case for i1.
Add a unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239062 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 18:19:13 +00:00
Frederic Riss
2368d54c07 YAML traits need to be in the llvm::yaml namespace.
Hope this fixes the bits, eg:
http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/27147

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238586 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:14:55 +00:00
Frederic Riss
9282af9d6c [YAMLIO] Make line-wrapping configurable and test it.
Summary:
We would wrap flow mappings and sequences when they go over a hardcoded 70
characters limit. Make the wrapping column configurable (and default to 70
co the change should be NFC for current users). Passing 0 allows to completely
suppress the wrapping which makes it easier to handle in tools like FileCheck.

Reviewers: bogner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:56:28 +00:00
Petar Jovanovic
a703f676f7 [Mips64] Add support for MCJIT for MIPS64r2 and MIPS64r6
Add support for resolving MIPS64r2 and MIPS64r6 relocations in MCJIT.

Patch by Vladimir Radosavljevic.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238424 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 13:48:41 +00:00
Duncan P. N. Exon Smith
09fe4bf794 Reapply "AsmPrinter: Change DIEValue to be stored by value"
This reverts commit r238350, effectively reapplying r238349 after fixing
(all?) the problems, all somehow related to how I was using
`AlignedArrayCharUnion<>` inside `DIEValue`:

  - MSVC can only handle `sizeof()` on types, not values.  Change the
    assert.
  - GCC doesn't know the `is_trivially_copyable` type trait.  Instead of
    asserting it, add destructors.
  - Call placement new even when constructing POD (i.e., the pointers).
  - Instead of copying the char buffer, copy the casted classes.

I've left in a couple of `static_assert`s that I think both MSVC and GCC
know how to handle.  If the bots disagree with me, I'll remove them.

  - Check that the constructed type is either standard layout or a
    pointer.  This protects against a programming error: we really want
    the "small" `DIEValue`s to be small and simple, so don't
    accidentally change them not to be.
  - Similarly, check that the size of the buffer is no bigger than a
    `uint64_t` or a pointer.  (I thought checking against
    `sizeof(uint64_t)` would be good enough, but Chandler suggested that
    pointers might sometimes be bigger than that in the context of
    sanitizers.)

I've also committed r238359 in the meantime, which introduces a
DIEValue.def to simplify dispatching between the various types (thanks
to a review comment by David Blaikie).  Without that, this commit would
be almost unintelligible.

Here's the original commit message:
--
Change `DIEValue` to be stored/passed/etc. by value, instead of
reference.  It's now a discriminated union, with a `Val` field storing
the actual type.  The classes that used to inherit from `DIEValue` no
longer do.  There are two categories of these:

  - Small values fit in a single pointer and are stored by value.
  - Large values require auxiliary storage, and are stored by reference.

The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp.  It
was relying on `DIEInteger`s being passed around by reference, so I
replaced that assumption with a `PatchLocation` type that stores a safe
reference to where the `DIEInteger` lives instead.

This commit causes a temporary regression in memory usage, since I've
left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit.  I
measured an increase from 845 MB to 879 MB, around 3.9%.  The follow-up
drops it lower than the starting point, and I've only recently brought
the memory this low anyway, so I'm committing these changes separately
to keep them incremental.  (I also considered swapping the commits, but
the other one first would cause a lot more code churn.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)
--

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238362 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 22:14:58 +00:00
Renato Golin
deae59fceb ARMTargetParser: Make BSD Thumb/BE armv6 work
Simple change to make arch like "thumbv6" and "armbev6" to return the
correct CPU for FreeBSD and NetBSD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 19:49:53 +00:00
Duncan P. N. Exon Smith
3c41ae83f2 Revert "AsmPrinter: Change DIEValue to be stored by value"
This reverts commit r238349, since it caused some errors on bots:
  - std::is_trivially_copyable isn't available until GCC 5.0.
  - It was complaining about strict aliasing with my use of
    ArrayCharUnion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238350 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 19:30:27 +00:00
Duncan P. N. Exon Smith
b9d92c6a8d AsmPrinter: Change DIEValue to be stored by value
Change `DIEValue` to be stored/passed/etc. by value, instead of
reference.  It's now a discriminated union, with a `Val` field storing
the actual type.  The classes that used to inherit from `DIEValue` no
longer do.  There are two categories of these:

  - Small values fit in a single pointer and are stored by value.
  - Large values require auxiliary storage, and are stored by reference.

The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp.  It
was relying on `DIEInteger`s being passed around by reference, so I
replaced that assumption with a `PatchLocation` type that stores a safe
reference to where the `DIEInteger` lives instead.

This commit causes a temporary regression in memory usage, since I've
left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit.  I
measured an increase from 845 MB to 879 MB, around 3.9%.  The follow-up
drops it lower than the starting point, and I've only recently brought
the memory this low anyway, so I'm committing these changes separately
to keep them incremental.  (I also considered swapping the commits, but
the other one first would cause a lot more code churn.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238349 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 19:22:50 +00:00
Duncan P. N. Exon Smith
24ad5c9e05 AsmPrinter: Make DIEString small
Expose the `DwarfStringPool` entry in a header, and store a pointer to
it directly in `DIEString`.  Instead of choosing at creation time how to
emit it, use the `dwarf::Form` to determine that at emission time.
Besides avoiding the other `DIEValue`, this shaves two pointers off of
`DIEString`; the data is now a single pointer.  This is a nice cleanup
on its own -- and drops memory usage from 861 MB down to 853 MB, around
0.9% -- but it's also preparation for passing `DIEValue`s by value.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238117 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-24 16:40:47 +00:00
Renato Golin
84b1a805bb Adding profile and version parsers to ARMTargetParser
This allows us to match armv6m to default to thumb, but will also be used by
Clang's driver and remove the current incomplete copy in it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238036 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 18:17:55 +00:00
Michael J. Spencer
b86942cca4 [Support] Fix ErrorOr equality operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237970 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 23:15:00 +00:00
Adrian Prantl
849c7601a0 IR / debug info: Add a DWOId field to DICompileUnit,
so DWARF skeleton CUs can be expression in IR. A skeleton CU is a
(typically empty) DW_TAG_compile_unit that has a DW_AT_(GNU)_dwo_name and
a DW_AT_(GNU)_dwo_id attribute. It is used to refer to external debug info.

This is a prerequisite for clang module debugging as discussed in
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-November/040076.html.
In order to refer to external types stored in split DWARF (dwo) objects,
such as clang modules, we need to emit skeleton CUs, which identify the
dwarf object (i.e., the clang module) by filename (the SplitDebugFilename)
and a hash value, the dwo_id.

This patch only contains the IR changes. The idea is that a CUs with a
non-zero dwo_id field will be emitted together with a DW_AT_GNU_dwo_name
and DW_AT_GNU_dwo_id attribute.

http://reviews.llvm.org/D9488
rdar://problem/20091852

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 20:37:30 +00:00
Alex Lorenz
802ab073da YAML: Null terminate block scalar's value.
The commit null terminates the string value in the `yaml::BlockScalarNode`
class.

This change is motivated by the initial MIR serialization commit (r237708)
that I reverted in r237730 because the LLVM IR source from the block
scalar node wasn't terminated by a null character and thus the buildbots
failed on one testcase sometimes. This change enables me to recommit 
the reverted commit. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237942 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:45:02 +00:00
Derek Schuff
493bc7e300 Fix StreamingMemoryObject to respect known object size.
The existing code for method StreamingMemoryObject.fetchToPos does not respect
the corresonding call to setKnownObjectSize(). As a result, it allows the
StreamingMemoryObject to read bytes past the object size.

This patch provides a test case, and code to fix the problem.

Patch by Karl Schimpf
Differential Revision: http://reviews.llvm.org/D8931

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237939 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:40:19 +00:00
Renato Golin
b6ea67e027 Make Triple::parseARMArch use ARMTargetParser
Simplifying Triple::parseARMArch, leaving all the parsing to ARMTargetParser.

This commit also adds AArch64 detection to ARMTargetParser canonicalization,
and a two RedHat arch names (v{6,7}hl, meaning hard-float / little-endian).

Adding enough unit tests to cover the basics. Clang checks fine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237902 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 13:52:20 +00:00
Alex Lorenz
3f1b2bdf5d AsmParser: Require a terminating null character when creating memory buffer.
This commit modifies the memory buffer creation in the AsmParser library so 
that it requires a terminating null character. The LLLexer in the AsmParser
library checks for EOF only when it sees a null character, thus it would
be best to require it when creating a memory buffer so that the memory
buffer constructor can verify that a terminating null character is indeed
present.

Reviewers: Duncan P. N. Exon Smith, Matthias Braun

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 20:41:27 +00:00
Renato Golin
8ca7ac2a38 Get Triple::getARMCPUForArch() to use TargetParser
First ARMTargetParser FIXME, conservatively changing the way we parse CPUs
in the back-end. Still not perfect, with a lot of special cases, but moving
towards a more generic solution.

Moving all logic to the target parser made some unwritten assumptions
about architectures in Clang to break. I've added a lot of architectures
required by Clang, and default to CPUs that Clang believes it should
(and I agree).

I've also added a lot of unit tests, with the correct CPU for each
architecture, and Clang seems to be working correctly, too.

It also became clear that using "unsigned ID" as the argument for the get
methods makes it hard to know what ID, so I also changed the argument names
to match the enum type names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237797 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 15:05:07 +00:00
Pawel Bylica
5a2d715235 Unit tests for the getSwappedBytes(double) fix from r237673.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237795 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 14:57:43 +00:00
David Blaikie
042dd34f9c Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237624 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:13:54 +00:00
Hans Wennborg
febe7813c8 Fix llvm::BumpPtrAllocatorImpl::Reset()
BumpPtrAllocator's Reset wouldn't clear CustomSizedSlabs if Slabs.size() == 0.

Patch by Kal <b17c0de@gmail.com>!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237588 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:54:17 +00:00
Eric Christopher
1bef1cdd92 While in GlobalValue fix the function(s) that don't follow the
naming convention and update users.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237461 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 18:20:14 +00:00
Alex Lorenz
29a3c1d580 YAML: Add support for literal block scalar I/O.
This commit gives the users of the YAML Traits I/O library 
the ability to serialize scalars using the YAML literal block 
scalar notation by allowing them to implement a specialization 
of the `BlockScalarTraits` struct for their custom types.

Reviewers: Duncan P. N. Exon Smith

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237404 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 23:08:22 +00:00
Alex Lorenz
b96942f6ec YAML: Implement block scalar parsing.
This commit implements the parsing of YAML block scalars.
Some code existed for it before, but it couldn't parse block
scalars.

This commit adds a new yaml node type to represent the block
scalar values. 

This commit also deletes the 'spec-09-27' and 'spec-09-28' tests
as they are identical to the test file 'spec-09-26'.

This commit introduces 3 new utility functions to the YAML scanner
class: `skip_s_space`, `advanceWhile` and `consumeLineBreakIfPresent`.

Reviewers: Duncan P. N. Exon Smith

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237314 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 23:10:51 +00:00
Justin Bogner
42ab8c0a90 InstrProf: Treat functions with a coverage map but no profile as unreached
If we have a coverage mapping but no profile data for a function,
calling it mismatched is misleading. This can just as easily be
unreachable code that was stripped from the binary. Instead, treat
these the same as functions where we have an explicit "zero" coverage
map by setting the count to zero for each mapped region.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 22:03:04 +00:00
Diego Novillo
a3bccceda7 Add function entry count metadata.
Summary:
This adds three Function methods to handle function entry counts:
setEntryCount() and getEntryCount().

Entry counts are stored under the MD_prof metadata node with the name
"function_entry_count". They are unsigned 64 bit values set by profilers
(instrumentation and sample profiler changes coming up).

Added documentation for new profile metadata and tests.

Reviewers: dexonsmith, bogner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237260 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 15:13:45 +00:00
David Blaikie
bbd301d97a Readdress r236990, use of static members on a non-static variable.
The TargetRegistry is just a namespace-like class, instantiated in one
place to use a range-based for loop. Instead, expose access to the
registry via a range-based 'targets()' function instead. This makes most
uses a bit awkward/more verbose - but eventually we should just add a
range-based find_if function which will streamline these functions. I'm
happy to mkae them a bit awkward in the interim as encouragement to
improve the algorithms in time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237059 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-11 22:20:48 +00:00
Aaron Ballman
0a62359646 Amends r236990, because I failed at hitting "save" before commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236991 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-11 13:11:38 +00:00
Aaron Ballman
9ffcd1bdbd Replacing a range-based for loop with an old-style for loop. This code was previously causing a warning with MSVC about a compiler-generated local variable because TargetRegistry::begin() and end() are static member functions. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236990 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-11 13:10:17 +00:00
Douglas Katzman
58b44d65f9 Unbreak build: Makefile must have the same change as CMakeLists.txt
This was omitted from http://reviews.llvm.org/D9441
(the irony is that that was to detect omissions in something else)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236878 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 16:39:59 +00:00
Douglas Katzman
d7e20e7be8 Prevent further errors of omission when adding backend names.
Differential Revision: http://reviews.llvm.org/D9441

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236865 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 15:34:12 +00:00
John Brawn
62f973306c [ARM] Reject invalid -march values
Restructure Triple::getARMCPUForArch so that invalid values will
return nullptr, while retaining the behaviour that an argument
specifying no particular architecture version will give a default
CPU. This will be used by clang to give an error on invalid -march
values.

Also restructure the extraction of the architecture version from
the MArch string a little to hopefully make what it's doing clearer.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 12:52:02 +00:00
Alex Lorenz
9daa4b18f7 YAML: Fix crash in the skip method of KeyValueNode class.
This commit changes the 'skip' method in the 'KeyValueNode' class
to ensure that it doesn't dereference a null pointer when calling 
the 'skip' method of its value child node. It also adds a unittest
that ensures that the crash doesn't occur.

This change is motivated by a patch that implements parsing
of YAML block scalars (http://reviews.llvm.org/D9503), as one
of the unittests in that patch triggered this problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 23:21:29 +00:00
Derek Schuff
683cf0f88f Add bitcode test to verify functions can be materialized out of order.
Summary:
Adds test to check that when getLazyBitcodeModule is called:
1) Functions are not materailzed by default.
2) Only the requested function gets materialized (if no block addresses
   are used).

Reviewers: jvoung, rafael

Reviewed By: rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 16:52:35 +00:00
Justin Bogner
730ddb6f57 InstrProf: Strip filename prefixes from the names we display for coverage
For consumers of coverage data, any filename prefixes we store in the
profile data are just noise. Strip this prefix if it exists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236558 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-05 23:44:48 +00:00
Ismail Donmez
eb32d4dc7a Fix regression in parsing armv{6,7}hl- triples. These are used by SUSE
and Redhat currently.

Reviewed by Jonathan Roelofs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-05 09:29:43 +00:00
Alex Lorenz
c41c3a4c3b YAML: Add an optional 'flow' field to the mapping trait to allow flow mapping output.
This patch adds an optional 'flow' field to the MappingTrait
class so that yaml IO will be able to output flow mappings.

Reviewers: Justin Bogner

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236456 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-04 20:11:40 +00:00
Hans Wennborg
375079a549 Option parsing: properly handle flag aliases for joined options (PR23394)
A joined option always needs to have an argument, even if it's an empty one.

Clang would previously assert when trying to use --extra-warnings, which is
a flag alias for -W, which is a joined option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236434 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-04 18:00:13 +00:00
Zachary Turner
ff6f472575 Fix compilation of PDBApiTest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236345 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-01 20:51:49 +00:00
Douglas Katzman
68f7995d19 Move unit test into anonymous namespace as per convention.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236332 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-01 18:51:06 +00:00
Alex Lorenz
9791e1ad9c YAML: Fix the output of sequences that contain flow sequences.
This patch fixes a bug where the YAML Output class emitted
a sequence of flow sequences without the '-' characters.
Before:
  
  seq:
    [ a, b ]
    [ c, d ]

After:

  seq:
    - [ a, b ]
    - [ c, d ]


Reviewers: Justin Bogner

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236329 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-01 18:34:25 +00:00
Diego Novillo
3c178d82ce Fix infinite recursion in ScaledNumber::toInt.
Patch from dexonsmith. The call to toInt() was calling compareTo() which
in some cases would call back to toInt(), creating an infinite loop.

Fixed by simplifying the logic in compareTo() to avoid the co-recursion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236326 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-01 17:59:15 +00:00
Douglas Katzman
e52ba69038 Exhaustively test all triples in TripleTest.
Iteration over all permutations didn't really work,
due to evolution of the underlying enums.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236251 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 20:08:44 +00:00
Diego Novillo
156f9e8a04 Fix private constructor for ScaledNumber.
Summary:
The private constructor for ScaledNumber was using uint64_t instead of
DigitsT. This was preventing instantiations of ScaledNumber with
anything other than uint64_t types.

In implementing the tests, I ran into another issue. Operators >>= and
<<= did not have variants for accepting other ScaledNumber as the shift
argument. This is expected by the SCALED_NUMBER_BOP.

It makes no sense to allow shifting a ScaledNumber by another
ScaledNumber, so the patch includes two new templates for shifting
ScaledNumbers.

Reviewers: dexonsmith

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236232 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 13:22:48 +00:00
Diego Novillo
dfac1e6730 Fix typo in comment. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236227 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 12:27:51 +00:00
Pawel Bylica
ef0d2a6e01 Add convenient overloads for CreateInsertElement and CreateExtractElement methods in IRBuilder
Summary:
This pathc add convenient overloads for CreateInsertElement and CreateExtractElement methods in IRBuilder
where vector index can be uint64_t instead of Value*.

Test Plan: Unit test included.

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: majnemer, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236214 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 09:01:22 +00:00
David Blaikie
39e7388a19 [opaque pointer type] Pass GlobalAlias the actual pointer type rather than decomposing it into pointee type + address space
Many of the callers already have the pointer type anyway, and for the
couple of callers that don't it's pretty easy to call PointerType::get
on the pointee type and address space.

This avoids LLParser from using PointerType::getElementType when parsing
GlobalAliases from IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236160 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 21:22:39 +00:00
Douglas Katzman
f74703a44f New architecture name - 'sparcel' for Sparc little-endian.
Differential Revision: http://reviews.llvm.org/D9263

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236139 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 19:15:08 +00:00
Reid Kleckner
6cc327cc18 Disable failing TestDevNull test on Windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236126 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:54:11 +00:00
Duncan P. N. Exon Smith
e56023a059 IR: Give 'DI' prefix to debug info metadata
Finish off PR23080 by renaming the debug info IR constructs from `MD*`
to `DI*`.  The last of the `DIDescriptor` classes were deleted in
r235356, and the last of the related typedefs removed in r235413, so
this has all baked for about a week.

Note: If you have out-of-tree code (like a frontend), I recommend that
you get everything compiling and tests passing with the *previous*
commit before updating to this one.  It'll be easier to keep track of
what code is using the `DIDescriptor` hierarchy and what you've already
updated, and I think you're extremely unlikely to insert bugs.  YMMV of
course.

Back to *this* commit: I did this using the rename-md-di-nodes.sh
upgrade script I've attached to PR23080 (both code and testcases) and
filtered through clang-format-diff.py.  I edited the tests for
test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns
were off-by-three.  It should work on your out-of-tree testcases (and
code, if you've followed the advice in the previous paragraph).

Some of the tests are in badly named files now (e.g.,
test/Assembler/invalid-mdcompositetype-missing-tag.ll should be
'dicompositetype'); I'll come back and move the files in a follow-up
commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236120 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:38:44 +00:00
Rafael Espindola
4389f0be73 Relax assert to avoid spurious failures with /dev/null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236106 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 14:53:25 +00:00
Daniel Berlin
b1e1aa04ed Make getModRefInfo(Instruction *) not crash on certain types of instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236023 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 19:19:14 +00:00
Duncan P. N. Exon Smith
fef483667f DebugInfo: Support up to 2^16 arguments in a subprogram
Support up to 2^16 arguments to a function.  If we do hit the limit,
assert out rather than restarting at 0 as we've done historically.

This fixes PR23332.  A clang test will follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235955 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 01:07:33 +00:00
Pawel Bylica
59764b94a7 Constfold insertelement to undef when index is out-of-bounds
Summary:
This patch adds constant folding of insertelement instruction to undef value when index operand is constant and is not less than vector size or is undef.

InstCombine does not support this case, but I'm happy to add it there also if this change is accepted.

Test Plan: Unittests and regression tests for ConstProp pass.

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235854 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27 09:30:49 +00:00
Duncan P. N. Exon Smith
ef477f3580 Verifier: Function metadata attachments require a body
Add a verifier check that only functions with bodies have metadata
attachments.  This should help catch bugs in frontends and
transformation passes.  Part of PR23340.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235784 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 21:53:27 +00:00
Duncan P. N. Exon Smith
eb79bb6e61 IR: Add Function metadata attachments
Add IR support for `Metadata` attachments.  Assembly and bitcode support
will follow shortly, but for now we just have unit tests.  This is part
of PR23340.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235783 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 21:51:02 +00:00
Pawel Bylica
8d00f2ad79 Correct extractelement constant folding
Summary: Constant folding of extractelement with out-of-bound index produces undef also for indexes bigger than 64bit (instead of crash assert failure as before)

Test Plan: Unit tests included.

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235700 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 07:42:35 +00:00
Pawel Bylica
9ee9f1a334 Fix APInt long division algorithm
Summary: This patch fixes step D4 of Knuth's division algorithm implementation. Negative sign of the step result was not always detected due to incorrect "borrow" handling.

Test Plan: Unit test that reveals the bug included.

Reviewers: chandlerc, yaron.keren

Reviewed By: yaron.keren

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235699 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 07:38:39 +00:00
Yaron Keren
2adb40ecb6 Another test to exercise APInt divide step D6.
This is divrem_big7 since divrem_big6 is used in Pawel upcoming patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235536 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 18:49:59 +00:00
David Blaikie
bc9eee72cf Replace std::auto_ptr with std::unique_ptr
std::auto_ptr is deprecated in GCC 5.0, and we are already using
std::unique_ptr all over the place.

Patch by Xan López.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 04:39:13 +00:00
Duncan P. N. Exon Smith
1cacd28c3b DebugInfo: Remove DIArray and DITypeArray typedefs
Remove the `DIArray` and `DITypeArray` typedefs, preferring the
underlying types (`DebugNodeArray` and `MDTypeRefArray`, respectively).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235413 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-21 20:07:38 +00:00
Duncan P. N. Exon Smith
7f892716df DebugInfo: Drop rest of DIDescriptor subclasses
Delete the remaining subclasses of (the already deleted) `DIDescriptor`.
Part of PR23080.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235404 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-21 18:44:06 +00:00
Reid Kleckner
4be4d30125 s/NULL/nullptr/ in OrcTestCommon.h to silence -Wsentinel in clang-cl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235386 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-21 15:56:21 +00:00
Duncan P. N. Exon Smith
d3c29ac587 DebugInfo: Delete subclasses of DIScope
Delete subclasses of (the already defunct) `DIScope`, updating users to
use the raw pointers from the `Metadata` hierarchy directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235356 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-20 22:10:08 +00:00
Lang Hames
302f000bf4 [Orc] Make the makeStub function propagate argument attributes onto the call to
the function body.

This is necessary for correctness when lazily compiling.

Also, flesh out the Orc unit test infrastructure slightly, and add a unit test
for this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235347 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-20 20:41:45 +00:00
Duncan P. N. Exon Smith
91ad62302f DebugInfo: Remove DIType
This is the last major parent class, so I'll probably start deleting
classes in batches now.  Looks like many of the references to the DI*
hierarchy were updated organically along the way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-20 18:52:06 +00:00
Rafael Espindola
f30ac8f5ec Don't allow pwrite to resize a stream.
The current implementations could exhibit some behavior differences:

raw_fd_ostream: Whatever the underlying fd does with seek+write. In a normal
file, the write position would be back to the old offset.

raw_svector_ostream: The write position is always the end of the stream, so
after pwrite the write position would be the new end. This matches what OS_X
(all BSD?) do with a pwrite in a O_APPEND fd.

Given that we don't need that feature and don't use O_APPEND a lot in LLVM,
just disallow it.

I am open to suggestions on renaming pwrite to something else, but this fixes
the issue for now.

Thanks to Yaron Keren for reporting it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235303 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-20 13:04:30 +00:00
Zachary Turner
9d74bda3e3 [PDB] Support executables and source/line info.
Previously DebugInfoPDB could only load data for a PDB given a
path to the PDB.  It could not open an EXE and find the matching
PDB and verify it matched, etc.  This patch adds support for that
so that we can simply load debug information for a PDB directly.

Additionally, this patch extends DebugInfoPDB to support getting
source and line information for symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235237 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-17 22:40:36 +00:00
Duncan P. N. Exon Smith
afc67405f8 DebugInfo: Remove DIDescriptor from the DIBuilder API
As a step toward killing `DIDescriptor` and its subclasses, remove it
from the `DIBuilder` API.  Replace the subclasses with appropriate
pointers from the new debug info hierarchy.  There are a couple of
possible surprises in type choices for out-of-tree frontends:

  - Subroutine types: `MDSubroutineType`, not `MDCompositeTypeBase`.
  - Composite types: `MDCompositeType`, not `MDCompositeTypeBase`.
  - Scopes: `MDScope`, not `MDNode`.
  - Generic debug info nodes: `DebugNode`, not `MDNode`.

This is part of PR23080.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235111 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 16:36:23 +00:00
Duncan P. N. Exon Smith
b07e129e63 DebugInfo: Gut DIDescriptor
PR23080 is almost finished.  With this commit, there's no consequential
API in `DIDescriptor` and its subclasses.  What's left?

  - Default-constructed to `nullptr`.
  - Handy `const_cast<>` (constructed from `const`, but accessors are
    non-`const`).

I think the safe way to catch those is to delete the classes and fix
compile errors.  That'll be my next step, after I delete the `DITypeRef`
(etc.) wrapper around `MDTypeRef`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235069 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 01:53:33 +00:00
Duncan P. N. Exon Smith
ed0e117ff3 DebugInfo: Gut DICompileUnit and DIFile
Continuing gutting `DIDescriptor` subclasses; this edition,
`DICompileUnit` and `DIFile`.  In the name of PR23080.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235055 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-15 23:19:27 +00:00
Duncan P. N. Exon Smith
88e419d66e DebugInfo: Remove 'inlinedAt:' field from MDLocalVariable
Remove 'inlinedAt:' from MDLocalVariable.  Besides saving some memory
(variables with it seem to be single largest `Metadata` contributer to
memory usage right now in -g -flto builds), this stops optimization and
backend passes from having to change local variables.

The 'inlinedAt:' field was used by the backend in two ways:

 1. To tell the backend whether and into what a variable was inlined.
 2. To create a unique id for each inlined variable.

Instead, rely on the 'inlinedAt:' field of the intrinsic's `!dbg`
attachment, and change the DWARF backend to use a typedef called
`InlinedVariable` which is `std::pair<MDLocalVariable*, MDLocation*>`.
This `DebugLoc` is already passed reliably through the backend (as
verified by r234021).

This commit removes the check from r234021, but I added a new check
(that will survive) in r235048, and changed the `DIBuilder` API in
r235041 to require a `!dbg` attachment whose 'scope:` is in the same
`MDSubprogram` as the variable's.

If this breaks your out-of-tree testcases, perhaps the script I used
(mdlocalvariable-drop-inlinedat.sh) will help; I'll attach it to PR22778
in a moment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235050 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-15 22:29:27 +00:00
Duncan P. N. Exon Smith
cb334476f1 DebugInfo: Require a DebugLoc in DIBuilder::insertDeclare()
Change `DIBuilder::insertDeclare()` and `insertDbgValueIntrinsic()` to
take an `MDLocation*`/`DebugLoc` parameter which it attaches to the
created intrinsic.  Assert at creation time that the `scope:` field's
subprogram matches the variable's.  There's a matching `clang` commit to
use the API.

The context for this is PR22778, which is removing the `inlinedAt:`
field from `MDLocalVariable`, instead deferring to the `!dbg` location
attached to the debug info intrinsic.  The best way to ensure we always
have a `!dbg` attachment is to require one at creation time.  I'll be
adding verifier checks next, but this API change is the best way to
shake out frontend bugs.

Note: I added an `llvm_unreachable()` in `bindings/go` and passed in
`nullptr` for the `DebugLoc`.  The `llgo` folks will eventually need to
pass a valid `DebugLoc` here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235041 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-15 21:18:07 +00:00
Daniel Berlin
2e6716eb55 Only recalculate DFS Numbers if invalid. Invalidate DFS numbers on reset. Add unit test to verify recalculation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234933 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 19:49:26 +00:00
Rafael Espindola
661ed85834 Add raw_pwrite_stream type.
This is a raw_ostream that also supports pwrite.
I will be used in a sec.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234895 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 15:00:34 +00:00
Duncan P. N. Exon Smith
125e3d3959 DebugInfo: Gut DISubprogram and DILexicalBlock*
Gut the `DIDescriptor` wrappers around `MDLocalScope` subclasses.  Note
that `DILexicalBlock` wraps `MDLexicalBlockBase`, not `MDLexicalBlock`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234850 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 03:40:37 +00:00
Daniel Berlin
b4f6438352 Make getModRefInfo with a default location not crash.
Add getModRefInfo that works without location.
Add unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234811 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-13 23:05:45 +00:00
Duncan P. N. Exon Smith
e2e641234f DebugInfo: Make MDSubprogram::getFunction() return Constant
Change `MDSubprogram::getFunction()` and
`MDGlobalVariable::getConstant()` to return a `Constant`.  Previously,
both returned `ConstantAsMetadata`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234699 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-11 20:27:40 +00:00
Alexander Kornienko
c16fc54851 Use 'override/final' instead of 'virtual' for overridden methods
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,misc-use-override' -header-filter='llvm|clang' \
    -j=32 -fix -format

http://reviews.llvm.org/D8925



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234679 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-11 02:11:45 +00:00
Duncan P. N. Exon Smith
2e25115e02 IR: Remove MDTupleTypedArrayWrapper::operator MDTuple*()
Remove `MDTupleTypedArrayWrapper::operator MDTuple*()`, since it causes
ambiguity (at least in some [1] compilers [2]) when using indexes to
`MDTupleTypedArrayWrapper::operator[](unsigned)` that are convertible to
(but not the same as) `unsigned`.

[1]: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/2308
[2]: http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/4442

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234326 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 16:50:39 +00:00
Duncan P. N. Exon Smith
92d1a52362 DebugInfo: Remove DITypedArray<>, replace with typedefs
Replace all uses of `DITypedArray<>` with `MDTupleTypedArrayWrapper<>`
and `MDTypeRefArray`.  The APIs are completely different, but the
provided functionality is the same: treat an `MDTuple` as if it's an
array of a particular element type.

To simplify this patch a bit, I've temporarily typedef'ed
`DebugNodeArray` to `DIArray` and `MDTypeRefArray` to `DITypeArray`.
I've also temporarily conditionalized the accessors to check for null --
eventually these should be changed to asserts and the callers should
check for null themselves.

There's a tiny accompanying patch to clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234290 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 04:14:33 +00:00
Duncan P. N. Exon Smith
5f3bcf7dc4 DebugInfo: Move DIFlag-related API from DIDescriptor to DebugNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234274 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 01:21:40 +00:00
Duncan P. N. Exon Smith
329f8219cd IR: Rename MDSubrange::getLo() to getLowerBound()
During initial review, the `lo:` field was renamed to `lowerBound:`.
Make the same change to the C++ API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234267 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 00:39:59 +00:00
Duncan P. N. Exon Smith
1545953510 IR: Stop using DIDescriptor::is*() and auto-casting
`DIDescriptor`'s subclasses allow construction from incompatible
pointers, and `DIDescriptor` defines a series of `isa<>`-like functions
(e.g., `isCompileUnit()` instead of `isa<MDCompileUnit>()`) that clients
tend to use like this:

    if (DICompileUnit(N).isCompileUnit())
      foo(DICompileUnit(N));

These construction patterns work together to make `DIDescriptor` behave
differently from normal pointers.

Instead, use built-in `isa<>`, `dyn_cast<>`, etc., and only build
`DIDescriptor`s from pointers that are valid for their type.

I've split this into a few commits for different parts of LLVM and clang
(to decrease the patch size and increase the chance of review).
Generally the changes I made were NFC, but in a few places I made things
stricter if it made sense from the surrounded code.

Eventually a follow-up commit will remove the API for the "old" way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234255 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 23:18:49 +00:00
Reid Kleckner
0123b6ee73 [lit] Fix running gtest type-parameterized tests on Windows
The '/' character in the test name of a type-parameterized test is not a
path separator, and should not be '\' on Windows. We were passing a test
name to --gtest_filter which found no tests, so the exit code was zero,
indicating a passed test.

This bug has been here since r84387 in 2009, when Jeff Yasskin added the
original lit support for type-paratermized tests. Somewhere along the
line some of the ValueMapTests started failing, but we can fix those
separately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234242 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 21:49:55 +00:00
Duncan P. N. Exon Smith
1ea24954c6 DebugInfo: Remove DIDescriptor::Verify()
Remove `DIDescriptor::Verify()` and the `Verify()`s from subclasses.
They had already been gutted, and just did an `isa<>` check.

In a couple of cases I've temporarily dropped the check entirely, but
subsequent commits are going to disallow conversions to the
`DIDescriptor`s directly from `MDNode`, so the checks will come back in
another form soon enough.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234201 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 19:49:39 +00:00
Duncan P. N. Exon Smith
e009b6fd92 DebugInfo: Use MDTypeRef throughout the hierarchy
Use `MDTypeRef` (etc.) in the new debug info hierarchy rather than raw
`Metadata *` pointers.

I rolled in a change to `DIBuilder` that looks unrelated: take `DIType`
instead of `DITypeRef` as type arguments when creating variables.
However, this was the simplest way to use `MDTypeRef` within the
functions, and didn't require any cleanups from callers in clang (since
they were all passing in `DIType`s anyway, relying on their implicit
conversions to `DITypeRef`).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234197 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 19:03:45 +00:00
Duncan P. N. Exon Smith
c6370a13cf DebugInfo: Remove dead code for accessing fields
Most fields are now accessed via the new debug info hierarchy.  I'll
make the rest of this code dead soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234182 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 17:21:05 +00:00
David Blaikie
19443c1bcb [opaque pointer type] API migration for GEP constant factories
Require the pointee type to be passed explicitly and assert that it is
correct. For now it's possible to pass nullptr here (and I've done so in
a few places in this patch) but eventually that will be disallowed once
all clients have been updated or removed. It'll be a long road to get
all the way there... but if you have the cahnce to update your callers
to pass the type explicitly without depending on a pointer's element
type, that would be a good thing to do soon and a necessary thing to do
eventually.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233938 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 18:55:32 +00:00
Benjamin Kramer
efdcf3d62d [support] Add a macro wrapper for alignas and simplify some code.
We wrap __attribute((aligned)) for GCC 4.7 and __declspec(align) for
MSVC. The latter behaves weird in some contexts so this should be used
carefully.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233910 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 11:32:48 +00:00
Duncan P. N. Exon Smith
34dea0fcab IR: Rename replaceWithUniqued() tests from r233751
replaceWithUniquedUnresolved
replaceWithUniquedUnresolvedChangedOperand
 =>
replaceWithUniquedResolvingOperand
replaceWithUniquedChangingOperand

I find the new names less confusing; they're also more accurate.  Sorry
for the churn.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233759 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 21:05:06 +00:00
Duncan P. N. Exon Smith
f067a68207 IR: Enable uniquing callbacks during MDNode::replaceWithUniqued()
Uniqued nodes have more complete registration with
`ReplaceableMetadataImpl` so that they can update themselves when
operands change.  Fix a bug where `MDNode::replaceWithUniqued()` wasn't
enabling these callbacks.

The two most obvious ways missing callbacks causes problems is that
auto-resolution fails and re-uniquing (on changed operands) just doesn't
happen.  I've added tests for both -- in both cases, I confirmed that
the final check was failing before the fix.

rdar://problem/20365935

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233751 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 20:50:50 +00:00
Lang Hames
d26a5d313c [MCJIT] Enable MCJIT regression tests on Darwin.
Commit r233747 fixed the issue that had been blocking this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233750 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 20:48:52 +00:00
Lang Hames
83b5f345b2 [ExecutionEngine] Fix MCJIT::addGlobalMapping.
This patch fixes MCJIT::addGlobalMapping by changing the implementation of the
ExecutionEngineState class. The new implementation maintains a bidirectional
mapping between symbol names (std::strings) and addresses (uint64_ts), rather
than a mapping between Value*s and void*s.

This has fix has been made for backwards compatibility, however the strongly
preferred way to resolve unknown symbols is by writing a custom
RuntimeDyld::SymbolResolver (formerly RTDyldMemoryManager) and overriding the
findSymbol method. The addGlobalMapping method is a hangover from the legacy JIT
(which has was removed in 3.6), and may be deprecated in a future release as
part of a clean-up of the ExecutionEngine interface.

Patch by Murat Bolat. Thanks Murat!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233747 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 20:31:14 +00:00
Duncan P. N. Exon Smith
d3cfcf9614 Verifier: Move over DISubprogram::Verify()
Move over the remaining (somewhat complicated) check from
`DISubprogram::Verify()`.  I suspect this check could be optimized --
e.g., it would be nice not to do another full traversal here -- but it's
not exactly obvious how.  For now, just bring it over as is.

Once we have a better model for the "canonical" subprogram of a
`Function`, we should enforce that all `!dbg` attachments lead to the
canonical one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233663 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 02:09:55 +00:00
Duncan P. N. Exon Smith
7f3757eb9b Transforms: Update unit tests to use verifyModule()
Since I'm slowly gutting `DISubprogram` and `DICompileUnit`, update the
`CloneFunc` unit tests to call `verifyModule()` (where the checks are
moving to).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 21:35:14 +00:00
Duncan P. N. Exon Smith
454c320c6e Transforms: Fix a use of the old DebugLoc in unittests
Missed this one before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 21:05:29 +00:00
Duncan P. N. Exon Smith
7380257f0e Verifier: Add operand checks for remaining debug info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233565 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 17:21:38 +00:00
Duncan P. N. Exon Smith
d3ec0ca17e Verifier: Add operand checks for MDLexicalBlock
Add operand checks for `MDLexicalBlock` and `MDLexicalBlockFile`.  Like
`MDLocalVariable` and `MDLocation`, these nodes always require a scope.

There was no test bitrot to fix here (just updated the serialization
tests in test/Assembler/mdlexicalblock.ll).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233561 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 16:37:48 +00:00
Duncan P. N. Exon Smith
bd38c8d788 Verifier: Check operands of MDSubprogram nodes
Check operands of `MDSubprogram`s in the verifier, and update the
accessors and factory functions to use more specific types.

There were a lot of broken testcases, which I fixed in r233466.  If you
have out-of-tree tests for debug info, you probably need similar changes
to the ones I made there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233559 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 16:19:15 +00:00
Lang Hames
da62155c11 [MCJIT][Orc] Refactor RTDyldMemoryManager, weave RuntimeDyld::SymbolInfo through
MCJIT.

This patch decouples the two responsibilities of the RTDyldMemoryManager class,
memory management and symbol resolution, into two new classes:
RuntimeDyld::MemoryManager and RuntimeDyld::SymbolResolver.

The symbol resolution interface is modified slightly, from:

  uint64_t getSymbolAddress(const std::string &Name);

to:

  RuntimeDyld::SymbolInfo findSymbol(const std::string &Name);

The latter passes symbol flags along with symbol addresses, allowing RuntimeDyld
and others to reason about non-strong/non-exported symbols.


The memory management interface removes the following method:

  void notifyObjectLoaded(ExecutionEngine *EE,
                          const object::ObjectFile &) {}

as it is not related to memory management. (Note: Backwards compatibility *is*
maintained for this method in MCJIT and OrcMCJITReplacement, see below).


The RTDyldMemoryManager class remains in-tree for backwards compatibility.
It inherits directly from RuntimeDyld::SymbolResolver, and indirectly from
RuntimeDyld::MemoryManager via the new MCJITMemoryManager class, which
just subclasses RuntimeDyld::MemoryManager and reintroduces the
notifyObjectLoaded method for backwards compatibility).

The EngineBuilder class retains the existing method:

  EngineBuilder&
  setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm);

and includes two new methods:

  EngineBuilder&
  setMemoryManager(std::unique_ptr<MCJITMemoryManager> MM);

  EngineBuilder&
  setSymbolResolver(std::unique_ptr<RuntimeDyld::SymbolResolver> SR);

Clients should use EITHER:

A single call to setMCJITMemoryManager with an RTDyldMemoryManager.

OR (exclusive)

One call each to each of setMemoryManager and setSymbolResolver.

This patch should be fully compatible with existing uses of RTDyldMemoryManager.
If it is not it should be considered a bug, and the patch either fixed or
reverted.

If clients find the new API to be an improvement the goal will be to deprecate
and eventually remove the RTDyldMemoryManager class in favor of the new classes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233509 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 03:37:06 +00:00