ir_node *res;
res = new_ir_node (db, irg, block, op_Start, mode_T, 0, NULL);
+ res->attr.start.irg = irg;
irn_vrfy_irg (res, irg);
return res;
res = new_ir_node (db, current_ir_graph, current_ir_graph->current_block,
op_Start, mode_T, 0, NULL);
+ res->attr.start.irg = current_ir_graph;
res = optimize_node (res);
irn_vrfy_irg (res, current_ir_graph);
static INLINE void
dump_node_info (ir_node *n) {
- fprintf (F, " info1: \"visited: %ld\n\"", get_irn_visited(n));
+ int i;
+ fprintf (F, " info1: \"");
+ fprintf (F, "visited: %ld \n", get_irn_visited(n));
+
+ /* Source types */
+ switch(get_irn_opcode(n)) {
+ case iro_Start: {
+ type *tp = get_entity_type(get_irg_ent(get_Start_irg(n)));
+ fprintf(F, "start of method of type %s \n", get_type_name(tp));
+ for (i = 0; i < get_method_n_params(tp); ++i)
+ fprintf(F, " param %d type: %s \n", i, get_type_name(get_method_param_type(tp, i)));
+ } break;
+ case iro_Alloc: {
+ fprintf(F, "allocating entity of type %s \n", get_type_name(get_Alloc_type(n)));
+ } break;
+ case iro_Free: {
+ fprintf(F, "freeing entity of type %s \n", get_type_name(get_Free_type(n)));
+ } break;
+ case iro_Sel: {
+ fprintf(F, "Selecting entity of type %s \n", get_type_name(get_entity_type(get_Sel_entity(n))));
+ fprintf(F, " from entity of type %s \n", get_type_name(get_entity_owner(get_Sel_entity(n))));
+ } break;
+ case iro_Call: {
+ type *tp = get_Call_type(n);
+ fprintf(F, "calling method of type %s \n", get_type_name(tp));
+ for (i = 0; i < get_method_n_params(tp); ++i)
+ fprintf(F, " param %d type: %s \n", i, get_type_name(get_method_param_type(tp, i)));
+ for (i = 0; i < get_method_n_ress(tp); ++i)
+ fprintf(F, " resul %d type: %s \n", i, get_type_name(get_method_res_type(tp, i)));
+ } break;
+ default: ;
+ }
+
+
+ fprintf (F, "\"");
+
}
static bool pred_in_wrong_graph(ir_node *n, int pos, pmap *irgmap) {
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->start = new_Start ();
+
/* Proj results of start node */
projX = new_Proj (res->start, mode_X, pns_initial_exec);
set_store (new_Proj (res->start, mode_M, pns_global_store));
node->attr.block.in_cg = NULL;
}
+/* Start references the irg it is in. */
+INLINE ir_graph *
+get_Start_irg(ir_node *node) {
+ assert(node->op == op_Start);
+ return node->attr.start.irg;
+}
+
+INLINE void
+set_Start_irg(ir_node *node, ir_graph *irg) {
+ assert(node->op == op_Start);
+ assert(is_ir_graph(irg));
+ node->attr.start.irg = irg;
+}
+
INLINE int
get_End_n_keepalives(ir_node *end) {
assert (end->op == op_End);
} else if (get_irn_op(node) == op_EndReg ||
get_irn_op(node) == op_EndExcept) {
return node->attr.end.irg;
+ } else if (get_irn_op(node) == op_Start) {
+ return node->attr.start.irg;
} else {
assert(0 && "no irg attr");
return NULL;
INLINE ir_node *get_irn_n (ir_node *node, int n);
INLINE void set_irn_n (ir_node *node, int n, ir_node *in);
/** Sets the mode struct of node */
-INLINE void set_irn_mode (ir_node *node, ir_mode *mode);
+INLINE void set_irn_mode (ir_node *node, ir_mode *mode);
/** Gets the mode struct. */
INLINE ir_mode *get_irn_mode (const ir_node *node);
/** Gets the mode-enum modecode. */
/** Outputs a unique number for this node if libfirm is compiled for
debugging, (configure with --enable-debug) else returns 0. */
-INLINE long get_irn_node_nr(const ir_node *node);
+INLINE long get_irn_node_nr(const ir_node *node);
/** Returns the ir_graph this node belongs to. Only valid for
- * CallBegin, EndReg and EndExcept */
-INLINE ir_graph *get_irn_irg(ir_node *node);
+ * CallBegin, EndReg, EndExcept and Start */
+INLINE ir_graph *get_irn_irg(ir_node *node);
/**
* irnode constructor.
* predecessors are removed, the node has the same predecessors in
* both views.
* @@@ Maybe better: arity is zero if no cg preds. */
-void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in);
-void set_Block_cg_cfgpred(ir_node * node, int pos, ir_node * pred);
+void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in);
+void set_Block_cg_cfgpred(ir_node * node, int pos, ir_node * pred);
/* @@@ not supported */
-ir_node ** get_Block_cg_cfgpred_arr(ir_node * node);
+ir_node **get_Block_cg_cfgpred_arr(ir_node * node);
/* Returns the number of interproc predecessors. 0 if none. */
-int get_Block_cg_n_cfgpreds(ir_node * node);
-ir_node * get_Block_cg_cfgpred(ir_node * node, int pos);
+int get_Block_cg_n_cfgpreds(ir_node * node);
+ir_node *get_Block_cg_cfgpred(ir_node * node, int pos);
/* frees the memory. */
-void remove_Block_cg_cfgpred_arr(ir_node * node);
+void remove_Block_cg_cfgpred_arr(ir_node * node);
+
+/* Start references the irg it is in. */
+ir_graph *get_Start_irg(ir_node *node);
+void set_Start_irg(ir_node *node, ir_graph *irg);
INLINE int get_End_n_keepalives(ir_node *end);
INLINE ir_node *get_End_keepalive(ir_node *end, int pos);
@todo Ev. replace by bitfield! */
} block_attr;
+/** Start attributes */
+typedef struct {
+ ir_graph *irg;
+} start_attr;
+
/** Cond attributes */
typedef struct {
cond_kind kind; /**< flavor of Cond */
/** Some irnodes just have one attribute, these are stored here,
some have more. Their name is 'irnodename_attr' */
typedef union {
+ start_attr start; /**< For Start */
block_attr block; /**< For Block: Fields needed to construct it */
cond_attr c; /**< For Cond. */
struct tarval *con; /**< For Const: contains the value of the constant */
{
op_Block = new_ir_op (iro_Block, "Block", pinned, 1, sizeof (block_attr));
- op_Start = new_ir_op (iro_Start, "Start", pinned, 0, 0);
+ op_Start = new_ir_op (iro_Start, "Start", pinned, 0, sizeof (start_attr));
op_End = new_ir_op (iro_End, "End", pinned, 0, 0);
op_Jmp = new_ir_op (iro_Jmp, "Jmp", pinned, 0, 0);
op_Cond = new_ir_op (iro_Cond, "Cond", pinned, 1, sizeof(cond_attr));