/* Inline functions for tree-flow.h
- Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#ifndef _TREE_FLOW_INLINE_H
#define _TREE_FLOW_INLINE_H 1
infrastructure is initialized. Check for presence of the datastructures
at first place. */
static inline bool
-gimple_in_ssa_p (struct function *fun)
+gimple_in_ssa_p (const struct function *fun)
{
return fun && fun->gimple_df && fun->gimple_df->in_ssa_p;
}
/* 'true' after aliases have been computed (see compute_may_aliases). */
static inline bool
-gimple_aliases_computed_p (struct function *fun)
+gimple_aliases_computed_p (const struct function *fun)
{
gcc_assert (fun && fun->gimple_df);
return fun->gimple_df->aliases_computed_p;
call-clobbered variables are addressable (e.g., a local static
variable). */
static inline bitmap
-gimple_addressable_vars (struct function *fun)
+gimple_addressable_vars (const struct function *fun)
{
gcc_assert (fun && fun->gimple_df);
return fun->gimple_df->addressable_vars;
/* Call clobbered variables in the function. If bit I is set, then
REFERENCED_VARS (I) is call-clobbered. */
static inline bitmap
-gimple_call_clobbered_vars (struct function *fun)
+gimple_call_clobbered_vars (const struct function *fun)
{
gcc_assert (fun && fun->gimple_df);
return fun->gimple_df->call_clobbered_vars;
/* Array of all variables referenced in the function. */
static inline htab_t
-gimple_referenced_vars (struct function *fun)
+gimple_referenced_vars (const struct function *fun)
{
if (!fun->gimple_df)
return NULL;
/* Artificial variable used to model the effects of function calls. */
static inline tree
-gimple_global_var (struct function *fun)
+gimple_global_var (const struct function *fun)
{
gcc_assert (fun && fun->gimple_df);
return fun->gimple_df->global_var;
/* Artificial variable used to model the effects of nonlocal
variables. */
static inline tree
-gimple_nonlocal_all (struct function *fun)
+gimple_nonlocal_all (const struct function *fun)
{
gcc_assert (fun && fun->gimple_df);
return fun->gimple_df->nonlocal_all;
/* Hashtable of variables annotations. Used for static variables only;
local variables have direct pointer in the tree node. */
static inline htab_t
-gimple_var_anns (struct function *fun)
+gimple_var_anns (const struct function *fun)
{
return fun->gimple_df->var_anns;
}
or NULL if we have reached the end. */
static inline bool
-end_htab_p (htab_iterator *hti)
+end_htab_p (const htab_iterator *hti)
{
if (hti->slot >= hti->limit)
return true;
iterating through. */
static inline bool
-end_referenced_vars_p (referenced_var_iterator *iter)
+end_referenced_vars_p (const referenced_var_iterator *iter)
{
return end_htab_p (&iter->hti);
}
/* Return the variable annotation for T, which must be a _DECL node.
Return NULL if the variable annotation doesn't already exist. */
static inline var_ann_t
-var_ann (tree t)
+var_ann (const_tree t)
{
gcc_assert (t);
gcc_assert (DECL_P (t));
/* Return the function annotation for T, which must be a FUNCTION_DECL node.
Return NULL if the function annotation doesn't already exist. */
static inline function_ann_t
-function_ann (tree t)
+function_ann (const_tree t)
{
gcc_assert (t);
gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
/* Return the may_aliases bitmap for variable VAR, or NULL if it has
no may aliases. */
static inline bitmap
-may_aliases (tree var)
+may_aliases (const_tree var)
{
return MTAG_ALIASES (var);
}
/* Return the line number for EXPR, or return -1 if we have no line
number information for it. */
static inline int
-get_lineno (tree expr)
+get_lineno (const_tree expr)
{
if (expr == NULL_TREE)
return -1;
return EXPR_LINENO (expr);
}
-/* Return the file name for EXPR, or return "???" if we have no
- filename information. */
-static inline const char *
-get_filename (tree expr)
-{
- const char *filename;
- if (expr == NULL_TREE)
- return "???";
-
- if (TREE_CODE (expr) == COMPOUND_EXPR)
- expr = TREE_OPERAND (expr, 0);
-
- if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
- return filename;
- else
- return "???";
-}
-
/* Return true if T is a noreturn call. */
static inline bool
noreturn_call_p (tree t)
/* Return true is IMM has reached the end of the immediate use list. */
static inline bool
-end_readonly_imm_use_p (imm_use_iterator *imm)
+end_readonly_imm_use_p (const imm_use_iterator *imm)
{
return (imm->imm_use == imm->end_p);
}
/* Return true if VAR has no uses. */
static inline bool
-has_zero_uses (tree var)
+has_zero_uses (const_tree var)
{
- ssa_use_operand_t *ptr;
- ptr = &(SSA_NAME_IMM_USE_NODE (var));
+ const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
/* A single use means there is no items in the list. */
return (ptr == ptr->next);
}
/* Return true if VAR has a single use. */
static inline bool
-has_single_use (tree var)
+has_single_use (const_tree var)
{
- ssa_use_operand_t *ptr;
- ptr = &(SSA_NAME_IMM_USE_NODE (var));
+ const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
/* A single use means there is one item in the list. */
return (ptr != ptr->next && ptr == ptr->next->next);
}
/* If VAR has only a single immediate use, return true, and set USE_P and STMT
to the use pointer and stmt of occurrence. */
static inline bool
-single_imm_use (tree var, use_operand_p *use_p, tree *stmt)
+single_imm_use (const_tree var, use_operand_p *use_p, tree *stmt)
{
- ssa_use_operand_t *ptr;
-
- ptr = &(SSA_NAME_IMM_USE_NODE (var));
+ const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
if (ptr != ptr->next && ptr == ptr->next->next)
{
*use_p = ptr->next;
/* Return the number of immediate uses of VAR. */
static inline unsigned int
-num_imm_uses (tree var)
+num_imm_uses (const_tree var)
{
- ssa_use_operand_t *ptr, *start;
- unsigned int num;
+ const ssa_use_operand_t *const start = &(SSA_NAME_IMM_USE_NODE (var));
+ const ssa_use_operand_t *ptr;
+ unsigned int num = 0;
- start = &(SSA_NAME_IMM_USE_NODE (var));
- num = 0;
for (ptr = start->next; ptr != start; ptr = ptr->next)
num++;
/* Return the PHI nodes for basic block BB, or NULL if there are no
PHI nodes. */
static inline tree
-phi_nodes (basic_block bb)
+phi_nodes (const_basic_block bb)
{
gcc_assert (!(bb->flags & BB_RTL));
if (!bb->il.tree)
ann->used = 1;
}
-/* Return true if T is an executable statement. */
-static inline bool
-is_exec_stmt (tree t)
-{
- return (t && !IS_EMPTY_STMT (t) && t != error_mark_node);
-}
-
-
-/* Return true if this stmt can be the target of a control transfer stmt such
- as a goto. */
-static inline bool
-is_label_stmt (tree t)
-{
- if (t)
- switch (TREE_CODE (t))
- {
- case LABEL_DECL:
- case LABEL_EXPR:
- case CASE_LABEL_EXPR:
- return true;
- default:
- return false;
- }
- return false;
-}
/* Return true if T (assumed to be a DECL) is a global variable. */
static inline bool
-is_global_var (tree t)
+is_global_var (const_tree t)
{
if (MTAG_P (t))
return (TREE_STATIC (t) || MTAG_GLOBAL (t));
slip in in the meantime. */
static inline bool
-phi_ssa_name_p (tree t)
+phi_ssa_name_p (const_tree t)
{
if (TREE_CODE (t) == SSA_NAME)
return true;
/* Returns the list of statements in BB. */
static inline tree
-bb_stmt_list (basic_block bb)
+bb_stmt_list (const_basic_block bb)
{
gcc_assert (!(bb->flags & BB_RTL));
return bb->il.tree->stmt_list;
name for a memory partition. */
static inline bool
-factoring_name_p (tree name)
+factoring_name_p (const_tree name)
{
return TREE_CODE (SSA_NAME_VAR (name)) == MEMORY_PARTITION_TAG;
}
/* Return true if VAR is a clobbered by function calls. */
static inline bool
-is_call_clobbered (tree var)
+is_call_clobbered (const_tree var)
{
if (!MTAG_P (var))
return var_ann (var)->call_clobbered;
/* Return the common annotation for T. Return NULL if the annotation
doesn't already exist. */
static inline tree_ann_common_t
-tree_common_ann (tree t)
+tree_common_ann (const_tree t)
{
/* Watch out static variables with unshared annotations. */
if (DECL_P (t) && TREE_CODE (t) == VAR_DECL)
/* Return true if PTR is finished iterating. */
static inline bool
-op_iter_done (ssa_op_iter *ptr)
+op_iter_done (const ssa_op_iter *ptr)
{
return ptr->done;
}
/* Return true is IMM has reached the end of the immediate use stmt list. */
static inline bool
-end_imm_use_stmt_p (imm_use_iterator *imm)
+end_imm_use_stmt_p (const imm_use_iterator *imm)
{
return (imm->imm_use == imm->end_p);
}
link_use_stmts_after (imm->imm_use, imm);
return USE_STMT (imm->imm_use);
-
}
/* This routine will return the first use on the stmt IMM currently refers
/* Return TRUE if the last use on the stmt IMM refers to has been visited. */
static inline bool
-end_imm_use_on_stmt_p (imm_use_iterator *imm)
+end_imm_use_on_stmt_p (const imm_use_iterator *imm)
{
return (imm->imm_use == &(imm->iter_node));
}
/* Return true if VAR cannot be modified by the program. */
static inline bool
-unmodifiable_var_p (tree var)
+unmodifiable_var_p (const_tree var)
{
if (TREE_CODE (var) == SSA_NAME)
var = SSA_NAME_VAR (var);
/* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in it. */
static inline bool
-array_ref_contains_indirect_ref (tree ref)
+array_ref_contains_indirect_ref (const_tree ref)
{
gcc_assert (TREE_CODE (ref) == ARRAY_REF);
somewhere in it. */
static inline bool
-ref_contains_array_ref (tree ref)
+ref_contains_array_ref (const_tree ref)
{
gcc_assert (handled_component_p (ref));
subvariables for it. */
static inline subvar_t *
-lookup_subvars_for_var (tree var)
+lookup_subvars_for_var (const_tree var)
{
var_ann_t ann = var_ann (var);
gcc_assert (ann);
types which are not gimple registers can have subvars. */
static inline bool
-var_can_have_subvars (tree v)
+var_can_have_subvars (const_tree v)
{
/* Volatile variables should never have subvars. */
if (TREE_THIS_VOLATILE (v))
static inline bool
overlap_subvar (unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size,
- tree sv, bool *exact)
+ const_tree sv, bool *exact)
{
/* There are three possible cases of overlap.
1. We can have an exact overlap, like so:
{
if (TREE_CODE (expr) == SSA_NAME)
return SSA_NAME_VALUE (expr);
- else if (TREE_CODE (expr) == TREE_LIST
+ else if (DECL_P (expr) || TREE_CODE (expr) == TREE_LIST
|| TREE_CODE (expr) == CONSTRUCTOR)
{
tree_ann_common_t ann = tree_common_ann (expr);
return ((ann) ? ann->value_handle : NULL_TREE);
}
- else if (DECL_P (expr))
- {
- tree *result = (tree *)pointer_map_contains (decl_vh_map,
- expr);
- if (result)
- return *result;
- return NULL_TREE;
- }
else if (is_gimple_min_invariant (expr))
return expr;
else if (EXPR_P (expr))
/* Accessor to tree-ssa-operands.c caches. */
static inline struct ssa_operands *
-gimple_ssa_operands (struct function *fun)
+gimple_ssa_operands (const struct function *fun)
{
return &fun->gimple_df->ssa_operands;
}
/* Map describing reference statistics for function FN. */
static inline struct mem_ref_stats_d *
-gimple_mem_ref_stats (struct function *fn)
+gimple_mem_ref_stats (const struct function *fn)
{
return &fn->gimple_df->mem_ref_stats;
}