Home

Awesome

Deprecated Repo

Please don't use this repo directly as it has been integrated into slang. Please make changes there instead.

Slang LLVM/Clang Library

The purpose of this project is to use the LLVM/Clang infrastructure to provide features for the Slang language compiler.

These features may include

Currently only executing code via 'host-callable' mechanism is supported.

Building

Once this repo has been cloned, it is neccessary to get the dependencies needed via

% git submodule update --init

Requirements

Ubuntu zlib may need to be installed...

sudo apt-get install zlib1g-dev

If zlib isn't available -lz on the link command line will fail.

Premake

Slang-llvm uses the tool premake5 in order to generate projects that can be built on different targets. On Linux premake will generate Makefile/s and on windows it will generate a Visual Studio solution. Information on invoking premake for different kinds of targets can be found here.

Slang's LLVM binaries are NOT a submodule. They can be accessed via the 'slang-pack' package manager mechanism. This requires setting --deps=true on the premake command line. Doing so will download the LLVM binaries specified in deps/target-deps.json.

premake vs2019 --deps=true

By default this assumes building for x86_64. If some other target is required it can be set via the --arch option. NOTE! This might seem unrequired by Visual Studio as it is possible to vary the 'platform' in the IDE. In this case though arch must be set to the desired platform, as any binaries (such as LLVM!) will only be available for the value specified in --arch. For example to build for x86

premake vs2019 --deps=true --arch=x86

The project currently builds three things

How to use

If the slang-llvm shared library/dll is placed in the same directory as the slang binaries, Slang will automatically use LLVM JIT for host-callable compilations.

Limitiations

Building LLVM/Clang

The Slang LLVM repo contains github actions to build LLVM into suitable libraries for linux and windows. The most up to date information will therefore be in the .github\workflows directory. These builds currently do not contain LLVM library that can target all binary targets, but just x64/x86/ARM/ARM64. They also only contain the headers and static c runtime libraries.

Due to the size of debug builds, it is not possible to build LLVM debug via github actions.