diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-24 20:50:20 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-24 20:50:20 +0000 |
commit | 6a3002a6b5a70d6bba151ed5bb48cedf138463c6 (patch) | |
tree | 69da52a0d2f2c33bd7511e1cb232e7c8cee99664 /gcc | |
parent | 2287ec4f299e39a1edae3b8b992aeaa28e8b2bd3 (diff) | |
download | gcc-6a3002a6b5a70d6bba151ed5bb48cedf138463c6.tar.gz |
* reg-stack.c (convert_regs_1): Return boolean value, true if the CFG
has been modified.
(convert_regs_2): Likewise. Adjust calls to convert_regs_1.
(convert_regs): Adjust calls to convert_regs_2. Clean up the CFG if
it has been modified.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165905 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/reg-stack.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/opt7.adb | 44 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/opt7.ads | 12 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/opt7_pkg.ads | 5 |
6 files changed, 94 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f250e70c29..c48d9d7b22d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2010-10-24 Eric Botcazou <ebotcazou@adacore.com> + * reg-stack.c (convert_regs_1): Return boolean value, true if the CFG + has been modified. + (convert_regs_2): Likewise. Adjust calls to convert_regs_1. + (convert_regs): Adjust calls to convert_regs_2. Clean up the CFG if + it has been modified. + +2010-10-24 Eric Botcazou <ebotcazou@adacore.com> + * config/sparc/sparc.c (sparc_type_code) <NULLPTR_TYPE>: New case. 2010-10-24 Paul Koning <ni1d@arrl.net> diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index e692584bb6b..98c5fcee77e 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -2876,9 +2876,10 @@ better_edge (edge e1, edge e2) return (e1->src->index < e2->src->index) ? e1 : e2; } -/* Convert stack register references in one block. */ +/* Convert stack register references in one block. Return true if the CFG + has been modified in the process. */ -static void +static bool convert_regs_1 (basic_block block) { struct stack_def regstack; @@ -2886,6 +2887,7 @@ convert_regs_1 (basic_block block) int reg; rtx insn, next; bool control_flow_insn_deleted = false; + bool cfg_altered = false; int debug_insns_with_starting_stack = 0; any_malformed_asm = false; @@ -3041,7 +3043,7 @@ convert_regs_1 (basic_block block) place, still, but we don't have enough information at that time. */ if (control_flow_insn_deleted) - purge_dead_edges (block); + cfg_altered |= purge_dead_edges (block); /* Something failed if the stack lives don't match. If we had malformed asms, we zapped the instruction itself, but that didn't produce the @@ -3051,14 +3053,18 @@ convert_regs_1 (basic_block block) || any_malformed_asm); bi->stack_out = regstack; bi->done = true; + + return cfg_altered; } -/* Convert registers in all blocks reachable from BLOCK. */ +/* Convert registers in all blocks reachable from BLOCK. Return true if the + CFG has been modified in the process. */ -static void +static bool convert_regs_2 (basic_block block) { basic_block *stack, *sp; + bool cfg_altered = false; /* We process the blocks in a top-down manner, in a way such that one block is only processed after all its predecessors. The number of predecessors @@ -3097,11 +3103,13 @@ convert_regs_2 (basic_block block) *sp++ = e->dest; } - convert_regs_1 (block); + cfg_altered |= convert_regs_1 (block); } while (sp != stack); free (stack); + + return cfg_altered; } /* Traverse all basic blocks in a function, converting the register @@ -3111,6 +3119,7 @@ convert_regs_2 (basic_block block) static void convert_regs (void) { + bool cfg_altered = false; int inserted; basic_block b; edge e; @@ -3129,7 +3138,7 @@ convert_regs (void) /* Process all blocks reachable from all entry points. */ FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs) - convert_regs_2 (e->dest); + cfg_altered |= convert_regs_2 (e->dest); /* ??? Process all unreachable blocks. Though there's no excuse for keeping these even when not optimizing. */ @@ -3138,7 +3147,7 @@ convert_regs (void) block_info bi = BLOCK_INFO (b); if (! bi->done) - convert_regs_2 (b); + cfg_altered |= convert_regs_2 (b); } inserted |= compensate_edges (); @@ -3149,6 +3158,9 @@ convert_regs (void) if (inserted) commit_edge_insertions (); + if (cfg_altered) + cleanup_cfg (0); + if (dump_file) fputc ('\n', dump_file); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9ee2d3cdb85..5e202cb0645 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-24 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt7.ad[sb]: New test. + * gnat.dg/opt7_pkg.ads: New helper. + 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/45735 diff --git a/gcc/testsuite/gnat.dg/opt7.adb b/gcc/testsuite/gnat.dg/opt7.adb new file mode 100644 index 00000000000..da3b0e6dfa2 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt7.adb @@ -0,0 +1,44 @@ +-- { dg-do compile }
+-- { dg-options "-Os -g" }
+
+with Opt7_Pkg;
+
+package body Opt7 is
+
+ procedure Parse (Str : String;
+ Time_Type : out time_t;
+ Abs_Time : out Time;
+ Delt_Time : out Duration) is
+ Year : Year_Number;
+ Month : Month_Number;
+ Day : Day_Number;
+ Minute : Integer := 0;
+ Idx : Integer := Str'First;
+ Ch : Character := Str (Idx);
+ Current_Time : Time;
+
+ begin
+ if Ch = '-' then
+ Time_Type := Absolute_Time;
+ Current_Time := Clock;
+ Day := Ada.Calendar.Day (Current_Time);
+ Month := Ada.Calendar.Month (Current_Time);
+ Year := Ada.Calendar.Year (Current_Time);
+ else
+ Time_Type := Delta_Time;
+ end if;
+ while Ch in '0' .. '9' loop
+ Minute := Minute + Character'Pos (Ch);
+ Idx := Idx + 1;
+ Ch := Str (Idx);
+ end loop;
+ if Time_Type = Absolute_Time then
+ Abs_Time := Time_Of (Year, Month, Day, Day_Duration (1));
+ else
+ Delt_Time := Duration (Float (Minute));
+ end if;
+ exception
+ when others => Opt7_Pkg.My_Raise_Exception;
+ end;
+
+end Opt7;
diff --git a/gcc/testsuite/gnat.dg/opt7.ads b/gcc/testsuite/gnat.dg/opt7.ads new file mode 100644 index 00000000000..c9803532670 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt7.ads @@ -0,0 +1,12 @@ +with Ada.Calendar; use Ada.Calendar;
+
+package Opt7 is
+
+ type time_t is (Absolute_Time, Delta_Time);
+
+ procedure Parse (Str : String;
+ Time_Type : out time_t;
+ Abs_Time : out Time;
+ Delt_Time : out Duration);
+
+end Opt7;
diff --git a/gcc/testsuite/gnat.dg/opt7_pkg.ads b/gcc/testsuite/gnat.dg/opt7_pkg.ads new file mode 100644 index 00000000000..db24f5dac7b --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt7_pkg.ads @@ -0,0 +1,5 @@ +package Opt7_Pkg is + + procedure My_Raise_Exception; + +end Opt7_Pkg; |