Commit Graph

1133 Commits

Author SHA1 Message Date
Chandler Carruth c74010df48 Make the moved-from SmallPtrSet be a valid, empty, small-state object.
Enhance the tests to actually require moves in C++11 mode, in addition
to testing the moved-from state. Further enhance the tests to cover
copy-assignment into a moved-from object and moving a large-state
object. (Note that we can't really test small-state vs. large-state as
that isn't an observable property of the API really.) This should finish
addressing review on r195239.

llvm-svn: 195261
2013-11-20 18:29:56 +00:00
Chandler Carruth 6d888bc0da Add a test for assignment operator behavior which was changed in
r195239, as well as a comment about the fact that assigning over
a moved-from object was in fact tested. Addresses some of the review
feedback on r195239.

llvm-svn: 195260
2013-11-20 18:21:25 +00:00
Chandler Carruth c0bfa8c231 [PM] Add the preservation system to the new pass manager.
This adds a new set-like type which represents a set of preserved
analysis passes. The set is managed via the opaque PassT::ID() void*s.
The expected convenience templates for interacting with specific passes
are provided. It also supports a symbolic "all" state which is
represented by an invalid pointer in the set. This state is nicely
saturating as it comes up often. Finally, it supports intersection which
is used when finding the set of preserved passes after N different
transforms.

The pass API is then changed to return the preserved set rather than
a bool. This is much more self-documenting than the previous system.
Returning "none" is a conservatively correct solution just like
returning "true" from todays passes and not marking any passes as
preserved. Passes can also be dynamically preserved or not throughout
the run of the pass, and whatever gets returned is the binding state.
Finally, preserving "all" the passes is allowed for no-op transforms
that simply can't harm such things.

Finally, the analysis managers are changed to instead of blindly
invalidating all of the analyses, invalidate those which were not
preserved. This should rig up all of the basic preservation
functionality. This also correctly combines the preservation moving up
from one IR-layer to the another and the preservation aggregation across
N pass runs. Still to go is incrementally correct invalidation and
preservation across IR layers incrementally during N pass runs. That
will wait until we have a device for even exposing analyses across IR
layers.

While the core of this change is obvious, I'm not happy with the current
testing, so will improve it to cover at least some of the invalidation
that I can test easily in a subsequent commit.

llvm-svn: 195241
2013-11-20 11:31:50 +00:00
Chandler Carruth 55758e9691 Give SmallPtrSet move semantics when we have R-value references.
Somehow, this ADT got missed which is moderately terrifying considering
the efficiency of move for it.

The code to implement move semantics for it is pretty horrible
currently but was written to reasonably closely match the rest of the
code. Unittests that cover both copying and moving (at a basic level)
added.

llvm-svn: 195239
2013-11-20 11:14:33 +00:00
Chandler Carruth d895e29e88 [PM] Make the function pass manager more regular.
The FunctionPassManager is now itself a function pass. When run over
a function, it runs all N of its passes over that function. This is the
1:N mapping in the pass dimension only. This allows it to be used in
either a ModulePassManager or potentially some other manager that
works on IR units which are supersets of Functions.

This commit also adds the obvious adaptor to map from a module pass to
a function pass, running the function pass across every function in the
module.

The test has been updated to use this new pattern.

llvm-svn: 195192
2013-11-20 04:39:16 +00:00
Chandler Carruth ed1ffe0197 [PM] Split the analysis manager into a function-specific interface and
a module-specific interface. This is the first of many steps necessary
to generalize the infrastructure such that we can support both
a Module-to-Function and Module-to-SCC-to-Function pass manager
nestings.

After a *lot* of attempts that never worked and didn't even make it to
a committable state, it became clear that I had gotten the layering
design of analyses flat out wrong. Four days later, I think I have most
of the plan for how to correct this, and I'm starting to reshape the
code into it. This is just a baby step I'm afraid, but starts separating
the fundamentally distinct concepts of function analysis passes and
module analysis passes so that in subsequent steps we can effectively
layer them, and have a consistent design for the eventual SCC layer.

As part of this, I've started some interface changes to make passes more
regular. The module pass accepts the module in the run method, and some
of the constructor parameters are gone. I'm still working out exactly
where constructor parameters vs. method parameters will be used, so
I expect this to fluctuate a bit.

This actually makes the invalidation less "correct" at this phase,
because now function passes don't invalidate module analysis passes, but
that was actually somewhat of a misfeature. It will return in a better
factored form which can scale to other units of IR. The documentation
has gotten less verbose and helpful.

llvm-svn: 195189
2013-11-20 04:01:38 +00:00
John Thompson 48e018a314 YAML I/O - Added default trait support for std:string. Making another attempt at this, this time doing a clean build on Linux, and running the LLVM, clang, and extra tests, to try to make sure there's no problems.
llvm-svn: 195134
2013-11-19 17:28:21 +00:00
Michael Ilseman d930c19d20 Add support for software expansion of 64-bit integer division instructions.
Patch by Dmitri Shtilman!

llvm-svn: 195116
2013-11-19 06:54:19 +00:00
Juergen Ributzka 05c5a93283 [weak vtables] Place class definitions into anonymous namespaces to prevent weak vtables.
This patch places class definitions in implementation files into anonymous
namespaces to prevent weak vtables. This eliminates the need of providing an
out-of-line definition to pin the vtable explicitly to the file.

llvm-svn: 195092
2013-11-19 03:08:35 +00:00
Juergen Ributzka d12ccbd343 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file. The memory leaks in this version have been fixed. Thanks
Alexey for pointing them out.

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

Reviewed by Andy

llvm-svn: 195064
2013-11-19 00:57:56 +00:00
Alexander Kornienko 681e37cbf6 Recover gracefully when deserializing invalid YAML input.
Fixes http://llvm.org/PR16221, http://llvm.org/PR15927
Phabricator: http://llvm-reviews.chandlerc.com/D1236

Patch by Andrew Tulloch!

llvm-svn: 195016
2013-11-18 15:50:04 +00:00
Alexey Samsonov 49109a279c Revert r194865 and r194874.
This change is incorrect. If you delete virtual destructor of both a base class
and a subclass, then the following code:
  Base *foo = new Child();
  delete foo;
will not cause the destructor for members of Child class. As a result, I observe
plently of memory leaks. Notable examples I investigated are:
ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl.

llvm-svn: 194997
2013-11-18 09:31:53 +00:00
Michael Gottesman 4d078a3d6f [block-freq] Add BlockFrequency::scale that returns a remainder from the division and make the private scale in BlockFrequency more performant.
This change is the first in a series of changes improving LLVM's Block
Frequency propogation implementation to not lose probability mass in
branchy code when propogating block frequency information from a basic
block to its successors. This patch is a simple infrastructure
improvement that does not actually modify the block frequency
algorithm. The specific changes are:

1. Changes the division algorithm used when scaling block frequencies by
branch probabilities to a short division algorithm. This gives us the
remainder for free as well as provides a nice speed boost. When I
benched the old routine and the new routine on a Sandy Bridge iMac with
disabled turbo mode performing 8192 iterations on an array of length
32768, I saw ~600% increase in speed in mean/median performance.

2. Exposes a scale method that returns a remainder. This is important so
we can ensure that when we scale a block frequency by some branch
probability BP = N/D, the remainder from the division by D can be
retrieved and propagated to other children to ensure no probability mass
is lost (more to come on this).

llvm-svn: 194950
2013-11-17 03:25:24 +00:00
Chandler Carruth a8df47603a [PM] Completely remove support for explicit 'require' methods on the
AnalysisManager. All this method did was assert something and we have
a perfectly good way to trigger that assert from the query path.

llvm-svn: 194947
2013-11-17 03:18:05 +00:00
Juergen Ributzka dbedae89b9 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file.

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

Reviewed by Andy

llvm-svn: 194865
2013-11-15 22:34:48 +00:00
Rui Ueyama e448f9e418 Path: Recognize COFF import library file magic.
Summary: Make identify_magic to recognize COFF import file.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 194852
2013-11-15 21:22:02 +00:00
Benjamin Kramer 63d39da992 Give unit test its own LLVMContext so MDNodes aren't leaked even if we never call llvm_shutdown.
Found by valgrind.

llvm-svn: 194797
2013-11-15 09:34:33 +00:00
Matt Arsenault b03bd4d96b Add addrspacecast instruction.
Patch by Michele Scandale!

llvm-svn: 194760
2013-11-15 01:34:59 +00:00
Rui Ueyama 829c4392e1 Recognize 0x0000 as a COFF file magic.
Summary:
Some machine-type-neutral object files containing only undefined symbols
actually do exist in the Windows standard library. Need to recognize them
as COFF files.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 194734
2013-11-14 22:09:08 +00:00
Nick Kledzik 4a9f00d8cb remove extra semicolon
llvm-svn: 194658
2013-11-14 03:03:05 +00:00
Nick Kledzik dd34f77cbd Add dyn_cast<> support to YAML I/O's IO class
llvm-svn: 194655
2013-11-14 02:38:07 +00:00
Nick Kledzik 1e6033ca33 Add simple support for tags in YAML I/O
llvm-svn: 194644
2013-11-14 00:59:59 +00:00
Rui Ueyama 5e3de7a7eb Path: Add tests for existing file magics.
llvm-svn: 194607
2013-11-13 21:55:41 +00:00
Rui Ueyama 89d1bdb687 Whitespace.
llvm-svn: 194605
2013-11-13 20:31:21 +00:00
Chandler Carruth ccb190972e Fix a null pointer dereference when copying a null polymorphic pointer.
This bug only bit the C++98 build bots because all of the actual uses
really do move. ;] But not *quite* ready to do the whole C++11 switch
yet, so clean it up. Also add a unit test that catches this immediately.

llvm-svn: 194548
2013-11-13 02:48:20 +00:00
Chandler Carruth 74015a7084 Introduce an AnalysisManager which is like a pass manager but with a lot
more smarts in it. This is where most of the interesting logic that used
to live in the implicit-scheduling-hackery of the old pass manager will
live.

Like the previous commits, note that this is a very early prototype!
I expect substantial changes before this is ready to use.

The core of the design is the following:

- We have an AnalysisManager which can be used across a series of
  passes over a module.
- The code setting up a pass pipeline registers the analyses available
  with the manager.
- Individual transform passes can check than an analysis manager
  provides the analyses they require in order to fail-fast.
- There is *no* implicit registration or scheduling.
- Analysis passes are different from other passes: they produce an
  analysis result that is cached and made available via the analysis
  manager.
- Cached results are invalidated automatically by the pass managers.
- When a transform pass requests an analysis result, either the analysis
  is run to produce the result or a cached result is provided.

There are a few aspects of this design that I *know* will change in
subsequent commits:
- Currently there is no "preservation" system, that needs to be added.
- All of the analysis management should move up to the analysis library.
- The analysis management needs to support at least SCC passes. Maybe
  loop passes. Living in the analysis library will facilitate this.
- Need support for analyses which are *both* module and function passes.
- Need support for pro-actively running module analyses to have cached
  results within a function pass manager.
- Need a clear design for "immutable" passes.
- Need support for requesting cached results when available and not
  re-running the pass even if that would be necessary.
- Need more thorough testing of all of this infrastructure.

There are other aspects that I view as open questions I'm hoping to
resolve as I iterate a bit on the infrastructure, and especially as
I start writing actual passes against this.
- Should we have separate management layers for function, module, and
  SCC analyses? I think "yes", but I'm not yet ready to switch the code.
  Adding SCC support will likely resolve this definitively.
- How should the 'require' functionality work? Should *that* be the only
  way to request results to ensure that passes always require things?
- How should preservation work?
- Probably some other things I'm forgetting. =]

Look forward to more patches in shorter order now that this is in place.

llvm-svn: 194538
2013-11-13 01:12:08 +00:00
Chandler Carruth 90a835d2a0 [PM] Start sketching out the new module and function pass manager.
This is still just a skeleton. I'm trying to pull together the
experimentation I've done into committable chunks, and this is the first
coherent one. Others will follow in hopefully short order that move this
more toward a useful initial implementation. I still expect the design
to continue evolving in small ways as I work through the different
requirements and features needed here though.

Keep in mind, all of this is off by default.

Currently, this mostly exercises the use of a polymorphic smart pointer
and templates to hide the polymorphism for the pass manager from the
pass implementation. The next step will be more significant, adding the
first framework of analysis support.

llvm-svn: 194325
2013-11-09 13:09:08 +00:00
Chandler Carruth 7caea41545 Move the old pass manager infrastructure into a legacy namespace and
give the files a legacy prefix in the right directory. Use forwarding
headers in the old locations to paper over the name change for most
clients during the transitional period.

No functionality changed here! This is just clearing some space to
reduce renaming churn later on with a new system.

Even when the new stuff starts to go in, it is going to be hidden behind
a flag and off-by-default as it is still WIP and under development.

This patch is specifically designed so that very little out-of-tree code
has to change. I'm going to work as hard as I can to keep that the case.
Only direct forward declarations of the PassManager class are impacted
by this change.

llvm-svn: 194324
2013-11-09 12:26:54 +00:00
Chandler Carruth 42fabdead0 Switch to allow implicit construction. In many cases, we're wrapping
a derived type and this makes it *much* easier to write this code.

llvm-svn: 194321
2013-11-09 05:55:03 +00:00
Chandler Carruth b32a79f935 Test the polymorphic behavior of this utility.
llvm-svn: 194320
2013-11-09 04:58:13 +00:00
Chandler Carruth ff272ac0e1 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? ;]

llvm-svn: 194318
2013-11-09 04:49:27 +00:00
Chandler Carruth b3b79ce632 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.

llvm-svn: 194317
2013-11-09 04:32:34 +00:00
Chandler Carruth 8f9bd1fa42 Move the test type out of the function and into the anonymous namespace
to fix C++98 builds.

llvm-svn: 194316
2013-11-09 04:09:50 +00:00
Chandler Carruth 64b0556071 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.

llvm-svn: 194315
2013-11-09 04:06:02 +00:00
Adrian Prantl a473a2ba19 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.

llvm-svn: 194304
2013-11-09 00:43:18 +00:00
Adrian Prantl c6e97f66c1 Revert "Run clang-format on file."
This reverts commit 194219.

llvm-svn: 194303
2013-11-09 00:43:12 +00:00
Bill Wendling b805c68f4d Run clang-format on file.
llvm-svn: 194219
2013-11-07 20:18:21 +00:00
Bill Wendling 8890460431 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

llvm-svn: 194218
2013-11-07 20:14:51 +00:00
Rafael Espindola ca35ffe6a2 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>.

llvm-svn: 194030
2013-11-05 00:28:01 +00:00
Rafael Espindola 6554e5a94d Merge CallGraph and BasicCallGraph.
llvm-svn: 193734
2013-10-31 03:03:55 +00:00
Rafael Espindola 55fdcff446 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.

llvm-svn: 193719
2013-10-30 22:37:51 +00:00
Rui Ueyama 00e24e48b6 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

llvm-svn: 193706
2013-10-30 18:32:26 +00:00
Nuno Lopes 1112eca0af make ConstantRange::signExtend() optimal
the case [x, INT_MIN) was not handled optimally

llvm-svn: 193694
2013-10-30 15:36:50 +00:00
Alexey Samsonov cbd806aef8 DWARF parser: propery handle DW_FORM_ref_sig8 and fix Windows build.
Based on D2050 by Timur Iskhodzhanov.

llvm-svn: 193619
2013-10-29 16:32:19 +00:00
Alexey Samsonov a56bbf0c8c DWARF parser: Use ArrayRef to represent form sizes and simplify DWARFDIE::extractFast() interface. No functionality change.
llvm-svn: 193560
2013-10-28 23:41:49 +00:00
Alexey Samsonov 48cbda5850 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

llvm-svn: 193553
2013-10-28 23:01:48 +00:00
Rui Ueyama b6decb0a80 Add a few tests for StringRef::{start,end}with.
llvm-svn: 193550
2013-10-28 22:42:54 +00:00
David Blaikie 8bc7db777d DIEHash: Summary hashing of member functions
llvm-svn: 193432
2013-10-25 20:04:25 +00:00
Rafael Espindola e5bf24684f Try to fix the build on windows.
llvm-svn: 193431
2013-10-25 19:47:55 +00:00
Rafael Espindola 1d19c8f03a Change MemoryBuffer::getFile to take a Twine.
llvm-svn: 193429
2013-10-25 19:06:52 +00:00
David Blaikie 65cc969f50 DIEHash: Summary hashing of nested types
llvm-svn: 193427
2013-10-25 18:38:43 +00:00
David Blaikie 2aee7be871 DIEHash: Const correct and use references where non-null/non-rebound.
llvm-svn: 193363
2013-10-24 18:29:03 +00:00
David Blaikie 32744412d2 DIEHash: Do not use shallow type hashing for unnamed types
llvm-svn: 193361
2013-10-24 17:53:58 +00:00
John Thompson 6cd5bd4a3d Reverting my r193344 checkin due to build breakage.
llvm-svn: 193350
2013-10-24 14:52:56 +00:00
John Thompson e38e57206f Added std::string as a built-in type for mapping.
llvm-svn: 193344
2013-10-24 13:36:58 +00:00
David Blaikie d70a055394 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.

llvm-svn: 193175
2013-10-22 18:14:41 +00:00
David Blaikie fe3233a568 DWARF Type Hashing: Include reference and rvalue reference type in the declarable summary hashing path
More support for 7.25 Part 5.

llvm-svn: 193129
2013-10-21 23:06:19 +00:00
David Blaikie 6cf58c8980 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.

llvm-svn: 193126
2013-10-21 22:36:50 +00:00
Andrew Kaylor 9217452f30 Removing unnecessary link component for MCJIT unittests
llvm-svn: 193125
2013-10-21 22:35:06 +00:00
David Blaikie 6a7a446af4 DIEHashTest: Correct the order of operands to the TEST macro
And add the 'Test' suffix so the test case name matches the file name.

llvm-svn: 193119
2013-10-21 20:28:30 +00:00
David Blaikie 980d4994b2 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.

llvm-svn: 193105
2013-10-21 18:59:40 +00:00
David Blaikie ca353be652 DIEHash: Support for simple (non-recursive, non-reused) type references
llvm-svn: 192924
2013-10-17 22:07:09 +00:00
David Blaikie 8a142aaa01 DIEHash: Include the type's context in the type hash.
llvm-svn: 192856
2013-10-17 00:10:34 +00:00
David Blaikie 6316ca45a7 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.

llvm-svn: 192855
2013-10-16 23:36:20 +00:00
David Blaikie d398ac561f 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.

llvm-svn: 192854
2013-10-16 22:43:10 +00:00
David Blaikie 71a0ad66a9 DIEHash: Include the trailing zero byte after the children of a DIE
llvm-svn: 192836
2013-10-16 20:29:06 +00:00
Rafael Espindola bab2afbfbe 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.

llvm-svn: 192823
2013-10-16 18:26:16 +00:00
Rafael Espindola 40a3d01849 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.

llvm-svn: 192803
2013-10-16 16:21:40 +00:00
David Blaikie 5980419379 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.

llvm-svn: 192744
2013-10-15 23:00:17 +00:00
Aaron Ballman 3cab3740b6 Silencing an MSVC warning.
llvm-svn: 192042
2013-10-05 19:41:41 +00:00
Tim Northover 39ddb3f9c1 MCJIT: skip some more new multi-module tests on unsupported platforms.
This should fix the i386 Darwin build-bot.

llvm-svn: 191840
2013-10-02 16:11:07 +00:00
Filip Pizlo 7aa695e026 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).

llvm-svn: 191804
2013-10-02 00:59:25 +00:00
Tareq A. Siraj d88b9832c8 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

llvm-svn: 191763
2013-10-01 14:28:18 +00:00
Andrew Kaylor 6bbb2c9fcd Tests for MCJIT multiple module support
llvm-svn: 191723
2013-10-01 01:48:36 +00:00
Matt Arsenault 27e783e90d 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.

llvm-svn: 191702
2013-09-30 21:23:03 +00:00
Benjamin Kramer d36f1abefd 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.

llvm-svn: 191673
2013-09-30 15:39:48 +00:00
Benjamin Kramer 0f01d4e309 Plug a memory leak in a unit test. Stack allocation is sufficient here.
llvm-svn: 191638
2013-09-29 11:29:20 +00:00
Dmitri Gribenko 78fe2ba3ba 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.

llvm-svn: 191563
2013-09-27 21:24:36 +00:00
Dmitri Gribenko 8f944628ac Make SourceMgr::PrintMessage() testable and add unit tests
llvm-svn: 191558
2013-09-27 21:09:25 +00:00
Tareq A. Siraj bf40e95959 Fixed typo in CreateProcessTrailingSlash test
--gtest_filter was filtering an invalid name for the test.

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

llvm-svn: 191100
2013-09-20 18:21:59 +00:00
Rui Ueyama 106ededc4e Re-submit r190469: YAMLIO: Fix string quoting logic.
llvm-svn: 190485
2013-09-11 04:00:08 +00:00
Hans Wennborg 33ae7cea9f Revert "YAMLIO: Fix string quoting logic." (r190469)
It was turning the buildbots red.

llvm-svn: 190480
2013-09-11 01:59:32 +00:00
Rui Ueyama 38dfffa891 Remove trailing whitespace
llvm-svn: 190472
2013-09-11 00:53:07 +00:00
Rui Ueyama 9a40ae8935 YAMLIO: Fix string quoting logic.
YAMLIO printed a string as is without quotes unless it contains a newline
character. That did not suffice. We also need to quote a string if it starts
with a backquote, quote, double quote or atsign, or it's the empty string.

llvm-svn: 190469
2013-09-11 00:45:48 +00:00
Rui Ueyama 754a3ead62 Try to unbreak mingw32 buildbot.
llvm-svn: 190438
2013-09-10 21:32:42 +00:00
Rui Ueyama 471d0c57e7 Add getenv() wrapper that works on multibyte environment variable.
On Windows, character encoding of multibyte environment variable varies
depending on settings. The only reliable way to handle it I think is to use
GetEnvironmentVariableW().

GetEnvironmentVariableW() works on wchar_t string, which is on Windows UTF16
string. That's not ideal because we use UTF-8 as the internal encoding in LLVM.
This patch defines a wrapper function which takes and returns UTF-8 string for
GetEnvironmentVariableW().

The wrapper function does not do any conversion and just forwards the argument
to getenv() on Unix.

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

llvm-svn: 190423
2013-09-10 19:45:51 +00:00
Bob Wilson 6b28b3183e Update CMake file to fix buildbots.
llvm-svn: 190331
2013-09-09 19:25:11 +00:00
Bob Wilson e407736a06 Revert patches to add case-range support for PR1255.
The work on this project was left in an unfinished and inconsistent state.
Hopefully someone will eventually get a chance to implement this feature, but
in the meantime, it is better to put things back the way the were.  I have
left support in the bitcode reader to handle the case-range bitcode format,
so that we do not lose bitcode compatibility with the llvm 3.3 release.

This reverts the following commits: 155464, 156374, 156377, 156613, 156704,
156757, 156804 156808, 156985, 157046, 157112, 157183, 157315, 157384, 157575,
157576, 157586, 157612, 157810, 157814, 157815, 157880, 157881, 157882, 157884,
157887, 157901, 158979, 157987, 157989, 158986, 158997, 159076, 159101, 159100,
159200, 159201, 159207, 159527, 159532, 159540, 159583, 159618, 159658, 159659,
159660, 159661, 159703, 159704, 160076, 167356, 172025, 186736

llvm-svn: 190328
2013-09-09 19:14:35 +00:00
Dmitri Gribenko 415fb584e4 MemoryBufer: add a test: check that a file with size that is a multiple of the
page size can be null terminated correctly by MemoryBuffer.

llvm-svn: 189965
2013-09-04 18:02:13 +00:00
Alexander Kornienko 9aa60fd6f8 Move generic isPrint and columnWidth implementations to a separate header/source to allow using both generic and system-dependent versions on win32.
Summary:
This is needed so we can use generic columnWidthUTF8 in clang-format on
win32 simultaneously with a separate system-dependent implementations of
isPrint/columnWidth in TextDiagnostic.cpp to avoid attempts to print Unicode
characters using narrow-character interfaces (which is not supported on Windows,
and we'll have to figure out how to handle this).

Reviewers: jordan_rose

Reviewed By: jordan_rose

CC: llvm-commits, klimek

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

llvm-svn: 189952
2013-09-04 16:00:12 +00:00
Eric Christopher a923e7b78d It's a very large constant. Say so.
llvm-svn: 189899
2013-09-04 00:58:10 +00:00
Eric Christopher 3e6c93189b Fix copy and pasto with CMake files for unittest.
llvm-svn: 189863
2013-09-03 22:08:28 +00:00
Eric Christopher 25b7adc8ce Add a hashing routine that handles hashing types. Add a test for
hashing the contents of DW_FORM_data1 on top of a type with attributes.

llvm-svn: 189862
2013-09-03 21:57:57 +00:00
Eric Christopher c2fa3a4e24 Alphabetize.
llvm-svn: 189848
2013-09-03 20:51:14 +00:00
Joerg Sonnenberger 6c4dc2b218 Add a Python-like join function to merge a list of strings with a
separator between each two elements.

llvm-svn: 189846
2013-09-03 20:43:54 +00:00
Eli Friedman e72f132097 Change default # of digits for APFloat::toString
This is a re-commit of r189442; I'll follow up with clang changes.

The previous default was almost, but not quite enough digits to
represent a floating-point value in a manner which preserves the
representation when it's read back in.  The larger default is much
less confusing.

I spent some time looking into printing exactly the right number of
digits if a precision isn't specified, but it's kind of complicated,
and I'm not really sure I understand what APFloat::toString is supposed
to output for FormatPrecision != 0 (or maybe the current API specification
is just silly, not sure which).  I have a WIP patch if anyone is interested.

llvm-svn: 189624
2013-08-29 23:44:34 +00:00
Rui Ueyama 8fb5a9113a Option parsing: support case-insensitive option matching.
Re-submitting r189416 with fix for Windows build on where strcasecmp is not defined.

llvm-svn: 189501
2013-08-28 20:04:31 +00:00
Ted Kremenek b33f944f4e Revert r189442 "Change default # of digits for APFloat::toString"
This is breaking numerous Clang tests on the buildbot.

llvm-svn: 189447
2013-08-28 06:21:46 +00:00
Eli Friedman 14cede2829 Change default # of digits for APFloat::toString
The previous default was almost, but not quite enough digits to
represent a floating-point value in a manner which preserves the
representation when it's read back in.  The larger default is much
less confusing.

I spent some time looking into printing exactly the right number of
digits if a precision isn't specified, but it's kind of complicated,
and I'm not really sure I understand what APFloat::toString is supposed
to output for FormatPrecision != 0 (or maybe the current API specification
is just silly, not sure which).  I have a WIP patch if anyone is interested.

llvm-svn: 189442
2013-08-28 05:23:51 +00:00
Rui Ueyama c3779ff83b Revert "Option parsing: support case-insensitive option matching." as it broke Windows buildbot.
This reverts r189416.

llvm-svn: 189424
2013-08-28 00:02:06 +00:00