Commit 6e2188e0 by Nathan Froyd Committed by Nathan Froyd

final.c (output_asm_insn): Call targetm.asm_out.print_operand_punct_valid_p.

	* final.c (output_asm_insn): Call
	targetm.asm_out.print_operand_punct_valid_p.  Update comments.
	(output_operand): Call targetm.asm_out.print_operand.  Update comments.
	(output_address): Call targetm.asm_out.print_operand_address.
	Update comments.
	* target.h (struct gcc_target): Add print_operand,
	print_operand_address, and print_operand_punct_valid_p fields.
	* targhooks.h (default_print_operand): Declare.
	(default_print_operand_address): Declare.
	(default_print_operand_punct_valid_p): Declare.
	* targhooks.c (default_print_operand): Define.
	(default_print_operand_address): Define.
	(default_print_operand_punct_valid_p): Define.
	* target-def.h (TARGET_PRINT_OPERAND): Define if not defined.
	(TARGET_PRINT_OPERAND_ADDRESS): Likewise.
	(TARGET_PRINT_OPERAND_PUNCT_VALID_P): Likewise.
	(TARGET_ASM_OUT): Add TARGET_PRINT_OPERAND,
	TARGET_PRINT_OPERAND_ADDRESS, and TARGET_PRINT_OPERAND_PUNCT_VALID_P.
	* vmsdbgout.c (addr_const_to_string): Update comment.
	* config/i386/i386.c (print_operand): Rename to...
	(ix86_print_operand): ...this.  Make static.
	(print_operand_address): Rename to...
	(ix86_print_operand_address): ...this.  Make static.  Call
	ix86_print_operand instead of PRINT_OPERAND.
	(ix86_print_operand_punct_valid_p): New function.
	(TARGET_PRINT_OPERAND): Define.
	(TARGET_PRINT_OPERAND_ADDRESS): Define.
	(TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.
	* config/i386/i386.h (HI_REGISTER_NAMES): Update comment.
	(PRINT_OPERAND_PUNCT_VALID_P): Delete.
	(PRINT_OPERAND): Delete.
	(PRINT_OPERAND_ADDRESS): Delete.
	* config/i386/i386-protos.h (print_operand): Delete prototype.
	(print_operand_address): Delete prototype.

From-SVN: r160245
parent b97e8f3a
2010-06-03 Nathan Froyd <froydnj@codesourcery.com>
* final.c (output_asm_insn): Call
targetm.asm_out.print_operand_punct_valid_p. Update comments.
(output_operand): Call targetm.asm_out.print_operand. Update comments.
(output_address): Call targetm.asm_out.print_operand_address.
Update comments.
* target.h (struct gcc_target): Add print_operand,
print_operand_address, and print_operand_punct_valid_p fields.
* targhooks.h (default_print_operand): Declare.
(default_print_operand_address): Declare.
(default_print_operand_punct_valid_p): Declare.
* targhooks.c (default_print_operand): Define.
(default_print_operand_address): Define.
(default_print_operand_punct_valid_p): Define.
* target-def.h (TARGET_PRINT_OPERAND): Define if not defined.
(TARGET_PRINT_OPERAND_ADDRESS): Likewise.
(TARGET_PRINT_OPERAND_PUNCT_VALID_P): Likewise.
(TARGET_ASM_OUT): Add TARGET_PRINT_OPERAND,
TARGET_PRINT_OPERAND_ADDRESS, and TARGET_PRINT_OPERAND_PUNCT_VALID_P.
* vmsdbgout.c (addr_const_to_string): Update comment.
* config/i386/i386.c (print_operand): Rename to...
(ix86_print_operand): ...this. Make static.
(print_operand_address): Rename to...
(ix86_print_operand_address): ...this. Make static. Call
ix86_print_operand instead of PRINT_OPERAND.
(ix86_print_operand_punct_valid_p): New function.
(TARGET_PRINT_OPERAND): Define.
(TARGET_PRINT_OPERAND_ADDRESS): Define.
(TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.
* config/i386/i386.h (HI_REGISTER_NAMES): Update comment.
(PRINT_OPERAND_PUNCT_VALID_P): Delete.
(PRINT_OPERAND): Delete.
(PRINT_OPERAND_ADDRESS): Delete.
* config/i386/i386-protos.h (print_operand): Delete prototype.
(print_operand_address): Delete prototype.
2010-06-03 Richard Guenther <rguenther@suse.de> 2010-06-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44403 PR tree-optimization/44403
......
...@@ -60,8 +60,6 @@ extern bool legitimate_pic_operand_p (rtx); ...@@ -60,8 +60,6 @@ extern bool legitimate_pic_operand_p (rtx);
extern int legitimate_pic_address_disp_p (rtx); extern int legitimate_pic_address_disp_p (rtx);
extern void print_reg (rtx, int, FILE*); extern void print_reg (rtx, int, FILE*);
extern void print_operand (FILE*, rtx, int);
extern void print_operand_address (FILE*, rtx);
extern bool output_addr_const_extra (FILE*, rtx); extern bool output_addr_const_extra (FILE*, rtx);
extern void split_di (rtx[], int, rtx[], rtx[]); extern void split_di (rtx[], int, rtx[], rtx[]);
......
...@@ -10962,7 +10962,7 @@ output_pic_addr_const (FILE *file, rtx x, int code) ...@@ -10962,7 +10962,7 @@ output_pic_addr_const (FILE *file, rtx x, int code)
} }
else else
/* We can't handle floating point constants; /* We can't handle floating point constants;
PRINT_OPERAND must handle them. */ TARGET_PRINT_OPERAND must handle them. */
output_operand_lossage ("floating constant misused"); output_operand_lossage ("floating constant misused");
break; break;
...@@ -11579,8 +11579,8 @@ get_some_local_dynamic_name (void) ...@@ -11579,8 +11579,8 @@ get_some_local_dynamic_name (void)
; -- print a semicolon (after prefixes due to bug in older gas). ; -- print a semicolon (after prefixes due to bug in older gas).
*/ */
void static void
print_operand (FILE *file, rtx x, int code) ix86_print_operand (FILE *file, rtx x, int code)
{ {
if (code) if (code)
{ {
...@@ -11615,7 +11615,7 @@ print_operand (FILE *file, rtx x, int code) ...@@ -11615,7 +11615,7 @@ print_operand (FILE *file, rtx x, int code)
if (!REG_P (x)) if (!REG_P (x))
{ {
putc ('[', file); putc ('[', file);
PRINT_OPERAND (file, x, 0); ix86_print_operand (file, x, 0);
putc (']', file); putc (']', file);
return; return;
} }
...@@ -11625,7 +11625,7 @@ print_operand (FILE *file, rtx x, int code) ...@@ -11625,7 +11625,7 @@ print_operand (FILE *file, rtx x, int code)
gcc_unreachable (); gcc_unreachable ();
} }
PRINT_OPERAND (file, x, 0); ix86_print_operand (file, x, 0);
return; return;
...@@ -11780,7 +11780,7 @@ print_operand (FILE *file, rtx x, int code) ...@@ -11780,7 +11780,7 @@ print_operand (FILE *file, rtx x, int code)
case 's': case 's':
if (CONST_INT_P (x) || ! SHIFT_DOUBLE_OMITS_COUNT) if (CONST_INT_P (x) || ! SHIFT_DOUBLE_OMITS_COUNT)
{ {
PRINT_OPERAND (file, x, 0); ix86_print_operand (file, x, 0);
fputs (", ", file); fputs (", ", file);
} }
return; return;
...@@ -12178,10 +12178,16 @@ print_operand (FILE *file, rtx x, int code) ...@@ -12178,10 +12178,16 @@ print_operand (FILE *file, rtx x, int code)
} }
} }
static bool
ix86_print_operand_punct_valid_p (unsigned char code)
{
return (code == '*' || code == '+' || code == '&' || code == ';');
}
/* Print a memory operand whose address is ADDR. */ /* Print a memory operand whose address is ADDR. */
void static void
print_operand_address (FILE *file, rtx addr) ix86_print_operand_address (FILE *file, rtx addr)
{ {
struct ix86_address parts; struct ix86_address parts;
rtx base, index, disp; rtx base, index, disp;
...@@ -30676,6 +30682,13 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree) ...@@ -30676,6 +30682,13 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#undef TARGET_ASM_UNALIGNED_DI_OP #undef TARGET_ASM_UNALIGNED_DI_OP
#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP #define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP
#undef TARGET_PRINT_OPERAND
#define TARGET_PRINT_OPERAND ix86_print_operand
#undef TARGET_PRINT_OPERAND_ADDRESS
#define TARGET_PRINT_OPERAND_ADDRESS ix86_print_operand_address
#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
#define TARGET_PRINT_OPERAND_PUNCT_VALID_P ix86_print_operand_punct_valid_p
#undef TARGET_SCHED_ADJUST_COST #undef TARGET_SCHED_ADJUST_COST
#define TARGET_SCHED_ADJUST_COST ix86_adjust_cost #define TARGET_SCHED_ADJUST_COST ix86_adjust_cost
#undef TARGET_SCHED_ISSUE_RATE #undef TARGET_SCHED_ISSUE_RATE
......
...@@ -1992,7 +1992,8 @@ do { \ ...@@ -1992,7 +1992,8 @@ do { \
For non floating point regs, the following are the HImode names. For non floating point regs, the following are the HImode names.
For float regs, the stack top is sometimes referred to as "%st(0)" For float regs, the stack top is sometimes referred to as "%st(0)"
instead of just "%st". PRINT_OPERAND handles this with the "y" code. */ instead of just "%st". TARGET_PRINT_OPERAND handles this with the
"y" code. */
#define HI_REGISTER_NAMES \ #define HI_REGISTER_NAMES \
{"ax","dx","cx","bx","si","di","bp","sp", \ {"ax","dx","cx","bx","si","di","bp","sp", \
...@@ -2162,20 +2163,6 @@ do { \ ...@@ -2162,20 +2163,6 @@ do { \
"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n" \ "call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n" \
TEXT_SECTION_ASM_OP); TEXT_SECTION_ASM_OP);
/* Print operand X (an rtx) in assembler syntax to file FILE.
CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
Effect of various CODE letters is described in i386.c near
print_operand function. */
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
((CODE) == '*' || (CODE) == '+' || (CODE) == '&' || (CODE) == ';')
#define PRINT_OPERAND(FILE, X, CODE) \
print_operand ((FILE), (X), (CODE))
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
print_operand_address ((FILE), (ADDR))
#define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \ #define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \
do { \ do { \
if (! output_addr_const_extra (FILE, (X))) \ if (! output_addr_const_extra (FILE, (X))) \
......
...@@ -3329,7 +3329,7 @@ output_asm_insn (const char *templ, rtx *operands) ...@@ -3329,7 +3329,7 @@ output_asm_insn (const char *templ, rtx *operands)
outputs an operand in a special way depending on the letter. outputs an operand in a special way depending on the letter.
Letters `acln' are implemented directly. Letters `acln' are implemented directly.
Other letters are passed to `output_operand' so that Other letters are passed to `output_operand' so that
the PRINT_OPERAND macro can define them. */ the TARGET_PRINT_OPERAND hook can define them. */
else if (ISALPHA (*p)) else if (ISALPHA (*p))
{ {
int letter = *p++; int letter = *p++;
...@@ -3395,12 +3395,10 @@ output_asm_insn (const char *templ, rtx *operands) ...@@ -3395,12 +3395,10 @@ output_asm_insn (const char *templ, rtx *operands)
c = *p; c = *p;
} }
/* % followed by punctuation: output something for that /* % followed by punctuation: output something for that
punctuation character alone, with no operand. punctuation character alone, with no operand. The
The PRINT_OPERAND macro decides what is actually done. */ TARGET_PRINT_OPERAND hook decides what is actually done. */
#ifdef PRINT_OPERAND_PUNCT_VALID_P else if (targetm.asm_out.print_operand_punct_valid_p ((unsigned char) *p))
else if (PRINT_OPERAND_PUNCT_VALID_P ((unsigned char) *p))
output_operand (NULL_RTX, *p++); output_operand (NULL_RTX, *p++);
#endif
else else
output_operand_lossage ("invalid %%-code"); output_operand_lossage ("invalid %%-code");
break; break;
...@@ -3472,14 +3470,13 @@ mark_symbol_refs_as_used (rtx x) ...@@ -3472,14 +3470,13 @@ mark_symbol_refs_as_used (rtx x)
} }
/* Print operand X using machine-dependent assembler syntax. /* Print operand X using machine-dependent assembler syntax.
The macro PRINT_OPERAND is defined just to control this function.
CODE is a non-digit that preceded the operand-number in the % spec, CODE is a non-digit that preceded the operand-number in the % spec,
such as 'z' if the spec was `%z3'. CODE is 0 if there was no char such as 'z' if the spec was `%z3'. CODE is 0 if there was no char
between the % and the digits. between the % and the digits.
When CODE is a non-letter, X is 0. When CODE is a non-letter, X is 0.
The meanings of the letters are machine-dependent and controlled The meanings of the letters are machine-dependent and controlled
by PRINT_OPERAND. */ by TARGET_PRINT_OPERAND. */
static void static void
output_operand (rtx x, int code ATTRIBUTE_UNUSED) output_operand (rtx x, int code ATTRIBUTE_UNUSED)
...@@ -3490,7 +3487,7 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED) ...@@ -3490,7 +3487,7 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED)
/* X must not be a pseudo reg. */ /* X must not be a pseudo reg. */
gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER); gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
PRINT_OPERAND (asm_out_file, x, code); targetm.asm_out.print_operand (asm_out_file, x, code);
if (x == NULL_RTX) if (x == NULL_RTX)
return; return;
...@@ -3498,16 +3495,15 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED) ...@@ -3498,16 +3495,15 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED)
for_each_rtx (&x, mark_symbol_ref_as_used, NULL); for_each_rtx (&x, mark_symbol_ref_as_used, NULL);
} }
/* Print a memory reference operand for address X /* Print a memory reference operand for address X using
using machine-dependent assembler syntax. machine-dependent assembler syntax. */
The macro PRINT_OPERAND_ADDRESS exists just to control this function. */
void void
output_address (rtx x) output_address (rtx x)
{ {
bool changed = false; bool changed = false;
walk_alter_subreg (&x, &changed); walk_alter_subreg (&x, &changed);
PRINT_OPERAND_ADDRESS (asm_out_file, x); targetm.asm_out.print_operand_address (asm_out_file, x);
} }
/* Print an integer constant expression in assembler syntax. /* Print an integer constant expression in assembler syntax.
......
...@@ -261,6 +261,18 @@ ...@@ -261,6 +261,18 @@
#define TARGET_ASM_TRAMPOLINE_TEMPLATE NULL #define TARGET_ASM_TRAMPOLINE_TEMPLATE NULL
#ifndef TARGET_PRINT_OPERAND
#define TARGET_PRINT_OPERAND default_print_operand
#endif
#ifndef TARGET_PRINT_OPERAND_ADDRESS
#define TARGET_PRINT_OPERAND_ADDRESS default_print_operand_address
#endif
#ifndef TARGET_PRINT_OPERAND_PUNCT_VALID_P
#define TARGET_PRINT_OPERAND_PUNCT_VALID_P default_print_operand_punct_valid_p
#endif
#define TARGET_ASM_ALIGNED_INT_OP \ #define TARGET_ASM_ALIGNED_INT_OP \
{TARGET_ASM_ALIGNED_HI_OP, \ {TARGET_ASM_ALIGNED_HI_OP, \
TARGET_ASM_ALIGNED_SI_OP, \ TARGET_ASM_ALIGNED_SI_OP, \
...@@ -314,7 +326,10 @@ ...@@ -314,7 +326,10 @@
TARGET_ASM_OUTPUT_ANCHOR, \ TARGET_ASM_OUTPUT_ANCHOR, \
TARGET_ASM_OUTPUT_DWARF_DTPREL, \ TARGET_ASM_OUTPUT_DWARF_DTPREL, \
TARGET_ASM_FINAL_POSTSCAN_INSN, \ TARGET_ASM_FINAL_POSTSCAN_INSN, \
TARGET_ASM_TRAMPOLINE_TEMPLATE } TARGET_ASM_TRAMPOLINE_TEMPLATE, \
TARGET_PRINT_OPERAND, \
TARGET_PRINT_OPERAND_ADDRESS, \
TARGET_PRINT_OPERAND_PUNCT_VALID_P }
/* Scheduler hooks. All of these default to null pointers, which /* Scheduler hooks. All of these default to null pointers, which
haifa-sched.c looks for and handles. */ haifa-sched.c looks for and handles. */
......
...@@ -277,6 +277,16 @@ struct gcc_target ...@@ -277,6 +277,16 @@ struct gcc_target
/* Emit the trampoline template. This hook may be NULL. */ /* Emit the trampoline template. This hook may be NULL. */
void (*trampoline_template) (FILE *); void (*trampoline_template) (FILE *);
/* Emit a machine-specific insn operand. */
void (*print_operand) (FILE *, rtx, int);
/* Emit a machine-specific memory address. */
void (*print_operand_address) (FILE *, rtx);
/* Determine whether CODE is a valid punctuation character for the
`print_operand' hook. */
bool (*print_operand_punct_valid_p)(unsigned char code);
} asm_out; } asm_out;
/* Functions relating to instruction scheduling. */ /* Functions relating to instruction scheduling. */
......
...@@ -325,6 +325,46 @@ default_unwind_emit (FILE * stream ATTRIBUTE_UNUSED, ...@@ -325,6 +325,46 @@ default_unwind_emit (FILE * stream ATTRIBUTE_UNUSED,
gcc_unreachable (); gcc_unreachable ();
} }
/* Emit to STREAM the assembler syntax for insn operand X. */
void
default_print_operand (FILE *stream ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
int code ATTRIBUTE_UNUSED)
{
#ifdef PRINT_OPERAND
PRINT_OPERAND (stream, x, code);
#else
gcc_unreachable ();
#endif
}
/* Emit to STREAM the assembler syntax for an insn operand whose memory
address is X. */
void
default_print_operand_address (FILE *stream ATTRIBUTE_UNUSED,
rtx x ATTRIBUTE_UNUSED)
{
#ifdef PRINT_OPERAND_ADDRESS
PRINT_OPERAND_ADDRESS (stream, x);
#else
gcc_unreachable ();
#endif
}
/* Return true if CODE is a valid punctuation character for the
`print_operand' hook. */
bool
default_print_operand_punct_valid_p (unsigned char code ATTRIBUTE_UNUSED)
{
#ifdef PRINT_OPERAND_PUNCT_VALID_P
return PRINT_OPERAND_PUNCT_VALID_P (code);
#else
return false;
#endif
}
/* True if MODE is valid for the target. By "valid", we mean able to /* True if MODE is valid for the target. By "valid", we mean able to
be manipulated in non-trivial ways. In particular, this means all be manipulated in non-trivial ways. In particular, this means all
the arithmetic is supported. the arithmetic is supported.
......
...@@ -63,6 +63,9 @@ extern bool hook_callee_copies_named ...@@ -63,6 +63,9 @@ extern bool hook_callee_copies_named
(CUMULATIVE_ARGS *ca, enum machine_mode, const_tree, bool); (CUMULATIVE_ARGS *ca, enum machine_mode, const_tree, bool);
extern void default_unwind_emit (FILE *, rtx); extern void default_unwind_emit (FILE *, rtx);
extern void default_print_operand (FILE *, rtx, int);
extern void default_print_operand_address (FILE *, rtx);
extern bool default_print_operand_punct_valid_p (unsigned char);
extern bool default_scalar_mode_supported_p (enum machine_mode); extern bool default_scalar_mode_supported_p (enum machine_mode);
extern bool default_decimal_float_supported_p (void); extern bool default_decimal_float_supported_p (void);
......
...@@ -491,8 +491,8 @@ addr_const_to_string (char *str, rtx x) ...@@ -491,8 +491,8 @@ addr_const_to_string (char *str, rtx x)
strcat (str, buf1); strcat (str, buf1);
} }
else else
/* We can't handle floating point constants; PRINT_OPERAND must /* We can't handle floating point constants;
handle them. */ TARGET_PRINT_OPERAND must handle them. */
output_operand_lossage ("floating constant misused"); output_operand_lossage ("floating constant misused");
break; break;
......
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