Modifying the compilation process with SPEC to use LLVM
Asked Answered
V

2

8

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 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!

Voroshilov answered 12/4, 2011 at 2:9 Comment(1)
Am kind of stuck in a same situation. I was going through test-suite thing but still no luck. Since this post is too old, I hope that you might have resolved this problem. So can you give me some details on it. I mean how actually you did resolve your problem? Asking for a friend.Coshow
R
3

LLVM has a test-suite subproject that already knows how to build and run SPEC. See the docs for more info.

Ribbentrop answered 12/4, 2011 at 6:5 Comment(1)
llvm-test-2.9.tgz: llvm-test-2.9/External/SPECAlkyne
W
2

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.

Willner answered 3/6, 2020 at 11:29 Comment(1)
Is there a way to not modify the original file (Makefile.defaults), but define a new file (ex. new-Makefile.defaults) and use it instead? It would be generally more convenientMarket

© 2022 - 2024 — McMap. All rights reserved.