From: nickc Date: Sat, 6 Aug 2005 13:50:42 +0000 (+0000) Subject: config/stormy16/stormy16.h (SYMBOL_FLAG_XSTORMY16_BELOW100): New define. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=ab764c12c9adf398f57888542c58d74abf0f0e2e config/stormy16/stormy16.h (SYMBOL_FLAG_XSTORMY16_BELOW100): New define. (ASM_OUTPUT_LABELREF): Delete - it is no longer needed. config/stormy16/stormy16.c (xstormy16_below100_symbol): Check symbol flags instead of symbol name mangling. (xstormy16_asm_output_aligned_common): Likewise. Also simplify code since the bss100_section cass is the only case where the below100 code will be triggered. (xstormy16_encode_section_info): Encode below100 attribute using the SYMBOL_FLAG_XSTORMY16_BELOW100 instead of mangling the name. (xstormy16_strip_name_encoding): Delete - this function is no longer needed. (TARGET_STRIP_NAME_ENCODING): Undefine. config/stormy16/stormy16-protos.h: Delete prototype for xstormy16_strip_name_encoding. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102810 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2497692dae0..436e5a65cdc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2005-08-06 Nick Clifton + + * config/stormy16/stormy16.h (SYMBOL_FLAG_XSTORMY16_BELOW100): + New define. + (ASM_OUTPUT_LABELREF): Delete - it is no longer needed. + * config/stormy16/stormy16.c (xstormy16_below100_symbol): + Check symbol flags instead of symbol name mangling. + (xstormy16_asm_output_aligned_common): Likewise. Also + simplify code since the bss100_section cass is the only case + where the below100 code will be triggered. + (xstormy16_encode_section_info): Encode below100 attribute + using the SYMBOL_FLAG_XSTORMY16_BELOW100 instead of mangling + the name. + (xstormy16_strip_name_encoding): Delete - this function is no + longer needed. + (TARGET_STRIP_NAME_ENCODING): Undefine. + * config/stormy16/stormy16-protos.h: Delete prototype for + xstormy16_strip_name_encoding. + 2005-08-06 Kazu Hirata * Makefile.in, cfgexpand.c, cfgloop.h, cfgloopmanip.c, diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h index e50a0c40777..1cc9c4fd098 100644 --- a/gcc/config/stormy16/stormy16-protos.h +++ b/gcc/config/stormy16/stormy16-protos.h @@ -29,7 +29,6 @@ extern int direct_return (void); extern int xstormy16_interrupt_function_p (void); extern int xstormy16_epilogue_uses (int); extern void xstormy16_function_profiler (void); -extern const char *xstormy16_strip_name_encoding (const char *name); extern void bss100_section (void); #if defined (TREE_CODE) diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 8a7c8d724c4..f9e5866aa54 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -529,12 +529,10 @@ xstormy16_below100_symbol (rtx x, if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 1)) == CONST_INT) x = XEXP (x, 0); + if (GET_CODE (x) == SYMBOL_REF) - { - const char *n = XSTR (x, 0); - if (n[0] == '@' && n[1] == 'b' && n[2] == '.') - return 1; - } + return (SYMBOL_REF_FLAGS (x) & SYMBOL_FLAG_XSTORMY16_BELOW100) != 0; + if (GET_CODE (x) == CONST_INT) { HOST_WIDE_INT i = INTVAL (x); @@ -1578,42 +1576,40 @@ xstormy16_asm_output_mi_thunk (FILE *file, than uninitialized. */ void xstormy16_asm_output_aligned_common (FILE *stream, - tree decl ATTRIBUTE_UNUSED, + tree decl, const char *name, int size, int align, int global) { - if (name[0] == '@' && name[2] == '.') + rtx mem = DECL_RTL (decl); + rtx symbol; + + if (mem != NULL_RTX + && GET_CODE (mem) == MEM + && GET_CODE (symbol = XEXP (mem, 0)) == SYMBOL_REF + && SYMBOL_REF_FLAGS (symbol) & SYMBOL_FLAG_XSTORMY16_BELOW100) { - const char *op = 0; - switch (name[1]) + const char *name2; + int p2align = 0; + + bss100_section (); + + while (align > 8) { - case 'b': - bss100_section(); - op = "space"; - break; + align /= 2; + p2align ++; } - if (op) - { - const char *name2; - int p2align = 0; - while (align > 8) - { - align /= 2; - p2align ++; - } - name2 = xstormy16_strip_name_encoding (name); - if (global) - fprintf (stream, "\t.globl\t%s\n", name2); - if (p2align) - fprintf (stream, "\t.p2align %d\n", p2align); - fprintf (stream, "\t.type\t%s, @object\n", name2); - fprintf (stream, "\t.size\t%s, %d\n", name2, size); - fprintf (stream, "%s:\n\t.%s\t%d\n", name2, op, size); - return; - } + name2 = default_strip_name_encoding (name); + if (global) + fprintf (stream, "\t.globl\t%s\n", name2); + if (p2align) + fprintf (stream, "\t.p2align %d\n", p2align); + fprintf (stream, "\t.type\t%s, @object\n", name2); + fprintf (stream, "\t.size\t%s, %d\n", name2, size); + fprintf (stream, "%s:\n\t.space\t%d\n", name2, size); + return; } if (!global) @@ -1631,52 +1627,16 @@ xstormy16_asm_output_aligned_common (FILE *stream, special addressing modes for them. */ static void -xstormy16_encode_section_info (tree decl, - rtx r, - int first ATTRIBUTE_UNUSED) +xstormy16_encode_section_info (tree decl, rtx r, int first) { - if (TREE_CODE (decl) == VAR_DECL + if (TREE_CODE (decl) == VAR_DECL && (lookup_attribute ("below100", DECL_ATTRIBUTES (decl)) || lookup_attribute ("BELOW100", DECL_ATTRIBUTES (decl)))) { - const char *newsection = 0; - char *newname; - tree idp; - rtx rtlname, rtl; - const char *oldname; - - rtl = r; - rtlname = XEXP (rtl, 0); - if (GET_CODE (rtlname) == MEM) - rtlname = XEXP (rtlname, 0); - gcc_assert (GET_CODE (rtlname) == SYMBOL_REF); - oldname = XSTR (rtlname, 0); - - if (DECL_INITIAL (decl)) - { - newsection = ".data_below100"; - DECL_SECTION_NAME (decl) = build_string (strlen (newsection), - newsection); - } - - newname = alloca (strlen (oldname) + 4); - sprintf (newname, "@b.%s", oldname); - idp = get_identifier (newname); - XEXP (rtl, 0) = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (idp)); - } -} - -const char * -xstormy16_strip_name_encoding (const char *name) -{ - while (1) - { - if (name[0] == '@' && name[2] == '.') - name += 3; - else if (name[0] == '*') - name ++; - else - return name; + rtx symbol = XEXP (r, 0); + + gcc_assert (GET_CODE (symbol) == SYMBOL_REF); + SYMBOL_REF_FLAGS (symbol) |= SYMBOL_FLAG_XSTORMY16_BELOW100; } } @@ -2676,8 +2636,6 @@ xstormy16_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED) #define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" #undef TARGET_ENCODE_SECTION_INFO #define TARGET_ENCODE_SECTION_INFO xstormy16_encode_section_info -#undef TARGET_STRIP_NAME_ENCODING -#define TARGET_STRIP_NAME_ENCODING xstormy16_strip_name_encoding #undef TARGET_ASM_OUTPUT_MI_THUNK #define TARGET_ASM_OUTPUT_MI_THUNK xstormy16_asm_output_mi_thunk diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index d224271401b..e37d19ab174 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -655,18 +655,17 @@ do { \ #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '|') #define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGNMENT) \ - xstormy16_asm_output_aligned_common(STREAM, DECL, NAME, SIZE, ALIGNMENT, 1) + xstormy16_asm_output_aligned_common (STREAM, DECL, NAME, SIZE, ALIGNMENT, 1) #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGNMENT) \ - xstormy16_asm_output_aligned_common(STREAM, DECL, NAME, SIZE, ALIGNMENT, 0) + xstormy16_asm_output_aligned_common (STREAM, DECL, NAME, SIZE, ALIGNMENT, 0) /* Output and Generation of Labels. */ +#define SYMBOL_FLAG_XSTORMY16_BELOW100 (SYMBOL_FLAG_MACH_DEP << 0) #define ASM_OUTPUT_SYMBOL_REF(STREAM, SYMBOL) \ do { \ const char *rn = XSTR (SYMBOL, 0); \ - if (rn[0] == '@' && rn[2] == '.') \ - rn += 3; \ if (SYMBOL_REF_FUNCTION_P (SYMBOL)) \ ASM_OUTPUT_LABEL_REF ((STREAM), rn); \ else \ @@ -680,9 +679,6 @@ do { \ fputc (')', STREAM); \ } while (0) -#define ASM_OUTPUT_LABELREF(STREAM, NAME) \ - asm_fprintf ((STREAM), "%U%s", xstormy16_strip_name_encoding (NAME)); - /* Globalizing directive for a label. */ #define GLOBAL_ASM_OP "\t.globl "