Commit Graph

1054 Commits

Author SHA1 Message Date
Chandler Carruth
c197a3ab4d Test the polymorphic behavior of this utility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194320 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:58:13 +00:00
Chandler Carruth
8caea7237a Use something really explicit to test "move semantics" on builds without
r-value references. I still want to test that when we have them,
llvm_move is actually a move.

Have I mentioned that I really want to move to C++11? ;]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194318 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:49:27 +00:00
Chandler Carruth
ca020d469e Add the critically missing 'clone' method. =]
Clang managed to never instantiate the copy constructor. Added tests to
ensure this path is tested.

We could still use tests for the polymorphic nature. Those coming up
next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194317 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:32:34 +00:00
Chandler Carruth
cd7a191d8a Move the test type out of the function and into the anonymous namespace
to fix C++98 builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194316 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:09:50 +00:00
Chandler Carruth
aec427786b Add a polymorphic_ptr<T> smart pointer data type. It's a somewhat silly
unique ownership smart pointer which is *deep* copyable by assuming it
can call a T::clone() method to allocate a copy of the owned data.

This is mostly useful with containers or other collections of uniquely
owned data in C++98 where they *might* copy. With C++11 we can likely
remove this in favor of move-only types and containers wrapped around
those types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194315 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:06:02 +00:00
Adrian Prantl
999ffb6085 Revert "Move copying of global initializers below the cloning of functions."
This would cause internal symbols that are only referenced by global initializers to be removed.

This reverts commit 194219.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194304 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 00:43:18 +00:00
Adrian Prantl
ab6f27c7ff Revert "Run clang-format on file."
This reverts commit 194219.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194303 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 00:43:12 +00:00
Bill Wendling
5ebdcd29b6 Run clang-format on file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194219 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-07 20:18:21 +00:00
Bill Wendling
5d5f2c37d5 Move copying of global initializers below the cloning of functions.
The BlockAddress doesn't have access to the correct basic blocks until the
functions have been cloned. This causes the BlockAddress to point to the old
values. Just wait until the functions have been cloned before copying the
initializers.
PR13163

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194218 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-07 20:14:51 +00:00
Rafael Espindola
f94b3480fc Simplify ErrorOr.
ErrorOr had quiet a bit of complexity and indirection to be able to hold a user
type with the error.

That feature is not used anymore. This patch removes it, it will live in svn
history if we ever need it again.

If we do need it again, IMHO there is one thing that should be done
differently: Holding extra info in the error is not a property a function also
returning a value or not. The ability to hold extra info should be in the error
type and ErrorOr templated over it so that we don't need the funny looking
ErrorOr<void>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194030 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-05 00:28:01 +00:00
Rafael Espindola
c143c7573b Merge CallGraph and BasicCallGraph.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193734 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 03:03:55 +00:00
Rafael Espindola
415b33f161 Add calls to doInitialization() and doFinalization() in verifyFunction()
The function verifyFunction() in lib/IR/Verifier.cpp misses some
calls. It creates a temporary FunctionPassManager that will run a
single Verifier pass. Unfortunately, FunctionPassManager is no
PassManager and does not call doInitialization() and doFinalization()
by itself. Verifier does important tasks in doInitialization() such as
collecting type information used to check DebugInfo metadata and
doFinalization() does some additional checks. Therefore these checks
were missed and debug info couldn't be verified at all, it just
crashed if the function had some.

verifyFunction() is currently not used in llvm unless -debug option is
enabled, and in unittests/IR/VerifierTest.cpp

VerifierTest had to be changed to create the function in a module from
which the type debug info can be collected.

Patch by Michael Kruse.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193719 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 22:37:51 +00:00
Rui Ueyama
f34c3ca304 Add {start,end}with_lower methods to StringRef.
startswith_lower is ocassionally useful and I think worth adding.
endwith_lower is added for completeness.

Differential Revision: http://llvm-reviews.chandlerc.com/D2041

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193706 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 18:32:26 +00:00
Nuno Lopes
d3b64efcb3 make ConstantRange::signExtend() optimal
the case [x, INT_MIN) was not handled optimally

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193694 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 15:36:50 +00:00
Alexey Samsonov
636a5cb8de DWARF parser: propery handle DW_FORM_ref_sig8 and fix Windows build.
Based on D2050 by Timur Iskhodzhanov.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193619 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 16:32:19 +00:00
Alexey Samsonov
6faff4886a DWARF parser: Use ArrayRef to represent form sizes and simplify DWARFDIE::extractFast() interface. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193560 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 23:41:49 +00:00
Alexey Samsonov
c5253237f8 DebugInfo: Introduce the notion of "form classes"
Summary:
Use DWARF4 table of form classes to fetch attributes from DIE
in a more consistent way. This shouldn't change the functionality and
serves as a refactoring for upcoming change: DW_AT_high_pc has different
semantics depending on its form class.

Reviewers: dblaikie, echristo

Reviewed By: echristo

CC: echristo, llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1961

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193553 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 23:01:48 +00:00
Rui Ueyama
bc850d0c6c Add a few tests for StringRef::{start,end}with.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193550 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 22:42:54 +00:00
David Blaikie
7c0c2e56b0 DIEHash: Summary hashing of member functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193432 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25 20:04:25 +00:00
Rafael Espindola
b1d39851bf Try to fix the build on windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25 19:47:55 +00:00
Rafael Espindola
76a74f7253 Change MemoryBuffer::getFile to take a Twine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193429 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25 19:06:52 +00:00
David Blaikie
a954618c6e DIEHash: Summary hashing of nested types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193427 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25 18:38:43 +00:00
David Blaikie
377e83202c DIEHash: Const correct and use references where non-null/non-rebound.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193363 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 18:29:03 +00:00
David Blaikie
1d7d8da4cb DIEHash: Do not use shallow type hashing for unnamed types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193361 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 17:53:58 +00:00
John Thompson
96b4005548 Reverting my r193344 checkin due to build breakage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193350 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 14:52:56 +00:00
John Thompson
43752f2d4f Added std::string as a built-in type for mapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193344 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 13:36:58 +00:00
David Blaikie
f196208900 DWARF type hashing: pointers to members
Includes a test case/FIXME demonstrating a bug/limitation in pointer to
member hashing. To be honest I'm not sure why we don't just always use
summary hashing for referenced types... but perhaps I'm missing
something.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193175 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22 18:14:41 +00:00
David Blaikie
449f036a81 DWARF Type Hashing: Include reference and rvalue reference type in the declarable summary hashing path
More support for 7.25 Part 5.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193129 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 23:06:19 +00:00
David Blaikie
f1545a2197 DWARF type hashing: begin implementing Step 5, summary hashing in declarable contexts
There are several other tag types that need similar handling but to
ensure test coverage they'll be coming incrementally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193126 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 22:36:50 +00:00
Andrew Kaylor
65d60c8468 Removing unnecessary link component for MCJIT unittests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193125 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 22:35:06 +00:00
David Blaikie
e46be7838a DIEHashTest: Correct the order of operands to the TEST macro
And add the 'Test' suffix so the test case name matches the file name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193119 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 20:28:30 +00:00
David Blaikie
3baa3c37ce DWARF type hashing: Handle multiple (including recursive) references to the same type
This uses a map, keeping the type DIE numbering separate from the DIEs
themselves - alternatively we could do things the way GCC does if we
want to add an integer to the DIE type to record the numbering there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193105 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 18:59:40 +00:00
David Blaikie
47f66d5a75 DIEHash: Support for simple (non-recursive, non-reused) type references
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192924 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 22:07:09 +00:00
David Blaikie
88a68cbbb5 DIEHash: Include the type's context in the type hash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192856 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 00:10:34 +00:00
David Blaikie
c098708220 DIEHash: Use DW_FORM_sdata for integers, per spec.
This allows us to produce the same hash as GCC for at least some simple
examples.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192855 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 23:36:20 +00:00
David Blaikie
a85ad23a1f Invert arguments to ASSERT_EQ to match gtest diagnostic printing
GTest assumes the left hand side of the assert is the expectation and
the right hand side is the test result. It's easier to read gtest
failures when these things are ordered correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192854 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 22:43:10 +00:00
David Blaikie
75ee00021d DIEHash: Include the trailing zero byte after the children of a DIE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192836 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 20:29:06 +00:00
Rafael Espindola
49978e6125 Fix MCDataAtom never calling remap when adding data.
This patch fixes a small mistake in MCDataAtom::addData() where it doesn't ever
call remap():

-  if (Data.size() > Begin - End - 1)
+  if (Data.size() > End + 1 - Begin)
     remap(Begin, End + 1);

This is currently not visible because of another bug is the disassembler, so
the patch includes a unit test.

Patch by Stephen Checkoway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192823 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 18:26:16 +00:00
Rafael Espindola
670655471d Assert on duplicate registration. Don't depend on function pointer equality.
Before this patch we would assert when building llvm as multiple shared
libraries (cmake's BUILD_SHARED_LIBS). The problem was the line

if (T.AsmStreamerCtorFn == Target::createDefaultAsmStreamer)

which returns false because of -fvisibility-inlines-hidden. It is easy
to fix just this one case, but I decided to try to also make the
registration more strict. It looks like the old logic for ignoring
followup registration was just a temporary hack that outlived its
usefulness.

This patch converts the ifs to asserts, fixes the few cases that were
registering twice and makes sure all the asserts compare with null.

Thanks for Joerg for reporting the problem and reviewing the patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192803 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 16:21:40 +00:00
David Blaikie
e4df43e36d Use ASSERT_EQ rather than ASSERT_TRUE for better unit test failures.
Also minor using namespace move so it's not hard-up against the function
definition and outside the namespace as is usual.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192744 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15 23:00:17 +00:00
Aaron Ballman
bd5b912dcc Silencing an MSVC warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192042 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-05 19:41:41 +00:00
Tim Northover
ea246d6af8 MCJIT: skip some more new multi-module tests on unsupported platforms.
This should fix the i386 Darwin build-bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191840 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-02 16:11:07 +00:00
Filip Pizlo
6eb43d2956 This threads SectionName through the allocateCodeSection/allocateDataSection APIs, both in C++ and C land.
It's useful for the memory managers that are allocating a section to know what the name of the section is.  
At a minimum, this is useful for low-level debugging - it's customary for JITs to be able to tell you what 
memory they allocated, and as part of any such dump, they should be able to tell you some meta-data about 
what each allocation is for.  This allows clients that supply their own memory managers to do this.  
Additionally, we also envision the SectionName being useful for passing meta-data from within LLVM to an LLVM 
client.

This changes both the C and C++ APIs, and all of the clients of those APIs within LLVM.  I'm assuming that 
it's safe to change the C++ API because that API is allowed to change.  I'm assuming that it's safe to change 
the C API because we haven't shipped the API in a release yet (LLVM 3.3 doesn't include the MCJIT memory 
management C API).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191804 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-02 00:59:25 +00:00
Tareq A. Siraj
c269c4f505 Add non-blocking Wait() for launched processes
- New ProcessInfo class to encapsulate information about child processes.
- Generalized the Wait() to support non-blocking wait on child processes.
- ExecuteNoWait() now returns a ProcessInfo object with information about
  the launched child. Users will be able to use this object to
  perform non-blocking wait.
- ExecuteNoWait() now accepts an ExecutionFailed param that tells if execution
  failed or not.

These changes will allow users to implement basic process parallel
tools.

Differential Revision: http://llvm-reviews.chandlerc.com/D1728


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191763 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-01 14:28:18 +00:00
Andrew Kaylor
70c1ea493e Tests for MCJIT multiple module support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191723 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-01 01:48:36 +00:00
Matt Arsenault
2ebcd57e6a Fix getOrInsertGlobal dropping the address space.
Currently it will insert an illegal bitcast.
Arguably, the address space argument should be
added for the creation case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191702 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-30 21:23:03 +00:00
Benjamin Kramer
adb412daa4 IRBuilder: Add RAII objects to reset insertion points or fast math flags.
Inspired by the object from the SLPVectorizer. This found a minor bug in the
debug loc restoration in the vectorizer where the location of a following
instruction was attached instead of the location from the original instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191673 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-30 15:39:48 +00:00
Benjamin Kramer
449a88e9a6 Plug a memory leak in a unit test. Stack allocation is sufficient here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191638 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-29 11:29:20 +00:00
Dmitri Gribenko
867c189d89 SourceMgr diagnotics printing: fix a bug where printing a fixit for a source
range that includes a tab character will cause out-of-bounds access to the
fixit string.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191563 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-27 21:24:36 +00:00
Dmitri Gribenko
8a93c3ab21 Make SourceMgr::PrintMessage() testable and add unit tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191558 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-27 21:09:25 +00:00