Remove obsolete outs invalidation
[libfirm] / ir / be / bestabs.c
index e8d1551..02c243d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -143,7 +143,7 @@ static unsigned get_type_number(stabs_handle *h, ir_type *tp)
                num = h->next_type_nr++;
                pmap_insert(h->type_map, tp, INT_TO_PTR(num));
        } else {
-               num = PTR_TO_INT(entry->value);
+               num = (unsigned)PTR_TO_INT(entry->value);
        }
        return num;
 }  /* get_type_number */
@@ -202,7 +202,7 @@ static const tarval_mode_info dec_output = {
 /**
  * emit a tarval as decimal
  */
-static void be_emit_tv_as_decimal(tarval *tv)
+static void be_emit_tv_as_decimal(ir_tarval *tv)
 {
        ir_mode *mode = get_tarval_mode(tv);
        const tarval_mode_info *old = get_tarval_mode_output_option(mode);
@@ -336,18 +336,18 @@ static void gen_pointer_type(wenv_t *env, ir_type *tp)
 static void print_array_type(stabs_handle *h, ir_type *tp, int local)
 {
        ir_type      *etp     = get_array_element_type(tp);
-       int          i, n     = get_array_n_dimensions(tp);
+       size_t       i, n     = get_array_n_dimensions(tp);
        unsigned     type_num = local ? h->next_type_nr++ : get_type_number(h, tp);
-       int          *perm;
+       size_t       *perm;
 
        be_emit_irprintf("%u=a", type_num);
-       NEW_ARR_A(int, perm, n);
+       perm = ALLOCAN(size_t, n);
        for (i = 0; i < n; ++i) {
                perm[i] = get_array_order(tp, i);
        }
 
        for (i = 0; i < n; ++i) {
-               int dim = perm[i];
+               size_t dim = perm[i];
 
                if (is_Const(get_array_lower_bound(tp, dim)) && is_Const(get_array_upper_bound(tp, dim))) {
                        long min = get_array_lower_bound_int(tp, dim);
@@ -508,7 +508,7 @@ static void gen_method_type(wenv_t *env, ir_type *tp)
  */
 static void walk_type(type_or_ent tore, void *ctx)
 {
-       wenv_t *env = ctx;
+       wenv_t *env = (wenv_t*)ctx;
        ir_type  *tp;
 
        if (is_type(tore.typ)) {
@@ -568,10 +568,9 @@ static void walk_type(type_or_ent tore, void *ctx)
 static void finish_types(wenv_t *env)
 {
        waitq *wq = env->wq;
-       ir_type *tp;
 
        while (! waitq_empty(wq)) {
-               tp = waitq_get(wq);
+               ir_type *tp = (ir_type*)waitq_get(wq);
                if (IS_TYPE_READY(tp))
                        continue;
 
@@ -626,27 +625,30 @@ static void gen_types(stabs_handle *h)
 /**
  * start a new source object (compilation unit)
  */
-static void stabs_so(dbg_handle *handle, const char *filename)
+static void stabs_unit_begin(dbg_handle *handle, const char *filename)
 {
        stabs_handle *h = (stabs_handle *)handle;
+
+       /* needed for the debug support */
+       be_gas_emit_switch_section(GAS_SECTION_TEXT);
+       be_emit_irprintf("%stext0:\n", be_gas_get_private_prefix());
+       be_emit_write_line();
+
        h->main_file = h->curr_file = filename;
        be_emit_irprintf("\t.stabs\t\"%s\",%d,0,0,%stext0\n", filename, N_SO, be_gas_get_private_prefix());
        be_emit_write_line();
-}  /* stabs_so */
+}
 
-/**
- * Main Program
- */
-static void stabs_main_program(dbg_handle *handle)
+static void stabs_unit_end(dbg_handle *handle)
 {
        ir_graph *irg = get_irp_main_irg();
-
        (void) handle;
        if (irg) {
-               be_emit_irprintf("\t.stabs\t\"%s\",%d,0,0,0\n", get_entity_name(get_irg_entity(irg)), N_MAIN);
-               be_emit_write_line();
+               ir_entity *entity = get_irg_entity(irg);
+               be_emit_irprintf("\t.stabs\t\"%s\",%d,0,0,0\n",
+                                get_entity_ld_name(entity), N_MAIN);
        }
-}  /* stabs_main_program */
+}
 
 static void stabs_set_dbg_info(dbg_handle *h, dbg_info *dbgi)
 {
@@ -683,12 +685,14 @@ static void stabs_set_dbg_info(dbg_handle *h, dbg_info *dbgi)
 /**
  * dump the stabs for a method begin
  */
-static void stabs_method_begin(dbg_handle *handle, const ir_entity *ent, const be_stack_layout_t *layout)
+static void stabs_method_begin(dbg_handle *handle, const ir_entity *ent)
 {
        stabs_handle *h = (stabs_handle *)handle;
+       ir_graph     *irg = get_entity_irg(ent);
        ir_type      *mtp, *rtp;
        unsigned     type_num;
        int          i, n, between_size;
+       be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
 
        h->cur_ent = ent;
        h->layout  = layout;
@@ -714,7 +718,7 @@ static void stabs_method_begin(dbg_handle *handle, const ir_entity *ent, const b
        between_size = get_type_size_bytes(layout->between_type);
        for (i = 0, n = get_method_n_params(mtp); i < n; ++i) {
                ir_type *ptp      = get_method_param_type(mtp, i);
-        const char *name  = get_method_param_name(mtp, i);
+        const char *name  = NULL;
                unsigned type_num = get_type_number(h, ptp);
         char buf[16];
         int ofs = 0;
@@ -827,11 +831,11 @@ static void stabs_variable(dbg_handle *handle, const ir_entity *ent)
                if (linkage & IR_LINKAGE_CONSTANT)
                        kind = N_ROSYM;
                snprintf(buf, sizeof(buf), "\t.stabs\t\"%s:S%u\",%d,0,0,%s\n",
-                       get_entity_name(ent), tp_num, kind, get_entity_ld_name(ent));
+                        get_entity_name(ent), tp_num, kind, get_entity_ld_name(ent));
        } else {
                /* a global variable */
                snprintf(buf, sizeof(buf), "\t.stabs\t\"%s:G%u\",%d,0,0,0\n",
-                       get_entity_name(ent), tp_num, N_GSYM);
+                        get_entity_name(ent), tp_num, (int)N_GSYM);
        }
        buf[sizeof(buf) - 1] = '\0';
 
@@ -851,8 +855,8 @@ static void stabs_close(dbg_handle *handle)
 /** The stabs operations. */
 static const debug_ops stabs_ops = {
        stabs_close,
-       stabs_so,
-       stabs_main_program,
+       stabs_unit_begin,
+       stabs_unit_end,
        stabs_method_begin,
        stabs_method_end,
        stabs_types,
@@ -871,7 +875,7 @@ static dbg_handle *be_stabs_open(void)
        return &h->base;
 }
 
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_stabs);
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_stabs)
 void be_init_stabs(void)
 {
        be_register_dbgout_module("stabs", be_stabs_open);