aboutsummaryrefslogtreecommitdiff
path: root/llvm/examples
AgeCommit message (Collapse)AuthorFilesLines
2016-09-11[ORC] Update examples for header changes in r281171.Lang Hames1-2/+2
llvm-svn: 281178
2016-08-26Fix singlton -> singleton typo.Eric Christopher5-5/+5
llvm-svn: 279801
2016-08-17Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner1-2/+2
Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
2016-08-11Use the range variant of find instead of unpacking begin/endDavid Majnemer1-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
2016-08-01[ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.Lang Hames6-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
2016-07-15[Kaleidoscope][BuildingAJIT] Start filling in text for chapter 3.Lang Hames3-14/+17
llvm-svn: 275518
2016-07-02New Kaleidoscope chapter: Creating object filesWilfred Hughes4-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
2016-06-11[MCJIT] Update MCJIT and get the fibonacci example working again.Lang Hames2-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
2016-05-31[Orc] Add conversion to/from RuntimeDyld::SymbolInfo for JITSymbol.Lang Hames6-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
2016-05-30[Kaleidoscope][BuildingAJIT] Don't build Chapter 5 on Windows for now.Lang Hames1-1/+3
The TCP setup code is currently *nix based and does not build on Windows. llvm-svn: 271194
2016-05-30[Kaleidoscope][BuildingAJIT] Add code for Chapter 5 - remote JITing.Lang Hames7-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
2016-05-27[Kaleidoscope][Orc] Remove the reference to the Orc directory that was removedLang Hames1-1/+0
in r271059. llvm-svn: 271061
2016-05-27[Kaleidoscope] Remove the old Kaleidoscope/ORC tutorial series.Lang Hames13-5684/+0
This code has been superseded by the new Building A JIT series. llvm-svn: 271059
2016-05-27[Kaleidoscope][BuildingAJIT] Add code for chapter 4.Lang Hames4-0/+1479
This chapter will cover lazy compilation directly from ASTs using the Compile Callbacks and Indirect Stubs APIs. llvm-svn: 271054
2016-05-26[Kaleidoscope][BuildingAJIT] Remove leftover debugging output statements.Lang Hames1-4/+0
llvm-svn: 270919
2016-05-26[Kaleidoscope][BuildingAJIT] Add explicit dependence on TransformUtils to ↵Lang Hames1-0/+1
Chapter3. llvm-svn: 270914
2016-05-26[Kaleidoscope][BuildingAJIT] Add code for Chapter 3.Lang Hames4-0/+1385
llvm-svn: 270909
2016-05-26[Kaleidoscope][BuildingAJIT] Fix a bug in the symbol resolver in Chapter2.Lang Hames1-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
2016-05-26[Kaleidoscope][BuildingAJIT] Make the optimizeModule method for Chapter2Lang Hames1-0/+2
private. llvm-svn: 270807
2016-05-25[Kaleidoscope][BuildingAJIT] Add code for the 2nd chapter of the BuildingAJITLang Hames4-0/+1369
tutorial. llvm-svn: 270794
2016-05-25[Kaleidoscope][BuildingAJIT] Delete trailing whitespace.Lang Hames1-1/+1
llvm-svn: 270787
2016-05-25[Kaleidoscope][BuildingAJIT] Add a description of the KaleidoscopeJIT addModuleLang Hames1-4/+15
method to Chapter1 of the BuildingAJIT tutorial. llvm-svn: 270778
2016-05-25Fix some Include What You Use warnings in examples; other minor fixes.Eugene Zelenko9-25/+114
Differential revision: http://reviews.llvm.org/D20607 llvm-svn: 270645
2016-05-23[Kaleidoscope] Add an initial "Building an ORC JIT" tutorial chapter.Lang Hames5-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
2016-05-22[Kaleidoscope] Fix static global ordering to prevent crash on exit.Lang Hames5-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
2016-05-19Fix some Clang-tidy modernize-use-bool-literals and Include What You Use ↵Eugene Zelenko11-96/+245
warnings in examples; other minor fixes. Differential revision: http://reviews.llvm.org/D20397 llvm-svn: 270008
2016-05-07[Orc] Rename OrcArchitectureSupport to OrcABISupport and add Win32 ABI support.Lang Hames1-2/+2
This enables lazy JITing on Windows x86-64. Patch by David. Thanks David! llvm-svn: 268845
2016-04-14Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini18-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
2016-03-25[Kaleidoscope] Rename Error -> LogError in Chapters 2-5.Lang Hames4-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
2016-03-25[Kaleidoscope] Fix 'Error' name clashes.Lang Hames3-87/+87
llvm-svn: 264426
2016-03-11[PM] Update Kaleidoscope with the new header file.Chandler Carruth4-0/+4
llvm-svn: 263223
2016-03-01Refactor duplicated code for linking with pthread.Rafael Espindola1-3/+1
llvm-svn: 262344
2016-01-26Remove autoconf supportChris Bieneman30-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
2016-01-11Fix examples corresponding to r257302.NAKAMURA Takumi1-1/+1
llvm-svn: 257313
2015-12-04[Orc] Fix Kaleidoscope example for change in r254693.Lang Hames1-1/+1
llvm-svn: 254695
2015-11-07examples: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith8-10/+10
llvm-svn: 252379
2015-11-05Fix Kaleidoscope example.Peter Collingbourne1-1/+2
llvm-svn: 252222
2015-11-03[Kaleidoscope][Orc] Fix the fully_lazy Orc Kaleidoscope example.Lang Hames1-6/+3
r251933 changed the Orc compile callbacks API, which broke this. llvm-svn: 251942
2015-11-03Kaleidoscope-ch2: Remove the dependence on LLVM by cloning make_unique into ↵David Blaikie1-11/+23
this project llvm-svn: 251936
2015-10-17[JIT/Examples] Fix Fibonacci so that it runs again.Davide Italiano1-1/+0
The old JIT is (long) gone. llvm-svn: 250604
2015-10-15Update for llvm API change.Eric Christopher1-2/+1
llvm-svn: 250375
2015-10-08Make the Kaleidoscope Orc examples -Wdeprecated clean by avoiding copying ↵David Blaikie4-4/+4
some AST nodes llvm-svn: 249703
2015-09-29Fix Clang-tidy modernize-use-nullptr warnings in examples and include ↵Hans Wennborg15-54/+49
directories; other minor cleanups. Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13172 llvm-svn: 248811
2015-09-18Fix typo and test commitLuke Larson1-1/+1
llvm-svn: 248042
2015-09-18Remove trailing whitespace from the old Orc Kaleidoscope examples.Lang Hames4-448/+444
llvm-svn: 247971
2015-09-09[PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatibleChandler Carruth4-12/+0
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 llvm-svn: 247167
2015-08-28Kaleidoscope: Prune __attribute__((used)). Some compilers wouldn't accept one.NAKAMURA Takumi5-10/+10
llvm-svn: 246268
2015-08-27Recommit r246175 - Add Kaleidoscope regression tests, with a fix to make sureLang Hames10-20/+30
the kaleidoscope 'library' functions aren't dead-stripped in release builds. llvm-svn: 246201
2015-08-27Revert r246175 to get builder green again.Lang Hames10-20/+10
llvm-svn: 246185
2015-08-27Add Kaleidoscope regression tests.Lang Hames10-10/+20
These will be run if LLVM_BUILD_EXAMPLES is enabled. llvm-svn: 246175