No description, website, or topics provided.
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
INPUTS Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and on… Sep 27, 2012
bindings [] Add Cursor.get_arguments() Nov 1, 2012
docs Added Documentation and ASan notes, clean-up of emtpy sections, coupl… Dec 20, 2012
examples analyzer-plugin/MainCallChecker.cpp: Fixup corresponding to r167275. Nov 2, 2012
include Add spir12 Ignore optimization level provided by user (#35) Apr 26, 2016
lib [OpenCL] Fix access qualifiers metadata for kernel arguments with typ… Jul 31, 2017
runtime Pass LLVM_ANDROID_TOOLCHAIN_DIR if set. Oct 24, 2012
test [OpenCL] Fix access qualifiers metadata for kernel arguments with typ… Jul 31, 2017
tools Merge SPIR generator changes Nov 28, 2013
unittests Fix binding of nodes in case of forEach..() matchers. Nov 11, 2012
utils Remove leftover code. Nov 9, 2012
www [analyzer] Check that the argument to CFMakeCollectable is non-NULL. Nov 7, 2012
.gitignore Add extra vim swap file pattern Oct 9, 2012
CMakeLists.txt CMake: Fix public header search for generating Xcode/MSVC projects. Oct 23, 2012 Create Oct 10, 2018
INSTALL.txt Add minimal INSTALL.txt Sep 13, 2009
LICENSE.TXT Happy new year 2012! Jan 1, 2012
Makefile The top-level clang Makefile is #included into other Makefiles. (sigh… Oct 3, 2012
ModuleInfo.txt Move the ModuleInfo.txt file. Jul 11, 2007
NOTES.txt Fix typo (test commit) Oct 18, 2012 Add spir12 Ignore optimization level provided by user (#35) Apr 26, 2016
README.txt commit access verified, revert change Mar 6, 2012

SPIR generator/Clang Installation Instructions

These instructions describe how to build, install and operate SPIR generator Clang.

Step 1: Organization

SPIR generator/Clang is designed to be built as part of an LLVM build.

SPIR generator/Clang is based on LLVM/Clang version 3.2.

The LLVM source code could be downloaded from

It is also available directly from the LLVM svn server:

  svn co llvm

Or could be cloned from LLVM git repository:

  git clone llvm
  cd llvm
  git checkout --track -b release_32 remotes/origin/release_32

Assuming that the LLVM source code is located at $LLVM_SRC_ROOT, then the clang source code should be installed as: $LLVM_SRC_ROOT/tools/clang.

The directory is not required to be called clang, but doing so will allow the LLVM build system to automatically recognize it and build it along with LLVM.

  cd $LLVM_SRC_ROOT/tools
  git clone clang
  cd clang
  git checkout --track -b spir_12 remotes/origin/spir_12

Step 2: Configure and Build LLVM

Configure and build your copy of LLVM (see $LLVM_SRC_ROOT/GettingStarted.html for more information).

Assuming you installed clang at $LLVM_SRC_ROOT/tools/clang then Clang will automatically be built with LLVM. Otherwise, run make in the Clang source directory to build Clang.

  • Note: currently there might be failures in check_clang project.

Step 3: (Optional) Verify Your Build

It is a good idea to run the Clang tests to make sure your build works correctly. From inside the Clang build directory, run make test to run the tests.

Step 4: Install Clang

If you wish to run Clang from the generated binary directory, you may skip this section.

From inside the Clang build directory, run make install to install the Clang compiler and header files into the prefix directory selected when LLVM was configured.

The Clang compiler is available as clang and clang++. It supports a gcc like command line interface. See the man page for clang (installed into $prefix/share/man/man1) for more information.

Step 5: Creating SPIR binaries

To create a SPIR binary from a valid OpenCL-C file (.cl), use the following command lines:

  clang -cc1 -emit-llvm-bc -triple <triple> <OpenCL compile options> -cl-spir-compile-options "<OpenCL compile options>" -include <opencl_spir.h> -o <output> <input>
  • <triple>: for 32 bit SPIR use spir-unknown-unknown, for 64 bit SPIR use spir64-unknown-unknown.
  • Note: <OpenCL compile options> appears twice. The command line option -cl-spir-compile-options "<OpenCL compile options>" specifies the compile options that occur in the SPIR metadata.
  • <opencl_spir.h>: download opencl_spir.h from
  • -O: -O0 (default) is the only tested option value at the moment. It's assumed by design that all optimizations are executed by SPIR consumer.

Reporting issues

Bugs/feature requests can be filed via github or Khronos Bugzilla bug tracker.