Patch to constify rtx_name
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Thu Aug 12 07:13:00 GMT 1999
This patch constifies rtx_name from rtl.[ch]. Tested on Irix6.
Okay to install?
--Kaveh
1999-08-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* rtl.c (rtx_name): Constify a char*.
* rtl.h (rtx_name, fix_sched_param): Likewise.
* gmicro/gmicro.c (rtx_name): Remove redundant declaration.
(mypr): Use accessor macro, not `rtx_name'.
* genemit.c (print_code): Constify a char*.
* genopinit.c (gen_insn): Use accessor macro, not `rtx_name'.
* genpeep.c (print_code): Constify a char*.
* genrecog.c (print_code): Likewise.
* graph.c (start_fct, start_bb, node_data, draw_edge, end_fct,
end_bb): Add static prototype.
(draw_edge): Constify a char*.
(end_bb): Remove unused parameter.
* haifa-sched.c (fix_sched_param, safe_concat, print_exp
print_block_visualization): Constify a char*.
diff -rup orig/egcs-CVS19990810/gcc/rtl.c egcs-CVS19990810/gcc/rtl.c
--- orig/egcs-CVS19990810/gcc/rtl.c Wed Aug 4 16:34:35 1999
+++ egcs-CVS19990810/gcc/rtl.c Wed Aug 11 13:08:32 1999
@@ -47,7 +47,7 @@ int rtx_length[NUM_RTX_CODE + 1];
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME ,
-char *rtx_name[] = {
+const char *rtx_name[] = {
#include "rtl.def" /* rtl expressions are documented here */
};
diff -rup orig/egcs-CVS19990810/gcc/rtl.h egcs-CVS19990810/gcc/rtl.h
--- orig/egcs-CVS19990810/gcc/rtl.h Tue Aug 10 15:41:33 1999
+++ egcs-CVS19990810/gcc/rtl.h Wed Aug 11 13:35:30 1999
@@ -51,7 +51,7 @@ enum rtx_code {
extern int rtx_length[];
#define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
-extern char *rtx_name[];
+extern const char *rtx_name[];
#define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
extern char *rtx_format[];
@@ -1354,7 +1354,7 @@ extern void dump_combine_total_stats PRO
extern void schedule_insns PROTO ((FILE *));
#endif
#ifdef HAIFA
-extern void fix_sched_param PROTO ((char *, char *));
+extern void fix_sched_param PROTO ((const char *, const char *));
#endif
/* In print-rtl.c */
diff -rup orig/egcs-CVS19990810/gcc/config/gmicro/gmicro.c egcs-CVS19990810/gcc/config/gmicro/gmicro.c
--- orig/egcs-CVS19990810/gcc/config/gmicro/gmicro.c Wed Dec 16 16:02:47 1998
+++ egcs-CVS19990810/gcc/config/gmicro/gmicro.c Wed Aug 11 13:15:56 1999
@@ -37,8 +37,6 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "insn-attr.h"
-extern char *rtx_name[];
-
mypr (s, a1, a2, a3, a4, a5)
char *s;
int a1, a2, a3, a4, a5;
@@ -52,7 +50,7 @@ myprcode (i)
if (i < 0 || i > 90)
fprintf (stderr, "code = %d\n", i);
else
- fprintf (stderr, "code = %s\n", rtx_name[i]);
+ fprintf (stderr, "code = %s\n", GET_RTX_NAME(i));
}
myabort (i)
diff -rup orig/egcs-CVS19990810/gcc/genemit.c egcs-CVS19990810/gcc/genemit.c
--- orig/egcs-CVS19990810/gcc/genemit.c Wed Aug 11 13:42:19 1999
+++ egcs-CVS19990810/gcc/genemit.c Wed Aug 11 13:18:52 1999
@@ -134,7 +134,7 @@ static void
print_code (code)
RTX_CODE code;
{
- register char *p1;
+ register const char *p1;
for (p1 = GET_RTX_NAME (code); *p1; p1++)
{
if (*p1 >= 'a' && *p1 <= 'z')
diff -rup orig/egcs-CVS19990810/gcc/genopinit.c egcs-CVS19990810/gcc/genopinit.c
--- orig/egcs-CVS19990810/gcc/genopinit.c Sat Apr 17 09:54:56 1999
+++ egcs-CVS19990810/gcc/genopinit.c Wed Aug 11 13:14:54 1999
@@ -176,7 +176,7 @@ gen_insn (insn)
case 'c':
for (op = 0; op < NUM_RTX_CODE; op++)
{
- for (p = rtx_name[op], q = np; *p; p++, q++)
+ for (p = GET_RTX_NAME(op), q = np; *p; p++, q++)
if (*p != *q)
break;
@@ -190,7 +190,7 @@ gen_insn (insn)
if (op == NUM_RTX_CODE)
matches = 0;
else
- np += strlen (rtx_name[op]);
+ np += strlen (GET_RTX_NAME(op));
break;
case 'a':
case 'b':
@@ -268,10 +268,10 @@ gen_insn (insn)
printf ("%smode", mode_name[m2]);
break;
case 'c':
- printf ("%s", rtx_name[op]);
+ printf ("%s", GET_RTX_NAME(op));
break;
case 'C':
- for (np = rtx_name[op]; *np; np++)
+ for (np = GET_RTX_NAME(op); *np; np++)
printf ("%c", toupper ((unsigned char)*np));
break;
}
diff -rup orig/egcs-CVS19990810/gcc/genpeep.c egcs-CVS19990810/gcc/genpeep.c
--- orig/egcs-CVS19990810/gcc/genpeep.c Mon Aug 9 15:42:01 1999
+++ egcs-CVS19990810/gcc/genpeep.c Wed Aug 11 13:20:31 1999
@@ -374,7 +374,7 @@ static void
print_code (code)
RTX_CODE code;
{
- register char *p1;
+ register const char *p1;
for (p1 = GET_RTX_NAME (code); *p1; p1++)
{
if (*p1 >= 'a' && *p1 <= 'z')
diff -rup orig/egcs-CVS19990810/gcc/genrecog.c egcs-CVS19990810/gcc/genrecog.c
--- orig/egcs-CVS19990810/gcc/genrecog.c Wed Aug 11 13:42:20 1999
+++ egcs-CVS19990810/gcc/genrecog.c Wed Aug 11 13:21:08 1999
@@ -1540,7 +1540,7 @@ static void
print_code (code)
enum rtx_code code;
{
- register char *p1;
+ register const char *p1;
for (p1 = GET_RTX_NAME (code); *p1; p1++)
{
if (*p1 >= 'a' && *p1 <= 'z')
diff -rup orig/egcs-CVS19990810/gcc/graph.c egcs-CVS19990810/gcc/graph.c
--- orig/egcs-CVS19990810/gcc/graph.c Mon Aug 9 15:42:02 1999
+++ egcs-CVS19990810/gcc/graph.c Wed Aug 11 13:29:12 1999
@@ -36,6 +36,13 @@ static const char *graph_ext[] =
/* vcg */ ".vcg",
};
+static void start_fct PROTO ((FILE *));
+static void start_bb PROTO ((FILE *, int));
+static void node_data PROTO ((FILE *, rtx));
+static void draw_edge PROTO ((FILE *, int, int, int, int));
+static void end_fct PROTO ((FILE *));
+static void end_bb PROTO ((FILE *));
+
/* Output text for new basic block. */
static void
start_fct (fp)
@@ -190,7 +197,7 @@ draw_edge (fp, from, to, bb_edge, class)
int bb_edge;
int class;
{
- char * color;
+ const char * color;
switch (graph_dump_format)
{
case vcg:
@@ -215,9 +222,8 @@ draw_edge (fp, from, to, bb_edge, class)
}
static void
-end_bb (fp, bb)
+end_bb (fp)
FILE *fp;
- int bb ATTRIBUTE_UNUSED;
{
switch (graph_dump_format)
{
@@ -346,7 +352,7 @@ print_rtl_graph_with_bb (base, suffix, r
bb = BASIC_BLOCK (i);
/* End of the basic block. */
- end_bb (fp, bb);
+ end_bb (fp);
/* Now specify the edges to all the successors of this
basic block. */
diff -rup orig/egcs-CVS19990810/gcc/haifa-sched.c egcs-CVS19990810/gcc/haifa-sched.c
--- orig/egcs-CVS19990810/gcc/haifa-sched.c Mon Aug 9 15:42:03 1999
+++ egcs-CVS19990810/gcc/haifa-sched.c Wed Aug 11 13:39:28 1999
@@ -222,7 +222,7 @@ static FILE *dump = 0;
void
fix_sched_param (param, val)
- char *param, *val;
+ const char *param, *val;
{
if (!strcmp (param, "verbose"))
sched_verbose_param = atoi (val);
@@ -455,7 +455,7 @@ static int schedule_block PROTO ((int, i
static void split_hard_reg_notes PROTO ((rtx, rtx, rtx));
static void new_insn_dead_notes PROTO ((rtx, rtx, rtx, rtx));
static void update_n_sets PROTO ((rtx, int));
-static char *safe_concat PROTO ((char *, char *, char *));
+static char *safe_concat PROTO ((char *, char *, const char *));
static int insn_issue_delay PROTO ((rtx));
static int birthing_insn_p PROTO ((rtx));
static void adjust_priority PROTO ((rtx));
@@ -748,7 +748,7 @@ static void init_target_units PROTO ((vo
static void insn_print_units PROTO ((rtx));
static int get_visual_tbl_length PROTO ((void));
static void init_block_visualization PROTO ((void));
-static void print_block_visualization PROTO ((int, char *));
+static void print_block_visualization PROTO ((int, const char *));
static void visualize_scheduled_insns PROTO ((int, int));
static void visualize_no_unit PROTO ((rtx));
static void visualize_stall_cycles PROTO ((int, int));
@@ -5792,7 +5792,7 @@ static char *
safe_concat (buf, cur, str)
char *buf;
char *cur;
- char *str;
+ const char *str;
{
char *end = buf + BUF_LEN - 2; /* leave room for null */
int c;
@@ -5821,10 +5821,10 @@ print_exp (buf, x, verbose)
int verbose;
{
char tmp[BUF_LEN];
- char *st[4];
+ const char *st[4];
char *cur = buf;
- char *fun = (char *)0;
- char *sep;
+ const char *fun = (char *)0;
+ const char *sep;
rtx op[4];
int i;
@@ -6433,7 +6433,7 @@ print_insn (buf, x, verbose)
static void
print_block_visualization (b, s)
int b;
- char *s;
+ const char *s;
{
int unit, i;
More information about the Gcc-patches
mailing list