Closed metacritical closed 2 years ago
Hy @metacritical
Thanks for reaching out. I have no immediate plans to add new features to llvm-node but are willing to help new contributors on board and review/merge their PRs.
In case others find this helpful, I've been using lli
to evaluate the IR which seems to work well for toy programs. The program
below is the output from module.print()
:
import { spawnSync } from 'child_process';
const LLI_PATH = '/opt/homebrew/opt/llvm/bin/lli';
export function evalIR(program: string): string {
const result = spawnSync(LLI_PATH, {
input: program,
});
if (result.stderr.length) {
console.warn('lli stderr:\n' + result.stderr.toString());
}
if (result.status !== 0) {
throw new Error('lli failed with status: ' + result.status);
}
return result.stdout.toString();
}
An important use case for llvm-node is to implement small toy languages, thus JIT becomes a necessary function. Not all use requires writing a bitcode to file. Is exposing JIT functions in the pipeline?