diff options
Diffstat (limited to 'llvm/examples/BrainF')
-rw-r--r-- | llvm/examples/BrainF/BrainF.cpp | 20 | ||||
-rw-r--r-- | llvm/examples/BrainF/BrainF.h | 9 | ||||
-rw-r--r-- | llvm/examples/BrainF/BrainFDriver.cpp | 23 |
3 files changed, 40 insertions, 12 deletions
diff --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp index d8c54b50b85..97ecdab0fe9 100644 --- a/llvm/examples/BrainF/BrainF.cpp +++ b/llvm/examples/BrainF/BrainF.cpp @@ -1,11 +1,11 @@ -//===-- BrainF.cpp - BrainF compiler example ----------------------------===// +//===-- BrainF.cpp - BrainF compiler example ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // // This class compiles the BrainF language into LLVM assembly. // @@ -21,13 +21,25 @@ // [ while(*h) { Start loop // ] } End loop // -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// #include "BrainF.h" -#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/APInt.h" +#include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Constant.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/GlobalValue.h" +#include "llvm/IR/GlobalVariable.h" +#include "llvm/IR/InstrTypes.h" +#include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/Type.h" +#include "llvm/Support/Casting.h" +#include <cstdlib> #include <iostream> using namespace llvm; diff --git a/llvm/examples/BrainF/BrainF.h b/llvm/examples/BrainF/BrainF.h index 15e9e084714..587be141b98 100644 --- a/llvm/examples/BrainF/BrainF.h +++ b/llvm/examples/BrainF/BrainF.h @@ -1,16 +1,16 @@ -//===-- BrainF.h - BrainF compiler class ----------------------*- C++ -*-===// +//===-- BrainF.h - BrainF compiler class ------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // // This class stores the data for the BrainF compiler so it doesn't have // to pass all of it around. The main method is parse. // -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// #ifndef BRAINF_H #define BRAINF_H @@ -18,6 +18,7 @@ #include "llvm/IR/IRBuilder.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" +#include <istream> using namespace llvm; @@ -91,4 +92,4 @@ class BrainF { Value *curhead; }; -#endif +#endif // BRAINF_H diff --git a/llvm/examples/BrainF/BrainFDriver.cpp b/llvm/examples/BrainF/BrainFDriver.cpp index b484d758ff0..d19427add87 100644 --- a/llvm/examples/BrainF/BrainFDriver.cpp +++ b/llvm/examples/BrainF/BrainFDriver.cpp @@ -1,11 +1,11 @@ -//===-- BrainFDriver.cpp - BrainF compiler driver -----------------------===// +//===-- BrainFDriver.cpp - BrainF compiler driver -------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // // This program converts the BrainF language into LLVM assembly, // which it can then run using the JIT or output as BitCode. @@ -22,21 +22,37 @@ // // lli prog.bf.bc #Run generated BitCode // -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// #include "BrainF.h" +#include "llvm/ADT/APInt.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/GenericValue.h" +#include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/Instructions.h" +#include "llvm/IR/LLVMContext.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/Value.h" #include "llvm/IR/Verifier.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/TargetSelect.h" #include "llvm/Support/raw_ostream.h" +#include <algorithm> +#include <cstdlib> #include <fstream> #include <iostream> +#include <memory> +#include <string> +#include <system_error> +#include <vector> + using namespace llvm; //Command line options @@ -53,7 +69,6 @@ ArrayBoundsChecking("abc", cl::desc("Enable array bounds checking")); static cl::opt<bool> JIT("jit", cl::desc("Run program Just-In-Time")); - //Add main function so can be fully compiled void addMainFunction(Module *mod) { //define i32 @main(i32 %argc, i8 **%argv) |