Hi there,<div><br></div><div>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:</div><div><br></div>
<div>$ clang -O3 -ccc-host-triple arcompact [-I...] file_to_compile.c another_file.c [-lm etc]</div><div><br></div><div>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.</div>
<div><br></div><div>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:</div><div><br></div><div>$ clang -S -emit-llvm -ccc-host-triple arcompact [--I... -L... etc] file_to_compile.c another_file.c </div>
<div>$ opt [passes] file_to_compile.s | llc -march=arcompact -o file_to_compile.s</div><div>$ opt [passes] another_file.s | llc -march=arcompact -o another_file.s</div><div>$ gcc-arcompact [-L... etc] file_to_compile.s another_file.s [-lm etc]</div>
<div><br></div><div>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...)?</div>
<div><br></div><div>Thanks for any help,</div><div>Stephen</div>