# include "array.h"
# include "irgmod.h"
# include "mangle.h"
+# include "irouts.h"
ir_graph *current_ir_graph;
INLINE ir_graph *get_current_ir_graph(void) {
ir_node *projX;
res = (ir_graph *) malloc (sizeof (ir_graph));
+ memset(res, 0, sizeof (ir_graph));
res->kind=k_ir_graph;
current_ir_graph = res;
res->pinned = pinned;
res->outs_state = no_outs;
res->dom_state = no_dom;
+ res->typeinfo_state = irg_typeinfo_none;
+ res->loopinfo_state = loopinfo_none;
/** Type information for the procedure of the graph **/
res->ent = ent;
res->start_block = new_immBlock ();
res->start = new_Start ();
res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
- res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
+ //res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
/* Proj results of start node */
projX = new_Proj (res->start, mode_X, pns_initial_exec);
/* Make a rudimentary ir graph for the constant code.
Must look like a correct irg, spare everything else. */
-ir_graph *new_const_code_irg() {
+ir_graph *new_const_code_irg(void) {
ir_graph *res;
ir_node *projX;
- res = (ir_graph *) malloc (sizeof (ir_graph));
+ res = (ir_graph *) malloc (sizeof(*res));
+ memset(res, 0, sizeof(*res));
+
current_ir_graph = res;
res->n_loc = 1; /* Only the memory. */
res->visited = 0; /* visited flag, for the ir walker */
res->end = new_End ();
mature_block(get_cur_block());
res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
- res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
+ //res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
res->start = new_Start ();
/* Proj results of start node */
set_irn_visited(get_cur_block(), -1);
set_Block_block_visited(get_cur_block(), -1);
set_Block_block_visited(res->start_block, -1);
+ set_irn_visited(res->start_block, -1);
+ set_irn_visited(res->bad, -1);
return res;
}
+/* Defined in iropt.c */
+void del_identities (pset *value_table);
+
/* Frees the passed irgraph.
Deallocates all nodes in this graph and the ir_graph structure.
Sets the field irgraph in the corresponding entity to NULL.
Does not free types, entities or modes that are used only by this
graph, nor the entity standing for this graph. */
void free_ir_graph (ir_graph *irg) {
- set_entity_irg(irg->ent, NULL);
+ if (irg->ent) set_entity_irg(irg->ent, NULL); /* not set in const code irg */
+ free_End(irg->end);
+ if (irg->frame_type) free_type(irg->frame_type);
+ if (irg->value_table) del_identities(irg->value_table);
+ if (irg->outs_state != no_outs) free_outs(irg);
+ obstack_free(irg->obst,NULL);
free(irg->obst);
#if USE_EXPLICIT_PHI_IN_STACK
free_Phi_in_stack(irg->Phi_in_stack);
#endif
+ irg->kind = k_BAD;
free(irg);
}
irg->bad = node;
}
+/* GL removed: we need unknown with mode for analyses.
ir_node *
get_irg_unknown (ir_graph *irg)
{
{
irg->unknown = node;
}
+*/
ir_node *
get_irg_current_block (ir_graph *irg)
/*
* checks wheater the ir_node pointer i on the obstack.
- * A more sophisticated chaeck would test the "whole" ir_node
+ * A more sophisticated check would test the "whole" ir_node
*/
for (p = irg->obst->chunk; p; p = p->prev) {
if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
irg->dom_state = dom_inconsistent;
}
+irg_loopinfo_state
+get_irg_loopinfo_state(ir_graph *irg) {
+ return irg->loopinfo_state;
+}
+
+void set_irg_loopinfo_state(ir_graph *irg, irg_loopinfo_state s) {
+ irg->loopinfo_state = s;
+}
+
+void
+set_irg_loopinfo_inconsistent(ir_graph *irg) {
+ if (irg->loopinfo_state == loopinfo_ip_consistent)
+ irg->loopinfo_state = loopinfo_ip_inconsistent;
+ else
+ irg->loopinfo_state = loopinfo_inconsistent;
+}
+
INLINE void
set_irg_pinned (ir_graph *irg, op_pinned p) {
irg->pinned = p;
}
+
+irg_callee_info_state get_irg_callee_info_state(ir_graph *irg) {
+ return irg->callee_info_state;
+}
+
+void set_irg_callee_info_state(ir_graph *irg, irg_callee_info_state s) {
+ irg->callee_info_state = s;
+}
+
+irg_inline_property get_irg_inline_property(ir_graph *irg) {
+ return irg->inline_property;
+}
+void set_irg_inline_property(ir_graph *irg, irg_inline_property s) {
+ irg->inline_property = s;
+}
+
+
INLINE void
set_irg_link (ir_graph *irg, void *thing) {
irg->link = thing;