Commit 2f806f3b by Nick Clifton Committed by 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.

From-SVN: r102810
parent a4d05547
2005-08-06 Nick Clifton <nickc@redhat.com>
* 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 <kazu@codesourcery.com> 2005-08-06 Kazu Hirata <kazu@codesourcery.com>
* Makefile.in, cfgexpand.c, cfgloop.h, cfgloopmanip.c, * Makefile.in, cfgexpand.c, cfgloop.h, cfgloopmanip.c,
......
...@@ -29,7 +29,6 @@ extern int direct_return (void); ...@@ -29,7 +29,6 @@ extern int direct_return (void);
extern int xstormy16_interrupt_function_p (void); extern int xstormy16_interrupt_function_p (void);
extern int xstormy16_epilogue_uses (int); extern int xstormy16_epilogue_uses (int);
extern void xstormy16_function_profiler (void); extern void xstormy16_function_profiler (void);
extern const char *xstormy16_strip_name_encoding (const char *name);
extern void bss100_section (void); extern void bss100_section (void);
#if defined (TREE_CODE) #if defined (TREE_CODE)
......
...@@ -529,12 +529,10 @@ xstormy16_below100_symbol (rtx x, ...@@ -529,12 +529,10 @@ xstormy16_below100_symbol (rtx x,
if (GET_CODE (x) == PLUS if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x, 1)) == CONST_INT) && GET_CODE (XEXP (x, 1)) == CONST_INT)
x = XEXP (x, 0); x = XEXP (x, 0);
if (GET_CODE (x) == SYMBOL_REF) if (GET_CODE (x) == SYMBOL_REF)
{ return (SYMBOL_REF_FLAGS (x) & SYMBOL_FLAG_XSTORMY16_BELOW100) != 0;
const char *n = XSTR (x, 0);
if (n[0] == '@' && n[1] == 'b' && n[2] == '.')
return 1;
}
if (GET_CODE (x) == CONST_INT) if (GET_CODE (x) == CONST_INT)
{ {
HOST_WIDE_INT i = INTVAL (x); HOST_WIDE_INT i = INTVAL (x);
...@@ -1578,42 +1576,40 @@ xstormy16_asm_output_mi_thunk (FILE *file, ...@@ -1578,42 +1576,40 @@ xstormy16_asm_output_mi_thunk (FILE *file,
than uninitialized. */ than uninitialized. */
void void
xstormy16_asm_output_aligned_common (FILE *stream, xstormy16_asm_output_aligned_common (FILE *stream,
tree decl ATTRIBUTE_UNUSED, tree decl,
const char *name, const char *name,
int size, int size,
int align, int align,
int global) 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; const char *name2;
switch (name[1]) int p2align = 0;
bss100_section ();
while (align > 8)
{ {
case 'b': align /= 2;
bss100_section(); p2align ++;
op = "space";
break;
} }
if (op)
{
const char *name2;
int p2align = 0;
while (align > 8) name2 = default_strip_name_encoding (name);
{ if (global)
align /= 2; fprintf (stream, "\t.globl\t%s\n", name2);
p2align ++; if (p2align)
} fprintf (stream, "\t.p2align %d\n", p2align);
name2 = xstormy16_strip_name_encoding (name); fprintf (stream, "\t.type\t%s, @object\n", name2);
if (global) fprintf (stream, "\t.size\t%s, %d\n", name2, size);
fprintf (stream, "\t.globl\t%s\n", name2); fprintf (stream, "%s:\n\t.space\t%d\n", name2, size);
if (p2align) return;
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;
}
} }
if (!global) if (!global)
...@@ -1631,52 +1627,16 @@ xstormy16_asm_output_aligned_common (FILE *stream, ...@@ -1631,52 +1627,16 @@ xstormy16_asm_output_aligned_common (FILE *stream,
special addressing modes for them. */ special addressing modes for them. */
static void static void
xstormy16_encode_section_info (tree decl, xstormy16_encode_section_info (tree decl, rtx r, int first)
rtx r,
int first ATTRIBUTE_UNUSED)
{ {
if (TREE_CODE (decl) == VAR_DECL if (TREE_CODE (decl) == VAR_DECL
&& (lookup_attribute ("below100", DECL_ATTRIBUTES (decl)) && (lookup_attribute ("below100", DECL_ATTRIBUTES (decl))
|| lookup_attribute ("BELOW100", DECL_ATTRIBUTES (decl)))) || lookup_attribute ("BELOW100", DECL_ATTRIBUTES (decl))))
{ {
const char *newsection = 0; rtx symbol = XEXP (r, 0);
char *newname;
tree idp; gcc_assert (GET_CODE (symbol) == SYMBOL_REF);
rtx rtlname, rtl; SYMBOL_REF_FLAGS (symbol) |= SYMBOL_FLAG_XSTORMY16_BELOW100;
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;
} }
} }
...@@ -2676,8 +2636,6 @@ xstormy16_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED) ...@@ -2676,8 +2636,6 @@ xstormy16_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" #define TARGET_ASM_ALIGNED_SI_OP "\t.word\t"
#undef TARGET_ENCODE_SECTION_INFO #undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO xstormy16_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 #undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK xstormy16_asm_output_mi_thunk #define TARGET_ASM_OUTPUT_MI_THUNK xstormy16_asm_output_mi_thunk
......
...@@ -655,18 +655,17 @@ do { \ ...@@ -655,18 +655,17 @@ do { \
#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '|') #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '|')
#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGNMENT) \ #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) \ #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. */ /* Output and Generation of Labels. */
#define SYMBOL_FLAG_XSTORMY16_BELOW100 (SYMBOL_FLAG_MACH_DEP << 0)
#define ASM_OUTPUT_SYMBOL_REF(STREAM, SYMBOL) \ #define ASM_OUTPUT_SYMBOL_REF(STREAM, SYMBOL) \
do { \ do { \
const char *rn = XSTR (SYMBOL, 0); \ const char *rn = XSTR (SYMBOL, 0); \
if (rn[0] == '@' && rn[2] == '.') \
rn += 3; \
if (SYMBOL_REF_FUNCTION_P (SYMBOL)) \ if (SYMBOL_REF_FUNCTION_P (SYMBOL)) \
ASM_OUTPUT_LABEL_REF ((STREAM), rn); \ ASM_OUTPUT_LABEL_REF ((STREAM), rn); \
else \ else \
...@@ -680,9 +679,6 @@ do { \ ...@@ -680,9 +679,6 @@ do { \
fputc (')', STREAM); \ fputc (')', STREAM); \
} while (0) } while (0)
#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
asm_fprintf ((STREAM), "%U%s", xstormy16_strip_name_encoding (NAME));
/* Globalizing directive for a label. */ /* Globalizing directive for a label. */
#define GLOBAL_ASM_OP "\t.globl " #define GLOBAL_ASM_OP "\t.globl "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment