Dump calling conventions for entities
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 18 Oct 2005 12:10:11 +0000 (12:10 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 18 Oct 2005 12:10:11 +0000 (12:10 +0000)
add info1 for ir_graphs

[r6713]

ir/ir/irdump.c
ir/ir/irdumptxt.c

index 80cb9d5..e8d5f1b 100644 (file)
@@ -1509,6 +1509,16 @@ dump_block_graph(FILE *F, ir_graph *irg) {
   current_ir_graph = rem;
 }
 
+/**
+ * Dump the info for an irg.
+ * Parsed by XVCG but not shown. use yComp.
+ */
+static void dump_graph_info(FILE *F, ir_graph *irg) {
+  fprintf(F, "info1:\"");
+  dump_entity_to_file(F, get_irg_entity(irg), dump_verbosity_entattrs | dump_verbosity_entconsts);
+  fprintf(F, "\"\n");
+}
+
 /** Dumps an irg as a graph clustered by block nodes.
  *  If interprocedural view edges can point to nodes out of this graph.
  */
@@ -1519,6 +1529,8 @@ static void dump_graph_from_list(FILE *F, ir_graph *irg) {
   fprintf(F, "\" label: \"%s\" status:clustered color:white \n",
       get_ent_dump_name(get_irg_entity(irg)));
 
+  dump_graph_info(F, irg);
+
   dump_block_graph(F, irg);
 
   /* Close the vcg information for the irg */
@@ -2319,6 +2331,8 @@ void dump_ir_extblock_graph (ir_graph *irg, const char *suffix)
   fprintf(F, "\" label: \"%s\" status:clustered color:white \n",
     get_ent_dump_name(get_irg_entity(irg)));
 
+  dump_graph_info(F, irg);
+
   for (i = 0; i < get_irp_n_irgs(); i++) {
     ir_graph *irg     = get_irp_irg(i);
     list_tuple *lists = ird_get_irg_link(irg);
index 559fcee..15eae46 100644 (file)
@@ -83,6 +83,7 @@ static FILE *text_open (const char *basename, const char * suffix1, const char *
   return F;
 }
 
+/* Write the irnode and all its attributes to the file passed. */
 int dump_irnode_to_file(FILE *F, ir_node *n) {
   int i, bad = 0;
   char comma;
@@ -542,6 +543,7 @@ void    dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned
 
     if (is_Method_type(get_entity_type(ent))) {
       unsigned mask = get_entity_additional_properties(ent);
+      unsigned cc   = get_entity_calling_convention(ent);
 
       if (mask) {
         fprintf(F, "\n%s  additional prop: ", prefix);
@@ -552,6 +554,17 @@ void    dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned
         if (mask & irg_nothrow_function)  fprintf(F, "nothrow_function, ");
         if (mask & irg_naked_function)    fprintf(F, "naked_function, ");
       }
+      fprintf(F, "\n%s  calling convention: ", prefix);
+      if (cc & irg_cc_reg_param) fprintf(F, "regparam, ");
+      if (cc & irg_cc_this_call) fprintf(F, "thiscall, ");
+      if ((cc & (irg_cc_last_on_top|irg_cc_callee_clear_stk)) == 0)
+        fprintf(F, "cdecl");
+      else if ((cc & (irg_cc_last_on_top|irg_cc_callee_clear_stk)) == (irg_cc_last_on_top|irg_cc_callee_clear_stk))
+        fprintf(F, "stdcall");
+      else {
+        fprintf(F, (cc & irg_cc_last_on_top) ? "last param on top, " : "first param on top, ");
+        fprintf(F, (cc & irg_cc_callee_clear_stk) ? "callee clear stack" : "caller clear stack");
+      }
     }
 
     fprintf(F, "\n");