1 |
Montier Jacques a écrit : |
2 |
|
3 |
>Merci aussi pour l'info sur l'erreur de frappe du commutateur -o3 ; |
4 |
>cela a-t-il eu une incidence sur le résultat de la compilation ?? |
5 |
> |
6 |
>Jacques |
7 |
> |
8 |
> |
9 |
Oui bien sûr cela a une influence. L'option "-O" et ses variantes "-Ox" |
10 |
permettent d'optimiser le code. "-O" ou "-O1" est la plus faible |
11 |
optimisation, "-O3" en théorie la plus performante (mais c'est à voir, |
12 |
en effet dans de nombreux cas "-O2" est plus efficace). Un des gros |
13 |
intérêts de Gentoo est d'optimiser la compilation pour sa machine, et ça |
14 |
mérite donc un petit peu de temps de réflexion. Tu trouveras sur la page |
15 |
suivante la présentation des meilleurs options de compilation en |
16 |
fonction de ton processeur : |
17 |
http://www.freehackers.org/gentoo/gccflags/flag_gcc3.html |
18 |
|
19 |
Tout ceci est décrit dans le manuel de gcc (man gcc) : |
20 |
|
21 |
Options That Control Optimization |
22 |
|
23 |
These options control various sorts of optimizations: |
24 |
|
25 |
-O |
26 |
-O1 Optimize. Optimizing compilation takes somewhat more time, and a |
27 |
lot more memory for a large function. |
28 |
|
29 |
Without -O, the compiler's goal is to reduce the cost of compila- |
30 |
tion and to make debugging produce the expected results. State- |
31 |
ments are independent: if you stop the program with a breakpoint |
32 |
between statements, you can then assign a new value to any |
33 |
variable |
34 |
or change the program counter to any other statement in the func- |
35 |
tion and get exactly the results you would expect from the source |
36 |
code. |
37 |
|
38 |
With -O, the compiler tries to reduce code size and execution |
39 |
time, |
40 |
without performing any optimizations that take a great deal |
41 |
of com- |
42 |
pilation time. |
43 |
|
44 |
-O2 Optimize even more. GCC performs nearly all supported optimiza- |
45 |
tions that do not involve a space-speed tradeoff. The compiler |
46 |
does not perform loop unrolling or function inlining when you |
47 |
spec- |
48 |
ify -O2. As compared to -O, this option increases both |
49 |
compilation |
50 |
time and the performance of the generated code. |
51 |
|
52 |
-O2 turns on all optional optimizations except for loop |
53 |
unrolling, |
54 |
function inlining, and register renaming. It also turns on the |
55 |
-fforce-mem option on all machines and frame pointer |
56 |
elimination on |
57 |
machines where doing so does not interfere with debugging. |
58 |
|
59 |
Please note the warning under -fgcse about invoking -O2 on |
60 |
programs |
61 |
that use computed gotos. |
62 |
|
63 |
-O3 Optimize yet more. -O3 turns on all optimizations specified |
64 |
by -O2 |
65 |
and also turns on the -finline-functions and -frename-registers |
66 |
options. |
67 |
|
68 |
-O0 Do not optimize. |
69 |
|
70 |
-Os Optimize for size. -Os enables all -O2 optimizations that do not |
71 |
typically increase code size. It also performs further optimiza- |
72 |
tions designed to reduce code size. |
73 |
|
74 |
If you use multiple -O options, with or without level |
75 |
numbers, the |
76 |
last such option is the one that is effective. |
77 |
|
78 |
|
79 |
|
80 |
|
81 |
-- |
82 |
gentoo-user-fr@g.o mailing list |