Passing llc options to Clang


Is there a way to passing llc options to clang, for example -march -mcpu, etc. ?

Some threads suggested using -mllvm flag,

I tried ./clang -mllvm -march=X86-64 -mcpu=core2 -o hello hello.c, but got “Unknown command line argument”


maybe try to use -mllvm for each arg

./clang -mllvm -march=X86-64 -mllvm -mcpu=core2 -o hello hello.c

Thanks, Daniil

I’ve tried that, still not working.

I’ve looked at test/CodeGen/X86
; RUN: llc < %s -march=x86-64 -mcpu=core2 …

they use x86-64 (with small letter)

You’ll be a lot better off if you use the gcc-style flags that clang accepts. If you bypass clang, it will generate LLVM IR for the default target, and then attempt to compile that IR using the triple you provided to llc.

Try ‘clang --target=x86_64-linux-gnu’ or whatever your target is.

Thanks, Reid

The reason I want to pass -mcpu is that I want to specify the subtarget so that when llc does the instruction scheduling, it would takes the subtarget scheduling information into consideration. I’m not sure --target flag will get what I want …