Commit 50d1ff6a by Richard Henderson Committed by Richard Henderson

v850.c (print_operand): Use SYMBOL_REF_[ZST]DA.

        * config/v850/v850.c (print_operand): Use SYMBOL_REF_[ZST]DA.
        (print_operand_address): Likewise.
        (ep_memory_operand): Likewise.
        (special_symbolref_operand): Likewise.
        (v850_encode_data_area): Use SYMBOL_REF_FLAGS.
        (v850_encode_section_info): Call default_encode_section_info.
        (v850_strip_name_encoding): Remove.
        * config/v850/v850.h (EXTRA_CONSTRAINT): Use SYMBOL_REF_[ZST]DA.
        (ASM_OUTPUT_LABELREF): Remove.
        (ZDA_NAME_FLAG_CHAR, ZDA_NAME_P): Remove.
        (SDA_NAME_FLAG_CHAR, SDA_NAME_P): Remove.
        (TDA_NAME_FLAG_CHAR, TDA_NAME_P): Remove.
        (ENCODED_NAME_P): Remove.
        (SYMBOL_FLAG_ZDA, SYMBOL_REF_ZDA_P): New.
        (SYMBOL_FLAG_SDA, SYMBOL_REF_SDA_P): New.
        (SYMBOL_FLAG_TDA, SYMBOL_REF_TDA_P): New.

From-SVN: r65738
parent e7d687bb
2003-04-17 Richard Henderson <rth@redhat.com> 2003-04-17 Richard Henderson <rth@redhat.com>
* config/v850/v850.c (print_operand): Use SYMBOL_REF_[ZST]DA.
(print_operand_address): Likewise.
(ep_memory_operand): Likewise.
(special_symbolref_operand): Likewise.
(v850_encode_data_area): Use SYMBOL_REF_FLAGS.
(v850_encode_section_info): Call default_encode_section_info.
(v850_strip_name_encoding): Remove.
* config/v850/v850.h (EXTRA_CONSTRAINT): Use SYMBOL_REF_[ZST]DA.
(ASM_OUTPUT_LABELREF): Remove.
(ZDA_NAME_FLAG_CHAR, ZDA_NAME_P): Remove.
(SDA_NAME_FLAG_CHAR, SDA_NAME_P): Remove.
(TDA_NAME_FLAG_CHAR, TDA_NAME_P): Remove.
(ENCODED_NAME_P): Remove.
(SYMBOL_FLAG_ZDA, SYMBOL_REF_ZDA_P): New.
(SYMBOL_FLAG_SDA, SYMBOL_REF_SDA_P): New.
(SYMBOL_FLAG_TDA, SYMBOL_REF_TDA_P): New.
2003-04-17 Richard Henderson <rth@redhat.com>
* config/stormy16/stormy16.c (xstormy16_encode_section_info): Kill. * config/stormy16/stormy16.c (xstormy16_encode_section_info): Kill.
* config/stormy16/stormy16.h (ASM_OUTPUT_SYMBOL_REF): Use * config/stormy16/stormy16.h (ASM_OUTPUT_SYMBOL_REF): Use
SYMBOL_REF_FUNCTION_P. SYMBOL_REF_FUNCTION_P.
......
...@@ -63,7 +63,6 @@ static void v850_insert_attributes PARAMS ((tree, tree *)); ...@@ -63,7 +63,6 @@ static void v850_insert_attributes PARAMS ((tree, tree *));
static void v850_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT)); static void v850_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT));
static void v850_encode_data_area PARAMS ((tree)); static void v850_encode_data_area PARAMS ((tree));
static void v850_encode_section_info PARAMS ((tree, int)); static void v850_encode_section_info PARAMS ((tree, int));
static const char *v850_strip_name_encoding PARAMS ((const char *));
/* Information about the various small memory areas. */ /* Information about the various small memory areas. */
struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] = struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
...@@ -104,8 +103,6 @@ static int v850_interrupt_p = FALSE; ...@@ -104,8 +103,6 @@ static int v850_interrupt_p = FALSE;
#undef TARGET_ENCODE_SECTION_INFO #undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO v850_encode_section_info #define TARGET_ENCODE_SECTION_INFO v850_encode_section_info
#undef TARGET_STRIP_NAME_ENCODING
#define TARGET_STRIP_NAME_ENCODING v850_strip_name_encoding
#undef TARGET_RTX_COSTS #undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS v850_rtx_costs #define TARGET_RTX_COSTS v850_rtx_costs
...@@ -509,20 +506,18 @@ print_operand (file, x, code) ...@@ -509,20 +506,18 @@ print_operand (file, x, code)
case 'O': case 'O':
if (special_symbolref_operand (x, VOIDmode)) if (special_symbolref_operand (x, VOIDmode))
{ {
const char *name;
if (GET_CODE (x) == SYMBOL_REF) if (GET_CODE (x) == SYMBOL_REF)
name = XSTR (x, 0); ;
else if (GET_CODE (x) == CONST) else if (GET_CODE (x) == CONST)
name = XSTR (XEXP (XEXP (x, 0), 0), 0); x = XEXP (XEXP (x, 0), 0);
else else
abort (); abort ();
if (ZDA_NAME_P (name)) if (SYMBOL_REF_ZDA_P (x))
fprintf (file, "zdaoff"); fprintf (file, "zdaoff");
else if (SDA_NAME_P (name)) else if (SYMBOL_REF_SDA_P (x))
fprintf (file, "sdaoff"); fprintf (file, "sdaoff");
else if (TDA_NAME_P (name)) else if (SYMBOL_REF_TDA_P (x))
fprintf (file, "tdaoff"); fprintf (file, "tdaoff");
else else
abort (); abort ();
...@@ -539,20 +534,18 @@ print_operand (file, x, code) ...@@ -539,20 +534,18 @@ print_operand (file, x, code)
case 'Q': case 'Q':
if (special_symbolref_operand (x, VOIDmode)) if (special_symbolref_operand (x, VOIDmode))
{ {
const char *name;
if (GET_CODE (x) == SYMBOL_REF) if (GET_CODE (x) == SYMBOL_REF)
name = XSTR (x, 0); ;
else if (GET_CODE (x) == CONST) else if (GET_CODE (x) == CONST)
name = XSTR (XEXP (XEXP (x, 0), 0), 0); x = XEXP (XEXP (x, 0), 0);
else else
abort (); abort ();
if (ZDA_NAME_P (name)) if (SYMBOL_REF_ZDA_P (x))
fprintf (file, "r0"); fprintf (file, "r0");
else if (SDA_NAME_P (name)) else if (SYMBOL_REF_SDA_P (x))
fprintf (file, "gp"); fprintf (file, "gp");
else if (TDA_NAME_P (name)) else if (SYMBOL_REF_TDA_P (x))
fprintf (file, "ep"); fprintf (file, "ep");
else else
abort (); abort ();
...@@ -692,55 +685,51 @@ print_operand_address (file, addr) ...@@ -692,55 +685,51 @@ print_operand_address (file, addr)
} }
break; break;
case SYMBOL_REF: case SYMBOL_REF:
if (ENCODED_NAME_P (XSTR (addr, 0)))
{ {
const char *name = XSTR (addr, 0); const char *off_name = NULL;
const char *off_name; const char *reg_name = NULL;
const char *reg_name;
if (ZDA_NAME_P (name)) if (SYMBOL_REF_ZDA_P (addr))
{ {
off_name = "zdaoff"; off_name = "zdaoff";
reg_name = "r0"; reg_name = "r0";
} }
else if (SDA_NAME_P (name)) else if (SYMBOL_REF_SDA_P (addr))
{ {
off_name = "sdaoff"; off_name = "sdaoff";
reg_name = "gp"; reg_name = "gp";
} }
else if (TDA_NAME_P (name)) else if (SYMBOL_REF_TDA_P (addr))
{ {
off_name = "tdaoff"; off_name = "tdaoff";
reg_name = "ep"; reg_name = "ep";
} }
else
abort ();
if (off_name)
fprintf (file, "%s(", off_name); fprintf (file, "%s(", off_name);
output_addr_const (file, addr); output_addr_const (file, addr);
if (reg_name)
fprintf (file, ")[%s]", reg_name); fprintf (file, ")[%s]", reg_name);
} }
else
output_addr_const (file, addr);
break; break;
case CONST: case CONST:
if (special_symbolref_operand (addr, VOIDmode)) if (special_symbolref_operand (addr, VOIDmode))
{ {
const char *name = XSTR (XEXP (XEXP (addr, 0), 0), 0); rtx x = XEXP (XEXP (addr, 0), 0);
const char *off_name; const char *off_name;
const char *reg_name; const char *reg_name;
if (ZDA_NAME_P (name)) if (SYMBOL_REF_ZDA_P (x))
{ {
off_name = "zdaoff"; off_name = "zdaoff";
reg_name = "r0"; reg_name = "r0";
} }
else if (SDA_NAME_P (name)) else if (SYMBOL_REF_SDA_P (x))
{ {
off_name = "sdaoff"; off_name = "sdaoff";
reg_name = "gp"; reg_name = "gp";
} }
else if (TDA_NAME_P (name)) else if (SYMBOL_REF_TDA_P (x))
{ {
off_name = "tdaoff"; off_name = "tdaoff";
reg_name = "ep"; reg_name = "ep";
...@@ -1051,7 +1040,7 @@ ep_memory_operand (op, mode, unsigned_load) ...@@ -1051,7 +1040,7 @@ ep_memory_operand (op, mode, unsigned_load)
break; break;
case SYMBOL_REF: case SYMBOL_REF:
return TDA_NAME_P (XSTR (addr, 0)); return SYMBOL_REF_TDA_P (addr);
case REG: case REG:
return REGNO (addr) == EP_REGNUM; return REGNO (addr) == EP_REGNUM;
...@@ -1067,7 +1056,7 @@ ep_memory_operand (op, mode, unsigned_load) ...@@ -1067,7 +1056,7 @@ ep_memory_operand (op, mode, unsigned_load)
if (GET_CODE (op0) == REG && REGNO (op0) == EP_REGNUM) if (GET_CODE (op0) == REG && REGNO (op0) == EP_REGNUM)
return TRUE; return TRUE;
if (GET_CODE (op0) == SYMBOL_REF && TDA_NAME_P (XSTR (op0, 0))) if (GET_CODE (op0) == SYMBOL_REF && SYMBOL_REF_TDA_P (op0))
return TRUE; return TRUE;
} }
break; break;
...@@ -1151,15 +1140,15 @@ special_symbolref_operand (op, mode) ...@@ -1151,15 +1140,15 @@ special_symbolref_operand (op, mode)
rtx op; rtx op;
enum machine_mode ATTRIBUTE_UNUSED mode; enum machine_mode ATTRIBUTE_UNUSED mode;
{ {
if (GET_CODE (op) == SYMBOL_REF) if (GET_CODE (op) == CONST
return ENCODED_NAME_P (XSTR (op, 0)); && GET_CODE (XEXP (op, 0)) == PLUS
else if (GET_CODE (op) == CONST)
return (GET_CODE (XEXP (op, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
&& ENCODED_NAME_P (XSTR (XEXP (XEXP (op, 0), 0), 0))
&& GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT
&& CONST_OK_FOR_K (INTVAL (XEXP (XEXP (op, 0), 1)))); && CONST_OK_FOR_K (INTVAL (XEXP (XEXP (op, 0), 1))))
op = XEXP (XEXP (op, 0), 0);
if (GET_CODE (op) == SYMBOL_REF)
return (SYMBOL_REF_FLAGS (op)
& (SYMBOL_FLAG_ZDA | SYMBOL_FLAG_TDA | SYMBOL_FLAG_SDA)) != 0;
return FALSE; return FALSE;
} }
...@@ -2338,9 +2327,8 @@ static void ...@@ -2338,9 +2327,8 @@ static void
v850_encode_data_area (decl) v850_encode_data_area (decl)
tree decl; tree decl;
{ {
const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0); int flags;
int len = strlen (str); rtx symbol;
char * newstr;
/* Map explict sections into the appropriate attribute */ /* Map explict sections into the appropriate attribute */
if (v850_get_data_area (decl) == DATA_AREA_NORMAL) if (v850_get_data_area (decl) == DATA_AREA_NORMAL)
...@@ -2380,19 +2368,16 @@ v850_encode_data_area (decl) ...@@ -2380,19 +2368,16 @@ v850_encode_data_area (decl)
return; return;
} }
newstr = alloca (len + 2); symbol = XEXP (DECL_RTL (decl), 0);
flags = SYMBOL_REF_FLAGS (symbol);
strcpy (newstr + 1, str);
switch (v850_get_data_area (decl)) switch (v850_get_data_area (decl))
{ {
case DATA_AREA_ZDA: *newstr = ZDA_NAME_FLAG_CHAR; break; case DATA_AREA_ZDA: flags |= SYMBOL_FLAG_ZDA; break;
case DATA_AREA_TDA: *newstr = TDA_NAME_FLAG_CHAR; break; case DATA_AREA_TDA: flags |= SYMBOL_FLAG_TDA; break;
case DATA_AREA_SDA: *newstr = SDA_NAME_FLAG_CHAR; break; case DATA_AREA_SDA: flags |= SYMBOL_FLAG_SDA; break;
default: abort (); default: abort ();
} }
SYMBOL_REF_FLAGS (symbol) = flags;
XSTR (XEXP (DECL_RTL (decl), 0), 0) = ggc_alloc_string (newstr, len + 2);
} }
static void static void
...@@ -2400,18 +2385,13 @@ v850_encode_section_info (decl, first) ...@@ -2400,18 +2385,13 @@ v850_encode_section_info (decl, first)
tree decl; tree decl;
int first; int first;
{ {
if (first && TREE_CODE (decl) == VAR_DECL default_encode_section_info (decl, first);
if (TREE_CODE (decl) == VAR_DECL
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
v850_encode_data_area (decl); v850_encode_data_area (decl);
} }
static const char *
v850_strip_name_encoding (str)
const char *str;
{
return str + (ENCODED_NAME_P (str) || *str == '*');
}
/* Return true if the given RTX is a register which can be restored /* Return true if the given RTX is a register which can be restored
by a function epilogue. */ by a function epilogue. */
int int
......
...@@ -926,13 +926,15 @@ struct cum_arg { int nbytes; int anonymous_args; }; ...@@ -926,13 +926,15 @@ struct cum_arg { int nbytes; int anonymous_args; };
#define EXTRA_CONSTRAINT(OP, C) \ #define EXTRA_CONSTRAINT(OP, C) \
((C) == 'Q' ? ep_memory_operand (OP, GET_MODE (OP), 0) \ ((C) == 'Q' ? ep_memory_operand (OP, GET_MODE (OP), 0) \
: (C) == 'R' ? special_symbolref_operand (OP, VOIDmode) \ : (C) == 'R' ? special_symbolref_operand (OP, VOIDmode) \
: (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF && ! ZDA_NAME_P (XSTR (OP, 0))) \ : (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF \
&& !SYMBOL_REF_ZDA_P (OP)) \
: (C) == 'T' ? ep_memory_operand(OP,GET_MODE(OP),TRUE) \ : (C) == 'T' ? ep_memory_operand(OP,GET_MODE(OP),TRUE) \
: (C) == 'U' ? ((GET_CODE (OP) == SYMBOL_REF && ZDA_NAME_P (XSTR (OP, 0))) \ : (C) == 'U' ? ((GET_CODE (OP) == SYMBOL_REF \
&& SYMBOL_REF_ZDA_P (OP)) \
|| (GET_CODE (OP) == CONST \ || (GET_CODE (OP) == CONST \
&& GET_CODE (XEXP (OP, 0)) == PLUS \ && GET_CODE (XEXP (OP, 0)) == PLUS \
&& GET_CODE (XEXP (XEXP (OP, 0), 0)) == SYMBOL_REF \ && GET_CODE (XEXP (XEXP (OP, 0), 0)) == SYMBOL_REF \
&& ZDA_NAME_P (XSTR (XEXP (XEXP (OP, 0), 0), 0)))) \ && SYMBOL_REF_ZDA_P (XEXP (XEXP (OP, 0), 0)))) \
: 0) : 0)
/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
...@@ -1201,13 +1203,6 @@ zbss_section () \ ...@@ -1201,13 +1203,6 @@ zbss_section () \
/* Globalizing directive for a label. */ /* Globalizing directive for a label. */
#define GLOBAL_ASM_OP "\t.global " #define GLOBAL_ASM_OP "\t.global "
/* This is how to output a reference to a user-level label named NAME.
`assemble_name' uses this. */
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(FILE, NAME) \
asm_fprintf (FILE, "%U%s", (*targetm.strip_name_encoding) (NAME))
#define ASM_PN_FORMAT "%s___%lu" #define ASM_PN_FORMAT "%s___%lu"
/* This is how we tell the assembler that two symbols have the same value. */ /* This is how we tell the assembler that two symbols have the same value. */
...@@ -1433,18 +1428,12 @@ extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_K ...@@ -1433,18 +1428,12 @@ extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_K
#define EP_REGNUM 30 /* ep register number */ #define EP_REGNUM 30 /* ep register number */
#define ZDA_NAME_FLAG_CHAR '@' #define SYMBOL_FLAG_ZDA (SYMBOL_FLAG_MACH_DEP << 0)
#define TDA_NAME_FLAG_CHAR '%' #define SYMBOL_FLAG_TDA (SYMBOL_FLAG_MACH_DEP << 1)
#define SDA_NAME_FLAG_CHAR '&' #define SYMBOL_FLAG_SDA (SYMBOL_FLAG_MACH_DEP << 2)
#define SYMBOL_REF_ZDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_ZDA) != 0)
#define ZDA_NAME_P(NAME) (*(NAME) == ZDA_NAME_FLAG_CHAR) #define SYMBOL_REF_TDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_TDA) != 0)
#define TDA_NAME_P(NAME) (*(NAME) == TDA_NAME_FLAG_CHAR) #define SYMBOL_REF_SDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_SDA) != 0)
#define SDA_NAME_P(NAME) (*(NAME) == SDA_NAME_FLAG_CHAR)
#define ENCODED_NAME_P(SYMBOL_NAME) \
( ZDA_NAME_P (SYMBOL_NAME) \
|| TDA_NAME_P (SYMBOL_NAME) \
|| SDA_NAME_P (SYMBOL_NAME))
/* Define this if you have defined special-purpose predicates in the /* Define this if you have defined special-purpose predicates in the
file `MACHINE.c'. This macro is called within an initializer of an file `MACHINE.c'. This macro is called within an initializer of an
......
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