[LLVMdev] Passing llc options to Clang

865 views
Skip to first unread message

Ziqiang Patrick Huang

unread,
Oct 13, 2014, 3:53:18 PM10/13/14
to llv...@cs.uiuc.edu
Hi, 

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"

Thanks,
Ziqiang 



Daniil Troshkov

unread,
Oct 13, 2014, 4:14:07 PM10/13/14
to Ziqiang Patrick Huang, LLVM Developers Mailing List
maybe try to use -mllvm for each arg

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

Ziqiang Patrick Huang

unread,
Oct 13, 2014, 4:20:17 PM10/13/14
to Daniil Troshkov, LLVM Developers Mailing List
Thanks, Daniil

I've tried that, still not working. 

2014-10-13 16:11 GMT-04:00 Daniil Troshkov <troshk...@gmail.com>:
maybe try to use -mllvm for each arg

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



--
Ziqiang Huang
Electrical and Computer Engineering
Hudson 213c, Duke University

Daniil Troshkov

unread,
Oct 13, 2014, 4:42:27 PM10/13/14
to Ziqiang Patrick Huang, LLVM Developers Mailing List
I've looked at test/CodeGen/X86
; RUN: llc < %s -march=x86-64 -mcpu=core2 ...

they use x86-64 (with small letter)

Reid Kleckner

unread,
Oct 13, 2014, 5:00:39 PM10/13/14
to Ziqiang Patrick Huang, LLVM Developers Mailing List
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.

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


Ziqiang Patrick Huang

unread,
Oct 13, 2014, 5:12:19 PM10/13/14
to Reid Kleckner, LLVM Developers Mailing List
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 ...


Reply all
Reply to author
Forward
0 new messages