问题
What are the major differences between LLVM GCC 4.2 and Apple LLVM compiler 3.1?
I'm fairly new to compilers so any help is appreciated. Also I'm especially interested in how the two compilers could affect game performance.
回答1:
The difference is a matter of both technology and speed.
CLANG was still young and buggy when Apple began the transition away from GCC's compiler and toolchain, so LLVM was built as a back-end to GCC to facilitate its eventual replacement. So, code went in and was compiled by GCC into some intermediate form, but was sent to LLVM to provide the final machine code and packaging.
Eventually, LLVM and especially CLANG were mature enough to replace GCC outright, which provided an amazing speed boost to compiling and a bump in the quality of the machine code output (though many argue that GCC still produces better quality code at the expense of speed).
But to address your concern about game performance: while CLANG may provide a "better" compile experience, performance is not the job of a compiler. While optimization and simplifications are a part of the compile process, the fact that people still write laggy games or produce infinite loops that lay waste to the stack show that performance is your job. The compiler can only do so much, the rest is up to you. The type or vendor of a compiler will also not make or break your game or affect frame rate or usability. You should read about lower-level optimizations for the ARM architecture. A few articles about NEON, and instruments would do you a lot more good than learning about "optimizing for the compiler".
回答2:
Another Difference: Clang supports most of C++11. GCC 4.2-Apple will not support C++11.
来源:https://stackoverflow.com/questions/12020349/difference-between-llvm-gcc-4-2-and-apple-llvm-compiler-3-1