summaryrefslogtreecommitdiffstats
path: root/llvm/examples
Commit message (Collapse)AuthorAgeFilesLines
...
* ExceptionDemo: remove some undefined behaviourSaleem Abdulrasool2016-11-201-14/+17
| | | | | | | | 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
* ExceptionDemo: prefer headers over redeclarationsSaleem Abdulrasool2016-11-201-63/+9
| | | | | | | | | | | 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
* [Examples] Fix some Clang-tidy modernize-use-default and Include What You ↵Eugene Zelenko2016-11-1818-56/+216
| | | | | | | | Use warnings; other minor fixes. Differential revision: https://reviews.llvm.org/D26433 llvm-svn: 287384
* [Orc] Update the BuildingAJIT Chapter 5 server class for the recent RPC changes.Lang Hames2016-11-111-13/+3
| | | | llvm-svn: 286642
* [ORC] Re-apply 286620 with fixes for the ErrorSuccess class.Lang Hames2016-11-112-5/+5
| | | | llvm-svn: 286639
* [ORC] Revert r286620 while I investigate a bot failure.Lang Hames2016-11-112-5/+5
| | | | llvm-svn: 286621
* [ORC] Refactor the ORC RPC utilities to add some new features.Lang Hames2016-11-112-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
* Fix examples files to reflect header split in r286566.Teresa Johnson2016-11-112-2/+2
| | | | | | I missed these files in examples/ llvm-svn: 286570
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-021-1/+1
| | | | | | | | | | Reviewers: beanz, lattner, jlebar Subscribers: jholewinski, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26235 llvm-svn: 285832
* [BuildingAJIT] Use the remote target triple to construct the TargetMachine inLang Hames2016-10-191-1/+2
| | | | | | | | | | 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
* [BuildingAJIT] Make the chapter 5 server export symbols.Lang Hames2016-10-191-0/+2
| | | | | | This will allow chapter 5 to work on Linux. llvm-svn: 284637
* [Kaleidoscope] Make Chapter 2 use llvm::make_unique, rather than a helper.Lang Hames2016-09-192-22/+15
| | | | | | | This essentially reverts r251936, minimizing the difference between Chapter2 and Chapter 3, and making Chapter 2's code match the tutorial text. llvm-svn: 281945
* [ORC] Update examples for header changes in r281171.Lang Hames2016-09-111-2/+2
| | | | llvm-svn: 281178
* Fix singlton -> singleton typo.Eric Christopher2016-08-265-5/+5
| | | | llvm-svn: 279801
* Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-171-2/+2
| | | | | | Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
* Use the range variant of find instead of unpacking begin/endDavid Majnemer2016-08-111-2/+1
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278433
* [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.Lang Hames2016-08-016-35/+33
| | | | | | | | | | | | | | | | 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. llvm-svn: 277386
* [Kaleidoscope][BuildingAJIT] Start filling in text for chapter 3.Lang Hames2016-07-153-14/+17
| | | | llvm-svn: 275518
* New Kaleidoscope chapter: Creating object filesWilfred Hughes2016-07-024-328/+1552
| | | | | | | | | | | | 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 llvm-svn: 274441
* [MCJIT] Update MCJIT and get the fibonacci example working again.Lang Hames2016-06-112-0/+3
| | | | | | | | | | 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. llvm-svn: 272455
* [Orc] Add conversion to/from RuntimeDyld::SymbolInfo for JITSymbol.Lang Hames2016-05-316-8/+8
| | | | | | | | | | 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. llvm-svn: 271350
* [Kaleidoscope][BuildingAJIT] Don't build Chapter 5 on Windows for now.Lang Hames2016-05-301-1/+3
| | | | | | The TCP setup code is currently *nix based and does not build on Windows. llvm-svn: 271194
* [Kaleidoscope][BuildingAJIT] Add code for Chapter 5 - remote JITing.Lang Hames2016-05-307-0/+1789
| | | | | | | | | | | | 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. llvm-svn: 271193
* [Kaleidoscope][Orc] Remove the reference to the Orc directory that was removedLang Hames2016-05-271-1/+0
| | | | | | in r271059. llvm-svn: 271061
* [Kaleidoscope] Remove the old Kaleidoscope/ORC tutorial series.Lang Hames2016-05-2713-5684/+0
| | | | | | This code has been superseded by the new Building A JIT series. llvm-svn: 271059
* [Kaleidoscope][BuildingAJIT] Add code for chapter 4.Lang Hames2016-05-274-0/+1479
| | | | | | | This chapter will cover lazy compilation directly from ASTs using the Compile Callbacks and Indirect Stubs APIs. llvm-svn: 271054
* [Kaleidoscope][BuildingAJIT] Remove leftover debugging output statements.Lang Hames2016-05-261-4/+0
| | | | llvm-svn: 270919
* [Kaleidoscope][BuildingAJIT] Add explicit dependence on TransformUtils to ↵Lang Hames2016-05-261-0/+1
| | | | | | Chapter3. llvm-svn: 270914
* [Kaleidoscope][BuildingAJIT] Add code for Chapter 3.Lang Hames2016-05-264-0/+1385
| | | | llvm-svn: 270909
* [Kaleidoscope][BuildingAJIT] Fix a bug in the symbol resolver in Chapter2.Lang Hames2016-05-261-1/+1
| | | | | | | | | | | 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. llvm-svn: 270899
* [Kaleidoscope][BuildingAJIT] Make the optimizeModule method for Chapter2Lang Hames2016-05-261-0/+2
| | | | | | private. llvm-svn: 270807
* [Kaleidoscope][BuildingAJIT] Add code for the 2nd chapter of the BuildingAJITLang Hames2016-05-254-0/+1369
| | | | | | tutorial. llvm-svn: 270794
* [Kaleidoscope][BuildingAJIT] Delete trailing whitespace.Lang Hames2016-05-251-1/+1
| | | | llvm-svn: 270787
* [Kaleidoscope][BuildingAJIT] Add a description of the KaleidoscopeJIT addModuleLang Hames2016-05-251-4/+15
| | | | | | method to Chapter1 of the BuildingAJIT tutorial. llvm-svn: 270778
* Fix some Include What You Use warnings in examples; other minor fixes.Eugene Zelenko2016-05-259-25/+114
| | | | | | Differential revision: http://reviews.llvm.org/D20607 llvm-svn: 270645
* [Kaleidoscope] Add an initial "Building an ORC JIT" tutorial chapter.Lang Hames2016-05-235-0/+1321
| | | | | | | | | 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. llvm-svn: 270487
* [Kaleidoscope] Fix static global ordering to prevent crash on exit.Lang Hames2016-05-225-5/+5
| | | | | | | If TheModule is declared before LLVMContext then it will be destructed after it, crashing when it tries to deregister itself from the destructed context. llvm-svn: 270381
* Fix some Clang-tidy modernize-use-bool-literals and Include What You Use ↵Eugene Zelenko2016-05-1911-96/+245
| | | | | | | | warnings in examples; other minor fixes. Differential revision: http://reviews.llvm.org/D20397 llvm-svn: 270008
* [Orc] Rename OrcArchitectureSupport to OrcABISupport and add Win32 ABI support.Lang Hames2016-05-071-2/+2
| | | | | | | | This enables lazy JITing on Windows x86-64. Patch by David. Thanks David! llvm-svn: 268845
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-1418-380/+346
| | | | | | | | | | | 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> llvm-svn: 266379
* [Kaleidoscope] Rename Error -> LogError in Chapters 2-5.Lang Hames2016-03-254-64/+64
| | | | | | | 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. llvm-svn: 264427
* [Kaleidoscope] Fix 'Error' name clashes.Lang Hames2016-03-253-87/+87
| | | | llvm-svn: 264426
* [PM] Update Kaleidoscope with the new header file.Chandler Carruth2016-03-114-0/+4
| | | | llvm-svn: 263223
* Refactor duplicated code for linking with pthread.Rafael Espindola2016-03-011-3/+1
| | | | llvm-svn: 262344
* Remove autoconf supportChris Bieneman2016-01-2630-519/+0
| | | | | | | | | | | | | | | | 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 llvm-svn: 258861
* Fix examples corresponding to r257302.NAKAMURA Takumi2016-01-111-1/+1
| | | | llvm-svn: 257313
* [Orc] Fix Kaleidoscope example for change in r254693.Lang Hames2015-12-041-1/+1
| | | | llvm-svn: 254695
* examples: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith2015-11-078-10/+10
| | | | llvm-svn: 252379
* Fix Kaleidoscope example.Peter Collingbourne2015-11-051-1/+2
| | | | llvm-svn: 252222
* [Kaleidoscope][Orc] Fix the fully_lazy Orc Kaleidoscope example.Lang Hames2015-11-031-6/+3
| | | | | | r251933 changed the Orc compile callbacks API, which broke this. llvm-svn: 251942
OpenPOWER on IntegriCloud