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

440 Commits

Author SHA1 Message Date
David Blaikie
798d5239e3 InstCombine: Fix layering by not including Scalar.h in InstCombine
(notionally Scalar.h is part of libLLVMScalarOpts, so it shouldn't be
included by InstCombine which doesn't/shouldn't need to depend on
ScalarOpts)

llvm-svn: 330669
2018-04-24 00:48:59 +00:00
Lang Hames
9f659ebeb6 [ORC] Create a new SymbolStringPool by default in ExecutionSession constructor.
This makes the common case of constructing an ExecutionSession tidier.

llvm-svn: 329013
2018-04-02 20:57:56 +00:00
David Blaikie
2efa3f569e Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h
Fixes layering - Transforms/Utils shouldn't depend on including a Scalar
or IPO header, because Scalar and IPO depend on Utils.

llvm-svn: 328717
2018-03-28 17:44:36 +00:00
Lang Hames
1e6a98aff9 [ORC] Re-apply r327566 with a fix for test-global-ctors.ll.
Also clang-formats the patch, which I should have done the first time around.

llvm-svn: 327594
2018-03-15 00:30:14 +00:00
Reid Kleckner
f02357933a Revert "[ORC] Switch from shared_ptr to unique_ptr for addModule methods."
This reverts commit r327566, it breaks
test/ExecutionEngine/OrcMCJIT/test-global-ctors.ll.

The test doesn't crash with a stack trace, unfortunately. It merely
returns 1 as the exit code.

ASan didn't produce a report, and I reproduced this on my Linux machine
and Windows box.

llvm-svn: 327576
2018-03-14 21:32:34 +00:00
Lang Hames
481402ffd7 [ORC] Switch from shared_ptr to unique_ptr for addModule methods.
Layer implementations typically mutate module state, and this is better
reflected by having layers own the Module they are operating on.

llvm-svn: 327566
2018-03-14 20:29:45 +00:00
Lang Hames
b8f97b94a0 [ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
unified GetResources callback.

Having a single 'GetResources' callback will simplify adding new resources in
the future.

llvm-svn: 325180
2018-02-14 22:13:02 +00:00
Rafael Espindola
1202040fcc Update examples for API change. NFC.
llvm-svn: 325157
2018-02-14 19:23:27 +00:00
Lang Hames
59fbe357fd [ORC] Remove Layer handles from the layer concept.
Handles were returned by addModule and used as keys for removeModule,
findSymbolIn, and emitAndFinalize. Their job is now subsumed by VModuleKeys,
which simplify resource management by providing a consistent handle across all
layers.

llvm-svn: 324700
2018-02-09 02:30:40 +00:00
Lang Hames
1f1c8bd14b Add OrcJIT dependency for Kaleidoscope Chapter 9.
This should fix the error at
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10421

llvm-svn: 324413
2018-02-06 22:22:10 +00:00
Lang Hames
e9b4f95b30 [ORC] Start migrating ORC layers to use the new ORC Core.h APIs.
In particular this patch switches RTDyldObjectLinkingLayer to use
orc::SymbolResolver and threads the requried changse (ExecutionSession
references and VModuleKeys) through the existing layer APIs.

The purpose of the new resolver interface is to improve query performance and
better support parallelism, both in JIT'd code and within the compiler itself.

The most visibile change is switch of the <Layer>::addModule signatures from:

Expected<Handle> addModule(std::shared_ptr<ModuleType> Mod,
                           std::shared_ptr<JITSymbolResolver> Resolver)

to:

Expected<Handle> addModule(VModuleKey K, std::shared_ptr<ModuleType> Mod);

Typical usage of addModule will now look like:

auto K = ES.allocateVModuleKey();
Resolvers[K] = createSymbolResolver(...);
Layer.addModule(K, std::move(Mod));

See the BuildingAJIT tutorial code for example usage.

llvm-svn: 324405
2018-02-06 21:25:11 +00:00
David Blaikie
a5f0240633 PR35705: Fix Chapter 9 example code for API changes to DIBuilder
llvm-svn: 321214
2017-12-20 19:36:54 +00:00
Shoaib Meenai
d81bfe1cb8 [CMake] Use PRIVATE in target_link_libraries for executables
We currently use target_link_libraries without an explicit scope
specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables.
Dependencies added in this way apply to both the target and its
dependencies, i.e. they become part of the executable's link interface
and are transitive.

Transitive dependencies generally don't make sense for executables,
since you wouldn't normally be linking against an executable. This also
causes issues for generating install export files when using
LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM
library dependencies, which are currently added as interface
dependencies. If clang is in the distribution components but the LLVM
libraries it depends on aren't (which is a perfectly legitimate use case
if the LLVM libraries are being built static and there are therefore no
run-time dependencies on them), CMake will complain about the LLVM
libraries not being in export set when attempting to generate the
install export file for clang. This is reasonable behavior on CMake's
part, and the right thing is for LLVM's build system to explicitly use
PRIVATE dependencies for executables.

Unfortunately, CMake doesn't allow you to mix and match the keyword and
non-keyword target_link_libraries signatures for a single target; i.e.,
if a single call to target_link_libraries for a particular target uses
one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must
also be updated to use those keywords. This means we must do this change
in a single shot. I also fully expect to have missed some instances; I
tested by enabling all the projects in the monorepo (except dragonegg),
and configuring both with and without shared libraries, on both Darwin
and Linux, but I'm planning to rely on the buildbots for other
configurations (since it should be pretty easy to fix those).

Even after this change, we still have a lot of target_link_libraries
calls that don't specify a scope keyword, mostly for shared libraries.
I'm thinking about addressing those in a follow-up, but that's a
separate change IMO.

Differential Revision: https://reviews.llvm.org/D40823

llvm-svn: 319840
2017-12-05 21:49:56 +00:00
Vlad Tsyrklevich
dc99911eb8 Fix broken links to the Itanium CXX ABI
llvm-svn: 312985
2017-09-12 00:19:11 +00:00
Lang Hames
c0cf59d6e5 [ORC] Refactor OrcRemoteTarget code to expose its RPC API, reduce
code duplication in the client, and improve error propagation.

This patch moves the OrcRemoteTarget rpc::Function declarations from
OrcRemoteTargetRPCAPI into their own namespaces under llvm::orc::remote so that
they can be used in new contexts (in particular, a remote-object-file adapter
layer that I will commit shortly).

Code duplication in OrcRemoteTargetClient (especially in loops processing the
code, rw-data and ro-data allocations) is removed by moving the loop bodies
into their own functions.

Error propagation is (slightly) improved by adding an ErrorReporter functor to
the OrcRemoteTargetClient -- Errors that can't be returned (because they occur
in destructors, or behind stable APIs that don't provide error returns) can be
sent to the ErrorReporter instead. Some methods in the Client API are also
changed to make better use of the Expected class: returning Expected<T>s rather
than returning Errors and taking T&s to store the results.

llvm-svn: 312500
2017-09-04 20:54:46 +00:00
Lang Hames
86d6a316cd [ORC] Add an Error return to the JITCompileCallbackManager::grow method.
Calling grow may result in an error if, for example, this is a callback
manager for a remote target. We need to be able to return this error to the
callee.

llvm-svn: 312429
2017-09-03 00:50:42 +00:00
Lang Hames
5af67ab313 [ORC][Kaleidoscope] Update Chapter 1 of BuildingAJIT to incorporate recent ORC
API changes.

llvm-svn: 310947
2017-08-15 19:20:10 +00:00
Hans Wennborg
46de941333 Defeat another -Wunused-but-set-variable warning
llvm-svn: 308484
2017-07-19 15:06:31 +00:00
Hiroshi Inoue
95d1010b48 fix typos in comments and error messges; NFC
llvm-svn: 307885
2017-07-13 06:48:39 +00:00
Lang Hames
94e6e7207c [ORC] Errorize the ORC APIs.
This patch updates the ORC layers and utilities to return and propagate
llvm::Errors where appropriate. This is necessary to allow ORC to safely handle
error cases in cross-process and remote JITing.

llvm-svn: 307350
2017-07-07 02:59:13 +00:00
Lang Hames
5ffd7d4185 [Orc] Remove the memory manager argument to addModule, and de-templatize the
symbol resolver argument.

De-templatizing the symbol resolver is part of the ongoing simplification of
ORC layer API.

Removing the memory management argument (and delegating construction of memory
managers for RTDyldObjectLinkingLayer to a functor passed in to the constructor)
allows us to build JITs whose base object layers need not be compatible with
RTDyldObjectLinkingLayer's memory mangement scheme. For example, a 'remote
object layer' that sends fully relocatable objects directly to the remote does
not need a memory management scheme at all (that will be handled by the remote).

llvm-svn: 307058
2017-07-04 04:42:30 +00:00
Lang Hames
7b43a9c7c5 [ORC] Re-apply r306166 and r306168 with fix for regression test.
llvm-svn: 306182
2017-06-23 23:25:28 +00:00
Rafael Espindola
b766456220 This reverts commit r306166 and r306168.
Revert "[ORC] Remove redundant semicolons from DEFINE_SIMPLE_CONVERSION_FUNCTIONS uses."
Revert "[ORC] Move ORC IR layer interface from addModuleSet to addModule and fix the module type as std::shared_ptr<Module>."

They broke ExecutionEngine/OrcMCJIT/test-global-ctors.ll on linux.

llvm-svn: 306176
2017-06-23 22:50:24 +00:00
Lang Hames
1f6bb5ebe0 [ORC] Move ORC IR layer interface from addModuleSet to addModule and fix the
module type as std::shared_ptr<Module>.

llvm-svn: 306166
2017-06-23 21:45:29 +00:00
Lang Hames
efe8bd1023 [ORC] Switch the object layer API from addObjectSet to addObject (singular), and
move the ObjectCache from the IRCompileLayer to SimpleCompiler.

This is the first in a series of patches aimed at cleaning up and improving the
robustness and performance of the ORC APIs.

llvm-svn: 306058
2017-06-22 21:06:54 +00:00
Zachary Turner
c5632126fc Move Object format code to lib/BinaryFormat.
This creates a new library called BinaryFormat that has all of
the headers from llvm/Support containing structure and layout
definitions for various types of binary formats like dwarf, coff,
elf, etc as well as the code for identifying a file from its
magic.

Differential Revision: https://reviews.llvm.org/D33843

llvm-svn: 304864
2017-06-07 03:48:56 +00:00
Eugene Zelenko
79d41e75c6 [Examples] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 303944
2017-05-26 00:00:14 +00:00
Peter Szecsi
22df982bb3 [Kaleidoscope] toy.cpp use after move fix
The variable Proto is moved at the beginning of the codegen() function.
According to the comment above, the pointed object should be used due the
reference P.

Differential Revision: https://reviews.llvm.org/D32939

llvm-svn: 302369
2017-05-07 11:00:01 +00:00
Serge Guelton
6ca59da244 Module::getOrInsertFunction is using C-style vararg instead of variadic templates.
From a user prospective, it forces the use of an annoying nullptr to mark the end of the vararg, and there's not type checking on the arguments.
The variadic template is an obvious solution to both issues.

Differential Revision: https://reviews.llvm.org/D31070

llvm-svn: 299949
2017-04-11 15:01:18 +00:00
NAKAMURA Takumi
7cceb44499 llvm/examples/Kaleidoscope/BuildingAJIT: More fixup corresponding to r295636.
I missed updating them since I just ran check-llvm (with examples) in r295645.

llvm-svn: 295646
2017-02-20 10:07:41 +00:00
NAKAMURA Takumi
beab260f4b llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h: Fixup corresponding to r295636.
llvm-svn: 295645
2017-02-20 09:56:24 +00:00
NAKAMURA Takumi
fb8f42dff7 Kaleidoscope-Ch7: Add TranformUtils for llvm::createPromoteMemoryToRegisterPass() added in r294870.
llvm-svn: 294881
2017-02-12 01:18:32 +00:00
Mehdi Amini
5a2632da06 Update Kaleidoscope tutorial and improve Windows support
Many quoted code blocks were not in sync with the actual toy.cpp
files. Improve tutorial text slightly in several places.
Added some step descriptions crucial to avoid crashes (like
InitializeNativeTarget* calls).
Solve/workaround problems with Windows (JIT'ed method not found, using
custom and standard library functions from host process).

Patch by: Moritz Kroll <moritz.kroll@gmx.de>

Differential Revision: https://reviews.llvm.org/D29864

llvm-svn: 294870
2017-02-11 21:26:52 +00:00
Eric Fiselier
db10580e9b [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.

llvm-svn: 294690
2017-02-10 01:59:20 +00:00
Matthias Braun
5426840a10 Use print() instead of dump() in code
The dump() functions are meant to be used in a debugger, code should
typically use something like print(errs());

llvm-svn: 293365
2017-01-28 02:47:46 +00:00
NAKAMURA Takumi
a86dd54b5e Chapter3/KaleidoscopeJIT.h: Fix a warning. [-Wunused-lambda-capture]
"this", aka class members, is not referred in the body.

llvm-svn: 293159
2017-01-26 08:31:14 +00:00
Boris Ulasevich
9fe65bc2ad BrainF example: fixing output buffering issue
Differential Revision: https://reviews.llvm.org/D27824

llvm-svn: 292216
2017-01-17 13:27:28 +00:00
Boris Ulasevich
face70091b BrainF example: fixing segfault caused by outdated code with missing MCJIT dependency
Differential Revision: https://reviews.llvm.org/D26280

llvm-svn: 289857
2016-12-15 19:29:42 +00:00
NAKAMURA Takumi
f8337108d2 Prune unused libdeps.
llvm-svn: 289060
2016-12-08 15:28:02 +00:00
Saleem Abdulrasool
b58305138d ExceptionDemo: remove some undefined behaviour
The casting based reading of the LSDA could attempt to read unsuitably aligned
data.  Avoid that case by explicitly using a memcpy.  A similar approach is used
in libc++abi to address the same UB.

llvm-svn: 287479
2016-11-20 02:36:38 +00:00
Saleem Abdulrasool
6d168b5903 ExceptionDemo: prefer headers over redeclarations
Rather than redeclaring the interfaces for exceptions, prefer using the
`unwind.h` header.  This is vended by at least gcc and clang, and can also be
found by an external unwinding library (e.g. libunwind).  Doing this simplifies
the example to the exception handling itself.  Minor tweaks are the result of
_Unwind_Context_t not being defined, which is just a typedef for struct
_Unwind_Context *.  NFC.

llvm-svn: 287478
2016-11-20 02:36:36 +00:00
Eugene Zelenko
cb56f53c92 [Examples] Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D26433

llvm-svn: 287384
2016-11-18 21:57:58 +00:00
Lang Hames
524bc4c230 [Orc] Update the BuildingAJIT Chapter 5 server class for the recent RPC changes.
llvm-svn: 286642
2016-11-11 21:55:25 +00:00
Lang Hames
1fe248463b [ORC] Re-apply 286620 with fixes for the ErrorSuccess class.
llvm-svn: 286639
2016-11-11 21:42:09 +00:00
Lang Hames
5c71b8a84a [ORC] Revert r286620 while I investigate a bot failure.
llvm-svn: 286621
2016-11-11 19:46:46 +00:00
Lang Hames
63b8f82e8f [ORC] Refactor the ORC RPC utilities to add some new features.
(1) Add support for function key negotiation.

The previous version of the RPC required both sides to maintain the same
enumeration for functions in the API. This means that any version skew between
the client and server would result in communication failure.

With this version of the patch functions (and serializable types) are defined
with string names, and the derived function signature strings are used to
negotiate the actual function keys (which are used for efficient call
serialization). This allows clients to connect to any server that supports a
superset of the API (based on the function signatures it supports).

(2) Add a callAsync primitive.

The callAsync primitive can be used to install a return value handler that will
run as soon as the RPC function's return value is sent back from the remote.

(3) Launch policies for RPC function handlers.

The new addHandler method, which installs handlers for RPC functions, takes two
arguments: (1) the handler itself, and (2) an optional "launch policy". When the
RPC function is called, the launch policy (if present) is invoked to actually
launch the handler. This allows the handler to be spawned on a background
thread, or added to a work list. If no launch policy is used, the handler is run
on the server thread itself. This should only be used for short-running
handlers, or entirely synchronous RPC APIs.

(4) Zero cost cross type serialization.

You can now define serialization from any type to a different "wire" type. For
example, this allows you to call an RPC function that's defined to take a
std::string while passing a StringRef argument. If a serializer from StringRef
to std::string has been defined for the channel type this will be used to
serialize the argument without having to construct a std::string instance.

This allows buffer reference types to be used as arguments to RPC calls without
requiring a copy of the buffer to be made.

llvm-svn: 286620
2016-11-11 19:42:44 +00:00
Teresa Johnson
21024a90a2 Fix examples files to reflect header split in r286566.
I missed these files in examples/

llvm-svn: 286570
2016-11-11 06:02:04 +00:00
Malcolm Parsons
79b7702948 Fix Clang-tidy readability-redundant-string-cstr warnings
Reviewers: beanz, lattner, jlebar

Subscribers: jholewinski, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D26235

llvm-svn: 285832
2016-11-02 16:43:50 +00:00
Lang Hames
020e3ff611 [BuildingAJIT] Use the remote target triple to construct the TargetMachine in
Chapter 5.

Chapter 5 demonstrates remote JITing: code is executed on the remote, not the
machine running the REPL, so it's the remote's triple (and TargetMachine) that
we need.

llvm-svn: 284657
2016-10-19 22:41:03 +00:00
Lang Hames
e7f3450978 [BuildingAJIT] Make the chapter 5 server export symbols.
This will allow chapter 5 to work on Linux.

llvm-svn: 284637
2016-10-19 20:22:12 +00:00