Added irg field to start, more verbose irdump
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 19 Aug 2003 09:29:16 +0000 (09:29 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 19 Aug 2003 09:29:16 +0000 (09:29 +0000)
[r1704]

ir/ir/ircons.c
ir/ir/irdump.c
ir/ir/irgraph.c
ir/ir/irnode.c
ir/ir/irnode.h
ir/ir/irnode_t.h
ir/ir/irop.c

index 0592148..3c852e4 100644 (file)
@@ -75,6 +75,7 @@ new_rd_Start (dbg_info* db, ir_graph *irg, ir_node *block)
   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;
@@ -984,6 +985,7 @@ new_d_Start (dbg_info* db)
 
   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);
index 825a923..41001d5 100644 (file)
@@ -262,7 +262,42 @@ dump_node_vcgattr (ir_node *n)
 
 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) {
index e39554b..0cd1a8e 100644 (file)
@@ -185,6 +185,7 @@ ir_graph *new_const_code_irg() {
   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));
index b33fbe0..e623222 100644 (file)
@@ -638,6 +638,20 @@ void remove_Block_cg_cfgpred_arr(ir_node * node) {
   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);
@@ -2142,6 +2156,8 @@ get_irn_irg(ir_node *node) {
   } 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;
index aa11d37..b259276 100644 (file)
@@ -114,7 +114,7 @@ INLINE void          set_irn_in            (ir_node *node, int arity,
 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. */
@@ -144,11 +144,11 @@ INLINE void         *get_irn_link          (const ir_node *node);
 
 /** 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.
@@ -207,15 +207,19 @@ INLINE int       Block_not_block_visited(ir_node *node);
  * 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);
index a84672b..c5e1c46 100644 (file)
@@ -51,6 +51,11 @@ typedef struct {
                                 @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 */
@@ -128,6 +133,7 @@ typedef struct {
 /** 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 */
index 197d178..bd3492c 100644 (file)
@@ -98,7 +98,7 @@ init_op(void)
 {
   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));