OSDN Git Service

2008-09-18 Martin Jambor <mjambor@suse.cz>
[pf3gnuchains/gcc-fork.git] / gcc / gimple.h
index 0c11f3e..03b6217 100644 (file)
@@ -38,6 +38,12 @@ DEF_VEC_P(gimple_seq);
 DEF_VEC_ALLOC_P(gimple_seq,gc);
 DEF_VEC_ALLOC_P(gimple_seq,heap);
 
+/* For each block, the PHI nodes that need to be rewritten are stored into
+   these vectors.  */
+typedef VEC(gimple, heap) *gimple_vec;
+DEF_VEC_P (gimple_vec);
+DEF_VEC_ALLOC_P (gimple_vec, heap);
+
 enum gimple_code {
 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
 #include "gimple.def"
@@ -816,6 +822,7 @@ enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
 void sort_case_labels (VEC(tree,heap) *);
 void gimple_set_body (tree, gimple_seq);
 gimple_seq gimple_body (tree);
+bool gimple_has_body_p (tree);
 gimple_seq gimple_seq_alloc (void);
 void gimple_seq_free (gimple_seq);
 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
@@ -872,10 +879,15 @@ extern bool is_gimple_lvalue (tree);
 bool is_gimple_address (const_tree);
 /* Returns true iff T is a GIMPLE invariant address.  */
 bool is_gimple_invariant_address (const_tree);
+/* Returns true iff T is a GIMPLE invariant address at interprocedural
+   level.  */
+bool is_gimple_ip_invariant_address (const_tree);
 /* Returns true iff T is a valid GIMPLE constant.  */
 bool is_gimple_constant (const_tree);
 /* Returns true iff T is a GIMPLE restricted function invariant.  */
 extern bool is_gimple_min_invariant (const_tree);
+/* Returns true iff T is a GIMPLE restricted interprecodural invariant.  */
+extern bool is_gimple_ip_invariant (const_tree);
 /* Returns true iff T is a GIMPLE rvalue.  */
 extern bool is_gimple_val (tree);
 /* Returns true iff T is a GIMPLE asm statement input.  */
@@ -1041,6 +1053,7 @@ gimple_has_substatements (gimple g)
     case GIMPLE_OMP_TASK:
     case GIMPLE_OMP_SECTIONS:
     case GIMPLE_OMP_SINGLE:
+    case GIMPLE_OMP_CRITICAL:
     case GIMPLE_WITH_CLEANUP_EXPR:
       return true;
 
@@ -1834,6 +1847,17 @@ gimple_assign_set_rhs_code (gimple s, enum tree_code code)
 }
 
 
+/* Return the gimple rhs class of the code of the expression computed on
+   the rhs of assignment statement GS.
+   This will never return GIMPLE_INVALID_RHS.  */
+
+static inline enum gimple_rhs_class
+gimple_assign_rhs_class (const_gimple gs)
+{
+  return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
+}
+
+
 /* Return true if S is a type-cast assignment.  */
 
 static inline bool
@@ -1842,8 +1866,7 @@ gimple_assign_cast_p (gimple s)
   if (is_gimple_assign (s))
     {
       enum tree_code sc = gimple_assign_rhs_code (s);
-      return sc == NOP_EXPR
-            || sc == CONVERT_EXPR
+      return CONVERT_EXPR_CODE_P (sc)
             || sc == VIEW_CONVERT_EXPR
             || sc == FIX_TRUNC_EXPR;
     }
@@ -1894,7 +1917,7 @@ gimple_call_set_lhs (gimple gs, tree lhs)
 
 
 /* Return the tree node representing the function called by call
-   statement GS.  This may or may not be a FUNCTION_DECL node.  */
+   statement GS.  */
 
 static inline tree
 gimple_call_fn (const_gimple gs)
@@ -1926,6 +1949,17 @@ gimple_call_set_fn (gimple gs, tree fn)
 }
 
 
+/* Set FNDECL to be the function called by call statement GS.  */
+
+static inline void
+gimple_call_set_fndecl (gimple gs, tree decl)
+{
+  GIMPLE_CHECK (gs, GIMPLE_CALL);
+  gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
+  gimple_set_op (gs, 1, build_fold_addr_expr (decl));
+}
+
+
 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
    Otherwise return NULL.  This function is analogous to
    get_callee_fndecl in tree land.  */
@@ -1933,8 +1967,13 @@ gimple_call_set_fn (gimple gs, tree fn)
 static inline tree
 gimple_call_fndecl (const_gimple gs)
 {
-  tree decl = gimple_call_fn (gs);
-  return (TREE_CODE (decl) == FUNCTION_DECL) ? decl : NULL_TREE;
+  tree addr = gimple_call_fn (gs);
+  if (TREE_CODE (addr) == ADDR_EXPR)
+    {
+      gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL);
+      return TREE_OPERAND (addr, 0);
+    }
+  return NULL_TREE;
 }
 
 
@@ -1946,9 +1985,9 @@ gimple_call_return_type (const_gimple gs)
   tree fn = gimple_call_fn (gs);
   tree type = TREE_TYPE (fn);
 
-  /* See through pointers.  */
-  if (POINTER_TYPE_P (type))
-    type = TREE_TYPE (type);
+  /* See through the pointer.  */
+  gcc_assert (POINTER_TYPE_P (type));
+  type = TREE_TYPE (type);
 
   gcc_assert (TREE_CODE (type) == FUNCTION_TYPE
              || TREE_CODE (type) == METHOD_TYPE);
@@ -1986,7 +2025,7 @@ gimple_call_set_chain (gimple gs, tree chain)
   GIMPLE_CHECK (gs, GIMPLE_CALL);
   gcc_assert (chain == NULL
               || TREE_CODE (chain) == ADDR_EXPR
-              || DECL_P (chain));
+              || SSA_VAR_P (chain));
   gimple_set_op (gs, 2, chain);
 }
 
@@ -4440,6 +4479,7 @@ basic_block gsi_insert_on_edge_immediate (edge, gimple);
 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
 void gsi_commit_one_edge_insert (edge, basic_block *);
 void gsi_commit_edge_inserts (void);
+gimple giple_copy_call_skip_args (gimple, bitmap);
 
 
 /* Convenience routines to walk all statements of a gimple function.