Modifying the compilation process with SPEC to use LLVM
I am currently working on running some llvm passes and would like to benchmark their usefulness using the SPEC 2006 CPU benchmark suite. However, I've not figured out how to modify the SPEC setup to do anything other than use llvm-gcc to output llvm bitcode. Here is what I'd like to modify the workflow of SPEC to do:
compile the .o files with llvm into llvm-bytecode
llvm-gcc -emit-llvm *.c
For each .o file, run opt (llvm's optimization pass):
opt -adce -mem2reg cfline.o
Link with llvm-link:
llvm-link *.o -o out.o.linked
Turn the 开发者_StackOverflow社区llvm bytecode into assembly
llc out.o.linked
And finally turn that into executable code:
gcc out.o.linked -o out.executable
Is there a way I can do this? I know I can edit the .cfg files to emit llvm, but then I don't know how to choose a different linking/pre-linking procedure.
Thanks!
LLVM has a test-suite subproject that already knows how to build and run SPEC. See the docs for more info.
In CPUSPEC2017, the linker can be modified using the config file. CLD/CXXLD needs to be set. For example, CLD = $(LLVM_BIN_PATH)/llvm-link, CXXLD = $(LLVM_BIN_PATH)/llvm-link.
The opt command can also be run by modifying the Makefile.defaults file. It can be added in the section specifying the commands to build the executables.
精彩评论