Closed iacore closed 1 year ago
The -i
/--show-ir
option you had should print the llvm ir to stdout (so you should use > hello.ll
instead of 2> hello.ll
). I can look into directly outputting to a file or cleaning this up a bit (e.g. the cranelift output for -i contains extra debug information) but this should work for your purpose.
Or am I misunderstanding your request?
Currently -i
produce the executable as well. I'd like it to only output LLVM IR, and stop there.
I also hope that the Ante compiler can be used together with other LLVM compilers (like clang).
Pushed an update to remove the --show-ir
and --show-hir
flags in favor of a --emit ir
and --emit hir
flags which will emit the ir or hir then stop. You should now be able to use:
ante -eir --backend llvm hello.an > hello.ll
without additional artifacts being generated :). Note that you can also bump up the optimization level to automatically switch over to the llvm backend:
ante -eir -O2 hello.an > hello.ll
One day I think these flags will write to the file system instead of stdout by default but for now this change should make them a bit simpler.
Apparently, this just works.
Can you add an option that only emit LLVM IR? The rest can be handled by Zig/Clang.
Zig can compile to many platforms quite easily. It does that by linking the correct libc for target platform automatically, including wasi-musl. I think it's better to leave the part after LLVM IR to Zig.
Zig can also compile itself (excluding LLVM) in WASM. It is used for bootstrapping. Maybe useful for embedding inside the Ante compiler?
Zig's supported targets: https://ziglang.org/download/0.10.0/release-notes.html#Support-Table