This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tuples] revert constification patch


This patch reverts the bits of the constification patch that provide
shadow functions and other cumbersome machinery in the middle end.  It's
way too hard to maintain this, and Diego suggested I remove it until the
next merge hopefully gets rid of it.

Committed to branch.

Aldy

	* Revert the parts of Kaveh's constification patch.that duplicate
	API calls.

Index: tree-ssa-threadupdate.c
===================================================================
--- tree-ssa-threadupdate.c	(revision 127870)
+++ tree-ssa-threadupdate.c	(working copy)
@@ -463,24 +463,24 @@ redirect_edges (void **slot, void *data)
 static bool
 redirection_block_p (const_basic_block bb)
 {
-  const_block_stmt_iterator bsi;
+  block_stmt_iterator bsi;
 
   /* Advance to the first executable statement.  */
-  bsi = cbsi_start (bb);
-  while (!cbsi_end_p (bsi)
-          && (TREE_CODE (cbsi_stmt (bsi)) == LABEL_EXPR
-              || gimple_nop_p (cbsi_stmt (bsi))))
-    cbsi_next (&bsi);
+  bsi = bsi_start (bb);
+  while (!bsi_end_p (bsi)
+          && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
+              || gimple_nop_p (bsi_stmt (bsi))))
+    bsi_next (&bsi);
 
   /* Check if this is an empty block.  */
-  if (cbsi_end_p (bsi))
+  if (bsi_end_p (bsi))
     return true;
 
   /* Test that we've reached the terminating control statement.  */
-  return cbsi_stmt (bsi)
-	 && (TREE_CODE (cbsi_stmt (bsi)) == COND_EXPR
-	     || TREE_CODE (cbsi_stmt (bsi)) == GOTO_EXPR
-	     || TREE_CODE (cbsi_stmt (bsi)) == SWITCH_EXPR);
+  return bsi_stmt (bsi)
+	 && (TREE_CODE (bsi_stmt (bsi)) == COND_EXPR
+	     || TREE_CODE (bsi_stmt (bsi)) == GOTO_EXPR
+	     || TREE_CODE (bsi_stmt (bsi)) == SWITCH_EXPR);
 }
 
 /* BB is a block which ends with a COND_EXPR or SWITCH_EXPR and when BB
Index: tree-gimple.c
===================================================================
--- tree-gimple.c	(revision 127870)
+++ tree-gimple.c	(working copy)
@@ -470,11 +470,6 @@ get_call_expr_in (tree t)
   GET_CALL_EXPR_IN_BODY;
 }
 
-const_tree
-const_get_call_expr_in (const_tree t)
-{
-  GET_CALL_EXPR_IN_BODY;
-}
 
 /* Given a memory reference expression T, return its base address.
    The base address of a memory reference expression is the main
Index: tree-gimple.h
===================================================================
--- tree-gimple.h	(revision 127870)
+++ tree-gimple.h	(working copy)
@@ -101,7 +101,6 @@ extern bool is_gimple_non_addressable (t
 extern bool is_gimple_call_addr (tree);
 /* If T makes a function call, returns the CALL_EXPR operand.  */
 extern tree get_call_expr_in (tree t);
-extern const_tree const_get_call_expr_in (const_tree t);
 
 extern void recalculate_side_effects (tree);
 extern enum gimple_rhs_class get_gimple_rhs_class (tree);
Index: tree-eh.c
===================================================================
--- tree-eh.c	(revision 127870)
+++ tree-eh.c	(working copy)
@@ -148,7 +148,7 @@ remove_stmt_from_eh_region (gimple t)
 }
 
 int
-lookup_stmt_eh_region_fn (struct function *ifun, const_gimple t)
+lookup_stmt_eh_region_fn (struct function *ifun, gimple t)
 {
   struct throw_stmt_node *p, n;
 
@@ -165,7 +165,7 @@ lookup_stmt_eh_region_fn (struct functio
 }
 
 int
-lookup_stmt_eh_region (const_gimple t)
+lookup_stmt_eh_region (gimple t)
 {
   /* We can get called from initialized data when -fnon-call-exceptions
      is on; prevent crash.  */
@@ -2035,7 +2035,7 @@ tree_could_throw_p (tree t)
 }
 
 bool
-stmt_can_throw_internal (const_gimple stmt)
+stmt_can_throw_internal (gimple stmt)
 {
   int region_nr;
   bool is_resx = false;
Index: tree-flow-inline.h
===================================================================
--- tree-flow-inline.h	(revision 127870)
+++ tree-flow-inline.h	(working copy)
@@ -754,21 +754,6 @@ bsi_start (basic_block bb)
   return bsi;
 }
 
-static inline const_block_stmt_iterator
-cbsi_start (const_basic_block bb)
-{
-  const_block_stmt_iterator bsi;
-  if (bb->index < NUM_FIXED_BLOCKS)
-    {
-      bsi.tsi.ptr = NULL;
-      bsi.tsi.container = NULL;
-    }
-  else
-    bsi.tsi = ctsi_start (bb_seq (bb));
-  bsi.bb = bb;
-  return bsi;
-}
-
 /* Return a block statement iterator that points to the first non-label
    statement in block BB.  */
 
@@ -801,21 +786,6 @@ bsi_last (basic_block bb)
   return bsi;
 }
 
-static inline const_block_stmt_iterator
-cbsi_last (const_basic_block bb)
-{
-  const_block_stmt_iterator bsi;
-
-  if (bb->index < NUM_FIXED_BLOCKS)
-    {
-      bsi.tsi.ptr = NULL;
-      bsi.tsi.container = NULL;
-    }
-  else
-    bsi.tsi = ctsi_last (bb_seq (bb));
-  bsi.bb = bb;
-  return bsi;
-}
 
 /* Return true if block statement iterator I has reached the end of
    the basic block.  */
@@ -825,12 +795,6 @@ bsi_end_p (block_stmt_iterator i)
   return gsi_end_p (i.gsi);
 }
 
-static inline bool
-cbsi_end_p (const_block_stmt_iterator i)
-{
-  return ctsi_end_p (i.tsi);
-}
-
 /* Modify block statement iterator I so that it is at the next
    statement in the basic block.  */
 static inline void
@@ -839,12 +803,6 @@ bsi_next (block_stmt_iterator *i)
   gsi_next (i->gsi);
 }
 
-static inline void
-cbsi_next (const_block_stmt_iterator *i)
-{
-  ctsi_next (&i->tsi);
-}
-
 /* Modify block statement iterator I so that it is at the previous
    statement in the basic block.  */
 static inline void
@@ -853,12 +811,6 @@ bsi_prev (block_stmt_iterator *i)
   gsi_prev (i->gsi);
 }
 
-static inline void
-cbsi_prev (const_block_stmt_iterator *i)
-{
-  ctsi_prev (&i->tsi);
-}
-
 /* Return the statement that block statement iterator I is currently
    at.  */
 static inline gimple
@@ -867,12 +819,6 @@ bsi_stmt (block_stmt_iterator i)
   return gsi_stmt (i.gsi);
 }
 
-static inline const_tree
-cbsi_stmt (const_block_stmt_iterator i)
-{
-  return ctsi_stmt (i.tsi);
-}
-
 /* Return a pointer to the statement that block statement iterator I
    is currently at.  */
 static inline tree *
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 127870)
+++ gimplify.c	(working copy)
@@ -754,7 +754,7 @@ gimple_add_tmp_var (tree tmp)
 /* Determines whether to assign a locus to the statement GS.  */
 
 static bool
-should_carry_locus_p (const_gimple gs)
+should_carry_locus_p (gimple gs)
 {
   /* Don't emit a line note for a label.  We particularly don't want to
      emit one for the break label, since it doesn't actually correspond
Index: tree-ssa-phiopt.c
===================================================================
--- tree-ssa-phiopt.c	(revision 127870)
+++ tree-ssa-phiopt.c	(working copy)
@@ -299,16 +299,16 @@ blocks_in_phiopt_order (void)
 bool
 empty_block_p (const_basic_block bb)
 {
-  const_block_stmt_iterator bsi;
+  block_stmt_iterator bsi;
 
   /* BB must have no executable statements.  */
-  bsi = cbsi_start (bb);
-  while (!cbsi_end_p (bsi)
-	  && (TREE_CODE (cbsi_stmt (bsi)) == LABEL_EXPR
-	      || gimple_nop_p (cbsi_stmt (bsi))))
-    cbsi_next (&bsi);
+  bsi = bsi_start (bb);
+  while (!bsi_end_p (bsi)
+	  && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
+	      || gimple_nop_p (bsi_stmt (bsi))))
+    bsi_next (&bsi);
 
-  if (!cbsi_end_p (bsi))
+  if (!bsi_end_p (bsi))
     return false;
 
   return true;
Index: except.h
===================================================================
--- except.h	(revision 127870)
+++ except.h	(working copy)
@@ -112,8 +112,8 @@ extern int eh_region_outermost (struct f
 /* tree-eh.c */
 extern void add_stmt_to_eh_region_fn (struct function *, gimple, int);
 extern bool remove_stmt_from_eh_region_fn (struct function *, gimple);
-extern int lookup_stmt_eh_region_fn (struct function *, const_gimple);
-extern int lookup_stmt_eh_region (const_gimple);
+extern int lookup_stmt_eh_region_fn (struct function *, gimple);
+extern int lookup_stmt_eh_region (gimple);
 extern bool verify_eh_edges (tree);
 
 /* If non-NULL, this is a function that returns an expression to be
Index: tree-flow.h
===================================================================
--- tree-flow.h	(revision 127870)
+++ tree-flow.h	(working copy)
@@ -633,9 +633,7 @@ typedef struct {
 } const_block_stmt_iterator;
 
 static inline block_stmt_iterator bsi_start (basic_block);
-static inline const_block_stmt_iterator cbsi_start (const_basic_block);
 static inline block_stmt_iterator bsi_last (basic_block);
-static inline const_block_stmt_iterator cbsi_last (const_basic_block);
 static inline block_stmt_iterator bsi_after_labels (basic_block);
 block_stmt_iterator bsi_for_stmt (gimple);
 static inline bool bsi_end_p (block_stmt_iterator);
@@ -726,12 +724,12 @@ extern void free_omp_regions (void);
 #define PENDING_STMT(e)	((e)->insns.t)
 
 extern void delete_tree_cfg_annotations (void);
-extern bool stmt_ends_bb_p (const_gimple);
-extern bool is_ctrl_stmt (const_gimple);
-extern bool is_ctrl_altering_stmt (const_gimple);
-extern bool computed_goto_p (const_gimple);
-extern bool simple_goto_p (const_gimple);
-extern bool stmt_can_make_abnormal_goto (const_gimple);
+extern bool stmt_ends_bb_p (gimple);
+extern bool is_ctrl_stmt (gimple);
+extern bool is_ctrl_altering_stmt (gimple);
+extern bool computed_goto_p (gimple);
+extern bool simple_goto_p (gimple);
+extern bool stmt_can_make_abnormal_goto (gimple);
 extern basic_block single_noncomplex_succ (basic_block bb);
 extern void tree_dump_bb (basic_block, FILE *, int);
 extern void debug_tree_bb (basic_block);
@@ -745,9 +743,7 @@ extern void print_loop_ir (FILE *);
 extern void cleanup_dead_labels (void);
 extern void group_case_labels (void);
 extern gimple first_stmt (basic_block);
-extern const_gimple const_first_stmt (const_basic_block);
 extern gimple last_stmt (basic_block);
-extern const_gimple const_last_stmt (const_basic_block);
 extern gimple last_and_only_stmt (basic_block);
 extern edge find_taken_edge (basic_block, tree);
 extern basic_block label_to_block_fn (struct function *, tree);
@@ -1080,7 +1076,7 @@ static inline bool unmodifiable_var_p (c
 extern void make_eh_edges (gimple);
 extern bool tree_could_trap_p (tree);
 extern bool tree_could_throw_p (tree);
-extern bool stmt_can_throw_internal (const_gimple);
+extern bool stmt_can_throw_internal (gimple);
 extern bool tree_can_throw_external (tree);
 extern void add_stmt_to_eh_region (gimple, int);
 extern bool remove_stmt_from_eh_region (gimple);
Index: tree-cfg.c
===================================================================
--- tree-cfg.c	(revision 127870)
+++ tree-cfg.c	(working copy)
@@ -97,7 +97,7 @@ static edge tree_try_redirect_by_replaci
 static unsigned int split_critical_edges (void);
 
 /* Various helpers.  */
-static inline bool stmt_starts_bb_p (const_gimple, const_gimple);
+static inline bool stmt_starts_bb_p (gimple, gimple);
 static int tree_verify_flow_info (void);
 static void tree_make_forwarder_block (edge);
 static void tree_cfg2vcg (FILE *);
@@ -1141,8 +1141,8 @@ group_case_labels (void)
 static bool
 tree_can_merge_blocks_p (const_basic_block a, const_basic_block b)
 {
-  const_gimple stmt;
-  const_block_stmt_iterator bsi;
+  gimple stmt;
+  block_stmt_iterator bsi;
   gimple_seq phis;
 
   if (!single_succ_p (a))
@@ -1162,7 +1162,7 @@ tree_can_merge_blocks_p (const_basic_blo
 
   /* If A ends by a statement causing exceptions or something similar, we
      cannot merge the blocks.  */
-  stmt = const_last_stmt (a);
+  stmt = last_stmt (a);
   if (stmt && stmt_ends_bb_p (stmt))
     return false;
 
@@ -1195,9 +1195,9 @@ tree_can_merge_blocks_p (const_basic_blo
     }
 
   /* Do not remove user labels.  */
-  for (bsi = cbsi_start (b); !cbsi_end_p (bsi); cbsi_next (&bsi))
+  for (bsi = bsi_start (b); !bsi_end_p (bsi); bsi_next (&bsi))
     {
-      stmt = cbsi_stmt (bsi);
+      stmt = bsi_stmt (bsi);
       if (gimple_code (stmt) != GIMPLE_LABEL)
 	break;
       if (!DECL_ARTIFICIAL (gimple_label_label (stmt)))
@@ -2450,7 +2450,7 @@ tree_cfg2vcg (FILE *file)
 /* Return true if T represents a stmt that always transfers control.  */
 
 bool
-is_ctrl_stmt (const_gimple t)
+is_ctrl_stmt (gimple t)
 {
   return gimple_code (t) == GIMPLE_COND
     || gimple_code (t) == GIMPLE_SWITCH
@@ -2464,7 +2464,7 @@ is_ctrl_stmt (const_gimple t)
    (e.g., a call to a non-returning function).  */
 
 bool
-is_ctrl_altering_stmt (const_gimple t)
+is_ctrl_altering_stmt (gimple t)
 {
   gcc_assert (t);
 
@@ -2493,7 +2493,7 @@ is_ctrl_altering_stmt (const_gimple t)
 /* FIXME tuples: This is unused elsewhere.  It should be a static.  */
 
 bool
-computed_goto_p (const_gimple t)
+computed_goto_p (gimple t)
 {
   return (gimple_code (t) == GIMPLE_GOTO
 	  && TREE_CODE (gimple_goto_dest (t)) != LABEL_DECL);
@@ -2503,7 +2503,7 @@ computed_goto_p (const_gimple t)
 /* Return true if T is a simple local goto.  */
 
 bool
-simple_goto_p (const_gimple t)
+simple_goto_p (gimple t)
 {
   return (gimple_code (t) == GIMPLE_GOTO
 	  && TREE_CODE (gimple_goto_dest (t)) == LABEL_DECL);
@@ -2514,7 +2514,7 @@ simple_goto_p (const_gimple t)
    Transfers of control flow associated with EH are excluded.  */
 
 bool
-stmt_can_make_abnormal_goto (const_gimple t)
+stmt_can_make_abnormal_goto (gimple t)
 {
   if (computed_goto_p (t))
     return true;
@@ -2533,7 +2533,7 @@ stmt_can_make_abnormal_goto (const_gimpl
    label.  */
 
 static inline bool
-stmt_starts_bb_p (const_gimple stmt, const_gimple prev_stmt)
+stmt_starts_bb_p (gimple stmt, gimple prev_stmt)
 {
   if (stmt == NULL)
     return false;
@@ -2567,7 +2567,7 @@ stmt_starts_bb_p (const_gimple stmt, con
 /* Return true if T should end a basic block.  */
 
 bool
-stmt_ends_bb_p (const_gimple t)
+stmt_ends_bb_p (gimple t)
 {
   return is_ctrl_stmt (t) || is_ctrl_altering_stmt (t);
 }
@@ -2601,13 +2601,6 @@ first_stmt (basic_block bb)
   return !bsi_end_p (i) ? bsi_stmt (i) : NULL_TREE;
 }
 
-const_gimple
-const_first_stmt (const_basic_block bb)
-{
-  const_block_stmt_iterator i = cbsi_start (bb);
-  return !cbsi_end_p (i) ? cbsi_stmt (i) : NULL_TREE;
-}
-
 /* Return the last statement in basic block BB.  */
 
 gimple
@@ -2617,13 +2610,6 @@ last_stmt (basic_block bb)
   return !bsi_end_p (b) ? bsi_stmt (b) : NULL_TREE;
 }
 
-const_gimple
-const_last_stmt (const_basic_block bb)
-{
-  const_block_stmt_iterator b = cbsi_last (bb);
-  return !cbsi_end_p (b) ? cbsi_stmt (b) : NULL_TREE;
-}
-
 /* Return the last statement of an otherwise empty block.  Return NULL
    if the block is totally empty, or if it contains more than one
    statement.  */
@@ -5944,8 +5930,8 @@ debug_loop_ir (void)
 static bool
 tree_block_ends_with_call_p (const_basic_block bb)
 {
-  const_block_stmt_iterator bsi = cbsi_last (bb);
-  return const_get_call_expr_in (cbsi_stmt (bsi)) != NULL;
+  block_stmt_iterator bsi = bsi_last (bb);
+  return get_call_expr_in (bsi_stmt (bsi)) != NULL;
 }
 
 
@@ -5955,7 +5941,7 @@ tree_block_ends_with_call_p (const_basic
 static bool
 tree_block_ends_with_condjump_p (const_basic_block bb)
 {
-  const_tree stmt = const_last_stmt (bb);
+  tree stmt = last_stmt (bb);
   return (stmt && TREE_CODE (stmt) == COND_EXPR);
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]