Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/adabkend.adb @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
4 -- -- | 4 -- -- |
5 -- A D A B K E N D -- | 5 -- A D A B K E N D -- |
6 -- -- | 6 -- -- |
7 -- B o d y -- | 7 -- B o d y -- |
8 -- -- | 8 -- -- |
9 -- Copyright (C) 2001-2018, AdaCore -- | 9 -- Copyright (C) 2001-2019, AdaCore -- |
10 -- -- | 10 -- -- |
11 -- GNAT is free software; you can redistribute it and/or modify it under -- | 11 -- GNAT is free software; you can redistribute it and/or modify it under -- |
12 -- terms of the GNU General Public License as published by the Free Soft- -- | 12 -- terms of the GNU General Public License as published by the Free Soft- -- |
13 -- ware Foundation; either version 3, or (at your option) any later ver- -- | 13 -- ware Foundation; either version 3, or (at your option) any later ver- -- |
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- | 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
115 Next_Arg := Next_Arg + 1; | 115 Next_Arg := Next_Arg + 1; |
116 return; -- ignore this switch | 116 return; -- ignore this switch |
117 | 117 |
118 -- Set optimization indicators appropriately. In gcc-based GNAT this | 118 -- Set optimization indicators appropriately. In gcc-based GNAT this |
119 -- is picked up from imported variables set by the gcc driver, but | 119 -- is picked up from imported variables set by the gcc driver, but |
120 -- for compilers with non-gcc back ends we do it here to allow use | 120 -- for compilers with non-gcc back ends we do it here to allow use of |
121 -- of these switches by the front end. Allowed optimization switches | 121 -- these switches by the front end. Allowed optimization switches are |
122 -- are -Os (optimize for size), -O[0123], and -O (same as -O1). | 122 -- -Os (optimize for size), -O[0123], -O (same as -O1), -Ofast |
123 -- (disregard strict standards compliance), and -Og (optimize | |
124 -- debugging experience). | |
123 | 125 |
124 elsif Switch_Chars (First) = 'O' then | 126 elsif Switch_Chars (First) = 'O' then |
125 if First = Last then | 127 if First = Last then |
126 Optimization_Level := 1; | 128 Optimization_Level := 1; |
127 | 129 |
132 | 134 |
133 elsif Switch_Chars (Last) in '0' .. '3' then | 135 elsif Switch_Chars (Last) in '0' .. '3' then |
134 Optimization_Level := | 136 Optimization_Level := |
135 Character'Pos (Switch_Chars (Last)) - Character'Pos ('0'); | 137 Character'Pos (Switch_Chars (Last)) - Character'Pos ('0'); |
136 | 138 |
139 -- Switch -Og is between -O0 and -O1 in GCC. Consider it like | |
140 -- -O0 for other back ends. | |
141 | |
142 elsif Switch_Chars (Last) = 'g' then | |
143 Optimization_Level := 0; | |
144 | |
137 else | 145 else |
138 Fail ("invalid switch: " & Switch_Chars); | 146 Fail ("invalid switch: " & Switch_Chars); |
139 end if; | 147 end if; |
148 | |
149 -- Switch -Ofast enables -O3 | |
150 | |
151 elsif Switch_Chars (First + 1 .. Last) = "fast" then | |
152 Optimization_Level := 3; | |
140 | 153 |
141 else | 154 else |
142 Fail ("invalid switch: " & Switch_Chars); | 155 Fail ("invalid switch: " & Switch_Chars); |
143 end if; | 156 end if; |
144 | 157 |
167 end if; | 180 end if; |
168 end; | 181 end; |
169 | 182 |
170 return; | 183 return; |
171 | 184 |
172 -- Special check, the back end switch -fno-inline also sets the | 185 -- Special check, the back-end switch -fno-inline also sets the |
173 -- front end flags to entirely inhibit all inlining. So we store it | 186 -- front end flags to entirely inhibit all inlining. So we store it |
174 -- and set the appropriate flags. | 187 -- and set the appropriate flags. |
175 | 188 |
176 elsif Switch_Chars (First .. Last) = "fno-inline" then | 189 elsif Switch_Chars (First .. Last) = "fno-inline" then |
177 Lib.Store_Compilation_Switch (Switch_Chars); | 190 Lib.Store_Compilation_Switch (Switch_Chars); |
184 elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then | 197 elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then |
185 Lib.Store_Compilation_Switch (Switch_Chars); | 198 Lib.Store_Compilation_Switch (Switch_Chars); |
186 Opt.Suppress_Control_Flow_Optimizations := True; | 199 Opt.Suppress_Control_Flow_Optimizations := True; |
187 return; | 200 return; |
188 | 201 |
189 -- Ignore all other back end switches | 202 -- Recognize -gxxx switches |
203 | |
204 elsif Switch_Chars (First) = 'g' then | |
205 Debugger_Level := 2; | |
206 | |
207 if First < Last then | |
208 case Switch_Chars (First + 1) is | |
209 when '0' => | |
210 Debugger_Level := 0; | |
211 when '1' => | |
212 Debugger_Level := 1; | |
213 when '2' => | |
214 Debugger_Level := 2; | |
215 when '3' => | |
216 Debugger_Level := 3; | |
217 when others => | |
218 null; | |
219 end case; | |
220 end if; | |
221 | |
222 -- Ignore all other back-end switches | |
190 | 223 |
191 elsif Is_Back_End_Switch (Switch_Chars) then | 224 elsif Is_Back_End_Switch (Switch_Chars) then |
192 null; | 225 null; |
193 | 226 |
194 -- Give error for junk switch | 227 -- Give error for junk switch |