aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2019-07-05 07:02:13 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-05 07:02:13 +0000
commit9cbb5574cd580de25e8aaf402e0f3d3c704a7157 (patch)
treefb0ce4bf7e6eb84d1692bede178bdb8f901193d1 /gcc
parent9795b20366362d63be058f1e4f3009d6bad79310 (diff)
downloadgcc-9cbb5574cd580de25e8aaf402e0f3d3c704a7157.zip
gcc-9cbb5574cd580de25e8aaf402e0f3d3c704a7157.tar.gz
gcc-9cbb5574cd580de25e8aaf402e0f3d3c704a7157.tar.bz2
[Ada] Accept compilation switches -Og/-Ofast in non-GCC backends
Tools like GNATprove built as GNAT backends rely on adabkend.adb to handle generic switches like the optimisation switches -Oxxx. This patch adds support for -Og and -Ofast that was missing. There is no impact on compilation. 2019-07-05 Yannick Moy <moy@adacore.com> gcc/ada/ * adabkend.adb (Scan_Back_End_Switches): Accept -Og and -Ofast switches. From-SVN: r273108
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/adabkend.adb23
2 files changed, 23 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 279eac5..7fe9577 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-05 Yannick Moy <moy@adacore.com>
+
+ * adabkend.adb (Scan_Back_End_Switches): Accept -Og and -Ofast
+ switches.
+
2019-07-05 Hristian Kirtchev <kirtchev@adacore.com>
* ali.adb: Relocate types Invocation_Construct_Record,
diff --git a/gcc/ada/adabkend.adb b/gcc/ada/adabkend.adb
index c42f3bd..3e1b14d 100644
--- a/gcc/ada/adabkend.adb
+++ b/gcc/ada/adabkend.adb
@@ -117,9 +117,11 @@ package body Adabkend is
-- Set optimization indicators appropriately. In gcc-based GNAT this
-- is picked up from imported variables set by the gcc driver, but
- -- for compilers with non-gcc back ends we do it here to allow use
- -- of these switches by the front end. Allowed optimization switches
- -- are -Os (optimize for size), -O[0123], and -O (same as -O1).
+ -- for compilers with non-gcc back ends we do it here to allow use of
+ -- these switches by the front end. Allowed optimization switches are
+ -- -Os (optimize for size), -O[0123], -O (same as -O1), -Ofast
+ -- (disregard strict standards compliance), and -Og (optimize
+ -- debugging experience).
elsif Switch_Chars (First) = 'O' then
if First = Last then
@@ -134,10 +136,21 @@ package body Adabkend is
Optimization_Level :=
Character'Pos (Switch_Chars (Last)) - Character'Pos ('0');
+ -- Switch -Og is between -O0 and -O1 in GCC. Consider it like
+ -- -O0 for other back ends.
+
+ elsif Switch_Chars (Last) = 'g' then
+ Optimization_Level := 0;
+
else
Fail ("invalid switch: " & Switch_Chars);
end if;
+ -- Switch -Ofast enables -O3
+
+ elsif Switch_Chars (First + 1 .. Last) = "fast" then
+ Optimization_Level := 3;
+
else
Fail ("invalid switch: " & Switch_Chars);
end if;
@@ -169,7 +182,7 @@ package body Adabkend is
return;
- -- Special check, the back end switch -fno-inline also sets the
+ -- Special check, the back-end switch -fno-inline also sets the
-- front end flags to entirely inhibit all inlining. So we store it
-- and set the appropriate flags.
@@ -206,7 +219,7 @@ package body Adabkend is
end case;
end if;
- -- Ignore all other back end switches
+ -- Ignore all other back-end switches
elsif Is_Back_End_Switch (Switch_Chars) then
null;