From 20fa157e674d0175f8c2717683462cdaded4d5be Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Mon, 30 Sep 2019 14:56:33 +0000 Subject: Introduce rtx_alloca, alloca_raw_REG and alloca_rtx_fmt_* When one passes short-lived fake rtxes to backends in order to test their capabilities, it might be beneficial to allocate these rtxes on stack in order to reduce the load on GC. Provide macro counterparts of some of the gen_* functions for that purpose. gcc/ChangeLog: 2019-09-30 Ilya Leoshkevich * emit-rtl.c (init_raw_REG): New function. (gen_raw_REG): Use init_raw_REG. * gengenrtl.c (gendef): Emit init_* functions and alloca_* macros. * rtl.c (rtx_alloc_stat_v): Use rtx_init. * rtl.h (rtx_init): New function. (rtx_alloca): New function. (init_raw_REG): New function. (alloca_raw_REG): New macro. From-SVN: r276303 --- gcc/rtl.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/rtl.h') diff --git a/gcc/rtl.h b/gcc/rtl.h index 9cadac7..b75b3ed 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2957,6 +2957,15 @@ extern HOST_WIDE_INT get_stack_check_protect (void); /* 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) \ @@ -3823,7 +3832,10 @@ gen_rtx_INSN (machine_mode mode, rtx_insn *prev_insn, rtx_insn *next_insn, 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); -- cgit v1.1