Commit Graph

416 Commits

Author SHA1 Message Date
Saleem Abdulrasool
802a1be56a 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287479 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-20 02:36:38 +00:00
Saleem Abdulrasool
308b046dd4 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287478 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-20 02:36:36 +00:00
Eugene Zelenko
38ccacb5ed [Examples] Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D26433


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 21:57:58 +00:00
Lang Hames
2322de66fe [Orc] Update the BuildingAJIT Chapter 5 server class for the recent RPC changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286642 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 21:55:25 +00:00
Lang Hames
085827f843 [ORC] Re-apply 286620 with fixes for the ErrorSuccess class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286639 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 21:42:09 +00:00
Lang Hames
b35b701639 [ORC] Revert r286620 while I investigate a bot failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:46:46 +00:00
Lang Hames
d8314f03b1 [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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:42:44 +00:00
Teresa Johnson
895b529ff6 Fix examples files to reflect header split in r286566.
I missed these files in examples/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286570 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 06:02:04 +00:00
Malcolm Parsons
4c12732226 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285832 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-02 16:43:50 +00:00
Lang Hames
207b6abad4 [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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 22:41:03 +00:00
Lang Hames
b5046bac11 [BuildingAJIT] Make the chapter 5 server export symbols.
This will allow chapter 5 to work on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284637 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 20:22:12 +00:00
Lang Hames
4cd6605af1 [Kaleidoscope] Make Chapter 2 use llvm::make_unique, rather than a helper.
This essentially reverts r251936, minimizing the difference between Chapter2
and Chapter 3, and making Chapter 2's code match the tutorial text.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-19 23:00:27 +00:00
Lang Hames
dd7c4ea725 [ORC] Update examples for header changes in r281171.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281178 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-11 21:34:13 +00:00
Eric Christopher
7092439c66 Fix singlton -> singleton typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279801 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26 02:00:21 +00:00
Justin Bogner
7d7a23e700 Replace a few more "fall through" comments with LLVM_FALLTHROUGH
Follow up to r278902. I had missed "fall through", with a space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278970 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:30:52 +00:00
David Majnemer
975248e4fb Use the range variant of find instead of unpacking begin/end
If the result of the find is only used to compare against end(), just
use is_contained instead.

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 22:21:41 +00:00
Lang Hames
075c1e2e1a [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.
This patch replaces RuntimeDyld::SymbolInfo with JITSymbol: A symbol class
that is capable of lazy materialization (i.e. the symbol definition needn't be
emitted until the address is requested). This can be used to support common
and weak symbols in the JIT (though this is not implemented in this patch).

For consistency, RuntimeDyld::SymbolResolver is renamed to JITSymbolResolver.

For space efficiency a new class, JITEvaluatedSymbol, is introduced that
behaves like the old RuntimeDyld::SymbolInfo - i.e. it is just a pair of an
address and symbol flags. Instances of JITEvaluatedSymbol can be used in
symbol-tables to avoid paying the space cost of the materializer.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277386 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 20:49:11 +00:00
Lang Hames
8e1c20f813 [Kaleidoscope][BuildingAJIT] Start filling in text for chapter 3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 01:39:49 +00:00
Wilfred Hughes
f9c643b6e0 New Kaleidoscope chapter: Creating object files
This new chapter describes compiling LLVM IR to object files.

The new chaper is chapter 8, so later chapters have been renumbered.
Since this brings us to 10 chapters total, I've also needed to rename
the other chapters to use two digit numbering.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274441 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02 17:01:59 +00:00
Lang Hames
df424f76e5 [MCJIT] Update MCJIT and get the fibonacci example working again.
MCJIT will now set the DataLayout on a module when it is added to the JIT,
rather than waiting until it is codegen'd, and the runFunction method will
finalize the module containing the function to be run before running it.

The fibonacci example has been updated to include and link against MCJIT.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272455 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-11 05:47:04 +00:00
Lang Hames
1fa1983597 [Orc] Add conversion to/from RuntimeDyld::SymbolInfo for JITSymbol.
This tidies up some code that was manually constructing RuntimeDyld::SymbolInfo
instances from JITSymbols. It will save more mess in the future when
JITSymbol::getAddress is extended to return an Expected<TargetAddress> rather
than just a TargetAddress, since we'll be able to embed the error checking in
the conversion.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271350 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 23:14:26 +00:00
Lang Hames
9aaeb83f58 [Kaleidoscope][BuildingAJIT] Don't build Chapter 5 on Windows for now.
The TCP setup code is currently *nix based and does not build on Windows.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271194 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-30 01:18:32 +00:00
Lang Hames
203f697825 [Kaleidoscope][BuildingAJIT] Add code for Chapter 5 - remote JITing.
This chapter demonstrates lazily JITing from ASTs with the expressions being
executed on a remote machine via a TCP connection. It needs some polish, but is
substantially complete.

Currently x86-64 SysV ABI (Darwin and Linux) only, but other architectures
can be supported by changing the server code to use alternative ABI support
classes from llvm/include/llvm/ExecutionEngine/Orc/OrcABISupport.h.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271193 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-30 00:09:26 +00:00
Lang Hames
fe7405cb98 [Kaleidoscope][Orc] Remove the reference to the Orc directory that was removed
in r271059.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271061 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:21:12 +00:00
Lang Hames
7a2177551f [Kaleidoscope] Remove the old Kaleidoscope/ORC tutorial series.
This code has been superseded by the new Building A JIT series.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271059 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:17:56 +00:00
Lang Hames
b0acadce69 [Kaleidoscope][BuildingAJIT] Add code for chapter 4.
This chapter will cover lazy compilation directly from ASTs using the Compile
Callbacks and Indirect Stubs APIs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 21:50:13 +00:00
Lang Hames
dfc9470f33 [Kaleidoscope][BuildingAJIT] Remove leftover debugging output statements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 21:27:52 +00:00
Lang Hames
ffdfc78e37 [Kaleidoscope][BuildingAJIT] Add explicit dependence on TransformUtils to Chapter3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270914 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 21:00:29 +00:00
Lang Hames
e0c300733e [Kaleidoscope][BuildingAJIT] Add code for Chapter 3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:35:39 +00:00
Lang Hames
67faeedf47 [Kaleidoscope][BuildingAJIT] Fix a bug in the symbol resolver in Chapter2.
Symbol resolution should be done on the top layer of the stack unless there's a
good reason to do otherwise. In this case it would have worked because
OptimizeLayer::addModuleSet eagerly passes all modules down to the
CompileLayer, meaning that searches in CompileLayer will find the definitions.
In later chapters where the top layer's addModuleSet isn't a pass-through, this
would break.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270899 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 19:44:33 +00:00
Lang Hames
fd4178f436 [Kaleidoscope][BuildingAJIT] Make the optimizeModule method for Chapter2
private.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270807 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 00:24:18 +00:00
Lang Hames
1ab578794e [Kaleidoscope][BuildingAJIT] Add code for the 2nd chapter of the BuildingAJIT
tutorial.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 23:25:23 +00:00
Lang Hames
f4f40d85e6 [Kaleidoscope][BuildingAJIT] Delete trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270787 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 22:48:43 +00:00
Lang Hames
ba9118ae86 [Kaleidoscope][BuildingAJIT] Add a description of the KaleidoscopeJIT addModule
method to Chapter1 of the BuildingAJIT tutorial.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270778 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 22:27:25 +00:00
Eugene Zelenko
578a1d21a0 Fix some Include What You Use warnings in examples; other minor fixes.
Differential revision: http://reviews.llvm.org/D20607


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270645 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 01:18:36 +00:00
Lang Hames
5d82919adc [Kaleidoscope] Add an initial "Building an ORC JIT" tutorial chapter.
This is a work in progress - the chapter text is incomplete, though
the example code compiles and runs.

Feedback and patches are, as usual, most welcome.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270487 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23 20:34:19 +00:00
Lang Hames
60e94e81eb [Kaleidoscope] Fix static global ordering to prevent crash on exit.
If TheModule is declared before LLVMContext then it will be destructed after it,
crashing when it tries to deregister itself from the destructed context.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270381 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-22 22:48:36 +00:00
Eugene Zelenko
efac554031 Fix some Clang-tidy modernize-use-bool-literals and Include What You Use warnings in examples; other minor fixes.
Differential revision: http://reviews.llvm.org/D20397


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270008 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 01:08:04 +00:00
Lang Hames
c14b8e9703 [Orc] Rename OrcArchitectureSupport to OrcABISupport and add Win32 ABI support.
This enables lazy JITing on Windows x86-64.

Patch by David. Thanks David!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268845 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07 03:36:38 +00:00
Mehdi Amini
8be7707c14 Remove every uses of getGlobalContext() in LLVM (but the C API)
At the same time, fixes InstructionsTest::CastInst unittest: yes
you can leave the IR in an invalid state and exit when you don't
destroy the context (like the global one), no longer now.

This is the first part of http://reviews.llvm.org/D19094

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-14 21:59:01 +00:00
Lang Hames
215b61f08e [Kaleidoscope] Rename Error -> LogError in Chapters 2-5.
This keeps the naming consistent with Chapters 6-8, where Error was renamed to
LogError in r264426 to avoid clashes with the new Error class in libSupport.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264427 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 17:41:26 +00:00
Lang Hames
d7b240afb9 [Kaleidoscope] Fix 'Error' name clashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 17:33:32 +00:00
Chandler Carruth
d129db74d9 [PM] Update Kaleidoscope with the new header file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263223 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 12:10:15 +00:00
Rafael Espindola
93ed620d27 Refactor duplicated code for linking with pthread.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262344 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 15:54:40 +00:00
Chris Bieneman
caeade4234 Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:29:08 +00:00
NAKAMURA Takumi
b201aa77b0 Fix examples corresponding to r257302.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257313 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 05:04:20 +00:00
Lang Hames
6d3f26eb9a [Orc] Fix Kaleidoscope example for change in r254693.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254695 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 02:32:32 +00:00
Duncan P. N. Exon Smith
7d7668eb6b examples: Remove implicit ilist iterator conversions, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252379 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-07 00:55:46 +00:00
Peter Collingbourne
dcbcd42f5c Fix Kaleidoscope example.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252222 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 22:18:31 +00:00
Lang Hames
166aa4459f [Kaleidoscope][Orc] Fix the fully_lazy Orc Kaleidoscope example.
r251933 changed the Orc compile callbacks API, which broke this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251942 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03 16:35:10 +00:00