summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt3
-rw-r--r--examples/ExceptionDemo/CMakeLists.txt1
-rw-r--r--examples/ExceptionDemo/ExceptionDemo.cpp3
-rw-r--r--examples/Kaleidoscope/Chapter4/toy.cpp3
-rw-r--r--examples/Kaleidoscope/Chapter5/toy.cpp3
-rw-r--r--examples/Kaleidoscope/Chapter6/toy.cpp3
-rw-r--r--examples/Kaleidoscope/Chapter7/CMakeLists.txt1
-rw-r--r--examples/Kaleidoscope/Chapter7/toy.cpp3
-rw-r--r--examples/Makefile3
-rw-r--r--examples/ModuleMaker/README.txt2
-rw-r--r--examples/OCaml-Kaleidoscope/Chapter6/Makefile9
-rw-r--r--examples/OCaml-Kaleidoscope/Chapter7/Makefile9
12 files changed, 37 insertions, 6 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index f60c0ed..54ee6cc 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -8,9 +8,6 @@ if( NOT WIN32 )
add_subdirectory(ExceptionDemo)
endif()
-include(CheckIncludeFile)
-check_include_file(pthread.h HAVE_PTHREAD_H)
-
if( HAVE_PTHREAD_H )
add_subdirectory(ParallelJIT)
endif( HAVE_PTHREAD_H )
diff --git a/examples/ExceptionDemo/CMakeLists.txt b/examples/ExceptionDemo/CMakeLists.txt
index d6619155..88c9ab7 100644
--- a/examples/ExceptionDemo/CMakeLists.txt
+++ b/examples/ExceptionDemo/CMakeLists.txt
@@ -1,4 +1,5 @@
set(LLVM_LINK_COMPONENTS jit nativecodegen)
+set(LLVM_REQUIRES_EH 1)
add_llvm_example(ExceptionDemo
ExceptionDemo.cpp
diff --git a/examples/ExceptionDemo/ExceptionDemo.cpp b/examples/ExceptionDemo/ExceptionDemo.cpp
index e09c990..95ccd24 100644
--- a/examples/ExceptionDemo/ExceptionDemo.cpp
+++ b/examples/ExceptionDemo/ExceptionDemo.cpp
@@ -1974,6 +1974,9 @@ int main(int argc, char* argv[]) {
// Optimizations turned on
#ifdef ADD_OPT_PASSES
+ // Basic AliasAnslysis support for GVN.
+ fpm.add(llvm::createBasicAliasAnalysisPass());
+
// Promote allocas to registers.
fpm.add(llvm::createPromoteMemoryToRegisterPass());
diff --git a/examples/Kaleidoscope/Chapter4/toy.cpp b/examples/Kaleidoscope/Chapter4/toy.cpp
index 327c5c0..a50d2a4 100644
--- a/examples/Kaleidoscope/Chapter4/toy.cpp
+++ b/examples/Kaleidoscope/Chapter4/toy.cpp
@@ -5,6 +5,7 @@
#include "llvm/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
+#include "llvm/Analysis/Passes.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
@@ -584,6 +585,8 @@ int main() {
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ // Provide basic AliasAnalysis support for GVN.
+ OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
OurFPM.add(createInstructionCombiningPass());
// Reassociate expressions.
diff --git a/examples/Kaleidoscope/Chapter5/toy.cpp b/examples/Kaleidoscope/Chapter5/toy.cpp
index c98ee88..26b3db6 100644
--- a/examples/Kaleidoscope/Chapter5/toy.cpp
+++ b/examples/Kaleidoscope/Chapter5/toy.cpp
@@ -5,6 +5,7 @@
#include "llvm/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
+#include "llvm/Analysis/Passes.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
@@ -829,6 +830,8 @@ int main() {
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ // Provide basic AliasAnalysis support for GVN.
+ OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
OurFPM.add(createInstructionCombiningPass());
// Reassociate expressions.
diff --git a/examples/Kaleidoscope/Chapter6/toy.cpp b/examples/Kaleidoscope/Chapter6/toy.cpp
index b7b8738..838125a 100644
--- a/examples/Kaleidoscope/Chapter6/toy.cpp
+++ b/examples/Kaleidoscope/Chapter6/toy.cpp
@@ -5,6 +5,7 @@
#include "llvm/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
+#include "llvm/Analysis/Passes.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
@@ -947,6 +948,8 @@ int main() {
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ // Provide basic AliasAnalysis support for GVN.
+ OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
OurFPM.add(createInstructionCombiningPass());
// Reassociate expressions.
diff --git a/examples/Kaleidoscope/Chapter7/CMakeLists.txt b/examples/Kaleidoscope/Chapter7/CMakeLists.txt
index 9b8227c..da38398 100644
--- a/examples/Kaleidoscope/Chapter7/CMakeLists.txt
+++ b/examples/Kaleidoscope/Chapter7/CMakeLists.txt
@@ -1,4 +1,5 @@
set(LLVM_LINK_COMPONENTS core jit interpreter native)
+set(LLVM_REQUIRES_RTTI 1)
add_llvm_example(Kaleidoscope-Ch7
toy.cpp
diff --git a/examples/Kaleidoscope/Chapter7/toy.cpp b/examples/Kaleidoscope/Chapter7/toy.cpp
index 0cf7869..e63578f 100644
--- a/examples/Kaleidoscope/Chapter7/toy.cpp
+++ b/examples/Kaleidoscope/Chapter7/toy.cpp
@@ -5,6 +5,7 @@
#include "llvm/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
+#include "llvm/Analysis/Passes.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
@@ -1111,6 +1112,8 @@ int main() {
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ // Provide basic AliasAnalysis support for GVN.
+ OurFPM.add(createBasicAliasAnalysisPass());
// Promote allocas to registers.
OurFPM.add(createPromoteMemoryToRegisterPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
diff --git a/examples/Makefile b/examples/Makefile
index bc09b8e..50a6db7 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -10,8 +10,7 @@ LEVEL=..
include $(LEVEL)/Makefile.config
-PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker \
- TracingBrainF
+PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker
ifeq ($(HAVE_PTHREAD),1)
PARALLEL_DIRS += ParallelJIT
diff --git a/examples/ModuleMaker/README.txt b/examples/ModuleMaker/README.txt
index ecbe30e..66a5d3f 100644
--- a/examples/ModuleMaker/README.txt
+++ b/examples/ModuleMaker/README.txt
@@ -4,5 +4,5 @@
This project is an extremely simple example of using some simple pieces of the
LLVM API. The actual executable generated by this project simply emits an
-LLVM bytecode file to standard output. It is designed to show some basic
+LLVM bitcode file to standard output. It is designed to show some basic
usage of LLVM APIs, and how to link to LLVM libraries.
diff --git a/examples/OCaml-Kaleidoscope/Chapter6/Makefile b/examples/OCaml-Kaleidoscope/Chapter6/Makefile
index 8312138..21f0c53 100644
--- a/examples/OCaml-Kaleidoscope/Chapter6/Makefile
+++ b/examples/OCaml-Kaleidoscope/Chapter6/Makefile
@@ -20,6 +20,15 @@ UsedOcamLibs := llvm llvm_analysis llvm_executionengine llvm_target \
OCAMLCFLAGS += -pp camlp4of
+OcamlSources1 = \
+ $(PROJ_SRC_DIR)/ast.ml \
+ $(PROJ_SRC_DIR)/parser.ml \
+ $(PROJ_SRC_DIR)/codegen.ml \
+ $(PROJ_SRC_DIR)/lexer.ml \
+ $(PROJ_SRC_DIR)/token.ml \
+ $(PROJ_SRC_DIR)/toplevel.ml \
+ $(PROJ_SRC_DIR)/toy.ml
+
ExcludeSources = $(PROJ_SRC_DIR)/myocamlbuild.ml
include $(LEVEL)/bindings/ocaml/Makefile.ocaml
diff --git a/examples/OCaml-Kaleidoscope/Chapter7/Makefile b/examples/OCaml-Kaleidoscope/Chapter7/Makefile
index ddf667b..99686e1 100644
--- a/examples/OCaml-Kaleidoscope/Chapter7/Makefile
+++ b/examples/OCaml-Kaleidoscope/Chapter7/Makefile
@@ -20,6 +20,15 @@ UsedOcamLibs := llvm llvm_analysis llvm_executionengine llvm_target \
OCAMLCFLAGS += -pp camlp4of
+OcamlSources1 = \
+ $(PROJ_SRC_DIR)/ast.ml \
+ $(PROJ_SRC_DIR)/parser.ml \
+ $(PROJ_SRC_DIR)/codegen.ml \
+ $(PROJ_SRC_DIR)/lexer.ml \
+ $(PROJ_SRC_DIR)/token.ml \
+ $(PROJ_SRC_DIR)/toplevel.ml \
+ $(PROJ_SRC_DIR)/toy.ml
+
ExcludeSources = $(PROJ_SRC_DIR)/myocamlbuild.ml
include $(LEVEL)/bindings/ocaml/Makefile.ocaml
OpenPOWER on IntegriCloud