Reputation: 33882
Why clang is using LLVM faster than using LLVM by hand?
This is the real example on Linux:
clang -O0 prog.c -c -emit-llvm
0.5 s
llc prog.bc
1.3 s
as prog.s -o prog.o
0.1 s
gcc prog.o -o prog -lm
0.04 s
total time: 2.0 s
Now just do everything from clang in one command:
clang prog.c -o prog -O0 -lm
total time: 0.7 s
Upvotes: 0
Views: 77
Reputation: 9340
When you're doing it by hand, you have a lot of intermediaries: prog.bc, prog.s, prog.o. Clang is an example of how LLVM is to be used as a library, therefore it never dumps anything to disk until the final step (which depending on switch, can be bitcode, assembly code, object file or executable), everything in the middle is in memory.
Upvotes: 1