Dump calling conventions for entities
[libfirm] / ir / ir / irdumptxt.c
index 597ec6c..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;
@@ -206,6 +207,8 @@ int dump_irnode_to_file(FILE *F, ir_node *n) {
   case iro_Cond: {
     fprintf(F, "  condition kind: %s\n",  get_Cond_kind(n) == dense ? "dense" : "fragmentary");
     fprintf(F, "  default ProjNr: %ld\n", get_Cond_defaultProj(n));
+    if (get_Cond_jmp_pred(n) != COND_JMP_PRED_NONE)
+      fprintf(F, "  jump prediction: %s\n", get_cond_jmp_predicate_name(get_Cond_jmp_pred(n)));
   } break;
   case iro_Alloc: {
     fprintf(F, "  allocating entity of type: %s \n", get_type_name_ex(get_Alloc_type(n), &bad));
@@ -213,6 +216,7 @@ int dump_irnode_to_file(FILE *F, ir_node *n) {
   } break;
   case iro_Free: {
     fprintf(F, "  freeing entity of type %s \n", get_type_name_ex(get_Free_type(n), &bad));
+    fprintf(F, "  allocated on: the %s\n", (get_Free_where(n) == stack_alloc) ? "stack" : "heap");
   } break;
   case iro_Sel: {
     entity *ent = get_Sel_entity(n);
@@ -539,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);
@@ -549,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");