The assembly is easier to output, and it has the advantage of being human readable. Regarding compilation time, here are some statistics from my compiler:
[~/ecc/ellcc/ecc/Main] main% ../../bin/x86-elf-ecc test/sieve.c -time-actions
===-------------------------------------------------------------------------===
... Ellcc action timing report ...
===-------------------------------------------------------------------------===
Total Execution Time: 2.9006 seconds (2.9857 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
2.0397 ( 71.3%) 0.0250 ( 65.8%) 2.0647 ( 71.2%) 2.1174 ( 70.9%) Bitcode linking
0.7999 ( 27.9%) 0.0070 ( 18.4%) 0.8069 ( 27.8%) 0.8111 ( 27.2%) Generating
0.0000 ( 0.0%) 0.0010 ( 2.6%) 0.0010 ( 0.0%) 0.0274 ( 0.9%) Assembly
0.0110 ( 0.4%) 0.0030 ( 7.9%) 0.0140 ( 0.5%) 0.0143 ( 0.5%) LLVM generation
0.0070 ( 0.2%) 0.0000 ( 0.0%) 0.0070 ( 0.2%) 0.0066 ( 0.2%) Type checking
0.0000 ( 0.0%) 0.0020 ( 5.3%) 0.0020 ( 0.1%) 0.0041 ( 0.1%) Linking
0.0030 ( 0.1%) 0.0000 ( 0.0%) 0.0030 ( 0.1%) 0.0031 ( 0.1%) Optimization
0.0010 ( 0.0%) 0.0000 ( 0.0%) 0.0010 ( 0.0%) 0.0010 ( 0.0%) Elaboration
0.0010 ( 0.0%) 0.0000 ( 0.0%) 0.0010 ( 0.0%) 0.0004 ( 0.0%) Integrity checking
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0004 ( 0.0%) Parsing
2.8626 (100.0%) 0.0380 (100.0%) 2.9006 (100.0%) 2.9857 (100.0%) TOTAL
[~/ecc/ellcc/ecc/Main] main%
As you can see, build time is overshadowed by building and generating code. This example compiles and bundles together a small main () together with the standard library, all in an intermediate LLVM form. Then a single assembly language file is created for the entire program. This file is linked (actually moved) using the linker that creates the a.out file.
source
share