[ARC] Refurbish and improve prologue/epilogue functions.
authorClaudiu Zissulescu <claziss@synopsys.com>
Tue, 13 Nov 2018 12:07:12 +0000 (13:07 +0100)
committerClaudiu Zissulescu <claziss@gcc.gnu.org>
Tue, 13 Nov 2018 12:07:12 +0000 (13:07 +0100)
commit90b480138a5492776e9fab6e7f95aae874d6a0ea
treeb009dad794b86a822eabf2473e17109b5ac96aac
parent8fa2c211f7852b1fe330423f4af096016bb3acbc
[ARC] Refurbish and improve prologue/epilogue functions.

Reimplement how prologue and epilogue is emitted to accomodate
enter/leave instructions, as well as improving the size of the
existing techinques.

The following modifications are added:

- millicode thunk calls can be now selected regardless of the
  optimization level. However they are enabled for size optimizations
  by default.  Also, the millicode optimization is turned off when we
  compile for long jumps.

- the compiler is able to use enter/leave instructions for prologue
  and epilogue. As these instructions are not ABI compatible we gurad
  them under a switch (i.e., -mcode-density-frame). When this option
  is on, the compiler will try emitting enter/leave instructions, if
  not, then millicode thunk calls (if enabled), and latter the regular
  push/pop instructions.

- The prologue/epilogue is now optimized to use pointer walks, hence
  improving the chance to have push_s/pop_s instructions emitted. It
  also tries to combine the stack adjustments with load/store
  operations.

gcc/
xxxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

        * common/config/arc/arc-common.c (arc_option_optimization_table):
        Millicode optimization is default on for size optimizations.
        * config/arc/arc-protos.h (arc_check_multi): New function.
        * config/arc/arc.c (RTX_OK_FOR_OFFSET_P): Rearange.
        (ENTER_LEAVE_START_REG): Define.
        (ENTER_LEAVE_END_REG): Likewise.
        (arc_override_options): Disable millicode when long calls option
        is on.
        (arc_frame_info): Change it from int to bool.
        (arc_compute_frame_size): Clean up.
        (arc_save_restore): Remove.
        (frame_save_reg): New function.
        (frame_restore_reg): Likewise.
        (arc_enter_leave_p): Likewise.
        (arc_save_callee_saves): Likewise.
        (arc_restore_callee_saves): Likewise.
        (arc_save_callee_enter): Likewise.
        (arc_restore_callee_leave): Likewise.
        (arc_save_callee_milli): Likewise.
        (arc_restore_callee_milli): Likewise.
        (arc_expand_prologue): Reimplement to emit enter/leave
        instructions.
        (arc_expand_epilogue): Likewise.
        (arc_check_multi): New function.
        * config/arc/arc.md (push_multi_fp): New pattern.
        (push_multi_fp_blink): Likewise.
        (pop_multi_fp): Likewise.
        (pop_multi_fp_blink): Likewise.
        (pop_multi_fp_ret): Likewise.
        (pop_multi_fp_blink_ret): Likewise.
        * config/arc/arc.opt (mmillicode): Update option.
        (mcode-density-frame): New option.
        * config/arc/predicates.md (push_multi_operand): New predicate.
        (pop_multi_operand): Likewise.
        * doc/invoke.texi (ARC): Update ARC options information.

gcc/testsuite
xxxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

        * gcc.target/arc/firq-1.c: Update test.
        * gcc.target/arc/firq-3.c: Likewise.
        * gcc.target/arc/firq-4.c: Likewise.
        * gcc.target/arc/interrupt-6.c: Likewise.

From-SVN: r266065
13 files changed:
gcc/ChangeLog
gcc/common/config/arc/arc-common.c
gcc/config/arc/arc-protos.h
gcc/config/arc/arc.c
gcc/config/arc/arc.md
gcc/config/arc/arc.opt
gcc/config/arc/predicates.md
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arc/firq-1.c
gcc/testsuite/gcc.target/arc/firq-3.c
gcc/testsuite/gcc.target/arc/firq-4.c
gcc/testsuite/gcc.target/arc/interrupt-6.c