* @brief Stabs support.
* @author Michael Beck
* @date 11.9.2006
- * @version $Id$
*/
#include "config.h"
*/
static unsigned get_type_number(stabs_handle *h, ir_type *tp)
{
- pmap_entry *entry;
+ void *entry;
unsigned num;
if (tp == NULL) {
/* map to the void type */
return 0;
}
- entry = pmap_find(h->type_map, tp);
- if (! entry) {
+ entry = pmap_get(h->type_map, tp);
+ if (entry == NULL) {
num = h->next_type_nr++;
- pmap_insert(h->type_map, tp, INT_TO_PTR(num));
+ pmap_insert(h->type_map, tp, INT_TO_PTR(num+1));
} else {
- num = (unsigned)PTR_TO_INT(entry->value);
+ num = ((unsigned)PTR_TO_INT(entry))-1;
}
return num;
-} /* get_type_number */
+}
/**
* Map a given Type to void by assigned the type number 0.
*/
static void map_to_void(stabs_handle *h, ir_type *tp)
{
- pmap_insert(h->type_map, tp, INT_TO_PTR(0));
+ pmap_insert(h->type_map, tp, INT_TO_PTR(1));
}
/**
(void) h;
be_emit_irprintf("\t.stabs\t\"void:t%u=%u\",%d,0,0,0\n", 0, 0, N_LSYM);
be_emit_write_line();
-} /* gen_void_type */
+}
typedef struct walker_env {
stabs_handle *h;
Ignore it here as it's name is remapped to "void". */
map_to_void(h, tp);
return;
- } /* if */
+ }
#if 0
if (get_mode_size_bits(mode) & 7) {
/* this is a bitfield type, ignore it */
return;
- } /* if */
+ }
#endif
type_num = get_type_number(h, tp);
be_emit_irprintf(":t%u=r1;%d;0;\",%d,0,0,0\n", type_num, size, N_LSYM);
be_emit_write_line();
}
-} /* gen_primitive_type */
+}
/**
* Generates an enum type
}
be_emit_irprintf(";\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
-} /* gen_enum_type */
+}
/**
* print a pointer type
print_pointer_type(h, tp, 0);
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
-} /* gen_pointer_type */
+}
/**
* print an array type
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
-} /* gen_array_type */
+}
/**
* Generates a struct/union type
}
be_emit_irprintf(";\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
-} /* gen_struct_type */
+}
/**
* Generates a method type
}
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
-} /* gen_method_type */
+}
/**
* type-walker: generate declaration for simple types,
tp = tore.typ;
/* ignore the unknown type */
- if (tp == firm_unknown_type)
+ if (is_unknown_type(tp))
return;
} else {
return;
- } /* if */
+ }
switch (get_type_tpop_code(tp)) {
case tpo_class:
if (tp == get_glob_type()) {
SET_TYPE_READY(tp);
- break;
+ return;
}
/* fall through */
case tpo_struct:
case tpo_union:
gen_struct_union_type(env, tp);
- break;
+ return;
case tpo_enumeration:
gen_enum_type(env->h, tp);
- break;
+ return;
case tpo_primitive:
gen_primitive_type(env->h, tp);
- break;
+ return;
case tpo_method:
gen_method_type(env, tp);
- break;
+ return;
case tpo_array:
gen_array_type(env, tp);
- break;
+ return;
case tpo_pointer:
gen_pointer_type(env, tp);
- break;
+ return;
+ case tpo_code:
+ case tpo_none:
case tpo_unknown:
+ case tpo_uninitialized:
/* the unknown type: ignore */
SET_TYPE_READY(tp);
- break;
- default:
- assert(! "Unknown tpop code");
- } /* switch */
-} /* walk_type */
+ return;
+ }
+ panic("Unknown tpop code");
+}
/**
* generate declaration for all types
break;
default:
assert(! "Unknown tpop code");
- } /* switch */
- } /* while */
-} /* finish_types */
+ }
+ }
+}
/**
* generate all types.
finish_types(&env);
del_waitq(env.wq);
-} /* gen_types */
+}
/* -------------------------- I/F ----------------------------- */
be_emit_irprintf("\",%d,0,0,%d\n", N_PSYM, ofs);
be_emit_write_line();
}
-} /* stabs_method_begin */
+}
/**
* dump the stabs for a method end
h->cur_ent = NULL;
h->layout = NULL;
-} /* stabs_method_end */
+}
/**
* dump types
h->next_type_nr++;
gen_void_type(h);
gen_types(h);
-} /* stabs_types */
+}
/**
* dump a variable in the global type
buf[sizeof(buf) - 1] = '\0';
be_emit_string(buf);
-} /* stabs_variable */
+}
/**
* Close the stabs handler.
stabs_handle *h = (stabs_handle *)handle;
pmap_destroy(h->type_map);
free(h);
-} /* stabs_close */
+}
/** The stabs operations. */
static const debug_ops stabs_ops = {