From: Benjamin Segovia Date: Tue, 12 Jun 2012 21:50:06 +0000 (+0000) Subject: Fixed a exception safety issue in the LLVM to GenIR translation Added a markdown... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2ea0ee21e2a2790a413c614bdf7a154c5886842;p=contrib%2Fbeignet.git Fixed a exception safety issue in the LLVM to GenIR translation Added a markdown readme file --- diff --git a/backend/README b/backend/README new file mode 100644 index 0000000..9483d7e --- /dev/null +++ b/backend/README @@ -0,0 +1,64 @@ +OpenCL Compiler +=============== + +This code base contains the compiler part of the complete OpenCL stack. The +run-time is not in this code base and is developed inside "OpenCL runtime" +project. The compiler is responsible to take a OpenCL language string and to +compile it into a binary that can be executed on Intel integrated GPUs. + +How to build +------------ + +The project uses CMake with three profiles: + + 1. Debug (-g) + 2. RelWithDebInfo (-g with optimizations) + 3. Release (only optimizations) +Basically, from the root directory of the project + +`> mkdir build` + +`> ccmake ../ # to configure` + +Choose whatever you want for the build + +Then press 'c' to configure and 'g' to generate the code + +`> make` + +The project only depends on LLVM (Low-Level Virtual Machine project). Right +now, the code has only been compiled with LLVM 3.0. It will not compile with +any thing older. A small amount of work should be required to make it work +with LLVM 3.1 but the port is not done. LLVM 3.0 can be downloaded at: + +[http://llvm.org/releases/](http://llvm.org/releases/) + +Be careful and download LLVM *3.0* + +How to run +---------- + +There is nothing to do to run it. However, unit tests can be compiled (by +setting GBE_COMPILE_UTESTS to true). Once compiled, you can simply run + +`> ./tester # to run the unit tests` + +Limitations +----------- + +Today, the compiler is far from complete. See doc/TODO.md for a (incomplete) +lists of things to do. + +Implementation details +---------------------- + +Several key decisions may use the hardware in an usual way. See the following +documents for the technical details about the compiler implementation: + +- [Flat address space](doc/flat\_address\_space) +- [Unstructured branches](doc/unstructured\_branches) +- [Scalar intermediate representation](doc/gen\_ir) +- [Clean backend implementation](doc/backend) + +Ben Segovia + diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp index a41f4a5..22c3317 100644 --- a/backend/src/llvm/llvm_to_gen.cpp +++ b/backend/src/llvm/llvm_to_gen.cpp @@ -83,8 +83,7 @@ namespace gbe // raw_fd_ostream closes stdout. We must reopen it o = NULL; - int fd; - fd = open("/dev/tty", O_WRONLY); + const int fd = open("/dev/tty", O_WRONLY); stdout = fdopen(fd, "w"); return true;