marsc should invoke llc, opt and gcc
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mars |
Triaged
|
Low
|
Matt Giuca |
Bug Description
It should be possible to compile, optimize and run a Mars program with the following commands:
$ marsc hello.mar
$ ./hello
Currently, it requires the following commands:
$ marsc -m main hello.mar
$ opt -std-compile-opts hello.bc | llc -o hello.s
$ gcc -o hello hello.s -lm -lgc
$ ./hello
The marsc program should, by default:
* Choose 'main' as the main function (the current default is to not have a main function and build a library). Add an option --no-main to get that behaviour.
* Call 'opt -std-compile-opts' to optimize the compiled bitcode. Add an option --no-optimize to disable this step.
* Call 'llc' to compile the bitcode into a native assembly program.
* Call 'gcc' to compile the assembly program into an executable.
Add additional options to:
* Stop at the bitcode stage, emitting a .bc file.
* Stop at the bitcode stage, and disassemble the bitcode using 'llvm-dis', emitting a .ll file.
* Stop at the native assembly stage, emitting a .s file.
* Have GCC stop at the compilation stage, emitting a .o file.
* Have GCC link as a shared object, emitting a .so file.