* [m32c] hookize PRINT_OPERAND & co
@ 2010-08-31 8:44 Naveen H. S
2010-08-31 16:18 ` Richard Henderson
0 siblings, 1 reply; 6+ messages in thread
From: Naveen H. S @ 2010-08-31 8:44 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]
Hi,
Please find attached the patch which hookizes PRINT_OPERAND and
related macros for the m32c backend. It also adds hook for
FUNCTION_VALUE_REGNO_P macro.
Please review the patch and let me know if there should be any
modifications in it.
Tested with m32c-elf. No new regressions.
ChangeLog
2010-08-31 Naveen H.S <naveen.S@kpitcummins.com>
* config/m32c/m32c.c (m32c_function_value_regno_p): Declare.
(m32c_print_operand_address): Likewise.
(m32c_print_operand): Likewise.
(m32c_print_operand_punct_valid_p): Likewise.
(TARGET_FUNCTION_VALUE_REGNO_P, TARGET_PRINT_OPERAND_PUNCT_VALID_P,
TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
* config/m32c/m32c.h (FUNCTION_VALUE_REGNO_P, PRINT_OPERAND_ADDRESS,
PRINT_OPERAND, PRINT_OPERAND_PUNCT_VALID_P): Delete.
* config/m32c/m32c-protos.h (m32c_print_operand): Delete.
(m32c_print_operand_address): Delete.
(m32c_print_operand_punct_valid_p): Delete.
(m32c_function_value_regno_p): Delete.
Thanks & Regards,
Naveen
[-- Attachment #2: m32c_printop_targhook.patch --]
[-- Type: application/octet-stream, Size: 4344 bytes --]
--- orig/gcc/config/m32c.orig/m32c.c 2010-07-14 01:13:30.000000000 +0530
+++ trunk/gcc/config/m32c/m32c.c 2010-08-31 11:57:24.000000000 +0530
@@ -83,6 +83,10 @@ static rtx m32c_subreg (enum machine_mod
static int need_to_save (int);
static rtx m32c_function_value (const_tree, const_tree, bool);
static rtx m32c_libcall_value (enum machine_mode, const_rtx);
+static bool m32c_function_value_regno_p (const unsigned int);
+static void m32c_print_operand_address (FILE *, rtx);
+static void m32c_print_operand (FILE *, rtx, int);
+static bool m32c_print_operand_punct_valid_p (unsigned char code);
/* Returns true if an address is specified, else false. */
static bool m32c_get_pragma_address (const char *varname, unsigned *addr);
@@ -1675,7 +1679,10 @@ m32c_function_value (const_tree valtype,
return m32c_libcall_value (mode, NULL_RTX);
}
-/* Implements FUNCTION_VALUE_REGNO_P. */
+/* How Scalar Function Values Are Returned */
+
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P m32c_function_value_regno_p
bool
m32c_function_value_regno_p (const unsigned int regno)
@@ -2353,7 +2360,9 @@ static char const *pushm_regs[] = {
"fb", "sb", "a1", "a0", "r3", "r2", "r1", "r0"
};
-/* Implements PRINT_OPERAND. */
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND m32c_print_operand
+
void
m32c_print_operand (FILE * file, rtx x, int code)
{
@@ -2707,17 +2716,18 @@ m32c_print_operand (FILE * file, rtx x,
return;
}
-/* Implements PRINT_OPERAND_PUNCT_VALID_P. See m32c_print_operand
- above for descriptions of what these do. */
-int
-m32c_print_operand_punct_valid_p (int c)
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P m32c_print_operand_punct_valid_p
+
+static bool
+m32c_print_operand_punct_valid_p (unsigned char c)
{
- if (c == '&' || c == '!')
- return 1;
- return 0;
+ return (c == '&' || c == '!');
}
-/* Implements PRINT_OPERAND_ADDRESS. Nothing unusual here. */
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS m32c_print_operand_address
+
void
m32c_print_operand_address (FILE * stream, rtx address)
{
--- orig/gcc/config/m32c.orig/m32c.h 2010-06-29 17:48:36.000000000 +0530
+++ trunk/gcc/config/m32c/m32c.h 2010-08-31 10:35:36.000000000 +0530
@@ -530,10 +530,6 @@ typedef struct m32c_cumulative_args
#define FUNCTION_ARG_BOUNDARY(MODE,TYPE) (TARGET_A16 ? 8 : 16)
#define FUNCTION_ARG_REGNO_P(r) m32c_function_arg_regno_p (r)
-/* How Scalar Function Values Are Returned */
-
-#define FUNCTION_VALUE_REGNO_P(r) m32c_function_value_regno_p (r)
-
/* How Large Values Are Returned */
#define DEFAULT_PCC_STRUCT_RETURN 1
@@ -633,10 +629,6 @@ typedef struct m32c_cumulative_args
{"a0a1", 4}, \
{"r0r2r1r3", 0} }
-#define PRINT_OPERAND(S,X,C) m32c_print_operand (S, X, C)
-#define PRINT_OPERAND_PUNCT_VALID_P(C) m32c_print_operand_punct_valid_p (C)
-#define PRINT_OPERAND_ADDRESS(S,X) m32c_print_operand_address (S, X)
-
#undef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "_"
--- orig/gcc/config/m32c.orig/m32c-protos.h 2010-06-26 09:00:19.000000000 +0530
+++ trunk/gcc/config/m32c/m32c-protos.h 2010-08-31 11:19:27.000000000 +0530
@@ -38,7 +38,6 @@ int m32c_initial_elimination_offset (in
void m32c_output_reg_pop (FILE *, int);
void m32c_output_reg_push (FILE *, int);
void m32c_override_options (void);
-int m32c_print_operand_punct_valid_p (int);
int m32c_push_rounding (int);
int m32c_reg_class_from_constraint (char, const char *);
void m32c_register_pragmas (void);
@@ -75,7 +74,6 @@ bool m32c_immd_dbl_mov (rtx *, MM);
rtx m32c_incoming_return_addr_rtx (void);
int m32c_legitimate_constant_p (rtx);
int m32c_legitimize_reload_address (rtx *, MM, int, int, int);
-bool m32c_function_value_regno_p (const unsigned int);
int m32c_limit_reload_class (MM, int);
int m32c_memory_move_cost (MM, int, int);
int m32c_modes_tieable_p (MM, MM);
@@ -85,8 +83,6 @@ int m32c_preferred_output_reload_class
int m32c_preferred_reload_class (rtx, int);
int m32c_prepare_move (rtx *, MM);
int m32c_prepare_shift (rtx *, int, int);
-void m32c_print_operand (FILE *, rtx, int);
-void m32c_print_operand_address (FILE *, rtx);
int m32c_reg_ok_for_base_p (rtx, int);
int m32c_register_move_cost (MM, int, int);
MM m32c_regno_reg_class (int);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [m32c] hookize PRINT_OPERAND & co
2010-08-31 8:44 [m32c] hookize PRINT_OPERAND & co Naveen H. S
@ 2010-08-31 16:18 ` Richard Henderson
2010-09-01 5:17 ` Naveen H. S
2010-09-17 10:20 ` Naveen H. S
0 siblings, 2 replies; 6+ messages in thread
From: Richard Henderson @ 2010-08-31 16:18 UTC (permalink / raw)
To: Naveen H. S; +Cc: gcc-patches
On 08/31/2010 12:04 AM, Naveen H. S wrote:
> * config/m32c/m32c.c (m32c_function_value_regno_p): Declare.
> (m32c_print_operand_address): Likewise.
> (m32c_print_operand): Likewise.
> (m32c_print_operand_punct_valid_p): Likewise.
> (TARGET_FUNCTION_VALUE_REGNO_P, TARGET_PRINT_OPERAND_PUNCT_VALID_P,
> TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
> * config/m32c/m32c.h (FUNCTION_VALUE_REGNO_P, PRINT_OPERAND_ADDRESS,
> PRINT_OPERAND, PRINT_OPERAND_PUNCT_VALID_P): Delete.
> * config/m32c/m32c-protos.h (m32c_print_operand): Delete.
> (m32c_print_operand_address): Delete.
> (m32c_print_operand_punct_valid_p): Delete.
> (m32c_function_value_regno_p): Delete.
Nearly ok.
> +static bool m32c_function_value_regno_p (const unsigned int);
...
> +/* How Scalar Function Values Are Returned */
> +
> +#undef TARGET_FUNCTION_VALUE_REGNO_P
> +#define TARGET_FUNCTION_VALUE_REGNO_P m32c_function_value_regno_p
>
> bool
> m32c_function_value_regno_p (const unsigned int regno)
static goes here too.
> +#undef TARGET_PRINT_OPERAND
> +#define TARGET_PRINT_OPERAND m32c_print_operand
> +
> void
> m32c_print_operand (FILE * file, rtx x, int code)
Likewise.
> +#undef TARGET_PRINT_OPERAND_ADDRESS
> +#define TARGET_PRINT_OPERAND_ADDRESS m32c_print_operand_address
> +
> void
> m32c_print_operand_address (FILE * stream, rtx address)
Likewise.
Ok with those changes.
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [m32c] hookize PRINT_OPERAND & co
2010-08-31 16:18 ` Richard Henderson
@ 2010-09-01 5:17 ` Naveen H. S
2010-09-17 10:20 ` Naveen H. S
1 sibling, 0 replies; 6+ messages in thread
From: Naveen H. S @ 2010-09-01 5:17 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc-patches, Prafulla Thakare
[-- Attachment #1: Type: text/plain, Size: 866 bytes --]
Hi
Thanks for reviewing the patch and suggestions.
>> Ok with those changes.
Please find attached the patch with suggested modifications.
It was also observed that TARGET_FUNCTION_VALUE_REGNO_P is implemented
for m32c. Hence, it has been removed from the patch.
ChangeLog
2010-09-01 Naveen H.S <naveen.S@kpitcummins.com>
* config/m32c/m32c.c ((m32c_print_operand_address): Declare.
(m32c_print_operand): Likewise.
(m32c_print_operand_punct_valid_p): Likewise.
(TARGET_PRINT_OPERAND_PUNCT_VALID_P, TARGET_PRINT_OPERAND
TARGET_PRINT_OPERAND_ADDRESS): Define.
* config/m32c/m32c.h (PRINT_OPERAND_ADDRESS, PRINT_OPERAND
PRINT_OPERAND_PUNCT_VALID_P): Delete.
* config/m32c/m32c-protos.h (m32c_print_operand): Delete.
(m32c_print_operand_address): Delete.
(m32c_print_operand_punct_valid_p): Delete.
Thanks & Regards,
Naveen
[-- Attachment #2: m32c_printop_targhook.patch --]
[-- Type: application/octet-stream, Size: 3449 bytes --]
--- orig/gcc/config/m32c.orig/m32c.c 2010-07-14 01:13:30.000000000 +0530
+++ trunk/gcc/config/m32c/m32c.c 2010-09-01 10:10:28.000000000 +0530
@@ -83,6 +83,9 @@ static rtx m32c_subreg (enum machine_mod
static int need_to_save (int);
static rtx m32c_function_value (const_tree, const_tree, bool);
static rtx m32c_libcall_value (enum machine_mode, const_rtx);
+static void m32c_print_operand_address (FILE *, rtx);
+static void m32c_print_operand (FILE *, rtx, int);
+static bool m32c_print_operand_punct_valid_p (unsigned char code);
/* Returns true if an address is specified, else false. */
static bool m32c_get_pragma_address (const char *varname, unsigned *addr);
@@ -2353,8 +2356,11 @@ static char const *pushm_regs[] = {
"fb", "sb", "a1", "a0", "r3", "r2", "r1", "r0"
};
-/* Implements PRINT_OPERAND. */
-void
+/* Implements TARGET_PRINT_OPERAND. */
+
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND m32c_print_operand
+static void
m32c_print_operand (FILE * file, rtx x, int code)
{
int i, j, b;
@@ -2707,18 +2713,22 @@ m32c_print_operand (FILE * file, rtx x,
return;
}
-/* Implements PRINT_OPERAND_PUNCT_VALID_P. See m32c_print_operand
+/* Implements TARGET_PRINT_OPERAND_PUNCT_VALID_P. See m32c_print_operand
above for descriptions of what these do. */
-int
-m32c_print_operand_punct_valid_p (int c)
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P m32c_print_operand_punct_valid_p
+
+static bool
+m32c_print_operand_punct_valid_p (unsigned char c)
{
- if (c == '&' || c == '!')
- return 1;
- return 0;
+ return (c == '&' || c == '!');
}
/* Implements PRINT_OPERAND_ADDRESS. Nothing unusual here. */
-void
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS m32c_print_operand_address
+
+static void
m32c_print_operand_address (FILE * stream, rtx address)
{
if (GET_CODE (address) == MEM)
diff -upr gcc/config/m32c.orig/m32c.h gcc/config/m32c/m32c.h
--- gcc/config/m32c.orig/m32c.h 2010-06-29 17:48:36.000000000 +0530
+++ gcc/config/m32c/m32c.h 2010-09-01 10:10:41.000000000 +0530
@@ -633,10 +633,6 @@ typedef struct m32c_cumulative_args
{"a0a1", 4}, \
{"r0r2r1r3", 0} }
-#define PRINT_OPERAND(S,X,C) m32c_print_operand (S, X, C)
-#define PRINT_OPERAND_PUNCT_VALID_P(C) m32c_print_operand_punct_valid_p (C)
-#define PRINT_OPERAND_ADDRESS(S,X) m32c_print_operand_address (S, X)
-
#undef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "_"
diff -upr gcc/config/m32c.orig/m32c-protos.h gcc/config/m32c/m32c-protos.h
--- gcc/config/m32c.orig/m32c-protos.h 2010-06-26 09:00:19.000000000 +0530
+++ gcc/config/m32c/m32c-protos.h 2010-09-01 10:10:59.000000000 +0530
@@ -38,7 +38,6 @@ int m32c_initial_elimination_offset (in
void m32c_output_reg_pop (FILE *, int);
void m32c_output_reg_push (FILE *, int);
void m32c_override_options (void);
-int m32c_print_operand_punct_valid_p (int);
int m32c_push_rounding (int);
int m32c_reg_class_from_constraint (char, const char *);
void m32c_register_pragmas (void);
@@ -85,8 +84,6 @@ int m32c_preferred_output_reload_class
int m32c_preferred_reload_class (rtx, int);
int m32c_prepare_move (rtx *, MM);
int m32c_prepare_shift (rtx *, int, int);
-void m32c_print_operand (FILE *, rtx, int);
-void m32c_print_operand_address (FILE *, rtx);
int m32c_reg_ok_for_base_p (rtx, int);
int m32c_register_move_cost (MM, int, int);
MM m32c_regno_reg_class (int);
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [m32c] hookize PRINT_OPERAND & co
2010-08-31 16:18 ` Richard Henderson
2010-09-01 5:17 ` Naveen H. S
@ 2010-09-17 10:20 ` Naveen H. S
2010-09-17 18:30 ` DJ Delorie
1 sibling, 1 reply; 6+ messages in thread
From: Naveen H. S @ 2010-09-17 10:20 UTC (permalink / raw)
To: dj; +Cc: gcc-patches, Richard Henderson, Prafulla Thakare
Hi,
Please review the patch and let me know if there should be any
modifications in it.
Thanks & Regards,
Naveen
-----Original Message-----
From: Naveen H. S
Sent: Wednesday, September 01, 2010 10:48 AM
To: 'Richard Henderson'
Cc: gcc-patches@gcc.gnu.org; Prafulla Thakare
Subject: RE: [m32c] hookize PRINT_OPERAND & co
Hi
Thanks for reviewing the patch and suggestions.
>> Ok with those changes.
Please find attached the patch with suggested modifications.
It was also observed that TARGET_FUNCTION_VALUE_REGNO_P is implemented for m32c. Hence, it has been removed from the patch.
ChangeLog
2010-09-01 Naveen H.S <naveen.S@kpitcummins.com>
* config/m32c/m32c.c ((m32c_print_operand_address): Declare.
(m32c_print_operand): Likewise.
(m32c_print_operand_punct_valid_p): Likewise.
(TARGET_PRINT_OPERAND_PUNCT_VALID_P, TARGET_PRINT_OPERAND
TARGET_PRINT_OPERAND_ADDRESS): Define.
* config/m32c/m32c.h (PRINT_OPERAND_ADDRESS, PRINT_OPERAND
PRINT_OPERAND_PUNCT_VALID_P): Delete.
* config/m32c/m32c-protos.h (m32c_print_operand): Delete.
(m32c_print_operand_address): Delete.
(m32c_print_operand_punct_valid_p): Delete.
Thanks & Regards,
Naveen
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [m32c] hookize PRINT_OPERAND & co
2010-09-17 10:20 ` Naveen H. S
@ 2010-09-17 18:30 ` DJ Delorie
2010-09-20 10:02 ` Naveen H. S
0 siblings, 1 reply; 6+ messages in thread
From: DJ Delorie @ 2010-09-17 18:30 UTC (permalink / raw)
To: Naveen H. S; +Cc: gcc-patches, rth, Prafulla.Thakare
Richard said "OK with those changes". You made the changes, so it's OK.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [m32c] hookize PRINT_OPERAND & co
2010-09-17 18:30 ` DJ Delorie
@ 2010-09-20 10:02 ` Naveen H. S
0 siblings, 0 replies; 6+ messages in thread
From: Naveen H. S @ 2010-09-20 10:02 UTC (permalink / raw)
To: DJ Delorie; +Cc: gcc-patches, rth, Prafulla Thakare
Hi,
Thanks for reviewing the patch.
Can you please commit it?
Thanks & Regards,
Naveen
-----Original Message-----
From: DJ Delorie [mailto:dj@redhat.com]
Sent: Friday, September 17, 2010 11:28 PM
To: Naveen H. S
Cc: gcc-patches@gcc.gnu.org; rth@redhat.com; Prafulla Thakare
Subject: Re: [m32c] hookize PRINT_OPERAND & co
Richard said "OK with those changes". You made the changes, so it's OK.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-20 9:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-31 8:44 [m32c] hookize PRINT_OPERAND & co Naveen H. S
2010-08-31 16:18 ` Richard Henderson
2010-09-01 5:17 ` Naveen H. S
2010-09-17 10:20 ` Naveen H. S
2010-09-17 18:30 ` DJ Delorie
2010-09-20 10:02 ` Naveen H. S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).