X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Fmangle.c;h=8873c79b580b986331d212776ec1d4c9088468c8;hb=75c56501fa4428e3460a36c77585b96027bcd167;hp=04c656361d06b5c9410f5dc0f9ac8e4ff23713cc;hpb=8191fe60df0c964d0ce4dfacf6d8697fde76dc22;p=libfirm diff --git a/ir/tr/mangle.c b/ir/tr/mangle.c index 04c656361..8873c79b5 100644 --- a/ir/tr/mangle.c +++ b/ir/tr/mangle.c @@ -13,6 +13,10 @@ # include "config.h" #endif +#ifdef HAVE_STDIO_H +# include +#endif + #include "mangle.h" #include "obst.h" @@ -26,7 +30,7 @@ static struct obstack mangle_obst; /** returned a mangled type name, currently no mangling */ static INLINE ident * -mangle_type (type *tp) +mangle_type (ir_type *tp) { assert (tp->kind == k_type); return tp->name; @@ -67,7 +71,7 @@ ident *mangle (ident *first, ident *scnd) { return res; } -/* Returns a new ident that represents 'prefixscndsuffix'. */ +/** Returns a new ident that represents 'prefixscndsuffix'. */ static ident *mangle3(const char *prefix, ident *scnd, const char *suffix) { char *cp; int len; @@ -83,14 +87,14 @@ static ident *mangle3(const char *prefix, ident *scnd, const char *suffix) { return res; } -/* Returns a new ident that represents first_scnd. */ -ident *mangle_u (ident *first, ident* scnd) { +/** Returns a new ident that represents firstscnd. */ +static ident *mangle_3(ident *first, char c, ident* scnd) { char *cp; int len; ident *res; obstack_grow(&mangle_obst, get_id_str(first), get_id_strlen(first)); - obstack_1grow(&mangle_obst,'_'); + obstack_1grow(&mangle_obst, c); obstack_grow(&mangle_obst,get_id_str(scnd),get_id_strlen(scnd)); len = obstack_object_size (&mangle_obst); cp = obstack_finish (&mangle_obst); @@ -99,9 +103,19 @@ ident *mangle_u (ident *first, ident* scnd) { return res; } +/* Returns a new ident that represents first_scnd. */ +ident *mangle_u (ident *first, ident* scnd) { + return mangle_3(first, '_', scnd); +} + +/* Returns a new ident that represents first.scnd. */ +ident *mangle_dot (ident *first, ident* scnd) { + return mangle_3(first, '.', scnd); +} + /* returns a mangled name for a Win32 function using it's calling convention */ ident *decorate_win32_c_fkt(entity *ent) { - type *tp = get_entity_type(ent); + ir_type *tp = get_entity_type(ent); unsigned cc_mask = get_method_calling_convention(tp); char buf[16]; int size, i;