Commit 453bd0f5 by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

re PR target/19806 (cris-axis-elf testsuite failure:…

re PR target/19806 (cris-axis-elf testsuite failure: gcc.c-torture/execute/20001130-1.c compilation,  -O0)

	PR target/19806
	* config/cris/cris.c (in_code): New variable.
	(cris_output_addr_const): Now a static function, a wrapper for
	output_addr_const.
	(cris_asm_output_symbol_ref): New function, broken out SYMBOL_REF
	case from old cris_output_addr_const.
	(cris_asm_output_label_ref): Similar for LABEL_REF.
	(cris_output_addr_const_extra): Similar for UNSPEC.
	* config/cris/cris.h (OUTPUT_ADDR_CONST_EXTRA)
	(ASM_OUTPUT_SYMBOL_REF, ASM_OUTPUT_LABEL_REF): Define.
	* config/cris/cris-protos.h (cris_output_addr_const): Remove
	declaration.
	(cris_asm_output_symbol_ref, cris_output_addr_const_extra)
	(cris_asm_output_label_ref): Declare.

From-SVN: r94738
parent 749c6ef9
2005-02-08 Hans-Peter Nilsson <hp@axis.com>
PR target/19806
* config/cris/cris.c (in_code): New variable.
(cris_output_addr_const): Now a static function, a wrapper for
output_addr_const.
(cris_asm_output_symbol_ref): New function, broken out SYMBOL_REF
case from old cris_output_addr_const.
(cris_asm_output_label_ref): Similar for LABEL_REF.
(cris_output_addr_const_extra): Similar for UNSPEC.
* config/cris/cris.h (OUTPUT_ADDR_CONST_EXTRA)
(ASM_OUTPUT_SYMBOL_REF, ASM_OUTPUT_LABEL_REF): Define.
* config/cris/cris-protos.h (cris_output_addr_const): Remove
declaration.
(cris_asm_output_symbol_ref, cris_output_addr_const_extra)
(cris_asm_output_label_ref): Declare.
2005-02-08 Paolo Bonzini <bonzini@gnu.org> 2005-02-08 Paolo Bonzini <bonzini@gnu.org>
PR preprocessor/19801 PR preprocessor/19801
......
...@@ -42,9 +42,11 @@ extern int cris_legitimate_pic_operand (rtx); ...@@ -42,9 +42,11 @@ extern int cris_legitimate_pic_operand (rtx);
extern int cris_gotless_symbol (rtx); extern int cris_gotless_symbol (rtx);
extern int cris_got_symbol (rtx); extern int cris_got_symbol (rtx);
extern int cris_symbol (rtx); extern int cris_symbol (rtx);
extern void cris_output_addr_const (FILE *, rtx); extern void cris_asm_output_symbol_ref (FILE *, rtx);
extern bool cris_output_addr_const_extra (FILE *, rtx);
extern int cris_cfun_uses_pic_table (void); extern int cris_cfun_uses_pic_table (void);
#endif /* RTX_CODE */ #endif /* RTX_CODE */
extern void cris_asm_output_label_ref (FILE *, char *);
extern void cris_target_asm_named_section (const char *, unsigned int, tree); extern void cris_target_asm_named_section (const char *, unsigned int, tree);
extern int cris_return_address_on_stack (void); extern int cris_return_address_on_stack (void);
......
...@@ -83,6 +83,10 @@ static char cris_output_insn_is_bound = 0; ...@@ -83,6 +83,10 @@ static char cris_output_insn_is_bound = 0;
just the "sym:GOTOFF" part. */ just the "sym:GOTOFF" part. */
static int cris_pic_sympart_only = 0; static int cris_pic_sympart_only = 0;
/* In code for output macros, this is how we know whether e.g. constant
goes in code or in a static initializer. */
static int in_code = 0;
/* Fix for reg_overlap_mentioned_p. */ /* Fix for reg_overlap_mentioned_p. */
static int cris_reg_overlap_mentioned_p (rtx, rtx); static int cris_reg_overlap_mentioned_p (rtx, rtx);
...@@ -90,6 +94,8 @@ static void cris_print_base (rtx, FILE *); ...@@ -90,6 +94,8 @@ static void cris_print_base (rtx, FILE *);
static void cris_print_index (rtx, FILE *); static void cris_print_index (rtx, FILE *);
static void cris_output_addr_const (FILE *, rtx);
static struct machine_function * cris_init_machine_status (void); static struct machine_function * cris_init_machine_status (void);
static rtx cris_struct_value_rtx (tree, int); static rtx cris_struct_value_rtx (tree, int);
...@@ -2972,178 +2978,120 @@ cris_split_movdx (rtx *operands) ...@@ -2972,178 +2978,120 @@ cris_split_movdx (rtx *operands)
return val; return val;
} }
/* This is in essence a copy of output_addr_const altered to output /* Use from within code, from e.g. PRINT_OPERAND and
symbolic operands as PIC. PRINT_OPERAND_ADDRESS. Macros used in output_addr_const need to emit
different things depending on whether code operand or constant is
FIXME: Add hooks similar to ASM_OUTPUT_SYMBOL_REF to get this effect in emitted. */
the "real" output_addr_const. All we need is one for LABEL_REF (and
one for CODE_LABEL?). */
void static void
cris_output_addr_const (FILE *file, rtx x) cris_output_addr_const (FILE *file, rtx x)
{ {
int is_plt = 0; in_code++;
output_addr_const (file, x);
restart: in_code--;
switch (GET_CODE (x)) }
{
case UNSPEC:
ASSERT_PLT_UNSPEC (x);
x = XVECEXP (x, 0, 0);
is_plt = 1;
/* Fall through. */
case SYMBOL_REF:
if (flag_pic)
{
const char *origstr = XSTR (x, 0);
const char *str;
str = (* targetm.strip_name_encoding) (origstr); /* Worker function for ASM_OUTPUT_SYMBOL_REF. */
if (is_plt) void
{ cris_asm_output_symbol_ref (FILE *file, rtx x)
if (cris_pic_sympart_only) {
{ if (flag_pic && in_code > 0)
assemble_name (file, str); {
fprintf (file, ":PLTG"); const char *origstr = XSTR (x, 0);
} const char *str;
else
{
if (TARGET_AVOID_GOTPLT)
/* We shouldn't get here. */
abort ();
fprintf (file, "[$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]); str = (* targetm.strip_name_encoding) (origstr);
assemble_name (file, XSTR (x, 0));
if (flag_pic == 1) if (cris_gotless_symbol (x))
fprintf (file, ":GOTPLT16]"); {
else if (! cris_pic_sympart_only)
fprintf (file, ":GOTPLT]"); fprintf (file, "$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
} assemble_name (file, str);
} fprintf (file, ":GOTOFF");
else if (cris_gotless_symbol (x)) }
{ else if (cris_got_symbol (x))
if (! cris_pic_sympart_only) {
fprintf (file, "$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]); if (cris_pic_sympart_only)
assemble_name (file, str); abort ();
fprintf (file, ":GOTOFF"); fprintf (file, "[$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
} assemble_name (file, XSTR (x, 0));
else if (cris_got_symbol (x))
{
if (cris_pic_sympart_only)
abort ();
fprintf (file, "[$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
assemble_name (file, XSTR (x, 0));
if (flag_pic == 1) if (flag_pic == 1)
fprintf (file, ":GOT16]"); fprintf (file, ":GOT16]");
else
fprintf (file, ":GOT]");
}
else else
LOSE_AND_RETURN ("unexpected PIC symbol", x); fprintf (file, ":GOT]");
/* Sanity check. */
if (! current_function_uses_pic_offset_table)
output_operand_lossage ("PIC register isn't set up");
} }
else else
assemble_name (file, XSTR (x, 0)); LOSE_AND_RETURN ("unexpected PIC symbol", x);
break;
case LABEL_REF: /* Sanity check. */
/* If we get one of those here, it should be dressed as PIC. Branch if (! current_function_uses_pic_offset_table)
labels are normally output with the 'l' specifier, which means it output_operand_lossage ("PIC register isn't set up");
will go directly to output_asm_label and not end up here. */ }
if (GET_CODE (XEXP (x, 0)) != CODE_LABEL else
&& (GET_CODE (XEXP (x, 0)) != NOTE assemble_name (file, XSTR (x, 0));
|| NOTE_LINE_NUMBER (XEXP (x, 0)) != NOTE_INSN_DELETED_LABEL)) }
fatal_insn ("unexpected address expression", x);
if (flag_pic) /* Worker function for ASM_OUTPUT_LABEL_REF. */
{
if (cris_gotless_symbol (x))
{
if (! cris_pic_sympart_only)
fprintf (file, "$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
cris_output_addr_const (file, XEXP (x, 0));
fprintf (file, ":GOTOFF"); void
} cris_asm_output_label_ref (FILE *file, char *buf)
else {
/* Labels are never marked as global symbols. */ if (flag_pic && in_code > 0)
fatal_insn ("unexpected PIC symbol", x); {
if (! cris_pic_sympart_only)
fprintf (file, "$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
assemble_name (file, buf);
/* Sanity check. */ fprintf (file, ":GOTOFF");
if (! current_function_uses_pic_offset_table)
internal_error ("emitting PIC operand, but PIC register isn't set up");
break;
}
output_addr_const (file, x); /* Sanity check. */
break; if (! current_function_uses_pic_offset_table)
internal_error ("emitting PIC operand, but PIC register isn't set up");
}
else
assemble_name (file, buf);
}
case NOTE: /* Worker function for OUTPUT_ADDR_CONST_EXTRA. */
if (NOTE_LINE_NUMBER (x) != NOTE_INSN_DELETED_LABEL)
fatal_insn ("unexpected NOTE as addr_const:", x);
case CODE_LABEL:
case CONST_INT:
case CONST_DOUBLE:
case ZERO_EXTEND:
case SIGN_EXTEND:
output_addr_const (file, x);
break;
case CONST: bool
/* This used to output parentheses around the expression, cris_output_addr_const_extra (FILE *file, rtx x)
but that does not work on the 386 (either ATT or BSD assembler). */ {
cris_output_addr_const (file, XEXP (x, 0)); switch (GET_CODE (x))
break; {
const char *origstr;
const char *str;
case PLUS: case UNSPEC:
/* Some assemblers need integer constants to appear last (e.g. masm). */ ASSERT_PLT_UNSPEC (x);
if (GET_CODE (XEXP (x, 0)) == CONST_INT) x = XVECEXP (x, 0, 0);
origstr = XSTR (x, 0);
str = (* targetm.strip_name_encoding) (origstr);
if (cris_pic_sympart_only)
{ {
cris_output_addr_const (file, XEXP (x, 1)); assemble_name (file, str);
if (INTVAL (XEXP (x, 0)) >= 0) fprintf (file, ":PLTG");
fprintf (file, "+");
output_addr_const (file, XEXP (x, 0));
} }
else else
{ {
cris_output_addr_const (file, XEXP (x, 0)); if (TARGET_AVOID_GOTPLT)
if (GET_CODE (XEXP (x, 1)) != CONST_INT /* We shouldn't get here. */
|| INTVAL (XEXP (x, 1)) >= 0) abort ();
fprintf (file, "+");
cris_output_addr_const (file, XEXP (x, 1));
}
break;
case MINUS: fprintf (file, "[$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
/* Avoid outputting things like x-x or x+5-x, assemble_name (file, XSTR (x, 0));
since some assemblers can't handle that. */
x = simplify_subtraction (x); if (flag_pic == 1)
if (GET_CODE (x) != MINUS) fprintf (file, ":GOTPLT16]");
goto restart; else
fprintf (file, ":GOTPLT]");
cris_output_addr_const (file, XEXP (x, 0));
fprintf (file, "-");
if ((GET_CODE (XEXP (x, 1)) == CONST_INT
&& INTVAL (XEXP (x, 1)) < 0)
|| GET_CODE (XEXP (x, 1)) != CONST_INT)
{
fprintf (file, "%s", targetm.asm_out.open_paren);
cris_output_addr_const (file, XEXP (x, 1));
fprintf (file, "%s", targetm.asm_out.close_paren);
} }
else return true;
output_addr_const (file, XEXP (x, 1));
break;
default: default:
LOSE_AND_RETURN ("unexpected address expression", x); return false;
} }
} }
......
...@@ -1352,6 +1352,9 @@ struct cum_args {int regs;}; ...@@ -1352,6 +1352,9 @@ struct cum_args {int regs;};
/* Node: Data Output */ /* Node: Data Output */
#define OUTPUT_ADDR_CONST_EXTRA(STREAM, X, FAIL) \
do { if (!cris_output_addr_const_extra (STREAM, X)) goto FAIL; } while (0)
#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) (C) == '@' #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) (C) == '@'
/* Node: Uninitialized Data */ /* Node: Uninitialized Data */
...@@ -1422,6 +1425,12 @@ struct cum_args {int regs;}; ...@@ -1422,6 +1425,12 @@ struct cum_args {int regs;};
#define SUPPORTS_WEAK 1 #define SUPPORTS_WEAK 1
#define ASM_OUTPUT_SYMBOL_REF(STREAM, SYM) \
cris_asm_output_symbol_ref (STREAM, SYM)
#define ASM_OUTPUT_LABEL_REF(STREAM, BUF) \
cris_asm_output_label_ref (STREAM, BUF)
/* Remove any previous definition (elfos.h). */ /* Remove any previous definition (elfos.h). */
#undef ASM_GENERATE_INTERNAL_LABEL #undef ASM_GENERATE_INTERNAL_LABEL
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
......
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