LLVM bindings for Node.js/JavaScript/TypeScript

Overview

llvm-bindings

LLVM bindings for Node.js/JavaScript/TypeScript

Supported OS

  • macOS
  • Ubuntu
  • Windows

Supported LLVM methods

listed in the TypeScript definition file.

Install

Install on macOS

# install cmake and llvm by homebrew
brew install cmake llvm

# install llvm-bindings by npm
npm install llvm-bindings

Install on Ubuntu

#install llvm by installation script
wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh

# install cmake by apt-get
sudo apt-get install cmake

# install llvm-bindings by npm
npm install llvm-bindings

Usage

// If you have configured ES module or TypeScript, you can replace the next line with `import llvm from 'llvm-bindings';`
const llvm = require('llvm-bindings');

const context = new llvm.LLVMContext();
const mod = new llvm.Module('demo', context);
const builder = new llvm.IRBuilder(context);

const returnType = builder.getInt32Ty();
const paramTypes = [builder.getInt32Ty(), builder.getInt32Ty()];
const functionType = llvm.FunctionType.get(returnType, paramTypes, false);
const func = llvm.Function.Create(functionType, llvm.Function.LinkageTypes.ExternalLinkage, 'add', mod);

const entryBB = llvm.BasicBlock.Create(context, 'entry', func);
builder.SetInsertionPoint(entryBB);

const a = func.getArg(0);
const b = func.getArg(1);
const result = builder.CreateAdd(a, b);
builder.CreateRet(result);

if (!llvm.verifyFunction(func) && !llvm.verifyModule(mod)) {
    mod.print();
}

You cannot declare a variable or constant named module in top level, because module is a built-in object in Node.js.

Note

Due to the limitation of node-addon-api, this project has not implemented inheritance yet, so calling the method of superclass from subclass object will report an error. Please see #1 for details.

Compatibility

llvm-bindings versions compatible LLVM versions
0.0.x, 0.1.x 11.0.x, 11.1.x
0.2.x 12.0.x

Acknowledgments

llvm-bindings is mostly inspired by llvm-node.

Comments
  • Unable to run on Monterey on M1 MacBook Pro

    Unable to run on Monterey on M1 MacBook Pro

    • OS version: Mac OS 12.0.1 M1 MacBook Pro
    • Node.js version: 17.01
    • LLVM version: 13

    Was able to successfully install the npm module on a brand new M1 MacBook but run into runtime errors when trying to launch:

    Error: dlopen(node_modules/llvm-bindings/build/Release/llvm-bindings.node, 0x0001): symbol not found in flat namespace '_LLVMInitializeAArch64AsmParser

    Expected behavior

    Everything works fine on an Intel Mac. I am assuming that there are some issues with M1 Mac's being Arm?

    bug 
    opened by wintermute-motherbrain 14
  • [Bug] CreateAlloca causes segmentation fault

    [Bug] CreateAlloca causes segmentation fault

    Your environment

    • OS version: MacOS monterey
    • Node.js version: 17.6.0
    • LLVM version: 13

    Describe the bug

    Essentially, if I pass an IRBuilder around a few functions as an argument, (I haven't tested without doing this but I strongly assume that nothing would change if I used it in its original function) CreateAlloca causes a segmentation fault. It used to work and I haven't changed anything about how I use it but it still doesn't work. I have tried manually declaring all of the values so I am sure there is nothing wrong with them. This is how I am using it:

    builder.CreateAlloca(builder.getInt64Ty(), null, name)
    

    All I get is a segmentation fault. I have run SetInsertPoint if you are wondering.

    Expected behavior

    No segmentation fault, a variable to be created

    opened by jso8910 7
  • [Feature] There seems to be no bindings for

    [Feature] There seems to be no bindings for "ConstantArray"

    Which LLVM APIs do you want llvm-bindings to provide There seems to be no bindings for "ConstantArray", which is quite an important datatype since it's needed for most string implementations. Could it be added to the bindings or is there some issue preventing that?

    opened by wavpro 6
  • [Bug]llvm-bindings@0.4.2 postinstall: `cmake-js compile`

    [Bug][email protected] postinstall: `cmake-js compile`

    Your environment

    • OS version: windows10 64
    • Node.js version: v14.17.6.
    • LLVM version: 13.0.1

    Could not find a configuration file for package "LLVM" that is compatible with requested version "14".

    Expected behavior

    A clear and concise description of what you expected to happen.

    opened by bill-mark 5
  • Can't install llvm-bindings on ubuntu 20.04

    Can't install llvm-bindings on ubuntu 20.04

    npm ERR! command failed
    npm ERR! command sh -c cross-env CMAKE_BUILD_PARALLEL_LEVEL=$(node -p 'require(`os`).cpus().length') cmake-js compile
    npm ERR! [
    npm ERR!   '/usr/bin/node',
    npm ERR!   '/root/code/flowge/node_modules/.bin/cmake-js',
    npm ERR!   'compile'
    npm ERR! ]
    npm ERR! info TOOL Using Unix Makefiles generator.
    npm ERR! info CMD CONFIGURE
    npm ERR! info RUN [
    npm ERR! info RUN   'cmake',
    npm ERR! info RUN   '/root/code/flowge/node_modules/llvm-bindings',
    npm ERR! info RUN   '--no-warn-unused-cli',
    npm ERR! info RUN   '-G',
    npm ERR! info RUN   'Unix Makefiles',
    npm ERR! info RUN   '-DCMAKE_JS_VERSION=6.3.0',
    npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
    npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/root/code/flowge/node_modules/llvm-bindings/build/Release',
    npm ERR! info RUN   '-DCMAKE_JS_INC=/root/.cmake-js/node-x64/v17.3.1/include/node',
    npm ERR! info RUN   '-DCMAKE_JS_SRC=',
    npm ERR! info RUN   '-DNODE_RUNTIME=node',
    npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=17.3.1',
    npm ERR! info RUN   '-DNODE_ARCH=x64'
    npm ERR! info RUN ]
    npm ERR! info REP Build has been failed, trying to do a full rebuild.
    npm ERR! info CMD CLEAN
    npm ERR! info RUN [
    npm ERR! info RUN   'cmake',
    npm ERR! info RUN   '-E',
    npm ERR! info RUN   'remove_directory',
    npm ERR! info RUN   '/root/code/flowge/node_modules/llvm-bindings/build'
    npm ERR! info RUN ]
    npm ERR! info CMD CONFIGURE
    npm ERR! info RUN [
    npm ERR! info RUN   'cmake',
    npm ERR! info RUN   '/root/code/flowge/node_modules/llvm-bindings',
    npm ERR! info RUN   '--no-warn-unused-cli',
    npm ERR! info RUN   '-G',
    npm ERR! info RUN   'Unix Makefiles',
    npm ERR! info RUN   '-DCMAKE_JS_VERSION=6.3.0',
    npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
    npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/root/code/flowge/node_modules/llvm-bindings/build/Release',
    npm ERR! info RUN   '-DCMAKE_JS_INC=/root/.cmake-js/node-x64/v17.3.1/include/node',
    npm ERR! info RUN   '-DCMAKE_JS_SRC=',
    npm ERR! info RUN   '-DNODE_RUNTIME=node',
    npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=17.3.1',
    npm ERR! info RUN   '-DNODE_ARCH=x64'
    npm ERR! info RUN ]
    npm ERR! ERR! OMG Process terminated: 1 
    

    I can't install llvm-bindings and this is what I get.. :/

    opened by YiraSan 5
  • postinstall - no member named 'getTypeByName' in 'llvm::Module'

    postinstall - no member named 'getTypeByName' in 'llvm::Module'

    postinstall gives this error:

    src/IR/Module.cpp:101:38: error: no member named 'getTypeByName' in 'llvm::Module'
        llvm::StructType *type = module->getTypeByName(name);
                                 ~~~~~~  ^
    

    Commenting out lines 101-104 at least allows postinstall to complete

    opened by bconnorwhite 5
  • [Bug] Command to install in Windows 10 not working

    [Bug] Command to install in Windows 10 not working

    Your environment

    • OS version: Windows 10
    • Node.js version: N/A
    • LLVM version: 13.0.1

    Describe the bug I ran this command, after doing the first few steps in the wiki:

    cmake -Thost=x64 -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_INCLUDE_TESTS=OFF ..
    CMake Error: The source directory "C:/LLVM" does not appear to contain CMakeLists.txt.
    Specify --help for usage, or press the help button on the CMake GUI.
    

    I think I need to cd to a specific dir first.

    Expected behavior Not CMake error.

    opened by ChocolateLoverRaj 4
  • error: use of undeclared identifier 'napi_object_freeze'

    error: use of undeclared identifier 'napi_object_freeze'

    I noticed a bunch of "use of undeclared identifier" errors after upgrading to v0.2.0 coming from node-addon-api on postinstall (with node v15), downgrading to node v14 fixes the issue

    opened by bconnorwhite 4
  • [Bug] CreateGEP causes segmentation fault

    [Bug] CreateGEP causes segmentation fault

    Your environment

    • OS version: macOS Monterey 12.1
    • Node.js version: 17.1.0
    • LLVM version: 13.0.1

    Describe the bug

    I'm trying to create a getelementptr statement using the bindings, but I get a segmentation fault when I run the program.

    const printConst = builder.CreateGlobalString(
      printArg.text,
      `${VARIABLE_STRING_PREFIX}.${VARIABLE_COUNT_GLOBAL}`,
      0,
      module
    );
    builder.CreateGEP(printConst.getType(), printConst, [
      builder.getInt64(0),
      builder.getInt64(0),
    ]);
    

    Expected behavior

    It should produce a statement similar to this:

    %cast210 = getelementptr [13 x i8],[13 x i8]* @.str, i64 0, i64 0
    
    opened by raphtlw 2
  • Memory intrinsics not working

    Memory intrinsics not working

    It seems that trying to access any of the memory intrinsic functions will cause a seg fault e.g.:

    const memcpy = llvm.Intrinsic.getDeclaration(module, llvm.Intrinsic.memmove)

    The intrinsic function highlighted in the test folder (debugtrap) does work but none of the memory related ones seem to work (memcpy, memcpy_inline, memmove, etc).

    Also, thank you for putting this library together, its great to finally have access to the larger feature set of llvm through node!

    good first issue 
    opened by wintermute-motherbrain 2
  • chore(deps-dev): bump @types/jest from 28.1.8 to 29.2.4

    chore(deps-dev): bump @types/jest from 28.1.8 to 29.2.4

    Bumps @types/jest from 28.1.8 to 29.2.4.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • chore(deps-dev): bump @types/jest from 28.1.8 to 29.2.5

    chore(deps-dev): bump @types/jest from 28.1.8 to 29.2.5

    Bumps @types/jest from 28.1.8 to 29.2.5.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • chore(deps): bump cmake-js from 6.3.2 to 7.1.1

    chore(deps): bump cmake-js from 6.3.2 to 7.1.1

    Bumps cmake-js from 6.3.2 to 7.1.1.

    Release notes

    Sourced from cmake-js's releases.

    v7.0.0

    This is a breaking change and will likely require some small changes to your cmake config to keep your project building.

    Summary

    A lot of work has gone into this release, to try and make the general usage of the library smoother. It has better support for building modules with node-api. The on disk footprint of the library is much smaller than before, with various dependencies removed, or updated.

    Upgrading

    We recommend having the following at the top of your cmake file, before the project(...) definition.

    cmake_minimum_required(VERSION 3.15)
    cmake_policy(SET CMP0091 NEW)
    cmake_policy(SET CMP0042 NEW)
    

    This will force MSVC to do a MT build, so if you were doing that another way, it should be possible to remove that. If you need to keep it building as MD, you can add set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL") in your cmake file.

    If you are using node-api, make sure that your package.json has the following, but with the correct NAPI_VERSION filled in. We use this to autodetect that your module is building with node-api.

    "binary": {
        "napi_versions": [7]
      },
    

    You should also add the following to the bottom of your cmake file. This lets us avoid downloading the full nodejs headers, and lets us use bundle a much more lightweight copy instead

    if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
      # Generate node.lib
      execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
    endif()
    

    If you have something like:

    execute_process(COMMAND node -p "require('node-addon-api').include"
            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
            OUTPUT_VARIABLE NODE_ADDON_API_DIR
            )
    string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
    string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
    target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR})
    

    in your file, it is no longer needed. We will inject the correct include paths for you, similar to what is done for nan.

    That should be everything.
    If we missed something in these steps, or if you are having problems getting your module building again, let us know in an issue.

    All changes:

    • update dependencies
    • replace some dependencies with modern language features

    ... (truncated)

    Changelog

    Sourced from cmake-js's changelog.

    v7.1.1 - 15/12/22

    • fix build errors on windows

    v7.1.0 - 14/12/22

    • add commands for retrieving cmake-js include and lib directories
    • fix win delay hook issues with electron
    • fix missing js_native_api_symbols in windows node.lib

    v7.0.0 - 08/10/22

    • update dependencies
    • replace some dependencies with modern language features
    • follow node-gyp behaviour for visual-studio version detection and selection
    • automatically locate node-addon-api and add to include paths
    • avoid downloads when building for node-api
    • encourage use of MT builds with MSVC, rather than MD

    v6.3.1 - 05/06/22

    • add missing bluebird dependency
    • fix platform detection for visual studio 2019 and newer
    • fix platform detection for macos

    v6.3.0 - 26/11/21

    v6.2.1 - 20/07/21

    • EOL hotfix (Thx Windows!)

    v6.2.0 - 19/07/21

    • various fixes

    v6.1.0 - 27/02/20

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • [Bug] Compilation errors on Linux Mint

    [Bug] Compilation errors on Linux Mint

    Your environment

    • OS version: Linux Mint 20.2 Uma
    • Node.js version: v10.19.0
    • LLVM version: 14.0.6
    • G++ version: g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

    Describe the bug

    Running npm install --save llvm-bindings results in an avalanche of errors, the first of which is:

    In file included from /home/arj/llvm-js/node_modules/node-addon-api/napi.h:3001,
                     from /home/arj/llvm-js/node_modules/llvm-bindings/include/ADT/index.h:3,
                     from /home/arj/llvm-js/node_modules/llvm-bindings/src/ADT/APFloat.cpp:1:
    /home/arj/llvm-js/node_modules/node-addon-api/napi-inl.h: In member function ‘T* Napi::Env::GetInstanceData() const’:
    /home/arj/llvm-js/node_modules/node-addon-api/napi-inl.h:562:24: error: there are no arguments to ‘napi_get_instance_data’ that depend on a template parameter, so a declaration of ‘napi_get_instance_data’ must be available [-fpermissive]
      562 |   napi_status status = napi_get_instance_data(_env, &data);
    

    See the complete output here.

    Expected behavior The library to be installed with no fatal errors.

    opened by arjohansen 0
  • [Bug] unable to find llvm-bindings.node

    [Bug] unable to find llvm-bindings.node

    Your environment

    • OS version: Linux 5.10.102.1-microsoft-standard-WSL2 x86_64 GNU/Linux
    • Node.js version: 12.22.9
    • LLVM version: 14.0.6

    Describe the bug when I try to run my ts project using esbuild, i get the error that it is unable to find the llvm-bindings.node file.

    rishav@Rishav-SB3:~/tyll$ npm run dev
    
    > [email protected] dev
    > esbuild --bundle tyll.ts --format=esm --log-level=warning --platform=node --outfile=dist/compiled.js && node dist/compiled.js
    
    /home/rishav/tyll/dist/compiled.js:145
          throw err;
          ^
    
    Error: Could not locate the bindings file. Tried:
     → /home/rishav/tyll/build/llvm-bindings.node
     → /home/rishav/tyll/build/Debug/llvm-bindings.node
     → /home/rishav/tyll/build/Release/llvm-bindings.node
     → /home/rishav/tyll/out/Debug/llvm-bindings.node
     → /home/rishav/tyll/Debug/llvm-bindings.node
     → /home/rishav/tyll/out/Release/llvm-bindings.node
     → /home/rishav/tyll/Release/llvm-bindings.node
     → /home/rishav/tyll/build/default/llvm-bindings.node
     → /home/rishav/tyll/compiled/12.22.9/linux/x64/llvm-bindings.node
     → /home/rishav/tyll/addon-build/release/install-root/llvm-bindings.node
     → /home/rishav/tyll/addon-build/debug/install-root/llvm-bindings.node
     → /home/rishav/tyll/addon-build/default/install-root/llvm-bindings.node
     → /home/rishav/tyll/lib/binding/node-v72-linux-x64/llvm-bindings.node
        at bindings (/home/rishav/tyll/dist/compiled.js:139:13)
        at node_modules/llvm-bindings/index.js (/home/rishav/tyll/dist/compiled.js:199:40)
        at __require2 (/home/rishav/tyll/dist/compiled.js:15:50)
        at Object.<anonymous> (/home/rishav/tyll/dist/compiled.js:204:36)
        at Module._compile (internal/modules/cjs/loader.js:999:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
        at Module.load (internal/modules/cjs/loader.js:863:32)
        at Function.Module._load (internal/modules/cjs/loader.js:708:14)
        at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
        at internal/main/run_main_module.js:17:47 {
      tries: [
        '/home/rishav/tyll/build/llvm-bindings.node',
        '/home/rishav/tyll/build/Debug/llvm-bindings.node',
        '/home/rishav/tyll/build/Release/llvm-bindings.node',
        '/home/rishav/tyll/out/Debug/llvm-bindings.node',
        '/home/rishav/tyll/Debug/llvm-bindings.node',
        '/home/rishav/tyll/out/Release/llvm-bindings.node',
        '/home/rishav/tyll/Release/llvm-bindings.node',
        '/home/rishav/tyll/build/default/llvm-bindings.node',
        '/home/rishav/tyll/compiled/12.22.9/linux/x64/llvm-bindings.node',
        '/home/rishav/tyll/addon-build/release/install-root/llvm-bindings.node',
        '/home/rishav/tyll/addon-build/debug/install-root/llvm-bindings.node',
        '/home/rishav/tyll/addon-build/default/install-root/llvm-bindings.node',
        '/home/rishav/tyll/lib/binding/node-v72-linux-x64/llvm-bindings.node'
      ]
    }
    

    Expected behavior

    I would expect that the llvm-bindings.node file would be correctly fetched from its location in the npm modules.

    To unblock myself, I have currently copied the file into ./Release/llvm-bindings.node path

    opened by rishavs 0
  • feat: basic code generation

    feat: basic code generation

    feat: basic code generation feat: add packed flag to StructType feat: add CallingConv to Function

    Adds basic code generation (in object and assembly formats) with new PassManagers for optimizations (not all of them was added) and legacy PassManager for code generation.

    Feel free to add any comments and notes about any stuff.

    opened by DairoGrey 2
  • How to create object file

    How to create object file

    Thanks for this awesome library. I've been able to do a lot with this library!

    My issue now is how to generate object file for the operating system. I can't fine anything similar to LLVMTargetMachineEmitToFile, LLVMGetDefaultTargetTriple, LLVMGetTargetFromTriple.

    Kindly help. Thanks in advance.

    enhancement 
    opened by mcfriend99 2
Releases(v0.4.2)
  • v0.4.2(Aug 1, 2022)

  • v0.4.1(Jul 22, 2022)

  • v0.4.0(Jun 27, 2022)

  • v0.3.8(Jun 6, 2022)

  • v0.3.7(Apr 27, 2022)

  • v0.3.6(Mar 16, 2022)

  • v0.3.5(Mar 1, 2022)

  • v0.3.4(Feb 17, 2022)

    Breaking Changes

    • IR: change the signature of Module.print (9a68779)

    Bug Fixes

    • IR: return missing in Module.print (377b1d4)

    Features

    • Config: add LLVM Config Macro (825dc3c)
    • IR: add class GetElementPtrInst (cecd9fc)
    • IR: add class SelectInst (8fa33b6)
    • IR: add class VectorType and more instruction classes (30bcc1c)
    • IR: add duplicated getType for all subclasses of Value (2e2bfe8)
    • IR: add Module.getDataLayoutStr and DataLayout.getStringRepresentation (3cc8563)
    Source code(tar.gz)
    Source code(zip)
  • v0.3.3(Dec 20, 2021)

  • v0.3.2(Dec 18, 2021)

    Bug Fixes

    • IR: the insertBB passed into DIBuilder.insertDeclare may be null (ea0760b)

    Features

    • IR: add DILexicalBlock and DIBuilder.createLexicalBlock (38519e0)
    • IR: add Module.ModFlagBehavior(enum) (2c4f1be)
    • IR: add some classes and methods related to debug information (7531651)
    • IR: supplement more classes and methods related to debug information (4314aaa)
    • IR: supplement some enums related to debug information (c08e087)
    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Nov 9, 2021)

  • v0.3.0(Oct 31, 2021)

  • v0.2.3(Oct 29, 2021)

    Bug Fixes

    • IR: add missing signature of IRBuilder.CreateResume (a1271cb)
    • IR: address transmission of InsertPoint's temporary object (a07a1fe)
    • IR: IRBuilder.SetInsertPoint typo (e2db57d)

    Features

    • IR: add class ConstantExpr (fbe662f)
    • IR: add ConstantExpr.getType (fb751eb)
    • IR: add DataLayout.getTypeAllocSize (18044f0)
    • IR: add Function.hasPersonalityFn, Function.setPersonalityFn and Function.setDoesNotThrow (6238bf6)
    • IR: add Function.insertInto, Function.removeFromParent and Function.eraseFromParent (43fda5c)
    • IR: add Intrinsic (403f747)
    • IR: add InvokeInst and IRBuilder.CreateInvoke (520f7a3)
    • IR: add IRBuilder.CreateInsertValue (6f60ded)
    • IR: add IRBuilder.InsertPoint, IRBuilder.saveIP, IRBuilder.saveAndClearIP and IRBuilder.restoreIP (4303af6)
    • IR: add LandingPadInst, IRBuilder.CreateExtractValue and IRBuilder.CreateLandingPad (2bd479a)
    • IR: add Module.getOrInsertFunction and FunctionCallee (693fdd5)
    • IR: add overloaded form of IRBuilder.CreateCall (1909cb8)
    • IR: add overloaded form of IRBuilder.CreateCall (d150d2c)
    • IR: add overloaded form of IRBuilder.CreateInvoke (815122d)
    • IR: add ResumeInst and IRBuilder.CreateResume (95358ad)
    • IR: add some duplicated methods of Type and Type.isSameType (0d6eabc)
    • IR: add StructType.get (7e27eee)
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(Oct 15, 2021)

    Features

    • IR: add ConstantFP.getType (7c788b4)
    • IR: add ConstantFP.getType (8106c4e)
    • IR: add Function.deleteBody, Function.removeFromParent and Function.eraseFromParent (e7ad3bf)
    • IR: add Function.getNumUses and Function.removeDeadConstantUsers (a770a28)
    • IR: add GlobalVariable.removeFromParent and GlobalVariable.eraseFromParent (b625e09)
    • IR: add IntegerType.isIntegerTy (3effe47)
    • IR: add IRBuilder.CreateUnreachable (9d91aa6)
    • IR: add PointerType.isIntegerTy (75edd4f)
    • IR: add StructType.isIntegerTy (086e647)
    • IR: add SwitchInst (042c942)
    • IR: add UnreachableInst (ec9666a)
    • IR: add Value.user_empty, Function.use_empty and Function.user_empty (34ccfd7)
    • Linker: add Linker (71437ba)
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Sep 29, 2021)

  • v0.2.0(May 24, 2021)

  • v0.1.8(May 24, 2021)

  • v0.1.7(Apr 20, 2021)

  • v0.1.6(Apr 13, 2021)

  • v0.1.5(Mar 30, 2021)

  • v0.1.4(Mar 29, 2021)

  • v0.1.3(Mar 29, 2021)

  • v0.1.2(Mar 28, 2021)

  • v0.1.1(Mar 28, 2021)

  • v0.1.0(Mar 28, 2021)

    Features

    • IR: add class Instruction and supplement several APIs of class BasicBlock (510973f)
    • IR: add IRBuilder.CreateGlobalString and IRBuilder.CreateGlobalStringPtr (02bb15c)
    • IR: add several instruction classes, include AllocaInst, BranchInst, CallInst, LoadInst, ReturnInst and StoreInst (8be97ad)
    • IR: make static 'New' functions of classes with subclasses more precise (b3bbb66)

    Performance Improvements

    • use HandleScope in right places (9f6953d)
    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Mar 27, 2021)

  • v0.0.2(Mar 26, 2021)

    Features

    • add Class Argument
    • add ConstantFP.getNaN
    • add Function.arg_size and Function.getArg
    • delete Class FunctionCallee
    • supplement more APIs of Class IRBuilder
    • add more test cases
    • add type signature for new APIs
    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(Mar 26, 2021)

    This is the first release of llvm-bindings.

    And in this version, llvm-bindings has supported some of high frequency used APIs of LLVM.

    The specific classes and functions supported by the version are as follows:

    • ADT: APInt APFloat
    • Bitcode: writeBitcodeToFile
    • IR: LLVMContext Module Type IntegerType PointerType FunctionType StructType Value User Constant ConstantInt ConstantFP GlobalValue GlobalObject GlobalVariable Function BasicBlock FunctionCallee IRBuilder
    • Support: Target TargetRegistry.lookupTarget initializeAllTargetInfos initializeAllTargets initializeAllTargetMCs initializeAllAsmParsers initializeAllAsmPrinters
    • Target: TargetMachine
    Source code(tar.gz)
    Source code(zip)
Owner
ApsarasX
Web前端熟练工/编译器爱好者/安全刚入门 正在研究TypeScript的静态分析/代码审计 涉猎JavaScript/TypeScript/C++/LLVM WeChat: ApsarasX
ApsarasX
Convert Javascript/TypeScript to C

Convert Javascript/TypeScript to C

Andrei Markeev 1.1k Jan 4, 2023
StarkScript - or the Stark programming language - is a compiled C-based programming language that aims to offer the same usability as that of JavaScript's and TypeScript's

StarkScript StarkScript - or the Stark programming language - is a compiled C-based programming language that aims to offer the same usability as that

EnderCommunity 5 May 10, 2022
This repository uses a ROS node to subscribe to camera (hikvision) and lidar (livox) data. After the node merges the data, it publishes the colored point cloud and displays it in rviz.

fusion-lidar-camera-ROS 一、介绍 本仓库是一个ROS工作空间,其中ws_fusion_camera/src有一个工具包color_pc ws_fusion_camera │ README.md │ └───src │ └───package: c

hongyu wang 23 Dec 7, 2022
Android Bindings for QuickJS, A fine little javascript engine.

quickjs-android quickjs-android 是 QuickJS JavaScript 引擎的 Android 接口框架,整体基于面向对象设计,提供了自动GC功能,使用简单。armeabi-v7a 的大小仅 350KB,是 Google V8 不错的替代品,启动速度比 V8 快,内

Wiki 121 Dec 28, 2022
Node.js bindings for the Mathematical Expression Toolkit

ExprTk.js This is the Node.js bindings for ExprTk (Github) by @ArashPartow ExprTk.js supports both synchronous and asynchronous background execution o

Momtchil Momtchev 8 Dec 12, 2022
A demo app using: Svelte, Typescript, Vite, and Emscripten

Svelte + TS + Vite + Emscripten This template should help get you started developing with Svelte, TypeScript, and Emscripten in Vite. This template wa

Wolf McNally 3 Nov 15, 2021
Collection of C++ containers extracted from LLVM

lvc lvc is a set of C++ containers extracted form LLVM for an easier integration in external projects. To avoid any potential conflit, the llvm namesp

Benjamin Navarro 26 Apr 22, 2022
Toy LLVM obfuscator pass

ToyObfuscator Some simple obfuscator ;) (base on llvm-10) Compile Build out-tree pass git clone https://github.com/veritas501/ToyObfuscator.git cd Toy

veritas501 51 Nov 6, 2022
VM devirtualization PoC based on AsmJit and llvm

vm_jit PoC vm devirtualization based on AsmJit. The binary was taken from YauzaCTF 2021 competition. You are welcome to try to solve it yourself, the

Pavel 58 Aug 8, 2022
Convert LLVM coverage information into HTML reports

llvm-coverage-to-html converter The clang compiler supports source based coverage tracking, but the default reporting options are very basic. This too

Thomas Neumann 2 Oct 11, 2021
A simple Jasper interpreter made with Flex, Bison and the LLVM IR

JasperCompiler A simple Jasper interpreter (for now) made with Flex and Bison. Jasper? Jasper is "a scripting language inspired by Haskell, Javascript

Emmanuel 2 Jan 16, 2022
Tobsterlang is a simple imperative programming language, written in C++ with LLVM.

tobsterlang Tobsterlang is a simple imperative programming language, written in C++ with LLVM. One of its distinct features is the fact it uses XML in

TOBSTERA 8 Nov 11, 2021
Writing a basic compiler frontend following LLVM's tutorial, with complete added supports Hindi and UTF-8 in general

सारस | SARAS Started with following LLVM's tutorial In development, a hobby project only JIT is broken right now, 'jit' branch par code hai uska Compi

Aditya Gupta 4 May 1, 2022
repo to house various LLVM based SIHFT passes for RISCV 32/64 soft error resilience

compas-ft-riscv COMPAS: Compiler-assisted Software-implemented Hardware Fault Tolerance implemented in LLVM passes for the RISC-V backend Repo to hous

EDA@TUM 2 Jan 10, 2022
pluggable tool to convert an unrolled TritonAST to LLVM-IR, optimize it and get back to TritonAST

it is fork from https://github.com/fvrmatteo/TritonASTLLVMIRTranslator *WARNINGS: tested only linux(ubuntu 20.04) and only llvm and clang version 10*

pr4gasm 5 Jun 10, 2022
Per function, Lua JIT using LLVM C++ toolchain

Lua Low Level Brief This is an alternative Lua (5.3.2) implementation that aims to archive better performance by generating native code with the help

Gabriel de Quadros Ligneul 10 Sep 4, 2021
LLVM IR and optimizer for shaders, including front-end adapters for GLSL and SPIR-V and back-end adapter for GLSL

Licensing LunarGLASS is available via a three clause BSD-style open source license. Goals The primary goals of the LunarGLASS project are: Reduce the

LunarG, Inc. 153 Dec 8, 2022
Elk is a tiny embeddable JavaScript engine that implements a small but usable subset of ES6

Elk is a tiny embeddable JavaScript engine that implements a small but usable subset of ES6. It is designed for microcontroller development. Instead of writing firmware code in C/C++, Elk allows to develop in JavaScript. Another use case is providing customers with a secure, protected scripting environment for product customisation.

Cesanta Software 1.5k Jan 8, 2023
JavaScript runtime for Fastly Compute@Edge

Fastly Compute@Edge JS Runtime The JS Compute Runtime for Fastly's Compute@Edge platform provides the environment JavaScript is executed in when using

Fastly 122 Dec 20, 2022