Commit 584f44cf authored by rth's avatar rth
Browse files

* config/frv/frv.c (symbol_ref_small_data_p): Remove. Replace

        all users with SYMBOL_REF_SMALL_P.
        (const_small_data_p): Use SYMBOL_REF_SMALL_P.
        (frv_encode_section_info): Remove.
        (frv_strip_name_encoding): Remove.
        (frv_in_small_data_p): Merge tests from encode_section_info.
        (frv_print_operand): Use '@' not SDATA_FLAG_CHAR.
        * config/frv/frv.h (SDATA_FLAG_CHAR): Remove.
        (SDATA_NAME_P): Remove.
        (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use SIZE not SDATA_NAME_P.
        (ASM_OUTPUT_LABELREF): Remove.
        (PRINT_OPERAND_PUNCT_VALID_P): Use '@' not SDATA_FLAG_CHAR.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65725 138bc75d-0d04-0410-961f-82ee72b054a4
parent d0a591a6
2003-04-16 Richard Henderson <rth@redhat.com> 2003-04-16 Richard Henderson <rth@redhat.com>
* config/frv/frv.c (symbol_ref_small_data_p): Remove. Replace
all users with SYMBOL_REF_SMALL_P.
(const_small_data_p): Use SYMBOL_REF_SMALL_P.
(frv_encode_section_info): Remove.
(frv_strip_name_encoding): Remove.
(frv_in_small_data_p): Merge tests from encode_section_info.
(frv_print_operand): Use '@' not SDATA_FLAG_CHAR.
* config/frv/frv.h (SDATA_FLAG_CHAR): Remove.
(SDATA_NAME_P): Remove.
(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use SIZE not SDATA_NAME_P.
(ASM_OUTPUT_LABELREF): Remove.
(PRINT_OPERAND_PUNCT_VALID_P): Use '@' not SDATA_FLAG_CHAR.
* config/frv/frv.c (frv_asm_out_constructor): New. * config/frv/frv.c (frv_asm_out_constructor): New.
(frv_asm_out_destructor): New. (frv_asm_out_destructor): New.
* config/frv/frv.h (CTORS_SECTION_ASM_OP): New. * config/frv/frv.h (CTORS_SECTION_ASM_OP): New.
......
...@@ -198,7 +198,6 @@ int frv_sched_lookahead = 4; /* -msched-lookahead=n */ ...@@ -198,7 +198,6 @@ int frv_sched_lookahead = 4; /* -msched-lookahead=n */
/* Forward references */ /* Forward references */
static int frv_default_flags_for_cpu PARAMS ((void)); static int frv_default_flags_for_cpu PARAMS ((void));
static int frv_string_begins_with PARAMS ((tree, const char *)); static int frv_string_begins_with PARAMS ((tree, const char *));
static FRV_INLINE int symbol_ref_small_data_p PARAMS ((rtx));
static FRV_INLINE int const_small_data_p PARAMS ((rtx)); static FRV_INLINE int const_small_data_p PARAMS ((rtx));
static FRV_INLINE int plus_small_data_p PARAMS ((rtx, rtx)); static FRV_INLINE int plus_small_data_p PARAMS ((rtx, rtx));
static void frv_print_operand_memory_reference_reg static void frv_print_operand_memory_reference_reg
...@@ -276,8 +275,6 @@ static void frv_pack_insns PARAMS ((void)); ...@@ -276,8 +275,6 @@ static void frv_pack_insns PARAMS ((void));
static void frv_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void frv_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void frv_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static void frv_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static bool frv_assemble_integer PARAMS ((rtx, unsigned, int)); static bool frv_assemble_integer PARAMS ((rtx, unsigned, int));
static const char * frv_strip_name_encoding PARAMS ((const char *));
static void frv_encode_section_info PARAMS ((tree, int));
static void frv_init_builtins PARAMS ((void)); static void frv_init_builtins PARAMS ((void));
static rtx frv_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int)); static rtx frv_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int));
static bool frv_in_small_data_p PARAMS ((tree)); static bool frv_in_small_data_p PARAMS ((tree));
...@@ -294,10 +291,6 @@ static void frv_asm_out_destructor PARAMS ((rtx, int)); ...@@ -294,10 +291,6 @@ static void frv_asm_out_destructor PARAMS ((rtx, int));
#define TARGET_ASM_FUNCTION_EPILOGUE frv_function_epilogue #define TARGET_ASM_FUNCTION_EPILOGUE frv_function_epilogue
#undef TARGET_ASM_INTEGER #undef TARGET_ASM_INTEGER
#define TARGET_ASM_INTEGER frv_assemble_integer #define TARGET_ASM_INTEGER frv_assemble_integer
#undef TARGET_STRIP_NAME_ENCODING
#define TARGET_STRIP_NAME_ENCODING frv_strip_name_encoding
#undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO frv_encode_section_info
#undef TARGET_INIT_BUILTINS #undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS frv_init_builtins #define TARGET_INIT_BUILTINS frv_init_builtins
#undef TARGET_EXPAND_BUILTIN #undef TARGET_EXPAND_BUILTIN
...@@ -318,15 +311,6 @@ static void frv_asm_out_destructor PARAMS ((rtx, int)); ...@@ -318,15 +311,6 @@ static void frv_asm_out_destructor PARAMS ((rtx, int));
struct gcc_target targetm = TARGET_INITIALIZER; struct gcc_target targetm = TARGET_INITIALIZER;
/* Given a SYMBOL_REF, return true if it points to small data. */
static FRV_INLINE int
symbol_ref_small_data_p (x)
rtx x;
{
return SDATA_NAME_P (XSTR (x, 0));
}
/* Given a CONST, return true if the symbol_ref points to small data. */ /* Given a CONST, return true if the symbol_ref points to small data. */
static FRV_INLINE int static FRV_INLINE int
...@@ -339,7 +323,7 @@ const_small_data_p (x) ...@@ -339,7 +323,7 @@ const_small_data_p (x)
return FALSE; return FALSE;
x0 = XEXP (XEXP (x, 0), 0); x0 = XEXP (XEXP (x, 0), 0);
if (GET_CODE (x0) != SYMBOL_REF || !SDATA_NAME_P (XSTR (x0, 0))) if (GET_CODE (x0) != SYMBOL_REF || !SYMBOL_REF_SMALL_P (x0))
return FALSE; return FALSE;
x1 = XEXP (XEXP (x, 0), 1); x1 = XEXP (XEXP (x, 0), 1);
...@@ -362,7 +346,7 @@ plus_small_data_p (op0, op1) ...@@ -362,7 +346,7 @@ plus_small_data_p (op0, op1)
&& REGNO (op0) == SDA_BASE_REG) && REGNO (op0) == SDA_BASE_REG)
{ {
if (GET_CODE (op1) == SYMBOL_REF) if (GET_CODE (op1) == SYMBOL_REF)
return symbol_ref_small_data_p (op1); return SYMBOL_REF_SMALL_P (op1);
if (GET_CODE (op1) == CONST) if (GET_CODE (op1) == CONST)
return const_small_data_p (op1); return const_small_data_p (op1);
...@@ -655,64 +639,6 @@ frv_string_begins_with (name, prefix) ...@@ -655,64 +639,6 @@ frv_string_begins_with (name, prefix)
return (TREE_STRING_LENGTH (name) > prefix_len return (TREE_STRING_LENGTH (name) > prefix_len
&& strncmp (TREE_STRING_POINTER (name), prefix, prefix_len) == 0); && strncmp (TREE_STRING_POINTER (name), prefix, prefix_len) == 0);
} }
/* Encode section information of DECL, which is either a VAR_DECL,
FUNCTION_DECL, STRING_CST, CONSTRUCTOR, or ???.
For the FRV we want to record:
- whether the object lives in .sdata/.sbss.
objects living in .sdata/.sbss are prefixed with SDATA_FLAG_CHAR
*/
static void
frv_encode_section_info (decl, first)
tree decl;
int first;
{
if (! first)
return;
if (TREE_CODE (decl) == VAR_DECL)
{
int size = int_size_in_bytes (TREE_TYPE (decl));
tree section_name = DECL_SECTION_NAME (decl);
int is_small = 0;
/* Don't apply the -G flag to internal compiler structures. We
should leave such structures in the main data section, partly
for efficiency and partly because the size of some of them
(such as C++ typeinfos) is not known until later. */
if (!DECL_ARTIFICIAL (decl) && size > 0 && size <= g_switch_value)
is_small = 1;
/* If we already know which section the decl should be in, see if
it's a small data section. */
if (section_name)
{
if (TREE_CODE (section_name) == STRING_CST)
{
if (frv_string_begins_with (section_name, ".sdata"))
is_small = 1;
if (frv_string_begins_with (section_name, ".sbss"))
is_small = 1;
}
else
abort ();
}
if (is_small)
{
rtx sym_ref = XEXP (DECL_RTL (decl), 0);
char * str = xmalloc (2 + strlen (XSTR (sym_ref, 0)));
str[0] = SDATA_FLAG_CHAR;
strcpy (&str[1], XSTR (sym_ref, 0));
XSTR (sym_ref, 0) = str;
}
}
}
/* Zero or more C statements that may conditionally modify two variables /* Zero or more C statements that may conditionally modify two variables
`fixed_regs' and `call_used_regs' (both of type `char []') after they have `fixed_regs' and `call_used_regs' (both of type `char []') after they have
...@@ -2622,7 +2548,7 @@ frv_print_operand_memory_reference (stream, x, addr_offset) ...@@ -2622,7 +2548,7 @@ frv_print_operand_memory_reference (stream, x, addr_offset)
case SYMBOL_REF: case SYMBOL_REF:
if (x0 && GET_CODE (x0) == REG && REGNO (x0) == SDA_BASE_REG if (x0 && GET_CODE (x0) == REG && REGNO (x0) == SDA_BASE_REG
&& symbol_ref_small_data_p (x1)) && SYMBOL_REF_SMALL_P (x1))
{ {
fputs ("#gprel12(", stream); fputs ("#gprel12(", stream);
assemble_name (stream, XSTR (x1, 0)); assemble_name (stream, XSTR (x1, 0));
...@@ -2805,7 +2731,7 @@ frv_print_operand (file, x, code) ...@@ -2805,7 +2731,7 @@ frv_print_operand (file, x, code)
fprintf (file, "%d", frv_print_operand_jump_hint (current_output_insn)); fprintf (file, "%d", frv_print_operand_jump_hint (current_output_insn));
break; break;
case SDATA_FLAG_CHAR: case '@':
/* Output small data area base register (gr16). */ /* Output small data area base register (gr16). */
fputs (reg_names[SDA_BASE_REG], file); fputs (reg_names[SDA_BASE_REG], file);
break; break;
...@@ -3522,7 +3448,7 @@ frv_legitimate_address_p (mode, x, strict_p, condexec_p) ...@@ -3522,7 +3448,7 @@ frv_legitimate_address_p (mode, x, strict_p, condexec_p)
case SYMBOL_REF: case SYMBOL_REF:
if (!condexec_p if (!condexec_p
&& regno0 == SDA_BASE_REG && regno0 == SDA_BASE_REG
&& symbol_ref_small_data_p (x1)) && SYMBOL_REF_SMALL_P (x1))
ret = TRUE; ret = TRUE;
break; break;
...@@ -3580,7 +3506,7 @@ frv_legitimize_address (x, oldx, mode) ...@@ -3580,7 +3506,7 @@ frv_legitimize_address (x, oldx, mode)
things up when force_reg is called to try and put it in a register because things up when force_reg is called to try and put it in a register because
we aren't optimizing. */ we aren't optimizing. */
if (optimize if (optimize
&& ((GET_CODE (x) == SYMBOL_REF && symbol_ref_small_data_p (x)) && ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_SMALL_P (x))
|| (GET_CODE (x) == CONST && const_small_data_p (x)))) || (GET_CODE (x) == CONST && const_small_data_p (x))))
{ {
ret = gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, SDA_BASE_REG), x); ret = gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, SDA_BASE_REG), x);
...@@ -3889,7 +3815,7 @@ int int_2word_operand (op, mode) ...@@ -3889,7 +3815,7 @@ int int_2word_operand (op, mode)
case SYMBOL_REF: case SYMBOL_REF:
/* small data references are already 1 word */ /* small data references are already 1 word */
return (flag_pic == 0) && (! symbol_ref_small_data_p (op)); return (flag_pic == 0) && (! SYMBOL_REF_SMALL_P (op));
case CONST_INT: case CONST_INT:
return ! IN_RANGE_P (INTVAL (op), -32768, 32767); return ! IN_RANGE_P (INTVAL (op), -32768, 32767);
...@@ -3951,7 +3877,7 @@ int pic_symbolic_operand (op, mode) ...@@ -3951,7 +3877,7 @@ int pic_symbolic_operand (op, mode)
case SYMBOL_REF: case SYMBOL_REF:
/* small data references are already 1 word */ /* small data references are already 1 word */
return ! symbol_ref_small_data_p (op); return ! SYMBOL_REF_SMALL_P (op);
case CONST: case CONST:
/* small data references are already 1 word */ /* small data references are already 1 word */
...@@ -3992,7 +3918,7 @@ int small_data_symbolic_operand (op, mode) ...@@ -3992,7 +3918,7 @@ int small_data_symbolic_operand (op, mode)
return const_small_data_p (op); return const_small_data_p (op);
case SYMBOL_REF: case SYMBOL_REF:
return symbol_ref_small_data_p (op); return SYMBOL_REF_SMALL_P (op);
} }
return FALSE; return FALSE;
...@@ -5504,7 +5430,7 @@ frv_emit_movsi (dest, src) ...@@ -5504,7 +5430,7 @@ frv_emit_movsi (dest, src)
break; break;
case SYMBOL_REF: case SYMBOL_REF:
if (symbol_ref_small_data_p (src)) if (SYMBOL_REF_SMALL_P (src))
base_regno = SDA_BASE_REG; base_regno = SDA_BASE_REG;
else if (flag_pic) else if (flag_pic)
...@@ -9779,23 +9705,38 @@ frv_expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -9779,23 +9705,38 @@ frv_expand_builtin (exp, target, subtarget, mode, ignore)
return 0; return 0;
} }
static const char *
frv_strip_name_encoding (str)
const char *str;
{
while (*str == '*' || *str == SDATA_FLAG_CHAR)
str++;
return str;
}
static bool static bool
frv_in_small_data_p (decl) frv_in_small_data_p (decl)
tree decl; tree decl;
{ {
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl)); HOST_WIDE_INT size;
tree section_name;
/* Don't apply the -G flag to internal compiler structures. We
should leave such structures in the main data section, partly
for efficiency and partly because the size of some of them
(such as C++ typeinfos) is not known until later. */
if (TREE_CODE (decl) != VAR_DECL || DECL_ARTIFICIAL (decl))
return false;
size = int_size_in_bytes (TREE_TYPE (decl));
if (size > 0 && size <= g_switch_value)
return true;
/* If we already know which section the decl should be in, see if
it's a small data section. */
section_name = DECL_SECTION_NAME (decl);
if (section_name)
{
if (TREE_CODE (section_name) != STRING_CST)
abort ();
if (frv_string_begins_with (section_name, ".sdata"))
return true;
if (frv_string_begins_with (section_name, ".sbss"))
return true;
}
return symbol_ref_small_data_p (XEXP (DECL_RTL (decl), 0)) return false;
&& size > 0 && size <= g_switch_value;
} }
static bool static bool
......
...@@ -2663,10 +2663,9 @@ __asm__("\n" \ ...@@ -2663,10 +2663,9 @@ __asm__("\n" \
macro if you do not define `EXTRA_SECTIONS'. */ macro if you do not define `EXTRA_SECTIONS'. */
#undef EXTRA_SECTION_FUNCTIONS #undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \ #define EXTRA_SECTION_FUNCTIONS \
SDATA_SECTION_FUNCTION \ SDATA_SECTION_FUNCTION \
SBSS_SECTION_FUNCTION \ SBSS_SECTION_FUNCTION \
FIXUP_SECTION_FUNCTION FIXUP_SECTION_FUNCTION
#define SDATA_SECTION_FUNCTION \ #define SDATA_SECTION_FUNCTION \
void \ void \
...@@ -2677,7 +2676,7 @@ sdata_section () \ ...@@ -2677,7 +2676,7 @@ sdata_section () \
fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \ fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
in_section = in_sdata; \ in_section = in_sdata; \
} \ } \
} \ }
#define SBSS_SECTION_FUNCTION \ #define SBSS_SECTION_FUNCTION \
void \ void \
...@@ -2688,7 +2687,7 @@ sbss_section () \ ...@@ -2688,7 +2687,7 @@ sbss_section () \
fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \ fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
in_section = in_sbss; \ in_section = in_sbss; \
} \ } \
} \ }
#define FIXUP_SECTION_FUNCTION \ #define FIXUP_SECTION_FUNCTION \
void \ void \
...@@ -2699,11 +2698,7 @@ fixup_section () \ ...@@ -2699,11 +2698,7 @@ fixup_section () \
fprintf (asm_out_file, "%s\n", FIXUP_SECTION_ASM_OP); \ fprintf (asm_out_file, "%s\n", FIXUP_SECTION_ASM_OP); \
in_section = in_fixup; \ in_section = in_fixup; \
} \ } \
} \ }
#define SDATA_FLAG_CHAR '@'
#define SDATA_NAME_P(NAME) (*(NAME) == SDATA_FLAG_CHAR)
/* Position Independent Code. */ /* Position Independent Code. */
...@@ -2788,10 +2783,10 @@ extern int size_directive_output; ...@@ -2788,10 +2783,10 @@ extern int size_directive_output;
#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \ #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \
do { \ do { \
if (SDATA_NAME_P (NAME)) \ if ((SIZE) > 0 && (SIZE) <= g_switch_value) \
sbss_section (); \ sbss_section (); \
else \ else \
bss_section (); \ bss_section (); \
ASM_OUTPUT_ALIGN (STREAM, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \ ASM_OUTPUT_ALIGN (STREAM, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL); \ ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL); \
ASM_OUTPUT_SKIP (STREAM, (SIZE) ? (SIZE) : 1); \ ASM_OUTPUT_SKIP (STREAM, (SIZE) ? (SIZE) : 1); \
...@@ -2814,19 +2809,6 @@ do { \ ...@@ -2814,19 +2809,6 @@ do { \
/* Globalizing directive for a label. */ /* Globalizing directive for a label. */
#define GLOBAL_ASM_OP "\t.globl " #define GLOBAL_ASM_OP "\t.globl "
/* A C statement (sans semicolon) to output to the stdio stream STREAM a
reference in assembler syntax to a label named NAME. This should add `_' to
the front of the name, if that is customary on your operating system, as it
is in most Berkeley Unix systems. This macro is used in `assemble_name'. */
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
do { \
const char *_name = (NAME); \
while (*_name == '*' || *_name == SDATA_FLAG_CHAR) \
_name++; \
asm_fprintf (STREAM, "%U%s", _name); \
} while (0)
/* A C statement to store into the string STRING a label whose name is made /* A C statement to store into the string STRING a label whose name is made
from the string PREFIX and the number NUM. from the string PREFIX and the number NUM.
...@@ -2980,7 +2962,7 @@ do { \ ...@@ -2980,7 +2962,7 @@ do { \
* == temporary integer CCR register (cr3) * == temporary integer CCR register (cr3)
& == temporary integer ICC register (icc3) */ & == temporary integer ICC register (icc3) */
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
((CODE) == '.' || (CODE) == '#' || (CODE) == SDATA_FLAG_CHAR || (CODE) == '~' \ ((CODE) == '.' || (CODE) == '#' || (CODE) == '@' || (CODE) == '~' \
|| (CODE) == '*' || (CODE) == '&') || (CODE) == '*' || (CODE) == '&')
/* A C compound statement to output to stdio stream STREAM the assembler syntax /* A C compound statement to output to stdio stream STREAM the assembler syntax
......
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