sparc: remove old code which was only valid for old beabi handling
[libfirm] / ir / be / bestabs.c
index 57853e7..f581bd0 100644 (file)
@@ -45,6 +45,7 @@
 #include "bemodule.h"
 #include "beemitter.h"
 #include "dbginfo.h"
+#include "begnuas.h"
 
 /* Non-Stab Symbol and Stab Symbol Types */
 enum stabs_types {
@@ -115,7 +116,7 @@ enum stabs_types {
  */
 typedef struct stabs_handle {
        dbg_handle              base;         /**< the base class */
-       ir_entity               *cur_ent;     /**< current method entity */
+       const ir_entity               *cur_ent;     /**< current method entity */
        const be_stack_layout_t *layout;      /**< current stack layout */
        unsigned                next_type_nr; /**< next type number */
        pmap                    *type_map;    /**< a map from type to type number */
@@ -175,7 +176,7 @@ typedef struct walker_env {
   do { \
     set_type_link(tp, (void *)1);  \
     waitq_put(wq, tp);             \
-  } while(0)
+  } while (0)
 
 /* a the is ready */
 #define SET_TYPE_READY(tp)     set_type_link(tp, NULL)
@@ -213,8 +214,14 @@ static void be_emit_tv_as_decimal(tarval *tv)
 
 static void emit_type_name(const ir_type *type)
 {
+       char *c;
        char buf[256];
        ir_print_type(buf, sizeof(buf), type);
+       /* replace special chars to be on the safe side */
+       for (c = buf; *c != '\0'; ++c) {
+               if (*c == '\n' || *c == '"' || *c == '\\')
+                       *c = '?';
+       }
        be_emit_string(buf);
 }
 
@@ -291,7 +298,7 @@ static void gen_enum_type(stabs_handle *h, ir_type *tp)
 /**
  * print a pointer type
  */
-void print_pointer_type(stabs_handle *h, ir_type *tp, int local)
+static void print_pointer_type(stabs_handle *h, ir_type *tp, int local)
 {
        unsigned     type_num = local ? h->next_type_nr++ : get_type_number(h, tp);
        ir_type      *el_tp   = get_pointer_points_to_type(tp);
@@ -623,7 +630,7 @@ static void stabs_so(dbg_handle *handle, const char *filename)
 {
        stabs_handle *h = (stabs_handle *)handle;
        h->main_file = h->curr_file = filename;
-       be_emit_irprintf("\t.stabs\t\"%s\",%d,0,0,.Ltext0\n", filename, N_SO);
+       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 */
 
@@ -676,12 +683,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, 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;
@@ -748,7 +757,7 @@ static void stabs_method_begin(dbg_handle *handle, ir_entity *ent, const be_stac
 static void stabs_method_end(dbg_handle *handle)
 {
        stabs_handle            *h = (stabs_handle *)handle;
-       ir_entity               *ent = h->cur_ent;
+       const ir_entity         *ent = h->cur_ent;
        const be_stack_layout_t *layout = h->layout;
        const char              *ld_name = get_entity_ld_name(ent);
        int                     i, n, frame_size;
@@ -806,7 +815,7 @@ static void stabs_types(dbg_handle *handle)
 /**
  * dump a variable in the global type
  */
-static void stabs_variable(dbg_handle *handle, ir_entity *ent)
+static void stabs_variable(dbg_handle *handle, const ir_entity *ent)
 {
        stabs_handle *h = (stabs_handle *)handle;
        unsigned tp_num = get_type_number(h, get_entity_type(ent));
@@ -854,7 +863,7 @@ static const debug_ops stabs_ops = {
 };
 
 /* Opens a stabs handler */
-dbg_handle *be_stabs_open(void)
+static dbg_handle *be_stabs_open(void)
 {
        stabs_handle *h = XMALLOCZ(stabs_handle);
 
@@ -864,9 +873,8 @@ dbg_handle *be_stabs_open(void)
        return &h->base;
 }
 
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_stabs);
 void be_init_stabs(void)
 {
        be_register_dbgout_module("stabs", be_stabs_open);
 }
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_stabs);