[ARC] Enable code density frame option for elf targets.
authorClaudiu Zissulescu <claziss@synopsys.com>
Mon, 18 Mar 2019 09:28:45 +0000 (10:28 +0100)
committerClaudiu Zissulescu <claziss@gcc.gnu.org>
Mon, 18 Mar 2019 09:28:45 +0000 (10:28 +0100)
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.
* config/arc/linux.h (TARGET_CODE_DENSITY_FRAME_DEFAULT): Define.
* config/arc/arc.md (pop_multi_fp_blink): Adjust constraints to
match what the ops is doing.
(push_multi_fp_blink): Likewise.
* config/arc/arc.c (arc_override_options): Enable enter/leave when
compiling for size and elf target.
(arc_save_callee_enter): Adjust note to match what enter/leave
operation does.

From-SVN: r269758

gcc/ChangeLog
gcc/config/arc/arc.c
gcc/config/arc/arc.md
gcc/config/arc/arc.opt
gcc/config/arc/elf.h
gcc/config/arc/linux.h

index 0ecd5c4f1e9e9b7cd68c1f2b81530f7c7b2d5831..2da36e7030b57f61393bbc167590c7017eb659a1 100644 (file)
@@ -1,3 +1,17 @@
+2019-03-18  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.
+       * config/arc/linux.h (TARGET_CODE_DENSITY_FRAME_DEFAULT): Define.
+       * config/arc/arc.md (pop_multi_fp_blink): Adjust constraints to
+       match what the ops is doing.
+       (push_multi_fp_blink): Likewise.
+       * config/arc/arc.c (arc_override_options): Enable enter/leave when
+       compiling for size and elf target.
+       (arc_save_callee_enter): Adjust note to match what enter/leave
+       operation does.
+
 2019-03-18  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * config/arc/arc.md (tst_movb): Fix constraint.
index f91a29c3a6814713c9ea16d6f8499e5bef8b4c0f..978d8450ab0f28842887bc2dea73cdfc9ceb1543 100644 (file)
@@ -1294,6 +1294,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)
     target_flags |= MASK_NO_SDATA_SET;
 
@@ -3140,7 +3143,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;
index 01a715ee1675bbd9130e3d60825aa9475fc4bbfb..e682983048a4b17b9979fe2842fdbe2bf0a21458 100644 (file)
@@ -6458,7 +6458,8 @@ 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"
   {
@@ -6466,14 +6467,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")
@@ -6485,7 +6486,8 @@ 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"
   {
@@ -6493,14 +6495,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")
index 3e864ddcfe68d3fb917c1ee5865b305566a0814a..e4330135a01e24e0a75a96aee51abbb34cbaf9f7 100644 (file)
@@ -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.
index 34d17b10bd36aa4a7dc716e25bbfda123b980680..297ac9b0ce01e2677a5039369d656de1fdf9b7de 100644 (file)
@@ -87,3 +87,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);             \
   }
+
+/* Enter/Leave default value.  */
+#undef TARGET_CODE_DENSITY_FRAME_DEFAULT
+#define TARGET_CODE_DENSITY_FRAME_DEFAULT 0
index 6c8a7b462964a7dfe110c0de2c8b25042c6bdbea..270ca907d8759001bc8d704458021c37d870f6da 100644 (file)
@@ -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