3 * File name: ir/ir/irgraph.c
4 * Purpose: Entry point to the representation of procedure code -- internal header.
5 * Author: Martin Trapp, Christian Schaefer
6 * Modified by: Goetz Lindenmaier
9 * Copyright: (c) 1998-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 * ir graph construction.
18 * @author Martin Trapp, Christian Schaefer
22 # ifndef _IRGRAPH_T_H_
23 # define _IRGRAPH_T_H_
27 # include "firm_common_t.h"
29 #define FRAME_TP_SUFFIX "frame_tp"
31 /** ir_graph holds all information for a procedure */
33 firm_kind kind; /**< always set to k_ir_graph*/
34 /* -- Basics of the representation -- */
35 struct entity *ent; /**< The entity of this procedure, i.e.,
36 the type of the procedure and the
37 class it belongs to. */
38 struct type *frame_type; /**< A class type representing the stack frame.
39 Can include "inner" methods. */
40 struct ir_node *start_block; /**< block the start node will belong to */
41 struct ir_node *start; /**< start node of this ir_graph */
42 struct ir_node *end_block; /**< block the end node will belong to */
43 struct ir_node *end; /**< end node of this ir_graph */
44 struct ir_node *cstore; /**< constant store -- no more needed!! */
45 struct ir_node *frame; /**< method's frame */
46 struct ir_node *globals; /**< pointer to the data segment containing all
47 globals as well as global procedures. */
48 struct ir_node *args; /**< methods arguments */
49 struct ir_node *bad; /**< bad node of this ir_graph, the one and
51 struct ir_node *unknown; /**< unknown node of this ir_graph */
52 struct obstack *obst; /**< obstack where all of the ir_nodes live */
53 struct ir_node *current_block; /**< block for newly gen_*()-erated
56 /* -- Fields indicating different states of irgraph -- */
57 irg_phase_state phase_state; /**< compiler phase */
58 op_pinned pinned; /**< Flag for status of nodes */
59 irg_outs_state outs_state; /**< Out edges. */
60 irg_dom_state dom_state; /**< Dominator information */
62 /* -- Fields for construction -- */
63 #if USE_EXPLICIT_PHI_IN_STACK
64 struct Phi_in_stack *Phi_in_stack; /**< needed for automatic Phi construction */
66 int n_loc; /**< number of local variable in this
67 procedure including procedure parameters. */
69 /* -- Fields for optimizations / analysis information -- */
70 pset *value_table; /**< hash table for global value numbering (cse)
71 for optimizing use in iropt.c */
72 struct ir_node **outs; /**< Space for the out arrays. */
73 struct ir_loop *loop; /**< The outermost loop */
74 void *link; /**< A void* field to link any information to
77 /* -- Fields for Walking the graph -- */
78 unsigned long visited; /**< this flag is an identifier for
79 ir walk. it will be incremented
80 every time someone walks through
82 unsigned long block_visited; /**< same as visited, for a complete block */
84 int graph_nr; /**< a unique graph number for each graph to make output
89 void init_irgraph(void);
91 /** Make a rudimentary ir graph for the constant code.
92 Must look like a correct irg, spare everything else. */
93 ir_graph *new_const_code_irg(void);
96 * Set the pinned state of a graph.
102 set_irg_pinned (ir_graph *irg, op_pinned p);
104 /** Returns the obstack associated with the graph. */
105 struct obstack *get_irg_obstack(ir_graph *irg);
108 * Returns true if the node n is allocated on the storage of graph irg.
110 * @param irg the IR graph
111 * @param n the IR node
113 int node_is_in_irgs_storage(ir_graph *irg, ir_node *n);
115 # endif /* _IRGRAPH_T_H_ */