GCC优化级别有多少种? [英] How many GCC optimization levels are there?
本文介绍了GCC优化级别有多少种?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
href=\"http://en.wikipedia.org/wiki/GNU%5FCompiler%5FCollection\"> GCC 优化级别多少 我试过的gcc -O1,GCC -O2,-O3 GCC,和gcc -O4 如果我用一个非常大的数字,这是行不通的。 不过,我曾尝试
GCC -O100
和它编译。</ P>
优化级别有多少?
解决方案
要学究,有7个可以给你不同的gcc -O有效的选择,但也有一些是同一个意思。从手册页
-
-O
(同-O1
) -
-O0
(如果未指定优化级别做任何优化,默认) -
-O1
(优化最小) -
-O2
(优化更多) -
-O3
(优化甚至更多) -
-Ofast
(优化非常积极地打破标准符合性的点) -
-Os
(优化的大小。-Os
使所有的-O2
的优化,一般不增加code尺寸。它还执行进一步优化
旨在减少code尺寸。-Os
禁用以下优化参数:-falign-功能-falign-跳跃-falign-循环-falign-标签-freorder块-freorder-块和分区-f prefetch环阵列-ftree-VECT环版本
)
How many GCC optimization levels are there?
I tried gcc -O1, gcc -O2, gcc -O3, and gcc -O4
If I use a really large number, it won't work.
However, I have tried
gcc -O100
and it compiled.
How many optimization levels are there?
解决方案
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
(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屋!
查看全文