Patchwork [05/13] Eliminate SET_BASIC_BLOCK macro.

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

Comments

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

	* cfg.c (compact_blocks): Replace uses of SET_BASIC_BLOCK
	with SET_BASIC_BLOCK_FOR_FN, making use of cfun explicit.
	(expunge_block): Likewise.
	* cfgrtl.c (create_basic_block_structure): Likewise.
	* df-core.c (df_compact_blocks, df_bb_replace): Likewise.
	* sel-sched.c (create_block_for_bookkeeping): Likewise.
	* tree-cfg.c (create_bb): Likewise.
---
 gcc/basic-block.h |  1 -
 gcc/cfg.c         | 10 +++++-----
 gcc/cfgrtl.c      |  2 +-
 gcc/df-core.c     |  8 ++++----
 gcc/sel-sched.c   |  4 ++--
 gcc/tree-cfg.c    |  2 +-
 6 files changed, 13 insertions(+), 14 deletions(-)

Patch

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index da93c6f..f759e27 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -333,7 +333,6 @@  struct GTY(()) control_flow_graph {
 #define profile_status		(cfun->cfg->x_profile_status)
 
 #define BASIC_BLOCK(N)		((*basic_block_info)[(N)])
-#define SET_BASIC_BLOCK(N,BB)	((*basic_block_info)[(N)] = (BB))
 
 /* For iterating over basic blocks.  */
 #define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 786fe48..f386168 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -153,8 +153,8 @@  compact_blocks (void)
 {
   int i;
 
-  SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN (cfun));
-  SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN (cfun));
+  SET_BASIC_BLOCK_FOR_FN (cfun, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN (cfun));
+  SET_BASIC_BLOCK_FOR_FN (cfun, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN (cfun));
 
   if (df)
     df_compact_blocks ();
@@ -165,14 +165,14 @@  compact_blocks (void)
       i = NUM_FIXED_BLOCKS;
       FOR_EACH_BB (bb)
 	{
-	  SET_BASIC_BLOCK (i, bb);
+	  SET_BASIC_BLOCK_FOR_FN (cfun, i, bb);
 	  bb->index = i;
 	  i++;
 	}
       gcc_assert (i == n_basic_blocks_for_fn (cfun));
 
       for (; i < last_basic_block; i++)
-	SET_BASIC_BLOCK (i, NULL);
+	SET_BASIC_BLOCK_FOR_FN (cfun, i, NULL);
     }
   last_basic_block = n_basic_blocks_for_fn (cfun);
 }
@@ -183,7 +183,7 @@  void
 expunge_block (basic_block b)
 {
   unlink_block (b);
-  SET_BASIC_BLOCK (b->index, NULL);
+  SET_BASIC_BLOCK_FOR_FN (cfun, b->index, NULL);
   n_basic_blocks_for_fn (cfun)--;
   /* We should be able to ggc_free here, but we are not.
      The dead SSA_NAMES are left pointing to dead statements that are pointing
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 63f44af..045d78b 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -331,7 +331,7 @@  create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)
   bb->index = last_basic_block++;
   bb->flags = BB_NEW | BB_RTL;
   link_block (bb, after);
-  SET_BASIC_BLOCK (bb->index, bb);
+  SET_BASIC_BLOCK_FOR_FN (cfun, bb->index, bb);
   df_bb_refs_record (bb->index, false);
   update_bb_for_insn (bb);
   BB_SET_PARTITION (bb, BB_UNPARTITIONED);
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 37876af..4fb92a9 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1601,7 +1601,7 @@  df_compact_blocks (void)
   i = NUM_FIXED_BLOCKS;
   FOR_EACH_BB (bb)
     {
-      SET_BASIC_BLOCK (i, bb);
+      SET_BASIC_BLOCK_FOR_FN (cfun, i, bb);
       bb->index = i;
       i++;
     }
@@ -1609,7 +1609,7 @@  df_compact_blocks (void)
   gcc_assert (i == n_basic_blocks_for_fn (cfun));
 
   for (; i < last_basic_block; i++)
-    SET_BASIC_BLOCK (i, NULL);
+    SET_BASIC_BLOCK_FOR_FN (cfun, i, NULL);
 
 #ifdef DF_DEBUG_CFG
   if (!df_lr->solutions_dirty)
@@ -1645,10 +1645,10 @@  df_bb_replace (int old_index, basic_block new_block)
     }
 
   df_clear_bb_dirty (new_block);
-  SET_BASIC_BLOCK (old_index, new_block);
+  SET_BASIC_BLOCK_FOR_FN (cfun, old_index, new_block);
   new_block->index = old_index;
   df_set_bb_dirty (BASIC_BLOCK (old_index));
-  SET_BASIC_BLOCK (new_block_index, NULL);
+  SET_BASIC_BLOCK_FOR_FN (cfun, new_block_index, NULL);
 }
 
 
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 1e3fcf0..1195f7e 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4663,8 +4663,8 @@  create_block_for_bookkeeping (edge e1, edge e2)
 	      new_bb->index = succ->index;
 	      succ->index = i;
 
-	      SET_BASIC_BLOCK (new_bb->index, new_bb);
-	      SET_BASIC_BLOCK (succ->index, succ);
+	      SET_BASIC_BLOCK_FOR_FN (cfun, new_bb->index, new_bb);
+	      SET_BASIC_BLOCK_FOR_FN (cfun, succ->index, succ);
 
 	      memcpy (&gbi, SEL_GLOBAL_BB_INFO (new_bb), sizeof (gbi));
 	      memcpy (SEL_GLOBAL_BB_INFO (new_bb), SEL_GLOBAL_BB_INFO (succ),
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 6c2cc16..2d7916b 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -610,7 +610,7 @@  create_bb (void *h, void *e, basic_block after)
     }
 
   /* Add the newly created block to the array.  */
-  SET_BASIC_BLOCK (last_basic_block, bb);
+  SET_BASIC_BLOCK_FOR_FN (cfun, last_basic_block, bb);
 
   n_basic_blocks_for_fn (cfun)++;
   last_basic_block++;