1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

1292 Commits

Author SHA1 Message Date
Chandler Carruth
7692110912 [PM] Remove the IRUnitT typedef requirement for analysis passes.
Since the analysis managers were split into explicit function and module
analysis managers, it is now completely trivial to specify this when
building up the concept and model types explicitly, and it is impossible
to end up with a type error at run time. We instantiate a template when
registering a pass that will enforce the requirement at a type-system
level, and we produce a dynamic error on all the other query paths to
the analysis manager if the pass in question isn't registered.

llvm-svn: 195447
2013-11-22 11:46:33 +00:00
Chandler Carruth
8370a1a333 [PM] Fix the analysis templates' usage of IRUnitT.
This is supposed to be the whole type of the IR unit, and so we
shouldn't pass a pointer to it but rather the value itself. In turn, we
need to provide a 'Module *' as that type argument (for example). This
will become more relevant with SCCs or other units which may not be
passed as a pointer type, but also brings consistency with the
transformation pass templates.

llvm-svn: 195445
2013-11-22 11:34:43 +00:00
Michael Gottesman
bed87ce7a7 [block-freq] Update data in test case to be unsigned long long to fix mingw build.
llvm-svn: 195411
2013-11-22 05:00:51 +00:00
Chandler Carruth
28195a6d83 [PM] Switch analysis managers to be threaded through the run methods
rather than the constructors of passes.

This simplifies the APIs of passes significantly and removes an error
prone pattern where the *same* manager had to be given to every
different layer. With the new API the analysis managers themselves will
have to be cross connected with proxy analyses that allow a pass at one
layer to query for the analysis manager of another layer. The proxy will
both expose a handle to the other layer's manager and it will provide
the invalidation hooks to ensure things remain consistent across layers.
Finally, the outer-most analysis manager has to be passed to the run
method of the outer-most pass manager. The rest of the propagation is
automatic.

I've used SFINAE again to allow passes to completely disregard the
analysis manager if they don't need or want to care. This helps keep
simple things simple for users of the new pass manager.

Also, the system specifically supports passing a null pointer into the
outer-most run method if your pass pipeline neither needs nor wants to
deal with analyses. I find this of dubious utility as while some
*passes* don't care about analysis, I'm not sure there are any
real-world users of the pass manager itself that need to avoid even
creating an analysis manager. But it is easy to support, so there we go.

Finally I renamed the module proxy for the function analysis manager to
the more verbose but less confusing name of
FunctionAnalysisManagerModuleProxy. I hate this name, but I have no idea
what else to name these things. I'm expecting in the fullness of time to
potentially have the complete cross product of types at the proxy layer:

{Module,SCC,Function,Loop,Region}AnalysisManager{Module,SCC,Function,Loop,Region}Proxy

(except for XAnalysisManagerXProxy which doesn't make any sense)

This should make it somewhat easier to do the next phases which is to
build the upward proxy and get its invalidation correct, as well as to
make the invalidation within the Module -> Function mapping pass be more
fine grained so as to invalidate fewer fuction analyses.

After all of the proxy analyses are done and the invalidation working,
I'll finally be able to start working on the next two fun fronts: how to
adapt an existing pass to work in both the legacy pass world and the new
one, and building the SCC, Loop, and Region counterparts. Fun times!

llvm-svn: 195400
2013-11-22 00:43:29 +00:00
Chandler Carruth
a087921555 [PM] Widen the interface for invalidate on an analysis result now that
it is completely optional, and sink the logic for handling the preserved
analysis set into it.

This allows us to implement the delegation logic desired in the proxy
module analysis for the function analysis manager where if the proxy
itself is preserved we assume the set of functions hasn't changed and we
do a fine grained invalidation by walking the functions in the module
and running the invalidate for them all at the manager level and letting
it try to invalidate any passes.

This in turn makes it blindingly obvious why we should hoist the
invalidate trait and have two collections of results. That allows
handling invalidation for almost all analyses without indirect calls and
it allows short circuiting when the preserved set is all.

llvm-svn: 195338
2013-11-21 10:53:05 +00:00
Chandler Carruth
41afa5d52d [PM] Add support for using SFINAE to reflect on an analysis's result
type and detect whether or not it provides an 'invalidate' member the
analysis manager should use.

This lets the overwhelming common case of *not* caring about custom
behavior when an analysis is invalidated be the the obvious default
behavior with no code written by the author of an analysis. Only when
they write code specifically to handle invalidation does it get used.

Both cases are actually covered by tests here. The test analysis uses
the default behavior, and the proxy module analysis actually has custom
behavior on invalidation that is firing correctly. (In fact, this is the
analysis which was the primary motivation for having custom invalidation
behavior in the first place.)

llvm-svn: 195332
2013-11-21 09:10:21 +00:00
Chandler Carruth
dbfa25a6b6 [PM] Add a module analysis pass proxy for the function analysis manager.
This proxy will fill the role of proxying invalidation events down IR
unit layers so that when a module changes we correctly invalidate
function analyses. Currently this is a very coarse solution -- any
change blows away the entire thing -- but the next step is to make
invalidation handling more nuanced so that we can propagate specific
amounts of invalidation from one layer to the next.

The test is extended to place a module pass between two function pass
managers each of which have preserved function analyses which get
correctly invalidated by the module pass that might have changed what
functions are even in the module.

llvm-svn: 195304
2013-11-21 02:11:31 +00:00
Nick Kledzik
3e803171af YAML I/O add support for validate()
MappingTrait template specializations can now have a validate() method which 
performs semantic checking. For details, see <http://llvm.org/docs/YamlIO.html>.

llvm-svn: 195286
2013-11-21 00:28:07 +00:00
Nick Kledzik
11ec8eba6c revert r194655
llvm-svn: 195285
2013-11-21 00:20:10 +00:00
Chandler Carruth
ffaacacd23 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
90ef1fdaca 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
5bbc7e8ce9 [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
8070950ee8 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
37fa148ed0 [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
9f55f1934e [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
844100cb0c 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
0f69f39907 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
990c8318f8 [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
5357a6d64b [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
d817824d74 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
3bfef6bdb6 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
e011e8ef82 [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
07fce80a5a [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
ee3af15269 [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
30dec160ae 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
a2ecba54d6 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
9921608896 Add addrspacecast instruction.
Patch by Michele Scandale!

llvm-svn: 194760
2013-11-15 01:34:59 +00:00
Rui Ueyama
caa74a04ef 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
f868d91818 remove extra semicolon
llvm-svn: 194658
2013-11-14 03:03:05 +00:00
Nick Kledzik
5701cc8c01 Add dyn_cast<> support to YAML I/O's IO class
llvm-svn: 194655
2013-11-14 02:38:07 +00:00
Nick Kledzik
cbecad4abd Add simple support for tags in YAML I/O
llvm-svn: 194644
2013-11-14 00:59:59 +00:00
Rui Ueyama
84aa3c1f2c Path: Add tests for existing file magics.
llvm-svn: 194607
2013-11-13 21:55:41 +00:00
Rui Ueyama
0c4d35a376 Whitespace.
llvm-svn: 194605
2013-11-13 20:31:21 +00:00
Chandler Carruth
7c64c22064 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
4e1d27ef68 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
62e299ec37 [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
f2e7a23acb 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
17436ff36f 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
04f0969715 Test the polymorphic behavior of this utility.
llvm-svn: 194320
2013-11-09 04:58:13 +00:00
Chandler Carruth
d01da74a3a 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
2d15bb84b6 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
034b3fa859 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
8d866a1fb5 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
155ecd9c23 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
20c6a8bef1 Revert "Run clang-format on file."
This reverts commit 194219.

llvm-svn: 194303
2013-11-09 00:43:12 +00:00
Bill Wendling
62b2b2d29b Run clang-format on file.
llvm-svn: 194219
2013-11-07 20:18:21 +00:00
Bill Wendling
1824ef73c8 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
334fa3d8a8 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
afc61d382c Merge CallGraph and BasicCallGraph.
llvm-svn: 193734
2013-10-31 03:03:55 +00:00
Rafael Espindola
d875d09386 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
75714118ae 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
79e69672f4 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
29ac66d0fe 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
08970d884d 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
c8dd7e63e8 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
d2d474fbd6 Add a few tests for StringRef::{start,end}with.
llvm-svn: 193550
2013-10-28 22:42:54 +00:00
David Blaikie
e9525a4ff2 DIEHash: Summary hashing of member functions
llvm-svn: 193432
2013-10-25 20:04:25 +00:00
Rafael Espindola
af6f5e9fa8 Try to fix the build on windows.
llvm-svn: 193431
2013-10-25 19:47:55 +00:00
Rafael Espindola
1587321957 Change MemoryBuffer::getFile to take a Twine.
llvm-svn: 193429
2013-10-25 19:06:52 +00:00
David Blaikie
949cb82c41 DIEHash: Summary hashing of nested types
llvm-svn: 193427
2013-10-25 18:38:43 +00:00
David Blaikie
f56c048e62 DIEHash: Const correct and use references where non-null/non-rebound.
llvm-svn: 193363
2013-10-24 18:29:03 +00:00
David Blaikie
60244215d0 DIEHash: Do not use shallow type hashing for unnamed types
llvm-svn: 193361
2013-10-24 17:53:58 +00:00
John Thompson
551080bf52 Reverting my r193344 checkin due to build breakage.
llvm-svn: 193350
2013-10-24 14:52:56 +00:00
John Thompson
d6f9322368 Added std::string as a built-in type for mapping.
llvm-svn: 193344
2013-10-24 13:36:58 +00:00
David Blaikie
0881f3b413 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
da979f0e59 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
8d41a02789 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
cdc52ed2cf Removing unnecessary link component for MCJIT unittests
llvm-svn: 193125
2013-10-21 22:35:06 +00:00
David Blaikie
c950a5b175 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
0cee42e793 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
3f9b6f1dec DIEHash: Support for simple (non-recursive, non-reused) type references
llvm-svn: 192924
2013-10-17 22:07:09 +00:00
David Blaikie
bb2461da8b DIEHash: Include the type's context in the type hash.
llvm-svn: 192856
2013-10-17 00:10:34 +00:00
David Blaikie
9599400c07 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
d991bcf46c 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
4774eee88b 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
f1aa4d7d7f 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
f60d850252 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
9006a00f8f 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
197142c475 Silencing an MSVC warning.
llvm-svn: 192042
2013-10-05 19:41:41 +00:00
Tim Northover
cb811c7132 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
1e0fa7cd7d 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
2c204767da 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
6f0e782b64 Tests for MCJIT multiple module support
llvm-svn: 191723
2013-10-01 01:48:36 +00:00
Matt Arsenault
9b03bd2eff 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
33abdcddb3 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
a6c9f4b0e0 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
9c747f2fbc 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
eee7bbf1df Make SourceMgr::PrintMessage() testable and add unit tests
llvm-svn: 191558
2013-09-27 21:09:25 +00:00
Tareq A. Siraj
da412cbe5f 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
e09a70f65a Re-submit r190469: YAMLIO: Fix string quoting logic.
llvm-svn: 190485
2013-09-11 04:00:08 +00:00
Hans Wennborg
3dd49010be 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
bdbf3fc714 Remove trailing whitespace
llvm-svn: 190472
2013-09-11 00:53:07 +00:00
Rui Ueyama
2ac0a76d79 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
c231a0ee6c Try to unbreak mingw32 buildbot.
llvm-svn: 190438
2013-09-10 21:32:42 +00:00
Rui Ueyama
3c8223f488 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
c660f26974 Update CMake file to fix buildbots.
llvm-svn: 190331
2013-09-09 19:25:11 +00:00
Bob Wilson
6c7d3717b3 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
22ee49cc37 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
6646ff4786 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
5d3f56aa82 It's a very large constant. Say so.
llvm-svn: 189899
2013-09-04 00:58:10 +00:00
Eric Christopher
b70795bbfd Fix copy and pasto with CMake files for unittest.
llvm-svn: 189863
2013-09-03 22:08:28 +00:00
Eric Christopher
9bd85fb4ef 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
8d0a520dc2 Alphabetize.
llvm-svn: 189848
2013-09-03 20:51:14 +00:00
Joerg Sonnenberger
d6a76ffd81 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
bb860a63ef 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
3ab487af0b 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
16beb74d93 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
75cdc76b2b 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
16ae963b6a 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
Rui Ueyama
a9f9cbaaf6 Option parsing: support case-insensitive option matching.
Link.exe's command line options are case-insensitive. This patch
adds a new attribute to OptTable to let the option parser to compare
options, ignoring case.

Command lines are generally case-insensitive on Windows. CL.exe is an
exception. So this new attribute should be useful for other commands
running on Windows.

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

llvm-svn: 189416
2013-08-27 23:47:01 +00:00
NAKAMURA Takumi
6c13dfe866 [Win32] mapped_file_region: Fix a bug in CreateFileMapping() that Size must contain Offset when Offset >= 65536.
llvm-svn: 189021
2013-08-22 15:14:53 +00:00
NAKAMURA Takumi
5915576b5b Whitespace.
llvm-svn: 189020
2013-08-22 15:14:45 +00:00
NAKAMURA Takumi
515692fc0a Suppress MemoryBufferTest.cpp on win32 for now. Investigating.
llvm-svn: 189001
2013-08-22 12:00:44 +00:00
NAKAMURA Takumi
26b76a4a44 MemoryBufferTest.cpp: Tweak offset corresponding to the case that PageSize is greater than 8000.
PageSize, aka AllocationGranularity, is 65536 on Win32 (and Cygwin).

llvm-svn: 188999
2013-08-22 10:23:58 +00:00
David Blaikie
29dad430cd Basic unit tests for PointerUnion
llvm-svn: 188933
2013-08-21 21:30:23 +00:00
Peter Collingbourne
aa48e92de9 Introduce SpecialCaseList::isIn overload for GlobalAliases.
Differential Revision: http://llvm-reviews.chandlerc.com/D1437

llvm-svn: 188688
2013-08-19 19:00:35 +00:00
Peter Collingbourne
ea402298e2 Remove SpecialCaseList::findCategory.
It turned out that I didn't need this for DFSan.

llvm-svn: 188646
2013-08-19 00:24:20 +00:00
Aaron Ballman
73cc6d0b07 Removing a spurious semi-colon; this macro expands into a namespace.
llvm-svn: 188525
2013-08-16 01:53:58 +00:00
Aaron Ballman
ead5a4d04b Tighten up the yamilizer so it stops eliding empty sequences if the embedded empty sequence is the first key/value in a map which is itself in a sequence.
Patch with help from Nick Kledzik.

llvm-svn: 188508
2013-08-15 23:17:53 +00:00
Alexey Samsonov
235b9a341c Expose CRC-32 implementation from zlib
llvm-svn: 188380
2013-08-14 16:03:29 +00:00
Hans Wennborg
581964696d Options: explicit handling of --
Clients of the option parsing library should handle it explicitly
using a KIND_REMAINING_ARGS option.

Clang and lld have been updated in r188316 and r188318, respectively.

Also fix -Wsign-compare warning in the option parsing test.

llvm-svn: 188323
2013-08-13 22:23:05 +00:00
Hans Wennborg
714e82ffc5 Options: Add new option kind that consumes remaining arguments
This adds KIND_REMAINING_ARGS, a class of options that consume
all remaining arguments on the command line.

This will be used to support /link in clang-cl, which is used
to forward all remaining arguments to the linker.

It also allows us to remove the hard-coded handling of "--",
allowing clients (clang and lld) to implement that functionality
themselves with this new option class.

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

llvm-svn: 188314
2013-08-13 21:09:50 +00:00
Nick Lewycky
ce26d6b8d0 Fix an oversight in isPotentiallyReachable where we wouldn't do any CFG-walking
to find loops if the From and To instructions were in the same block.

Refactor the code a little now that we need to fill to start the CFG-walking
algorithm with more than one starting basic block sometimes.

Special thanks to Andrew Trick for catching an error in my understanding of
natural loops in code review.

llvm-svn: 188236
2013-08-13 00:03:47 +00:00
Tareq A. Siraj
135d71f85d Fixes a bug when iterating on paths
This fixes the incorrect implementation of iterating on file/directory
paths.

Differential Review: http://llvm-reviews.chandlerc.com/D1277

llvm-svn: 188183
2013-08-12 17:10:49 +00:00
Alexey Samsonov
92dd689c77 Relax conditions of test added in r188156 to fix it on Windows
llvm-svn: 188157
2013-08-12 09:04:58 +00:00
Alexey Samsonov
d27061d7e7 Introduce factory methods for SpecialCaseList
Summary:
Doing work in constructors is bad: this change suggests to
call SpecialCaseList::create(Path, Error) instead of
"new SpecialCaseList(Path)". Currently the latter may crash with
report_fatal_error, which is undesirable - sometimes we want to report
the error to user gracefully - for example, if he provides an incorrect
file as an argument of Clang's -fsanitize-blacklist flag.

Reviewers: pcc

Reviewed By: pcc

CC: llvm-commits

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

llvm-svn: 188156
2013-08-12 07:49:36 +00:00
Alexey Samsonov
1021d4d06d Fix off-by-one error in Regex::isValid
llvm-svn: 187992
2013-08-08 17:32:45 +00:00
Benjamin Kramer
ef710e7620 Use EXPECT_TRUE/EXPECT_FALSE to avoid bogus warnings from the guts of gtest.
llvm-svn: 187976
2013-08-08 11:17:39 +00:00
Alexander Kornienko
8030dee9b6 Changed isPrint for U+00AD SOFT HYPHEN to return true.
Summary:
This is consistent with MacOSX implementation, and most terminals
actually display this character (checked on gnome-terminal, lxterminal, lxterm,
Terminal.app, iterm2). Actually, this is in line with the ISO Latin 1 standard
(ISO 8859-1), which defines it differently from the Unicode Standard. More
information here: http://www.cs.tut.fi/~jkorpela/shy.html

Reviewers: gribozavr, jordan_rose

CC: llvm-commits

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

llvm-svn: 187949
2013-08-08 01:10:50 +00:00
Alexander Kornienko
220f2326c6 Disabled columnWidth test for OSX, need someone with Mac to deal with this effectively.
llvm-svn: 187848
2013-08-07 02:08:31 +00:00
Alexander Kornienko
7963f834a9 Use correct platform detection macro: __MACOSX__ -> __APPLE__
llvm-svn: 187847
2013-08-07 01:23:28 +00:00
Reid Kleckner
6f129a9240 Fix boolean logic in LockFileManager and test it
This fixes a bug from r187826.

Reviewers: hans

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

llvm-svn: 187846
2013-08-07 01:22:04 +00:00
Alexander Kornienko
7cc4e92aef Disable tests on WIN32 (which has incorrect implementation of isPrint and
columnWidth), and partially disable tests on MACOSX (which handles some
characters differently).

llvm-svn: 187842
2013-08-07 00:41:18 +00:00
Alexander Kornienko
340c08d4fe Implemented llvm::sys::locale::columnWidth and isPrint for the case of generic UTF8-capable terminal.
Summary:
This is a second attempt to get this right. After reading the Unicode
Standard I came up with the code that uses definitions of "printable" and
"column width" more suitable for terminal output (i.e. fixed-width fonts and
special treatment of many control characters).
The implementation here can probably be used for Windows and MacOS if someone
can test it properly.
The patch addresses PR14910.

Reviewers: jordan_rose, gribozavr

CC: llvm-commits

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

llvm-svn: 187837
2013-08-07 00:07:07 +00:00
Peter Collingbourne
8df077ca5e Introduce Regex::isLiteralERE function.
This will be used to implement an optimisation for literal entries
in special case lists.

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

llvm-svn: 187731
2013-08-05 17:47:59 +00:00
Peter Collingbourne
6ee348574a Make one of the AttributeSet ctors maintain the invariant that the
attribute list is ordered by index.

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

llvm-svn: 187682
2013-08-02 22:29:40 +00:00
Hans Wennborg
749f8bc956 Option parsing: recognize the special -- token
Everything that comes after -- should be treated as a filename. This
enables passing in filenames that would otherwise be conflated with
command-line options.

This is especially important for clang-cl which supports options
starting with /, which are easily conflatable with Unix-style
path names.

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

llvm-svn: 187675
2013-08-02 21:20:27 +00:00
Sean Silva
34ac6fd42a Update incorrect file headers.
One of these was spotted in review by Rafael.

llvm-svn: 187598
2013-08-01 18:42:28 +00:00
Hans Wennborg
9c475c6d9d Option parsing: remove non-SUPPORT_ALIASARGS fall-back
The clients of this code have been updated to all support AliasArgs.

This depends on Clang r187538 and lld r187541.

llvm-svn: 187546
2013-07-31 23:28:51 +00:00
Hans Wennborg
ad911dcfea Option parsing: add support for alias arguments.
This makes option aliases more powerful by enabling them to
pass along arguments to the option they're aliasing.

For example, if we have a joined option "-foo=", we can now
specify a flag option "-bar" to be an alias of that, with the
argument "baz".

This is especially useful for the cl.exe compatible clang driver,
where many options are aliases. For example, this patch enables
us to alias "/Ox" to "-O3" (-O is a joined option), and "/WX" to
"-Werror" (again, -W is a joined option).

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

llvm-svn: 187537
2013-07-31 22:44:41 +00:00
Matt Arsenault
c8e1c3d111 Fix ptr vector inconsistency in CreatePointerCast
One form would accept a vector of pointers, and the other did not.
Make both accept vectors of pointers, and add an assertion
for the number of elements.

llvm-svn: 187464
2013-07-31 00:17:33 +00:00
Rafael Espindola
553f85ed4b Fix windows' implementation of status when a file doesn't exist.
The unix one was returning no_such_file_or_directory, but the windows one
was return success.

Update the one one caller that was depending on the old behavior.

llvm-svn: 187463
2013-07-31 00:10:25 +00:00
Matt Arsenault
07681f54ed Respect address space sizes in isEliminableCastPair.
This avoids constant folding bitcast/ptrtoint/inttoptr combinations
that have illegal bitcasts between differently sized address spaces.

llvm-svn: 187455
2013-07-30 22:27:10 +00:00
Matt Arsenault
f58e03599f Revert "Remove isCastable since nothing uses it now"
Apparently dragonegg uses it.

llvm-svn: 187454
2013-07-30 22:02:14 +00:00
Matt Arsenault
2121a49954 Remove isCastable since nothing uses it now
llvm-svn: 187448
2013-07-30 21:11:17 +00:00
Matt Arsenault
c825ddd4ca Change behavior of calling bitcasted alias functions.
It will now only convert the arguments / return value and call
the underlying function if the types are able to be bitcasted.
This avoids using fp<->int conversions that would occur before.

llvm-svn: 187444
2013-07-30 20:45:05 +00:00
Rafael Espindola
0de5f81e03 Implement getUniqueID for directories on windows.
llvm-svn: 187441
2013-07-30 20:25:53 +00:00
Rui Ueyama
4c06308b07 Implement TokenizeWindowsCommandLine.
This is a follow up patch for r187390 to implement the parser for the
Windows-style command line. This should follow the rule as described
at http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx

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

llvm-svn: 187430
2013-07-30 19:03:20 +00:00
Rafael Espindola
2bf7932f99 Include st_dev to make the result of getUniqueID actually unique.
This will let us use getUniqueID instead of st_dev directly on clang.

llvm-svn: 187378
2013-07-29 21:26:49 +00:00
Michael Gottesman
f899e8827f [APFloat] Make all arithmetic operations with NaN produce positive NaNs.
IEEE-754R 1.4 Exclusions states that IEEE-754R does not specify the
interpretation of the sign of NaNs. In order to remove an irrelevant
variable that most floating point implementations do not use,
standardize add, sub, mul, div, mod so that operating anything with
NaN always yields a positive NaN.

In a later commit I am going to update the APIs for creating NaNs so
that one can not even create a negative NaN.

llvm-svn: 187314
2013-07-27 21:49:25 +00:00
Nick Lewycky
5cf284ba76 Update this CMakeLists.txt for r187283 too.
llvm-svn: 187286
2013-07-27 01:26:30 +00:00
Nick Lewycky
3d5df03884 Reimplement isPotentiallyReachable to make nocapture deduction much stronger.
Adds unit tests for it too.

Split BasicBlockUtils into an analysis-half and a transforms-half, and put the
analysis bits into a new Analysis/CFG.{h,cpp}. Promote isPotentiallyReachable
into llvm::isPotentiallyReachable and move it into Analysis/CFG.

llvm-svn: 187283
2013-07-27 01:24:00 +00:00
Rafael Espindola
326babb234 Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."
This reverts commit r187248. It broke many bots.

llvm-svn: 187254
2013-07-26 22:13:57 +00:00
Bill Schmidt
149eda1b1e [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.
Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for
all PowerPC targets, whether 32- or 64-bit.  They will both implicitly
define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not
for 32-bit targets.  We cannot be sure that all other possible
compilers used to compile Clang/LLVM define both __ppc__ and
__powerpc__, for example, so it is best to check for both when relying
on either inside the Clang/LLVM code base.

This patch makes sure we always check for both variants.  In addition,
it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp.
(At least one of __ppc__ and __powerpc__ should always be defined when
compiling for a PowerPC target, no matter which compiler is used, so
testing for them is unnecessary.)

There are some places in the compiler that check for other variants,
like __POWERPC__ and _POWER, and I have left those in place.  There is
no need to add them elsewhere.  This seems to be in Apple-specific
code, and I won't take a chance on breaking it.

There is no intended change in behavior; thus, no test cases are
added.

llvm-svn: 187248
2013-07-26 21:39:15 +00:00
Rafael Espindola
28c7549697 Don't end a file name with a dot. It looks odd.
llvm-svn: 187124
2013-07-25 15:00:17 +00:00
Akira Hatanaka
69d1c115db [mips] Use pristine object file while processing relocations.
Similar to ARM change r182800, dynamic linker will read bits/addends from
    the original object rather than from the object that might have been patched
    previously. For the purpose of relocations for MCJIT stubs on MIPS, we
    internally use otherwise unused MIPS relocations.
    
    The change also enables MCJIT unit tests for MIPS (EL/BE), and the following
    two tests now pass:
    
    - MCJITTest.return_global and
    - MCJITTest.multiple_functions.
    
    These issues have been tracked as Bug 16250.

    Patch by Petar Jovanovic.

llvm-svn: 187019
2013-07-24 01:58:40 +00:00
Eli Bendersky
3cde6ffa64 Refactor the unit test for MemoryBuffer::getOpenFileSlice
Run in two different modes: with and without reopening the temporary file
between creating it and mapping it with MemoryBuffer.

llvm-svn: 186986
2013-07-23 20:58:51 +00:00
Rafael Espindola
f3a9f67eee Split getOpenFile into getOpenFile and getOpenFileSlice.
The main observation is that we never need both the filesize and the map size.
When mapping a slice of a file, it doesn't make sense to request a null
terminator and that would be the only case where the filesize would be used.

There are other cleanups that should be done in this area:

* A client should not have to pass the size (even an explicit -1) to say if
  it wants a null terminator or not, so we should probably swap the argument
  order.
* The default should be to not require a null terminator. Very few clients
  require this, but many end up asking for it just because it is the default.

llvm-svn: 186984
2013-07-23 20:25:01 +00:00
Eli Bendersky
44a6964953 Add a simple unit test for MemoryBuffer::getOpenFile
llvm-svn: 186887
2013-07-22 22:46:21 +00:00
Hans Wennborg
0eedbce23d Option parsing: allow aliases in groups
Option aliases in option groups were previously disallowed by an assert.
As far as I can tell, there was no technical reason for this, and I would
like to be able to put cl.exe compatible options in their own group for Clang,
so let's change the assert.

llvm-svn: 186838
2013-07-22 16:18:13 +00:00
Hans Wennborg
0bea6b44c7 Add Option unit tests to the make build
Previously, they were only built and run in the CMake build.

llvm-svn: 186756
2013-07-20 03:04:36 +00:00
Reid Kleckner
d00a7da89a Add some flag exclusion tests.
llvm-svn: 186704
2013-07-19 18:05:13 +00:00
Rafael Espindola
949820eabd Add a unit test for checking that we respect the F_Binary flag.
llvm-svn: 186676
2013-07-19 14:41:25 +00:00
Reid Kleckner
c1af8a0511 [Support] Beef up and expose the response file parsing in llvm::cl
The plan is to use it for clang and lld.

Major behavior changes:
- We can now parse UTF-16 files that have a byte order mark.
- PR16209: Don't drop backslashes on the floor if they don't escape
  anything.

The actual parsing loop was based on code from Clang's driver.cpp,
although it's been rewritten to track its state with control flow rather
than state variables.

Reviewers: hans

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

llvm-svn: 186587
2013-07-18 16:52:05 +00:00
Rafael Espindola
d5796b9a12 Remove dead code.
llvm-svn: 186561
2013-07-18 03:29:51 +00:00
Rafael Espindola
9e2da8f46a Fix a regression I introduced back in r178147.
We don't want cast and dyn_cast to work on temporaries. They don't extend
lifetime like a direct bind to a reference would, so they can introduce
hard to find bugs.

I added tests to make sure we don't regress this. Thanks to Eli Friedman for
noticing this and for his suggestions on how to test it.

llvm-svn: 186559
2013-07-18 02:42:40 +00:00
Eli Friedman
d18dd0a7b0 Handle '.' correctly in hex float literal parsing.
There were a couple of different loops that were not handling
'.' correctly in APFloat::convertFromHexadecimalString; these mistakes
could lead to assertion failures and incorrect rounding for overlong
hex float literals.

Fixes PR16643.

llvm-svn: 186539
2013-07-17 22:17:29 +00:00
Rafael Espindola
2a9326a78f Add a wrapper for open.
This centralizes the handling of O_BINARY and opens the way for hiding more
differences (like how open behaves with directories).

llvm-svn: 186447
2013-07-16 19:44:17 +00:00
Peter Collingbourne
82d932d6c2 Make SpecialCaseList match full strings, as documented, using anchors.
Differential Revision: http://llvm-reviews.chandlerc.com/D1149

llvm-svn: 186431
2013-07-16 17:56:07 +00:00
Reid Kleckner
362d3541d3 [Support] Add a Unicode conversion wrapper from UTF16 to UTF8
This is to support parsing UTF16 response files in LLVM/lib/Option for
lld and clang.

Reviewers: hans

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

llvm-svn: 186426
2013-07-16 17:14:33 +00:00
NAKAMURA Takumi
146b5ba105 unittests/Support: Add TimeValue.Win32FILETIME, corresponding to r186374.
llvm-svn: 186375
2013-07-16 02:44:23 +00:00
NAKAMURA Takumi
a97dcc8354 Rename Support.TimeValue to TimeValue.time_t in unittests/Support.
llvm-svn: 186372
2013-07-16 02:03:32 +00:00
Stephen Lin
ece45b5ee9 Convert Windows to Unix line endings, no functionality change.
llvm-svn: 186264
2013-07-13 22:08:55 +00:00
Rafael Espindola
3a35f99e5a Attempt at fixing a mingw bot.
It is failing with

YAMLTest.cpp:38:   instantiated from here
YAMLTraits.h:226: error: 'llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping' is not a valid template argument for type 'void (*)(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' because function 'static void llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' has not external linkage

llvm-svn: 186245
2013-07-13 12:36:30 +00:00
Benjamin Kramer
5d304115ca Sync SmallBitVector with BitVector. Add unit tests for the missing methods.
llvm-svn: 186123
2013-07-11 21:59:16 +00:00
Peter Collingbourne
16d8086f72 Implement categories for special case lists.
A special case list can now specify categories for specific globals,
which can be used to instruct an instrumentation pass to treat certain
functions or global variables in a specific way, such as by omitting
certain aspects of instrumentation while keeping others, or informing
the instrumentation pass that a specific uninstrumentable function
has certain semantics, thus allowing the pass to instrument callers
according to those semantics.

For example, AddressSanitizer now uses the "init" category instead of
global-init prefixes for globals whose initializers should not be
instrumented, but which in all other respects should be instrumented.

The motivating use case is DataFlowSanitizer, which will have a
number of different categories for uninstrumentable functions, such
as "functional" which specifies that a function has pure functional
semantics, or "discard" which indicates that a function's return
value should not be labelled.

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

llvm-svn: 185978
2013-07-09 22:03:17 +00:00
Peter Collingbourne
87165fe6e5 Add some SpecialCaseList unit tests.
Differential Revision: http://llvm-reviews.chandlerc.com/D1091

llvm-svn: 185977
2013-07-09 22:03:12 +00:00
Sean Silva
dbfeeb71d5 Make BinaryRef output correctly in case of empty data.
Previously, it would simply output nothing, but it should output an
empty string `""`.

llvm-svn: 185894
2013-07-09 00:54:46 +00:00
Rafael Espindola
fc25f0c6cf We now always create files with the correct permissions. Simplify the interface.
llvm-svn: 185834
2013-07-08 16:42:01 +00:00
Rafael Espindola
9afbde4cba Fix windows build.
llvm-svn: 185730
2013-07-05 22:32:33 +00:00
Rafael Espindola
d6fa9469ca Use sys::fs::createTemporaryFile.
llvm-svn: 185719
2013-07-05 20:14:52 +00:00
Craig Topper
783617eba7 Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
llvm-svn: 185606
2013-07-04 01:31:24 +00:00
David Blaikie
c69f695988 Fix -Wsign-compare warning and remove windows-style line endings introduced by r185421
llvm-svn: 185443
2013-07-02 16:48:10 +00:00
Elena Demikhovsky
a6f1ca6a6f Fixed alignment of code sections in the JIT mode. Added a test to the JITMemoryManager.
llvm-svn: 185421
2013-07-02 12:24:22 +00:00
Michael Gottesman
b399188af0 [APFloat] Ensure that we can properly parse strings that do not have null terminators.
rdar://14323230

llvm-svn: 185397
2013-07-01 23:54:08 +00:00
Matt Arsenault
5b3f0a05c2 Fix copypaste error in test.
Thename says it's an i32*, but it was actually creating another i8*

llvm-svn: 185239
2013-06-28 23:24:10 +00:00
Daniel Malea
8f769455dc Replace UNIXy path with os-independent one in DebugIR unit test
- should resolve windows buildbot failure

llvm-svn: 185232
2013-06-28 22:17:57 +00:00
Jakob Stoklund Olesen
e4b031bd1a Fix a bad overflow check pointed out by Ben.
llvm-svn: 185226
2013-06-28 21:51:18 +00:00
Daniel Malea
e29c3e7e3d Fix Windows/Darwin build error in DebugIR unit tests
- mistakenly used get_current_dir() linux function
- replaced with getcwd/_getcwd as appropriate for current platform

llvm-svn: 185225
2013-06-28 21:49:53 +00:00
Andrew Kaylor
89294db42d Revising the MCJIT ObjectCache interface to allow subclasses to avoid retaining references to returned objects
llvm-svn: 185221
2013-06-28 21:40:16 +00:00
Daniel Malea
f5547eb2d8 Adding tests for DebugIR pass
- lit tests verify that each line of input LLVM IR gets a !dbg node and a
  corresponding entry of metadata that contains the line number 
- unit tests verify that DebugIR works as advertised in the interface
- refactored some useful IR generation functionality from the MCJIT unit tests
  so it can be reused

llvm-svn: 185212
2013-06-28 20:37:20 +00:00
Jakob Stoklund Olesen
a9465b9413 Add a division operator to BlockFrequency.
Allow a BlockFrequency to be divided by a non-zero BranchProbability
with saturating arithmetic. This will be used to compute the frequency
of a loop header given the probability of leaving the loop.

Our long division algorithm already saturates on overflow, so that was a
freebie.

llvm-svn: 185184
2013-06-28 18:23:42 +00:00
Rafael Espindola
ac62522b9b Add a convenience createUniqueDirectory function.
There are a few valid situation where we care about the structure inside a
directory, but not about the directory itself. A simple example is for unit
testing directory traversal.

PathV1 had a function like this, add one to V2 and port existing users of the
created temp file and delete it hack to using it.

llvm-svn: 185059
2013-06-27 03:45:31 +00:00
Michael Gottesman
6fb80a527d [APFloat] Added unittest for APFloat.divide that checks special cases, result categories, and result statuses.
llvm-svn: 185050
2013-06-27 00:42:00 +00:00
Michael Gottesman
e83cdadda7 Removed two logging printf statements from the APFloat tests... = /.
llvm-svn: 185045
2013-06-27 00:00:45 +00:00
Michael Gottesman
34f626681a [APFloat] Added unittest for APFloat.multiply that checks special cases, result categories, and result status.
llvm-svn: 185044
2013-06-26 23:55:26 +00:00
Michael Gottesman
78c7b539c6 [APFloat] Added unittest for APFloat.subtract that checks special cases, result categories, and result status.
llvm-svn: 185043
2013-06-26 23:55:23 +00:00
Michael Gottesman
e1dcbcd7a2 [APFloat] Removed debugging cruft that snuck in.
llvm-svn: 184974
2013-06-26 17:59:36 +00:00
Rafael Espindola
50996b2c4d Remove unused includes.
llvm itself is now PathV1 clean.

llvm-svn: 184947
2013-06-26 13:54:34 +00:00
Rafael Espindola
07ffa7d08b Port GetMainExecutable over to PathV2.
I will remove the V1 version as soon as I change clang in the next commit.

llvm-svn: 184914
2013-06-26 05:01:35 +00:00
Michael Gottesman
85c75137ce [APFloat] Removed trailing whitespace from unittests.
llvm-svn: 184715
2013-06-24 09:58:09 +00:00
Michael Gottesman
69c24d2254 [APFloat] Added a large unittest for APFloat.add that checks that special values are computed correctly.
llvm-svn: 184714
2013-06-24 09:58:07 +00:00
Benjamin Kramer
30c35d5305 Revert "BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability."
This reverts commit r184584. Breaks PPC selfhost.

llvm-svn: 184590
2013-06-21 20:20:27 +00:00
Benjamin Kramer
3315e168ee BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability.
Zero is used by BlockFrequencyInfo as a special "don't know" value. It also
causes a sink for frequencies as you can't ever get off a zero frequency with
more multiplies.

This recovers a 10% regression on MultiSource/Benchmarks/7zip. A zero frequency
was propagated into an inner loop causing excessive spilling.

PR16402.

llvm-svn: 184584
2013-06-21 19:30:05 +00:00
Akira Hatanaka
28386f0db3 [mips] Remove Triple:mips from SupportedArchs in MCJIT unittests
MIPS does not handle multiple relocations correctly, so two tests from the
unittests are expected to fail. These are:
 - MCJITTest.return_global and
 - MCJITTest.multiple_functions.

Until the multiple relocations are fixed, XFAIL the MCJIT unittests for
MIPS. This issue is tracked as Bug 16250.

Patch by Petar Jovanovic.

llvm-svn: 184461
2013-06-20 20:33:06 +00:00
Michael Gottesman
5982da1002 [APFloat] Rename isIEEENormal => isNormal and remove old isNormal method.
The old isNormal is already functionally replaced by the method isFiniteNonZero
in r184350 and all references to said method were replaced in LLVM/clang in
r184356/134366.

llvm-svn: 184449
2013-06-20 18:34:38 +00:00
Michael Gottesman
c03c0f1f1b [APFloat] Fix typo in test so we actually test if we handle denormals.
llvm-svn: 184447
2013-06-20 18:25:16 +00:00
Rafael Espindola
dc37cdb22d Rename fs::GetUniqueID to fs::getUniqueID to match the style guide.
llvm-svn: 184431
2013-06-20 15:06:35 +00:00
Michael Gottesman
7af8cd5aad [APFloat] Changed APFloat::isNormal => APFloat::isFiniteNonZero for all tests in unittests.
I forgot to to do this in r184356. The only references were in APFloatTest.cpp.

llvm-svn: 184366
2013-06-19 21:53:45 +00:00
Aaron Ballman
406fa22a89 Modified the implementation of fs::GetUniqueID on Windows such that it actually finds a unique identifier for a file. Also adds unit tests for GetUniqueID.
llvm-svn: 184351
2013-06-19 21:03:50 +00:00
Michael Gottesman
c82a0b3e6d [APFloat] Added isFiniteNonZero predicate.
This is the first patch in a series of patches to rename isNormal =>
isFiniteNonZero and isIEEENormal => isNormal. In order to prevent careless
errors on my part the overall plan is:

1. Add the isFiniteNonZero predicate with tests. I can do this in a method
independent of isNormal. (This step is this patch).
2. Convert all references to isNormal with isFiniteNonZero. My plan is to
comment out isNormal locally and continually convert isNormal references =>
isFiniteNonZero until llvm/clang compiles.
3. Remove old isNormal and rename isIEEENormal to isNormal.
4. Look through all of said references from patch 2 and see if we can simplify
them by using the new isNormal.

llvm-svn: 184350
2013-06-19 21:00:17 +00:00
Bill Wendling
8d83852261 Add unit test to test a trivial verifier check.
llvm-svn: 184338
2013-06-19 19:26:44 +00:00
Rafael Espindola
ef0d0d8b0b Avoid using PathV1.h in Program.h.
llvm-svn: 183940
2013-06-13 20:25:38 +00:00
Rafael Espindola
5b921b1aa1 Remove the program class.
It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just
those two functions and make Execute and Wait implementations details.

llvm-svn: 183864
2013-06-12 20:58:35 +00:00
Rafael Espindola
191f66d683 Move PathV2.h to Path.h
Most clients have already been moved from Path V1 to V2. The ones using V1
now include PathV1.h explicitly.

llvm-svn: 183801
2013-06-11 22:21:28 +00:00
Aaron Ballman
8be7652e28 sys::process::get_id() now returns the process ID instead of a process handle on Windows. Patch thanks to Kim Gräsman!
llvm-svn: 183621
2013-06-08 20:29:03 +00:00
Benjamin Kramer
2fbc7287e4 BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.
llvm-svn: 183525
2013-06-07 15:14:31 +00:00
Benjamin Kramer
5f752c703f Optimize BitVector::all().
llvm-svn: 183521
2013-06-07 14:14:38 +00:00
Michael Gottesman
b152f55b6e IEEE-754R 5.7.2 General Operations is* operations (except for isCanonical).
Specifically the following work was done:

1. If the operation was not implemented, I implemented it.

2. If the operation was already implemented, I just moved its location
in the APFloat header into the IEEE-754R 5.7.2 section. If the name was
incorrect, I put in a comment giving the true IEEE-754R name.

Also unittests have been added for all of the functions which did not
already have a unittest.

llvm-svn: 183179
2013-06-04 03:46:25 +00:00
Benjamin Kramer
36e2996805 Try to avoid "integer literal too big" warnings from older GCCs.
llvm-svn: 183081
2013-06-01 22:29:41 +00:00
Eric Christopher
67d642450e Add support for adding the contents of a StringRef to the MD5 hash.
llvm-svn: 183054
2013-05-31 22:34:56 +00:00
Eric Christopher
3b08ea0a4f Convert more unsigned char -> uint8_t.
llvm-svn: 183053
2013-05-31 22:34:52 +00:00
Michael Gottesman
cad66f5206 [APFloat] Added a unittest for APFloat::getZero.
llvm-svn: 183028
2013-05-31 18:43:34 +00:00
Rafael Espindola
bd67fd9669 Remove unused member.
llvm-svn: 182958
2013-05-30 20:19:35 +00:00
Michael Gottesman
2adb2144bb Implement IEEE-754R 2008 nextUp/nextDown functions in the guise of the function APFloat::next(bool nextDown).
rdar://13852078

llvm-svn: 182945
2013-05-30 18:07:13 +00:00
Eric Christopher
30048ba007 Add a comment and some tests including the NULL byte.
llvm-svn: 182900
2013-05-30 00:43:26 +00:00
Michael Gottesman
bff1b48095 Added a unittest for APFloat::getSmallestNormalized.
llvm-svn: 182897
2013-05-30 00:18:47 +00:00
Michael Gottesman
09f3ab01b8 Added code to the unittest for APFloat::getSmallest to double check that we consider the result to be denormal.
I additionally changed certain checks to use EXPECT_FALSE instead of a boolean
complement with EXPECT_TRUE.

llvm-svn: 182896
2013-05-30 00:18:44 +00:00
Michael Gottesman
7fceea7dae Add a unittest for APFloat::getSmallest.
llvm-svn: 182894
2013-05-29 23:58:29 +00:00
Michael Gottesman
2a51955f08 [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for use in APFloat IEEE-754R 2008 nextUp/nextDown function.
rdar://13852078

llvm-svn: 182801
2013-05-28 19:50:20 +00:00
Eric Christopher
fae8590f51 Add to testsuite.
llvm-svn: 182693
2013-05-24 23:20:16 +00:00
Eric Christopher
ad99dcf36c ArrayRef-ize MD5 and clean up a few variable names.
Add a stringize method to make dumping a bit easier, and add a testcase
exercising a few different paths.

llvm-svn: 182692
2013-05-24 23:08:17 +00:00
Michael J. Spencer
02fa6608fd [Support] Remove Count{Leading,Trailing}Zeros_{32,64}.
llvm-svn: 182690
2013-05-24 22:58:37 +00:00
Michael J. Spencer
f5ff6c7f54 [Support][MathExtras] Fix literal type issues.
llvm-svn: 182679
2013-05-24 22:19:05 +00:00
Michael J. Spencer
dbf83dd515 [Support] Add type generic bit utilities to MathExtras.h
llvm-svn: 182667
2013-05-24 20:29:47 +00:00
Filip Pizlo
26d10a1d63 Expose the RTDyldMemoryManager through the C API. This allows clients of
the C API to provide their own way of allocating JIT memory (both code 
and data) and finalizing memory permissions (page protections, cache 
flush).

llvm-svn: 182448
2013-05-22 02:46:43 +00:00
Filip Pizlo
40c1832484 Roll out r182407 and r182408 because they broke builds.
llvm-svn: 182409
2013-05-21 20:03:01 +00:00
Filip Pizlo
46c8b4222c Expose the RTDyldMemoryManager through the C API. This allows clients of
the C API to provide their own way of allocating JIT memory (both code 
and data) and finalizing memory permissions (page protections, cache 
flush).

llvm-svn: 182408
2013-05-21 20:00:56 +00:00
Ulrich Weigand
ec9f537092 Alternative fix for problem addressed in r182233
Revision r182233 partially reverted the change in r181200 to simplify
JIT unif test #ifdefs, because that change caused a link error on some
host operating systems where the export list requires the following
symbols to be defined:

 JITTest_AvailableExternallyFunction
 JITTest_AvailableExternallyGlobal

As discussed on the list, the commit reverts r182233 (and re-installs
the full r181200 change), and instead fixes the link problem by moving
those two symbols to the top of the file and unconditionally defining
them.

llvm-svn: 182367
2013-05-21 10:30:59 +00:00
Bob Wilson
de1f36eea4 Partially revert change in r181200 that tried to simplify JIT unit test #ifdefs.
The export list for this test requires the following symbols to be available:
  JITTest_AvailableExternallyFunction
  JITTest_AvailableExternallyGlobal
The change in r181200 commented them out, which caused the test to fail to
link, at least on Darwin. I have only reverted the change for arm, since I
can't test the other targets and since it sounds like that change was fixing
real problems for those other targets. It should be possible to rearrange the
code to keep those definitions outside the #ifdefs, but that should be done by
someone who can reproduce the problems that r181200 was trying to fix.

llvm-svn: 182233
2013-05-20 06:13:09 +00:00
Renato Golin
56e43f179a SubArch support in MCJIT unittest
llvm-svn: 182220
2013-05-19 20:10:10 +00:00
Tim Northover
04eba4a59a AArch64: enable MCJIT unittests
llvm-svn: 182217
2013-05-19 19:44:56 +00:00
David Tweed
ccbb603f31 Minor changes to the MCJITTest unittests to use the correct API for finalizing
the JIT object (including XFAIL an ARM test that now needs fixing). Also renames
internal function for consistency.

llvm-svn: 182085
2013-05-17 10:01:46 +00:00
David Blaikie
898763a097 Use only explicit bool conversion operators
BitVector/SmallBitVector::reference::operator bool remain implicit since
they model more exactly a bool, rather than something else that can be
boolean tested.

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

One behavior change (YAMLParser) was made, though no test case is
included as I'm not sure how to reach that code path. Essentially any
comparison of llvm::yaml::document_iterators would be invalid if neither
iterator was at the end.

This helped uncover a couple of bugs in Clang - test cases provided for
those in a separate commit along with similar changes to `operator bool`
instances in Clang.

llvm-svn: 181868
2013-05-15 07:36:59 +00:00
Filip Pizlo
585f35b5a0 SectionMemoryManager shouldn't be a JITMemoryManager. Previously, the
EngineBuilder interface required a JITMemoryManager even if it was being used 
to construct an MCJIT. But the MCJIT actually wants a RTDyldMemoryManager. 
Consequently, the SectionMemoryManager, which is meant for MCJIT, derived 
from the JITMemoryManager and then stubbed out a bunch of JITMemoryManager 
methods that weren't relevant to the MCJIT.

This patch fixes the situation: it teaches the EngineBuilder that 
RTDyldMemoryManager is a supertype of JITMemoryManager, and that it's 
appropriate to pass a RTDyldMemoryManager instead of a JITMemoryManager if 
we're using the MCJIT. This allows us to remove the stub methods from 
SectionMemoryManager, and make SectionMemoryManager a direct subtype of 
RTDyldMemoryManager.

llvm-svn: 181820
2013-05-14 19:29:00 +00:00
Duncan Sands
d4dd4dcf15 Get the unittests compiling when building with cmake and the setting
-DLLVM_ENABLE_THREADS=false.

llvm-svn: 181788
2013-05-14 13:29:16 +00:00
Shuxin Yang
e016d80534 Fix a bug that APFloat::fusedMultiplyAdd() mistakenly evaluate "14.5f * -14.5f + 225.0f" to 225.0f.
llvm-svn: 181715
2013-05-13 18:03:12 +00:00
Andrew Kaylor
50bcd67af6 Fix MCJITCAPITest.cpp unit test on Windows.
MCJIT on Windows requires an explicit target triple with "-elf" appended to generate objects in ELF format.  The common test framework was setting up this triple, but it wasn't passed to the C API in the test.

llvm-svn: 181614
2013-05-10 17:58:41 +00:00
Rafael Espindola
b0598a0361 Remove exception handling support from the old JIT.
llvm-svn: 181354
2013-05-07 20:53:59 +00:00
Andrew Trick
66c37e7321 Implemented public interface for modifying registered (not positional or sink options) command line options at runtime.
Patch by Dan Liew!

llvm-svn: 181254
2013-05-06 21:56:35 +00:00