* class.c (build_base_path): Tidy a bit.
[official-gcc.git] / gcc / tree-gimple.h
blobd2c91032031af59ff3343ffd3a6444fe145c7b55
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>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #ifndef _TREE_SIMPLE_H
23 #define _TREE_SIMPLE_H 1
26 #include "tree-iterator.h"
28 extern tree create_tmp_var_raw (tree, const char *);
29 extern tree create_tmp_var (tree, const char *);
30 extern bool is_gimple_tmp_var (tree);
31 extern tree get_initialized_tmp_var (tree, tree *, tree *);
32 extern tree get_formal_tmp_var (tree, tree *);
33 extern void declare_tmp_vars (tree, tree);
35 extern tree rationalize_compound_expr (tree);
36 extern tree right_assocify_expr (tree);
37 extern void annotate_all_with_locus (tree *, location_t);
39 /* Validation of GIMPLE expressions. Note that these predicates only check
40 the basic form of the expression, they don't recurse to make sure that
41 underlying nodes are also of the right form. */
43 /* Returns true iff T is a valid GIMPLE statement. */
44 bool is_gimple_stmt (tree);
46 /* Returns true iff TYPE is a valid type for a scalar register variable. */
47 bool is_gimple_reg_type (tree);
48 /* Returns true iff T is a scalar register variable. */
49 bool is_gimple_reg (tree);
50 /* Returns true iff T is any sort of variable. */
51 bool is_gimple_variable (tree);
52 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
53 bool is_gimple_min_lval (tree);
54 /* Returns true iff T is an lvalue other than an INDIRECT_REF. */
55 bool is_gimple_addr_expr_arg (tree);
56 /* Returns true iff T is any valid GIMPLE lvalue. */
57 bool is_gimple_lvalue (tree);
59 /* Returns true iff T is a GIMPLE restricted function invariant. */
60 bool is_gimple_min_invariant (tree);
61 /* Returns true iff T is a GIMPLE rvalue. */
62 bool is_gimple_val (tree);
63 /* Returns true iff T is a valid rhs for a MODIFY_EXPR. */
64 bool is_gimple_rhs (tree);
66 /* Returns true iff T is a valid if-statement condition. */
67 bool is_gimple_condexpr (tree);
69 /* Returns true iff T is a type conversion. */
70 bool is_gimple_cast (tree);
71 /* Returns true iff T is a valid CONSTRUCTOR element (either an rvalue or
72 another CONSTRUCTOR). */
73 bool is_gimple_constructor_elt (tree);
74 /* Returns true iff T is a variable that does not need to live in memory. */
75 bool is_gimple_non_addressable (tree t);
77 /* If T makes a function call, returns the CALL_EXPR operand. */
78 tree get_call_expr_in (tree t);
80 void recalculate_side_effects (tree);
82 void append_to_statement_list (tree, tree *);
83 void append_to_statement_list_force (tree, tree *);
84 void append_to_compound_expr (tree, tree *);
86 /* FIXME we should deduce this from the predicate. */
87 typedef enum fallback_t {
88 fb_none = 0,
89 fb_rvalue = 1,
90 fb_lvalue = 2,
91 fb_mayfail = 4,
92 fb_either= fb_rvalue | fb_lvalue
93 } fallback_t;
95 enum gimplify_status {
96 GS_ERROR = -2, /* Something Bad Seen. */
97 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
98 GS_OK = 0, /* We did something, maybe more to do. */
99 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
102 enum gimplify_status gimplify_expr (tree *, tree *, tree *,
103 bool (*) (tree), fallback_t);
104 void gimplify_stmt (tree *);
105 void gimplify_to_stmt_list (tree *);
106 void gimplify_body (tree *, tree);
107 void push_gimplify_context (void);
108 void pop_gimplify_context (tree);
110 /* Miscellaneous helpers. */
111 tree get_base_address (tree t);
112 void gimple_add_tmp_var (tree);
113 tree gimple_current_bind_expr (void);
114 void gimple_push_bind_expr (tree);
115 void gimple_pop_bind_expr (void);
116 void unshare_all_trees (tree);
117 tree voidify_wrapper_expr (tree);
118 tree gimple_build_eh_filter (tree, tree, tree);
119 tree build_and_jump (tree *);
120 tree alloc_stmt_list (void);
121 void free_stmt_list (tree);
122 tree force_labels_r (tree *, int *, void *);
124 /* In tree-nested.c. */
125 extern void lower_nested_functions (tree);
127 #endif /* _TREE_SIMPLE_H */