* @author Martin Trapp, Christian Schaefer
*/
+#include <stddef.h>
#include "irop.h"
# ifndef _IRGRAPH_H_
# define _IRGRAPH_H_
-# include "tv.h"
# include "entity.h"
/* to resolve recursion between irnode.h and irgraph.h */
#endif
/**
- * @page ir_graph The struct ir_graph
+ * @page ir_graph The struct ir_graph
*
* This struct contains all information about a procedure.
* It's allocated directly to memory.
* it's result. This is a Proj node on the fourth output of
* the start node. This output is tagged as pn_Start_T_args.
*
+ * *proj_args The proj nodes off the args node.
+ *
* *bad The Bad node is an auxiliary node. It is needed only once,
* so there is this globally reachable node.
*
/** Sets the node that represents the argument pointer. */
void set_irg_args (ir_graph *irg, ir_node *node);
+/** Returns an array of the nodes off the argument pointer. */
+ir_node **get_irg_proj_args (const ir_graph *irg);
+/** Sets the array of the nodes off the argument pointer. */
+void set_irg_proj_args (ir_graph *irg, ir_node **nodes);
+
/** Returns the current block of a graph. */
ir_node *get_irg_current_block (const ir_graph *irg);
/** Sets the current block of a graph. */
phase_low
} irg_phase_state;
+/** returns the phase_state of an IR graph. */
irg_phase_state get_irg_phase_state (const ir_graph *irg);
+
+/** sets the phase state of an IR graph. */
void set_irg_phase_low(ir_graph *irg);
/** state: op_pin_state_pinned
op_pin_state get_irg_pinned (const ir_graph *irg);
/** state: outs_state
- Outs are the back edges or def-use edges.
- Values: outs_none, outs_consistent, outs_inconsistent
- outs_none: outs are not computed, no memory is allocated.
- outs_consistent: outs are computed and correct,
- outs_inconsistent: outs have been computed, memory is still allocated,
- but the graph has been changed since. */
+ * Outs are the back edges or def-use edges of ir nodes.
+ * Values: outs_none, outs_consistent, outs_inconsistent */
typedef enum {
- outs_none,
- outs_consistent,
- outs_inconsistent
+ outs_none, /**< Outs are not computed, no memory is allocated. */
+ outs_consistent, /**< Outs are computed and correct. */
+ outs_inconsistent /**< Outs have been computed, memory is still allocated,
+ but the graph has been changed since. */
} irg_outs_state;
irg_outs_state get_irg_outs_state(const ir_graph *irg);
-void set_irg_outs_inconsistent(ir_graph *irg);
+void set_irg_outs_inconsistent(ir_graph *irg);
/** state: dom_state
Signals the state of the dominator infomation.
dom_consistent, /**< dominator information is computed and correct */
dom_inconsistent /**< dominator information is computed but the graph has been changed since */
} irg_dom_state;
+
+/** returns the dom_state of an IR graph. */
irg_dom_state get_irg_dom_state(const ir_graph *irg);
+
+/** sets the dom_state of an IR graph. */
void set_irg_dom_inconsistent(ir_graph *irg);
/** state: loopinfo_state
loopinfo_inter = 8, /**< Loop information for interprocedural view. */
loopinfo_for_firmjni = 16, /**< A hack for firmjni: all enums must differ as they
- are used in a switch. */
+ are used in a switch. */
/** IntRAprocedural loop information constructed and valid. */
loopinfo_consistent = loopinfo_constructed | loopinfo_valid,
irg_callee_info_consistent,
irg_callee_info_inconsistent
} irg_callee_info_state;
+
+/** returns the callee_info_state of an IR graph. */
irg_callee_info_state get_irg_callee_info_state(const ir_graph *irg);
+
+/** sets the callee_info_state of an IR graph. */
void set_irg_callee_info_state(ir_graph *irg, irg_callee_info_state s);
/** property:
/** Sets the inline property of a graph. */
void set_irg_inline_property(ir_graph *irg, irg_inline_property s);
-/** A void * field to link arbritary information to the node. */
+/** A void * field to link arbitrary information to the node. */
void set_irg_link (ir_graph *irg, void *thing);
void *get_irg_link (const ir_graph *irg);
-/* increments visited by one */
+/** Increments visited flag by one.
+ * @see also: get_irn_visited() get_irg_block_visited(). */
void inc_irg_visited (ir_graph *irg);
unsigned long get_irg_visited (const ir_graph *irg);
void set_irg_visited (ir_graph *irg, unsigned long i);
+/** An interprocedural flag valid for all irgs.
+ * @see also: get_irn_visited() get_irg_block_visited(). */
unsigned long get_max_irg_visited (void);
void set_max_irg_visited (int val);
unsigned long inc_max_irg_visited (void);
-/* increments block_visited by one */
+/** Increments block_visited by one.
+ * @see also: get_irn_visited() get_irg_block_visited(). */
void inc_irg_block_visited (ir_graph *irg);
unsigned long get_irg_block_visited (const ir_graph *irg);
void set_irg_block_visited (ir_graph *irg, unsigned long i);
-/** put the proj's into the same block as its predecessors */
+/** move Proj nodes into the same block as its predecessors */
void normalize_proj_nodes(ir_graph *irg);
+/** set a description for local value n */
+void set_irg_loc_description(ir_graph *irg, int n, void *description);
+
+/** get the description for local value n */
+void *get_irg_loc_description(ir_graph *irg, int n);
+
+/**
+ * Access custom graph data.
+ * The data must have been registered with
+ * register_additional_graph_data() before.
+ * @param graph The graph to get the data from.
+ * @param type The type of the data you registered.
+ * @param off The value returned by register_additional_graph_data().
+ * @return A pointer of type @p type.
+ */
+#define get_irg_data(graph,type,off) \
+ (assert(off > 0 && "Invalid graph data offset"), (type *) ((char *) (graph) - (off)))
+
+/**
+ * Get the pointer to the node some custom data belongs to.
+ * @param data The pointer to the custom data.
+ * @param off The number as returned by register_additional_graph_data().
+ * @return A pointer to the ir node the custom data belongs to.
+ */
+#define get_irg_data_base(data,off) \
+ (assert(off > 0 && "Invalid graph data offset"), (ir_graph *) ((char *) (data) + (off)))
+
+/**
+ * Request additional data to be allocated with an ir graph.
+ * @param size The size of the additional data required.
+ * @return A positive number, if the opration was successful, which
+ * must be passed to the access macro get_irg_data(), 0 if the
+ * registration failed.
+ */
+size_t register_additional_graph_data(size_t size);
+
# endif /* _IRGRAPH_H_ */