diff options
author | Ghjuvan Lacambre <lacambre@adacore.com> | 2021-06-21 11:47:59 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-09-20 12:31:29 +0000 |
commit | 8967ee52ea92c865801d6137600e33e4a32cd2ec (patch) | |
tree | 42ccd25ab111e6d198e2da96aca647f095db6339 /gcc/ada/adabkend.adb | |
parent | 3afd5368f50f7a5060fddd652a41b141691172d1 (diff) | |
download | gcc-8967ee52ea92c865801d6137600e33e4a32cd2ec.zip gcc-8967ee52ea92c865801d6137600e33e4a32cd2ec.tar.gz gcc-8967ee52ea92c865801d6137600e33e4a32cd2ec.tar.bz2 |
[Ada] Refactor scan_backend_switch to share logic across backends
gcc/ada/
* adabkend.adb (Scan_Back_End_Switches): Replace switch-scanning
logic with call to Backend_Utils.Scan_Common_Back_End_Switches.
* back_end.adb (Scan_Back_End_Switches): Replace switch-scanning
logic with call to Backend_Utils.Scan_Common_Back_End_Switches.
* backend_utils.adb: New file.
* backend_utils.ads: New file.
* gcc-interface/Make-lang.in: Add ada/backend_utils.o.
Diffstat (limited to 'gcc/ada/adabkend.adb')
-rw-r--r-- | gcc/ada/adabkend.adb | 58 |
1 files changed, 11 insertions, 47 deletions
diff --git a/gcc/ada/adabkend.adb b/gcc/ada/adabkend.adb index 2ad58ef..118ca95 100644 --- a/gcc/ada/adabkend.adb +++ b/gcc/ada/adabkend.adb @@ -22,15 +22,16 @@ -- This is the version of the Back_End package for back ends written in Ada -with Atree; use Atree; +with Atree; use Atree; +with Backend_Utils; use Backend_Utils; with Debug; with Lib; -with Opt; use Opt; -with Output; use Output; -with Osint; use Osint; -with Osint.C; use Osint.C; -with Switch.C; use Switch.C; -with Types; use Types; +with Opt; use Opt; +with Output; use Output; +with Osint; use Osint; +with Osint.C; use Osint.C; +with Switch.C; use Switch.C; +with Types; use Types; with System.OS_Lib; use System.OS_Lib; @@ -182,48 +183,11 @@ package body Adabkend is return; - -- 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. - - elsif Switch_Chars (First .. Last) = "fno-inline" then - Lib.Store_Compilation_Switch (Switch_Chars); - Opt.Disable_FE_Inline := True; - return; - - -- Similar processing for -fpreserve-control-flow - - elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then - Lib.Store_Compilation_Switch (Switch_Chars); - Opt.Suppress_Control_Flow_Optimizations := True; - return; - - -- Recognize -gxxx switches - - elsif Switch_Chars (First) = 'g' then - Debugger_Level := 2; - - if First < Last then - case Switch_Chars (First + 1) is - when '0' => - Debugger_Level := 0; - when '1' => - Debugger_Level := 1; - when '2' => - Debugger_Level := 2; - when '3' => - Debugger_Level := 3; - when others => - null; - end case; - end if; - - elsif Switch_Chars (First .. Last) = "S" then - Generate_Asm := True; - -- Ignore all other back-end switches - elsif Is_Back_End_Switch (Switch_Chars) then + elsif Scan_Common_Back_End_Switch (Switch_Chars) + or else Is_Back_End_Switch (Switch_Chars) + then null; -- Give error for junk switch |