This is my own attempt to create a C frontend to match the C++ API of llvm as close as reasonable.
Currently targeting llvm-16
Some notable features include:
-
Any functions taking in a string take a pointer and a length.
-
Match the file structure of LLVM
-
All types and functions begin with
llvm_
-
All all methods are formatted as
llvm_<TypeName>_<methodName>_<possible override specifier>
-
All enum variants start with their name.
ie. This means if an enum is named
llvm_Foo
and has the variantsBar
andBaz
, they will be namedllvm_Foo_Bar
andllvm_Foo_Baz
respectively.
A pre-generated CMakeLists.txt
is included for easy building. Standard cmake steps apply: mkdir build; cd build; cmake ../; make
.
The CmakeLists.txt
is generated by ./rnn.ts setup
. This script can also be used to build the library with ./rnn.ts build
.
This is the script that defines the project, it automatically add the files in the source directories and get the libraries, etc.
To use the rnn.ts
script you need bun installed.
This has yet to be tested on windows. It does work on linux, and should work on macos.
- C++17 compatible compiler
- cmake
- llvm-16
The following will create a folder build
where you will find the static library libllvm_c_2.a
.
mkdir build
cd build
cmake ../
make
You need only to add include
to your include path, and to link llvm_c_2
and llvm-14
.
-I<llvm_c_2>/include/ -L<llvm_c_2>/build -lllvm_c_2 `llvm-config[-14] --libdir --libs`
Not everything is currently exposed. I'm only exposing specific APIs as I need them. Please feel free to contribute to add more.
For a loose list of what is exposed look at the file structure. Of course, not every function/method is exposed for every type.
If you add any files, you need to rerun the configuration script ./rnn.ts set
, refer to Building for more information
The llvm_c_2
is licensed under the MIT license.