This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/5] [ARC] Enable code density frame option for elf targets.


* Claudiu Zissulescu <claziss@gmail.com> [2019-03-06 12:20:02 +0200]:

> xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>
> 
> 	* config/arc/arc.opt (mcode-density-frame): Get the inital value
> 	from TARGET_CODE_DENSITY_FRAME_DEFAULT.
> 	* config/arc/elf.h (TARGET_CODE_DENSITY_FRAME_DEFAULT): Define it
> 	to 1.
> 	* config/arc/linux.h (TARGET_CODE_DENSITY_FRAME_DEFAULT): Define
> 	it to 0.

In general this looks fine, but there's a few nits inline....

Thanks,
Andrew


> ---
>  gcc/config/arc/arc.c   |  5 ++++-
>  gcc/config/arc/arc.md  | 20 ++++++++++----------

These changes don't appear in the ChangeLog file.

>  gcc/config/arc/arc.opt |  2 +-
>  gcc/config/arc/elf.h   |  4 ++++
>  gcc/config/arc/linux.h |  4 ++++
>  5 files changed, 23 insertions(+), 12 deletions(-)
> 
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 0b18e677735..9e086477027 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -1292,6 +1292,9 @@ arc_override_options (void)
>    if (arc_size_opt_level == 3)
>      optimize_size = 1;
>  
> +  if (TARGET_V2 && optimize_size && (ATTRIBUTE_PCS == 2))
> +    TARGET_CODE_DENSITY_FRAME = 1;
> +
>    if (flag_pic)
>      {
>        /* If we had SDATA enabled, still don't use GP when pic is
> @@ -3188,7 +3191,7 @@ arc_save_callee_enter (unsigned int gmask,
>    reg = gen_rtx_SET (stack_pointer_rtx,
>  		     plus_constant (Pmode,
>  				    stack_pointer_rtx,
> -				    nregs * UNITS_PER_WORD));
> +				    -nregs * UNITS_PER_WORD));
>    RTX_FRAME_RELATED_P (reg) = 1;
>    XVECEXP (insn, 0, indx++) = reg;
>    off = nregs * UNITS_PER_WORD;
> diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
> index 54d073107a8..c64a7fdb653 100644
> --- a/gcc/config/arc/arc.md
> +++ b/gcc/config/arc/arc.md
> @@ -6442,7 +6442,7 @@ core_3, archs4x, archs4xd, archs4xd_slow"
>  			 (plus:SI (reg:SI SP_REG)
>  				  (match_operand 1 "immediate_operand" "")))
>  		    (set (mem:SI (plus:SI (reg:SI SP_REG)
> -					  (match_dup 1)))
> +					  (match_operand 2 "immediate_operand" "")))
>  			 (reg:SI 13))])]
>    "TARGET_CODE_DENSITY"
>    {
> @@ -6450,14 +6450,14 @@ core_3, archs4x, archs4xd, archs4xd_slow"
>     rtx tmp = XVECEXP (operands[0], 0, len - 1);
>     if (MEM_P (XEXP (tmp, 0)))
>       {
> -      operands[2] = XEXP (tmp, 1);
> -      return "enter_s\\t{r13-%2} ; sp=sp-%1";
> +      operands[3] = XEXP (tmp, 1);
> +      return "enter_s\\t{r13-%3} ; sp=sp+(%1)";
>       }
>     else
>       {
>        tmp = XVECEXP (operands[0], 0, len - 3);
> -      operands[2] = XEXP (tmp, 1);
> -      return "enter_s\\t{r13-%2, fp} ; sp=sp-%1";
> +      operands[3] = XEXP (tmp, 1);
> +      return "enter_s\\t{r13-%3, fp} ; sp=sp+(%1)";
>       }
>    }
>    [(set_attr "type" "call_no_delay_slot")
> @@ -6469,7 +6469,7 @@ core_3, archs4x, archs4xd, archs4xd_slow"
>  			 (plus:SI (reg:SI SP_REG)
>  				  (match_operand 1 "immediate_operand" "")))
>  		    (set (mem:SI (plus:SI (reg:SI SP_REG)
> -					  (match_dup 1)))
> +					  (match_operand 2 "immediate_operand" "")))
>  			 (reg:SI RETURN_ADDR_REGNUM))])]
>    "TARGET_CODE_DENSITY"
>    {
> @@ -6477,14 +6477,14 @@ core_3, archs4x, archs4xd, archs4xd_slow"
>     rtx tmp = XVECEXP (operands[0], 0, len - 1);
>     if (MEM_P (XEXP (tmp, 0)))
>       {
> -      operands[2] = XEXP (tmp, 1);
> -      return "enter_s\\t{r13-%2, blink} ; sp=sp-%1";
> +      operands[3] = XEXP (tmp, 1);
> +      return "enter_s\\t{r13-%3, blink} ; sp=sp+(%1)";
>       }
>     else
>       {
>        tmp = XVECEXP (operands[0], 0, len - 3);
> -      operands[2] = XEXP (tmp, 1);
> -      return "enter_s\\t{r13-%2, fp, blink} ; sp=sp-%1";
> +      operands[3] = XEXP (tmp, 1);
> +      return "enter_s\\t{r13-%3, fp, blink} ; sp=sp+(%1)";
>       }
>    }
>    [(set_attr "type" "call_no_delay_slot")
> diff --git a/gcc/config/arc/arc.opt b/gcc/config/arc/arc.opt
> index a5271cbbceb..567df30951f 100644
> --- a/gcc/config/arc/arc.opt
> +++ b/gcc/config/arc/arc.opt
> @@ -537,5 +537,5 @@ Target Report Var(TARGET_BRANCH_INDEX) Init(DEFAULT_BRANCH_INDEX)
>  Enable use of BI/BIH instructions when available.
>  
>  mcode-density-frame
> -Target Report Var(TARGET_CODE_DENSITY_FRAME)
> +Target Report Var(TARGET_CODE_DENSITY_FRAME) Init(TARGET_CODE_DENSITY_FRAME_DEFAULT)
>  Enable ENTER_S and LEAVE_S opcodes for ARCv2.
> diff --git a/gcc/config/arc/elf.h b/gcc/config/arc/elf.h
> index 8f9bec05606..651741f3342 100644
> --- a/gcc/config/arc/elf.h
> +++ b/gcc/config/arc/elf.h
> @@ -98,3 +98,7 @@ along with GCC; see the file COPYING3.  If not see
>        fixed_regs[GP_REG] = 0;					\
>        arc_regno_reg_class[GP_REG] = GENERAL_REGS;		\
>      }
> +
> +/* Enter/Leave ops are default on for elf targets.  */
> +#undef TARGET_CODE_DENSITY_FRAME_DEFAULT
> +#define TARGET_CODE_DENSITY_FRAME_DEFAULT 0

You comment/email-subject says on, your code says off :)

> diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h
> index 6c8a7b46296..270ca907d87 100644
> --- a/gcc/config/arc/linux.h
> +++ b/gcc/config/arc/linux.h
> @@ -133,3 +133,7 @@ along with GCC; see the file COPYING3.  If not see
>     fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount");			\
>     emit_library_call (fun, LCT_NORMAL, VOIDmode, rt, Pmode);	\
>    }
> +
> +/* Enter/Leave ops are default off for linux targets.  */
> +#undef TARGET_CODE_DENSITY_FRAME_DEFAULT
> +#define TARGET_CODE_DENSITY_FRAME_DEFAULT 0
> -- 
> 2.20.1
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]