有多少GCC优化级别? [英] How many GCC optimization levels are there?
本文介绍了有多少GCC优化级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有多少 GCC 优化级别?
我试过gcc -O1,gcc -O2,gcc -O3和gcc -O4
I tried gcc -O1, gcc -O2, gcc -O3, and gcc -O4
如果我使用一个非常大的数字,
If I use a really large number, it won't work.
但是,我尝试过
gcc -O100
并编译。
推荐答案
为了迂腐,有七个不同的有效-O选项,你可以给gcc,是一些意思相同的事情。从手册页
To be pedantic, there are 7 different valid -O options you can give to gcc, though there are some that mean the same thing. From the man page
-
-O
(与-O1
相同) -
-O0
(不进行优化,默认情况下未指定优化级别) -
O1
(最低限度优化) -
-O2
-
-O3
(进一步优化) -
非常积极地优化到达到标准合规性)
-
-Os
(针对大小进行优化-Os
启用所有通常不会增加代码大小的所有-O2
优化它还执行进一步的优化
旨在减少代码大小
-Os
禁用以下优化标志:-falign-functions -falign-jumps -falign-loops -falign-labels -freorder- freorder-blocks-and-partition -fprefetch-loop-arrays -ftree-vect-loop-version
)
-O
(Same as-O1
)-O0
(do no optimization, the default if no optimization level is specified)-O1
(optimize minimally)-O2
(optimize more)-O3
(optimize even more)-Ofast
(optimize very aggressively to the point of breaking standard compliance)-Os
(Optimize for size.-Os
enables all-O2
optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.-Os
disables the following optimization flags:-falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays -ftree-vect-loop-version
)
这篇关于有多少GCC优化级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文