📄 00000006.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>OPTIMIZATION OPTIONS <BR> These options control various sorts of optimizations: <BR> <BR> -O <BR> <BR> -O1 Optimize. Optimizing compilation takes somewhat <BR> more time, and a lot more memory for a large func- <BR> tion. <BR> <BR> Without `-O', the compiler's goal is to reduce the <BR> cost of compilation and to make debugging produce <BR> the expected results. Statements are independent: <BR> if you stop the program with a breakpoint between <BR> statements, you can then assign a new value to any <BR> variable or change the program counter to any other <BR> statement in the function and get exactly the re- <BR> sults you would expect from the source code. <BR> <BR> Without `-O', only variables declared register are <BR> allocated in registers. The resulting compiled <BR> code is a little worse than produced by PCC without <BR> `-O'. <BR> <BR> With `-O', the compiler tries to reduce code size <BR> and execution time. <BR> <BR> When you specify `-O', the two options <BR> `-fthread-jumps' and `-fdefer-pop' are turned on. <BR> On machines that have delay slots, the <BR> `-fdelayed-branch' option is turned on. For those <BR> machines that can support debugging even without a <BR> frame pointer, the `-fomit-frame-pointer' option is <BR> turned on. On some machines other flags may also <BR> be turned on. <BR> <BR> -O2 Optimize even more. Nearly all supported optimiza- <BR> tions that do not involve a space-speed tradeoff <BR> are performed. Loop unrolling and function inlin- <BR> ing are not done, for example. As compared to -O, <BR> this option increases both compilation time and the <BR> performance of the generated code. <BR> <BR> -O3 Optimize yet more. This turns on everything -O2 <BR> does, along with also turning on -fin- <BR> line-functions. <BR> <BR> -O0 Do not optimize. <BR> If you use multiple -O options, with or without <BR> level numbers, the last such option is the one that <BR> is effective. <BR> <BR> Options of the form `-fflag' specify machine-independent <BR> flags. Most flags have both positive and negative forms; <BR> the negative form of `-ffoo' would be `-fno-foo'. The <BR> following list shows only one form--the one which is not <BR> the default. You can figure out the other form by either <BR> removing `no-' or adding it. <BR> <BR> -ffloat-store <BR> Do not store floating point variables in registers. <BR> This prevents undesirable excess precision on ma- <BR> chines such as the 68000 where the floating regis- <BR> ters (of the 68881) keep more precision than a dou- <BR> ble is supposed to have. <BR> <BR> For most programs, the excess precision does only <BR> good, but a few programs rely on the precise defi- <BR> nition of IEEE floating point. Use `-ffloat-store' <BR> for such programs. <BR> <BR> -fmemoize-lookups <BR> <BR> -fsave-memoized <BR> Use heuristics to compile faster (C++ only). These <BR> heuristics are not enabled by default, since they <BR> are only effective for certain input files. Other <BR> input files compile more slowly. <BR> <BR> The first time the compiler must build a call to a <BR> member function (or reference to a data member), it <BR> must (1) determine whether the class implements <BR> member functions of that name; (2) resolve which <BR> member function to call (which involves figuring <BR> out what sorts of type conversions need to be <BR> made); and (3) check the visibility of the member <BR> function to the caller. All of this adds up to <BR> slower compilation. Normally, the second time a <BR> call is made to that member function (or reference <BR> to that data member), it must go through the same <BR> lengthy process again. This means that code like <BR> this <BR> <BR> cout << "This " << p << " has " << n << " <BR> legs.\n"; <BR> <BR> makes six passes through all three steps. By using <BR> a software cache, a "hit" significantly reduces <BR> this cost. Unfortunately, using the cache intro- <BR> duces another layer of mechanisms which must be im- <BR> plemented, and so incurs its own overhead. <BR> `-fmemoize-lookups' enables the software cache. <BR> <BR> Because access privileges (visibility) to members <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -