summaryrefslogtreecommitdiff
path: root/examples/Kaleidoscope
AgeCommit message (Collapse)Author
2016-05-30[Kaleidoscope][BuildingAJIT] Don't build Chapter 5 on Windows for now.Lang Hames
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[Kaleidoscope][BuildingAJIT] Add code for Chapter 5 - remote JITing.Lang Hames
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-27[Kaleidoscope][Orc] Remove the reference to the Orc directory that was removedLang Hames
in r271059. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271061 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27[Kaleidoscope] Remove the old Kaleidoscope/ORC tutorial series.Lang Hames
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[Kaleidoscope][BuildingAJIT] Add code for chapter 4.Lang Hames
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-26[Kaleidoscope][BuildingAJIT] Remove leftover debugging output statements.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26[Kaleidoscope][BuildingAJIT] Add explicit dependence on TransformUtils to ↵Lang Hames
Chapter3. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270914 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26[Kaleidoscope][BuildingAJIT] Add code for Chapter 3.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26[Kaleidoscope][BuildingAJIT] Fix a bug in the symbol resolver in Chapter2.Lang Hames
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[Kaleidoscope][BuildingAJIT] Make the optimizeModule method for Chapter2Lang Hames
private. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270807 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25[Kaleidoscope][BuildingAJIT] Add code for the 2nd chapter of the BuildingAJITLang Hames
tutorial. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25[Kaleidoscope][BuildingAJIT] Delete trailing whitespace.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270787 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25[Kaleidoscope][BuildingAJIT] Add a description of the KaleidoscopeJIT addModuleLang Hames
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-25Fix some Include What You Use warnings in examples; other minor fixes.Eugene Zelenko
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-23[Kaleidoscope] Add an initial "Building an ORC JIT" tutorial chapter.Lang Hames
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-22[Kaleidoscope] Fix static global ordering to prevent crash on exit.Lang Hames
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-19Fix some Clang-tidy modernize-use-bool-literals and Include What You Use ↵Eugene Zelenko
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-07[Orc] Rename OrcArchitectureSupport to OrcABISupport and add Win32 ABI support.Lang Hames
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-04-14Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini
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-03-25[Kaleidoscope] Rename Error -> LogError in Chapters 2-5.Lang Hames
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[Kaleidoscope] Fix 'Error' name clashes.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11[PM] Update Kaleidoscope with the new header file.Chandler Carruth
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263223 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26Remove autoconf supportChris Bieneman
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-11Fix examples corresponding to r257302.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257313 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04[Orc] Fix Kaleidoscope example for change in r254693.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254695 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-07examples: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252379 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05Fix Kaleidoscope example.Peter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252222 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03[Kaleidoscope][Orc] Fix the fully_lazy Orc Kaleidoscope example.Lang Hames
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-03Kaleidoscope-ch2: Remove the dependence on LLVM by cloning make_unique into ↵David Blaikie
this project git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251936 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15Update for llvm API change.Eric Christopher
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250375 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08Make the Kaleidoscope Orc examples -Wdeprecated clean by avoiding copying ↵David Blaikie
some AST nodes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29Fix Clang-tidy modernize-use-nullptr warnings in examples and include ↵Hans Wennborg
directories; other minor cleanups. Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13172 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248811 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-18Remove trailing whitespace from the old Orc Kaleidoscope examples.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247971 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-09[PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatibleChandler Carruth
with the new pass manager, and no longer relying on analysis groups. This builds essentially a ground-up new AA infrastructure stack for LLVM. The core ideas are the same that are used throughout the new pass manager: type erased polymorphism and direct composition. The design is as follows: - FunctionAAResults is a type-erasing alias analysis results aggregation interface to walk a single query across a range of results from different alias analyses. Currently this is function-specific as we always assume that aliasing queries are *within* a function. - AAResultBase is a CRTP utility providing stub implementations of various parts of the alias analysis result concept, notably in several cases in terms of other more general parts of the interface. This can be used to implement only a narrow part of the interface rather than the entire interface. This isn't really ideal, this logic should be hoisted into FunctionAAResults as currently it will cause a significant amount of redundant work, but it faithfully models the behavior of the prior infrastructure. - All the alias analysis passes are ported to be wrapper passes for the legacy PM and new-style analysis passes for the new PM with a shared result object. In some cases (most notably CFL), this is an extremely naive approach that we should revisit when we can specialize for the new pass manager. - BasicAA has been restructured to reflect that it is much more fundamentally a function analysis because it uses dominator trees and loop info that need to be constructed for each function. All of the references to getting alias analysis results have been updated to use the new aggregation interface. All the preservation and other pass management code has been updated accordingly. The way the FunctionAAResultsWrapperPass works is to detect the available alias analyses when run, and add them to the results object. This means that we should be able to continue to respect when various passes are added to the pipeline, for example adding CFL or adding TBAA passes should just cause their results to be available and to get folded into this. The exception to this rule is BasicAA which really needs to be a function pass due to using dominator trees and loop info. As a consequence, the FunctionAAResultsWrapperPass directly depends on BasicAA and always includes it in the aggregation. This has significant implications for preserving analyses. Generally, most passes shouldn't bother preserving FunctionAAResultsWrapperPass because rebuilding the results just updates the set of known AA passes. The exception to this rule are LoopPass instances which need to preserve all the function analyses that the loop pass manager will end up needing. This means preserving both BasicAAWrapperPass and the aggregating FunctionAAResultsWrapperPass. Now, when preserving an alias analysis, you do so by directly preserving that analysis. This is only necessary for non-immutable-pass-provided alias analyses though, and there are only three of interest: BasicAA, GlobalsAA (formerly GlobalsModRef), and SCEVAA. Usually BasicAA is preserved when needed because it (like DominatorTree and LoopInfo) is marked as a CFG-only pass. I've expanded GlobalsAA into the preserved set everywhere we previously were preserving all of AliasAnalysis, and I've added SCEVAA in the intersection of that with where we preserve SCEV itself. One significant challenge to all of this is that the CGSCC passes were actually using the alias analysis implementations by taking advantage of a pretty amazing set of loop holes in the old pass manager's analysis management code which allowed analysis groups to slide through in many cases. Moving away from analysis groups makes this problem much more obvious. To fix it, I've leveraged the flexibility the design of the new PM components provides to just directly construct the relevant alias analyses for the relevant functions in the IPO passes that need them. This is a bit hacky, but should go away with the new pass manager, and is already in many ways cleaner than the prior state. Another significant challenge is that various facilities of the old alias analysis infrastructure just don't fit any more. The most significant of these is the alias analysis 'counter' pass. That pass relied on the ability to snoop on AA queries at different points in the analysis group chain. Instead, I'm planning to build printing functionality directly into the aggregation layer. I've not included that in this patch merely to keep it smaller. Note that all of this needs a nearly complete rewrite of the AA documentation. I'm planning to do that, but I'd like to make sure the new design settles, and to flesh out a bit more of what it looks like in the new pass manager first. Differential Revision: http://reviews.llvm.org/D12080 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247167 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28Kaleidoscope: Prune __attribute__((used)). Some compilers wouldn't accept one.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246268 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27Recommit r246175 - Add Kaleidoscope regression tests, with a fix to make sureLang Hames
the kaleidoscope 'library' functions aren't dead-stripped in release builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246201 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27Revert r246175 to get builder green again.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246185 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27Add Kaleidoscope regression tests.Lang Hames
These will be run if LLVM_BUILD_EXAMPLES is enabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246175 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27Kaleidoscope: Prune unused libdeps.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246126 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26Kaleidoscope: Update libdeps corresponding to r246002.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246025 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26Big Kaleidoscope tutorial update.Lang Hames
This commit switches the underlying JIT for the Kaleidoscope tutorials from MCJIT to a custom ORC-based JIT, KaleidoscopeJIT. This fixes a lot of the bugs in Kaleidoscope that were introduced when we deleted the legacy JIT. The documentation for Chapter 4, which introduces the JIT APIs, is updated to reflect the change. Also included are a number of C++11 modernizations and general cleanup. Where appropriate, the docs have been updated to reflect these changes too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246002 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19[CMake] Kaleidoscope-Ch2: Don't pass -Wno-unused-private-field unconditionally.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245516 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19[Kaleidoscope] More inter-chapter diff reduction.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245474 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19[Kaleidoscope] Clang-format the Kaleidoscope tutorials.Lang Hames
Also reduces changes between tutorial chapters. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18[Kaleidoscope] Start C++11'ifying the kaleidoscope tutorials.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245322 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06[PM/AA] Hoist the interface for BasicAA into a header file.Chandler Carruth
This is the first mechanical step in preparation for making this and all the other alias analysis passes available to the new pass manager. I'm factoring out all the totally boring changes I can so I'm moving code around here with no other changes. I've even minimized the formatting churn. I'll reformat and freshen comments on the interface now that its located in the right place so that the substantive changes don't triger this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244197 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31DI: Rewrite the DIBuilder local variable APIDuncan P. N. Exon Smith
Replace the general `createLocalVariable()` with two more specific functions: `createParameterVariable()` and `createAutoVariable()`, and rewrite the documentation. Besides cleaning up the API, this avoids exposing the fake DWARF tags `DW_TAG_arg_variable` and `DW_TAG_auto_variable` to frontends, and is preparation for removing them completely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243764 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24DI/Verifier: Fix argument bitrot in DILocalVariableDuncan P. N. Exon Smith
Add a verifier check that `DILocalVariable`s of tag `DW_TAG_arg_variable` always have a non-zero 'arg:' field, and those of tag `DW_TAG_auto_variable` always have a zero 'arg:' field. These are the only configurations that are properly understood by the backend. (Also, fix the bad examples in LangRef and test/Assembler, and fix the bug in Kaleidoscope Ch8.) A large number of testcases seem to have bitrotted their way forward from some ancient version of the debug info hierarchy that didn't have `arg:` parameters. If you have out-of-tree testcases that start failing in the verifier and you don't care enough to get the `arg:` right, you may have some luck just calling: sed -e 's/, arg: 0/, arg: 1/' or some such, but I hand-updated the ones in tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243183 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24Remove access to the DataLayout in the TargetMachineMehdi Amini
Summary: Replace getDataLayout() with a createDataLayout() method to make explicit that it is intended to create a DataLayout only and not accessing it for other purpose. This change is the last of a series of commits dedicated to have a single DataLayout during compilation by using always the one owned by the module. Reviewers: echristo Subscribers: jholewinski, llvm-commits, rafael, yaron.keren Differential Revision: http://reviews.llvm.org/D11103 (cherry picked from commit 5609fc56bca971e5a7efeaa6ca4676638eaec5ea) From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243114 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24Revert "Remove access to the DataLayout in the TargetMachine"Mehdi Amini
This reverts commit 0f720d984f419c747709462f7476dff962c0bc41. It breaks clang too badly, I need to prepare a proper patch for clang first. From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243089 91177308-0d34-0410-b5e6-96231b3b80d8