Download PathScale™ Compiler Suite User Guide
Transcript
4 – The PathScale C/C++ Compiler Using the C/C++ Compilers The command-line flags for both compilers are compatible with those taken by the GCC suite. See section 4.1 for more discussion of this. 4.1 Using the C/C++ Compilers If you currently use the GCC compilers, the PathScale compiler commands will be familiar. Makefiles that presently work with GCC should operate with the PathScale compilers effortlessly–simply change the command used to invoke the compiler and rebuild. See section 5.7.1 for information on modifying existing scripts The invocation of the compiler is identical to the GCC compilers, but the flags to control the compilation are different. We have sought to provide flags compatible with GCC’s flag usage whenever possible and also provide optimization features that are absent in GCC, such as IPA and LNO. Generally speaking, instead of being a single component as in GCC, the PathScale compiler is structured into components that perform different classes of optimizations. Accordingly, compilation flags are provided under group names like -IPA, -LNO, -OPT, -CG, etc. For this reason, many of the compilation flags in our compiler will differ from those in GCC. See the eko man page for more information. The default optimization level is 2. This is equivalent to passing -O2 as a flag. The following three commands are identical in their function: $ pathcc hello.c $ pathcc -O hello.c $ pathcc -O2 hello.c See section 7.1 for information about the optimization levels available for use with the compiler. To run with -Ofast or with -ipa, the flag must also be given on the link command. $ pathCC -c -Ofast warpengine.cc $ pathCC -c -Ofast wormhole.cc $ pathCC -o ftl -Ofast warpengine.o wormhole.o See section 7.3 for information on -ipa and -Ofast. 4.1.1 Accessing the GCC 4.x Front-ends for C and C++ This release is compatible with version 4.2.0 of the GNU C/C++ compiler in terms of the source language constructs they support. This is the default on Linux distributions whose compiler is GNU 4.x. On systems with GNU 3.x compilers, pathcc/pathCC will generate code compitable with GNU 3.x. You can use the "-gnu4" option to direct pathcc/pathCC to be compitable with GNU 4.x. A sample command for C is: $ pathcc -gnu4 world.c 4-2