[LLVMdev] Cleanest way to do llvm-driven compile with specified passes
stephen.mcgruer at gmail.com
Tue Oct 16 06:07:14 PDT 2012
I have a target platform for which I'm compiling code with llvm and my own
backend. My current compilation route to create an executable is to just
call something like:
$ clang -O3 -ccc-host-triple arcompact [-I...] file_to_compile.c
another_file.c [-lm etc]
Importantly, clang here is running with the target version of gcc as the
driver, so that gcc (call it gcc-arcompact) takes care of calling the
correct assembler, linker, etc for the backend output.
Now what I want to do is select my own optimization passes specifically. As
far as I can tell, the following seems to be the only way to do it:
$ clang -S -emit-llvm -ccc-host-triple arcompact [--I... -L... etc]
$ opt [passes] file_to_compile.s | llc -march=arcompact -o file_to_compile.s
$ opt [passes] another_file.s | llc -march=arcompact -o another_file.s
$ gcc-arcompact [-L... etc] file_to_compile.s another_file.s [-lm etc]
Is there a cleaner way to do this - i.e. by telling clang what optimization
passes to run (or to pass onto the backend to run), or by not having to run
a unique opt command for each input file (of which there may be a few...)?
Thanks for any help,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev