set_regno_raw (x, regno, nregs);
}
+/* Initialize a fresh REG rtx with mode MODE and register REGNO. */
+
+rtx
+init_raw_REG (rtx x, machine_mode mode, unsigned int regno)
+{
+ set_mode_and_regno (x, mode, regno);
+ REG_ATTRS (x) = NULL;
+ ORIGINAL_REGNO (x) = regno;
+ return x;
+}
+
/* Generate a new REG rtx. Make sure ORIGINAL_REGNO is set properly, and
don't attempt to share with the various global pieces of rtl (such as
frame_pointer_rtx). */
gen_raw_REG (machine_mode mode, unsigned int regno)
{
rtx x = rtx_alloc (REG MEM_STAT_INFO);
- set_mode_and_regno (x, mode, regno);
- REG_ATTRS (x) = NULL;
- ORIGINAL_REGNO (x) = regno;
+ init_raw_REG (x, mode, regno);
return x;
}
puts (")");
}
-/* Generate the code for the function to generate RTL whose
- format is FORMAT. */
+/* Generate the code for functions to generate RTL whose format is FORMAT. */
static void
gendef (const char *format)
const char *p;
int i, j;
- /* Start by writing the definition of the function name and the types
+ /* Write the definition of the init function name and the types
of the arguments. */
- printf ("static inline rtx\ngen_rtx_fmt_%s_stat (RTX_CODE code, machine_mode mode", format);
+ puts ("static inline rtx");
+ printf ("init_rtx_fmt_%s (rtx rt, machine_mode mode", format);
for (p = format, i = 0; *p != 0; p++)
if (*p != '0')
printf (",\n\t%sarg%d", type_from_format (*p), i++);
+ puts (")");
- puts (" MEM_STAT_DECL)");
-
- /* Now write out the body of the function itself, which allocates
- the memory and initializes it. */
+ /* Now write out the body of the init function itself. */
puts ("{");
- puts (" rtx rt;");
- puts (" rt = rtx_alloc (code PASS_MEM_STAT);\n");
-
puts (" PUT_MODE_RAW (rt, mode);");
for (p = format, i = j = 0; *p ; ++p, ++i)
else
printf (" %s (rt, %d) = arg%d;\n", accessor_from_format (*p), i, j++);
- puts ("\n return rt;\n}\n");
+ puts (" return rt;\n}\n");
+
+ /* Write the definition of the gen function name and the types
+ of the arguments. */
+
+ puts ("static inline rtx");
+ printf ("gen_rtx_fmt_%s_stat (RTX_CODE code, machine_mode mode", format);
+ for (p = format, i = 0; *p != 0; p++)
+ if (*p != '0')
+ printf (",\n\t%sarg%d", type_from_format (*p), i++);
+ puts (" MEM_STAT_DECL)");
+
+ /* Now write out the body of the function itself, which allocates
+ the memory and initializes it. */
+ puts ("{");
+ puts (" rtx rt;\n");
+
+ puts (" rt = rtx_alloc (code PASS_MEM_STAT);");
+ printf (" return init_rtx_fmt_%s (rt, mode", format);
+ for (p = format, i = 0; *p != 0; p++)
+ if (*p != '0')
+ printf (", arg%d", i++);
+ puts (");\n}\n");
+
+ /* Write the definition of gen macro. */
+
printf ("#define gen_rtx_fmt_%s(c, m", format);
for (p = format, i = 0; *p != 0; p++)
if (*p != '0')
- printf (", p%i",i++);
- printf (")\\\n gen_rtx_fmt_%s_stat (c, m", format);
+ printf (", arg%d", i++);
+ printf (") \\\n gen_rtx_fmt_%s_stat ((c), (m)", format);
for (p = format, i = 0; *p != 0; p++)
if (*p != '0')
- printf (", p%i",i++);
+ printf (", (arg%d)", i++);
printf (" MEM_STAT_INFO)\n\n");
+
+ /* Write the definition of alloca macro. */
+
+ printf ("#define alloca_rtx_fmt_%s(c, m", format);
+ for (p = format, i = 0; *p != 0; p++)
+ if (*p != '0')
+ printf (", arg%d", i++);
+ printf (") \\\n init_rtx_fmt_%s (rtx_alloca ((c)), (m)", format);
+ for (p = format, i = 0; *p != 0; p++)
+ if (*p != '0')
+ printf (", (arg%d)", i++);
+ printf (")\n\n");
}
/* Generate the documentation header for files we write. */
/* In rtl.c */
extern rtx rtx_alloc (RTX_CODE CXX_MEM_STAT_INFO);
+inline rtx
+rtx_init (rtx rt, RTX_CODE code)
+{
+ memset (rt, 0, RTX_HDR_SIZE);
+ PUT_CODE (rt, code);
+ return rt;
+}
+#define rtx_alloca(code) \
+ rtx_init ((rtx) alloca (RTX_CODE_SIZE ((code))), (code))
extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int);
#define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
#define const_wide_int_alloc(NWORDS) \
extern rtx gen_rtx_CONST_INT (machine_mode, HOST_WIDE_INT);
extern rtx gen_rtx_CONST_VECTOR (machine_mode, rtvec);
extern void set_mode_and_regno (rtx, machine_mode, unsigned int);
+extern rtx init_raw_REG (rtx, machine_mode, unsigned int);
extern rtx gen_raw_REG (machine_mode, unsigned int);
+#define alloca_raw_REG(mode, regno) \
+ init_raw_REG (rtx_alloca (REG), (mode), (regno))
extern rtx gen_rtx_REG (machine_mode, unsigned int);
extern rtx gen_rtx_SUBREG (machine_mode, rtx, poly_uint64);
extern rtx gen_rtx_MEM (machine_mode, rtx);