Patchwork [08/13] Eliminate label_to_block_map macro.

login
register
mail settings
Submitter David Malcolm
Date Dec. 6, 2013, 2:51 p.m.
Message ID <1386341499-19603-9-git-send-email-dmalcolm@redhat.com>
Download mbox | patch
Permalink /patch/298053/
State New
Headers show

Comments

David Malcolm - Dec. 6, 2013, 2:51 p.m.
gcc/
	* basic-block.h (label_to_block_map): Eliminate macro.

	* gimple.c (gimple_set_bb): Replace uses of label_to_block_map
	with uses of label_to_block_map_for_fn, making uses of cfun be
	explicit.
	* tree-cfg.c (delete_tree_cfg_annotations): Likewise.
	(verify_gimple_label): Likewise.
---
 gcc/basic-block.h | 1 -
 gcc/gimple.c      | 8 +++++---
 gcc/tree-cfg.c    | 5 +++--
 3 files changed, 8 insertions(+), 6 deletions(-)

Patch

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 69689f3..4ab8289 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -328,7 +328,6 @@  struct GTY(()) control_flow_graph {
 
 /* Defines for textual backward source compatibility.  */
 #define last_basic_block	(cfun->cfg->x_last_basic_block)
-#define label_to_block_map	(cfun->cfg->x_label_to_block_map)
 #define profile_status		(cfun->cfg->x_profile_status)
 
 /* For iterating over basic blocks.  */
diff --git a/gcc/gimple.c b/gcc/gimple.c
index f11362a..077dca5 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1475,17 +1475,19 @@  gimple_set_bb (gimple stmt, basic_block bb)
       uid = LABEL_DECL_UID (t);
       if (uid == -1)
 	{
-	  unsigned old_len = vec_safe_length (label_to_block_map);
+	  unsigned old_len =
+	    vec_safe_length (label_to_block_map_for_fn (cfun));
 	  LABEL_DECL_UID (t) = uid = cfun->cfg->last_label_uid++;
 	  if (old_len <= (unsigned) uid)
 	    {
 	      unsigned new_len = 3 * uid / 2 + 1;
 
-	      vec_safe_grow_cleared (label_to_block_map, new_len);
+	      vec_safe_grow_cleared (label_to_block_map_for_fn (cfun),
+				     new_len);
 	    }
 	}
 
-      (*label_to_block_map)[uid] = bb;
+      (*label_to_block_map_for_fn (cfun))[uid] = bb;
     }
 }
 
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 9558546..f384b04 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2379,7 +2379,7 @@  stmt_ends_bb_p (gimple t)
 void
 delete_tree_cfg_annotations (void)
 {
-  vec_free (label_to_block_map);
+  vec_free (label_to_block_map_for_fn (cfun));
 }
 
 
@@ -4281,7 +4281,8 @@  verify_gimple_label (gimple stmt)
 
   uid = LABEL_DECL_UID (decl);
   if (cfun->cfg
-      && (uid == -1 || (*label_to_block_map)[uid] != gimple_bb (stmt)))
+      && (uid == -1
+	  || (*label_to_block_map_for_fn (cfun))[uid] != gimple_bb (stmt)))
     {
       error ("incorrect entry in label_to_block_map");
       err |= true;