]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/tree-gimple.h
rtl.h (MEM_READONLY_P): Replace RTX_UNCHANGING_P.
[thirdparty/gcc.git] / gcc / tree-gimple.h
CommitLineData
6de9cd9a
DN
1/* Functions to analyze and validate GIMPLE trees.
2 Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3 Contributed by Diego Novillo <dnovillo@redhat.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22#ifndef _TREE_SIMPLE_H
23#define _TREE_SIMPLE_H 1
24
25
26#include "tree-iterator.h"
27
28extern tree create_tmp_var_raw (tree, const char *);
7e140280 29extern tree create_tmp_var_name (const char *);
6de9cd9a 30extern tree create_tmp_var (tree, const char *);
6de9cd9a
DN
31extern tree get_initialized_tmp_var (tree, tree *, tree *);
32extern tree get_formal_tmp_var (tree, tree *);
33extern void declare_tmp_vars (tree, tree);
34
6de9cd9a
DN
35extern void annotate_all_with_locus (tree *, location_t);
36
37/* Validation of GIMPLE expressions. Note that these predicates only check
38 the basic form of the expression, they don't recurse to make sure that
39 underlying nodes are also of the right form. */
40
0c322af3
JM
41typedef bool (*gimple_predicate)(tree);
42
6de9cd9a 43/* Returns true iff T is a valid GIMPLE statement. */
44de5aeb 44extern bool is_gimple_stmt (tree);
6de9cd9a
DN
45
46/* Returns true iff TYPE is a valid type for a scalar register variable. */
44de5aeb 47extern bool is_gimple_reg_type (tree);
6de9cd9a 48/* Returns true iff T is a scalar register variable. */
44de5aeb 49extern bool is_gimple_reg (tree);
14797075 50/* Returns true if T is a GIMPLE temporary variable, false otherwise. */
17ad5b5e 51extern bool is_gimple_formal_tmp_var (tree);
14797075 52/* Returns true if T is a GIMPLE temporary register variable. */
17ad5b5e 53extern bool is_gimple_formal_tmp_reg (tree);
6de9cd9a 54/* Returns true iff T is any sort of variable. */
44de5aeb 55extern bool is_gimple_variable (tree);
6de9cd9a 56/* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
44de5aeb 57extern bool is_gimple_min_lval (tree);
e847cc68
RH
58/* Returns true iff T is something whose address can be taken. */
59extern bool is_gimple_addressable (tree);
6de9cd9a 60/* Returns true iff T is any valid GIMPLE lvalue. */
44de5aeb 61extern bool is_gimple_lvalue (tree);
6de9cd9a
DN
62
63/* Returns true iff T is a GIMPLE restricted function invariant. */
44de5aeb 64extern bool is_gimple_min_invariant (tree);
6de9cd9a 65/* Returns true iff T is a GIMPLE rvalue. */
44de5aeb 66extern bool is_gimple_val (tree);
0c322af3
JM
67/* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
68 GIMPLE temporary, a renamed user variable, or something else,
69 respectively. */
17ad5b5e 70extern bool is_gimple_formal_tmp_rhs (tree);
0c322af3
JM
71extern bool is_gimple_reg_rhs (tree);
72extern bool is_gimple_mem_rhs (tree);
73/* Returns the appropriate one of the above three predicates for the LHS
74 T. */
75extern gimple_predicate rhs_predicate_for (tree);
6de9cd9a
DN
76
77/* Returns true iff T is a valid if-statement condition. */
44de5aeb 78extern bool is_gimple_condexpr (tree);
6de9cd9a
DN
79
80/* Returns true iff T is a type conversion. */
44de5aeb 81extern bool is_gimple_cast (tree);
6de9cd9a
DN
82/* Returns true iff T is a valid CONSTRUCTOR element (either an rvalue or
83 another CONSTRUCTOR). */
44de5aeb 84extern bool is_gimple_constructor_elt (tree);
6de9cd9a 85/* Returns true iff T is a variable that does not need to live in memory. */
44de5aeb 86extern bool is_gimple_non_addressable (tree t);
6de9cd9a 87
0f59171d 88/* Returns true iff T is a valid call address expression. */
90051e16 89extern bool is_gimple_call_addr (tree);
6de9cd9a 90/* If T makes a function call, returns the CALL_EXPR operand. */
44de5aeb 91extern tree get_call_expr_in (tree t);
6de9cd9a 92
44de5aeb 93extern void recalculate_side_effects (tree);
6de9cd9a 94
6de9cd9a
DN
95/* FIXME we should deduce this from the predicate. */
96typedef enum fallback_t {
97 fb_none = 0,
98 fb_rvalue = 1,
99 fb_lvalue = 2,
100 fb_mayfail = 4,
101 fb_either= fb_rvalue | fb_lvalue
102} fallback_t;
103
104enum gimplify_status {
105 GS_ERROR = -2, /* Something Bad Seen. */
106 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
107 GS_OK = 0, /* We did something, maybe more to do. */
108 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
109};
110
44de5aeb
RK
111extern enum gimplify_status gimplify_expr (tree *, tree *, tree *,
112 bool (*) (tree), fallback_t);
65355d53 113extern void gimplify_type_sizes (tree, tree *);
44de5aeb
RK
114extern void gimplify_one_sizepos (tree *, tree *);
115extern void gimplify_stmt (tree *);
116extern void gimplify_to_stmt_list (tree *);
117extern void gimplify_body (tree *, tree);
118extern void push_gimplify_context (void);
119extern void pop_gimplify_context (tree);
120extern void gimplify_and_add (tree, tree *);
6de9cd9a
DN
121
122/* Miscellaneous helpers. */
44de5aeb
RK
123extern void gimple_add_tmp_var (tree);
124extern tree gimple_current_bind_expr (void);
125extern void gimple_push_bind_expr (tree);
126extern void gimple_pop_bind_expr (void);
127extern void unshare_all_trees (tree);
128extern tree voidify_wrapper_expr (tree, tree);
129extern tree gimple_build_eh_filter (tree, tree, tree);
130extern tree build_and_jump (tree *);
131extern tree alloc_stmt_list (void);
132extern void free_stmt_list (tree);
133extern tree force_labels_r (tree *, int *, void *);
134extern enum gimplify_status gimplify_va_arg_expr (tree *, tree *, tree *);
6de9cd9a
DN
135
136/* In tree-nested.c. */
137extern void lower_nested_functions (tree);
138
139#endif /* _TREE_SIMPLE_H */