This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[m32r] hookize PRINT_OPERAND &co.
- From: Nathan Froyd <froydnj at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: nickc at redhat dot com
- Date: Mon, 7 Jun 2010 13:08:25 -0700
- Subject: [m32r] hookize PRINT_OPERAND &co.
The patch below converts the m32r port to TARGET_PRINT_OPERAND &co. I am
planning to commit this at the end of the week if there are no comments.
Tested on m32r-elf.
-Nathan
* m32r-protos.h (m32r_print_operand): Delete.
(m32r_print_operand_address): Delete.
* m32r.h (m32r_punct_chars): Delete.
(PRINT_OPERAND): Delete.
(PRINT_OPERAND_PUNCT_VALID_P): Delete.
(PRINT_OPERAND_ADDRESS): Delete.
* m32r.c (m32r_punct_chars): Make static.
(m32r_print_operand_address): Make static.
(m32r_print_operand): Make static.
(m32r_print_operand_punct_valid_p): New function.
(TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS):
(TARGET_PRINT_OPERAND_ADDRESS): Define.
--- a/gcc/config/m32r/m32r-protos.h
+++ b/gcc/config/m32r/m32r-protos.h
@@ -43,8 +43,6 @@ extern int zero_and_one (rtx, rtx);
extern char * emit_cond_move (rtx *, rtx);
extern void m32r_output_block_move (rtx, rtx *);
extern int m32r_expand_block_move (rtx *);
-extern void m32r_print_operand (FILE *, rtx, int);
-extern void m32r_print_operand_address (FILE *, rtx);
extern int m32r_not_same_reg (rtx, rtx);
extern int m32r_hard_regno_rename_ok (unsigned int, unsigned int);
extern int m32r_legitimate_pic_operand_p (rtx);
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -44,7 +44,7 @@
#include "tm-constrs.h"
/* Array of valid operand punctuation characters. */
-char m32r_punct_chars[256];
+static char m32r_punct_chars[256];
/* Selected code model. */
enum m32r_model m32r_model = M32R_MODEL_DEFAULT;
@@ -67,6 +67,9 @@ static void block_move_call (rtx, rtx, rtx);
static int m32r_is_insn (rtx);
static rtx m32r_legitimize_address (rtx, rtx, enum machine_mode);
static tree m32r_handle_model_attribute (tree *, tree, tree, int, bool *);
+static void m32r_print_operand (FILE *, rtx, int);
+static void m32r_print_operand_address (FILE *, rtx);
+static bool m32r_print_operand_punct_valid_p (unsigned char code);
static void m32r_output_function_prologue (FILE *, HOST_WIDE_INT);
static void m32r_output_function_epilogue (FILE *, HOST_WIDE_INT);
@@ -111,6 +114,13 @@ static const struct attribute_spec m32r_attribute_table[] =
#undef TARGET_ASM_ALIGNED_SI_OP
#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t"
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND m32r_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS m32r_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P m32r_print_operand_punct_valid_p
+
#undef TARGET_ASM_FUNCTION_PROLOGUE
#define TARGET_ASM_FUNCTION_PROLOGUE m32r_output_function_prologue
#undef TARGET_ASM_FUNCTION_EPILOGUE
@@ -216,7 +226,7 @@ m32r_init (void)
{
init_reg_tables ();
- /* Initialize array for PRINT_OPERAND_PUNCT_VALID_P. */
+ /* Initialize array for TARGET_PRINT_OPERAND_PUNCT_VALID_P. */
memset (m32r_punct_chars, 0, sizeof (m32r_punct_chars));
m32r_punct_chars['#'] = 1;
m32r_punct_chars['@'] = 1; /* ??? no longer used */
@@ -1933,7 +1943,7 @@ m32r_file_start (void)
CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
For `%' followed by punctuation, CODE is the punctuation and X is null. */
-void
+static void
m32r_print_operand (FILE * file, rtx x, int code)
{
rtx addr;
@@ -2160,7 +2170,7 @@ m32r_print_operand (FILE * file, rtx x, int code)
/* Print a memory address as an operand to reference that memory location. */
-void
+static void
m32r_print_operand_address (FILE * file, rtx addr)
{
rtx base;
@@ -2248,6 +2258,12 @@ m32r_print_operand_address (FILE * file, rtx addr)
}
}
+static bool
+m32r_print_operand_punct_valid_p (unsigned char code)
+{
+ return m32r_punct_chars[code];
+}
+
/* Return true if the operands are the constants 0 and 1. */
int
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -1274,24 +1274,6 @@ L2: .word STATIC
SUBTARGET_ADDITIONAL_REGISTER_NAMES \
}
-/* A C expression which evaluates to true if CODE is a valid
- punctuation character for use in the `PRINT_OPERAND' macro. */
-extern char m32r_punct_chars[256];
-#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
- m32r_punct_chars[(unsigned char) (CHAR)]
-
-/* 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.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-#define PRINT_OPERAND(FILE, X, CODE) \
- m32r_print_operand (FILE, X, CODE)
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand that is a memory
- reference whose address is ADDR. ADDR is an RTL expression. */
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- m32r_print_operand_address (FILE, ADDR)
-
/* If defined, C string expressions to be used for the `%R', `%L',
`%U', and `%I' options of `asm_fprintf' (see `final.c'). These
are useful when a single `md' file must support multiple assembler