add piston nix pkg for llvm_ir
This commit is contained in:
parent
560b4ac1ee
commit
daeed0ce5e
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
curl -L "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz" -o llvm-ir.tar.xz
|
||||
|
||||
tar xf llvm-ir.tar.xz clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu-/bin --strip-components=1
|
||||
|
||||
rm llvm-ir.tar.xz
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
llc "$@" -o binary.s
|
||||
clang binary.s -o binary
|
|
@ -1,2 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
export PATH=$PWD/bin:$PATH
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"language": "llvm_ir",
|
||||
"version": "12.0.1",
|
||||
"aliases": ["llvm", "llvm-ir", "ll"]
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
shift
|
||||
binary "$@"
|
|
@ -1,10 +0,0 @@
|
|||
@.str = private unnamed_addr constant [2 x i8] c"OK"
|
||||
|
||||
declare i32 @puts(i8* nocapture) nounwind
|
||||
|
||||
define i32 @main() {
|
||||
%cast210 = getelementptr [2 x i8],[2 x i8]* @.str, i64 0, i64 0
|
||||
|
||||
call i32 @puts(i8* %cast210)
|
||||
ret i32 0
|
||||
}
|
|
@ -61,4 +61,5 @@ args: {
|
|||
"brainfuck" = import ./brainfuck.nix args;
|
||||
"node-coffeescript" = import ./node-coffeescript.nix args;
|
||||
"jvm-scala" = import ./jvm-scala.nix args;
|
||||
"llvm_ir" = import ./llvm_ir.nix args;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
pkg = pkgs.llvm;
|
||||
clang = pkgs.llvmPackages_13.libcxxClang;
|
||||
in piston.mkRuntime {
|
||||
language = "llvm_ir";
|
||||
version = clang.version;
|
||||
|
||||
aliases = [
|
||||
"llvm"
|
||||
"llvm-ir"
|
||||
"ll"
|
||||
];
|
||||
|
||||
compile = ''
|
||||
${pkg}/bin/llc "$@" -o binary.s
|
||||
${clang}/bin/clang binary.s -o binary
|
||||
'';
|
||||
|
||||
run = ''
|
||||
shift
|
||||
./binary "$@"
|
||||
'';
|
||||
|
||||
tests = [
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.ll" = ''
|
||||
@.str = private unnamed_addr constant [2 x i8] c"OK"
|
||||
|
||||
declare i32 @puts(i8* nocapture) nounwind
|
||||
|
||||
define i32 @main() {
|
||||
%cast210 = getelementptr [2 x i8],[2 x i8]* @.str, i64 0, i64 0
|
||||
|
||||
call i32 @puts(i8* %cast210)
|
||||
ret i32 0
|
||||
}
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.ll";
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue