RISC-V: Add interrupt attribute support

Programming / Compilers / GCC - wilson [138bc75d-0d04-0410-961f-82ee72b054a4] - 25 May 2018 22:29 EDT

gcc/
- config/riscv/riscv-protos.h (riscv_epilogue_uses): New.
- config/riscv/riscv.c (struct machine_function): Add interrupt_handler_p and attribute_checked_p fields. (riscv_attribute_table): Add interrupt. (riscv_interrupt_type_p): New. (riscv_save_reg_p): Save extra regs for interrupt handler. (riscv_use_save_libcall): Return false for interrupt handler. (riscv_first_stack_step): Add forward declaration. (riscv_compute_frame_info): New local interrupt_save_t1. Set it for interrupt handler with large frame. Use it for saved reg list. (riscv_expand_prologue): Move flag_stack_usage_info support to eliminate duplication. (riscv_expand_epilogue): Generate mret for interrupt handler. (riscv_epilogue_uses): New. (riscv_can_use_return_insn): Return false for interrupt handler. (riscv_function_ok_for_sibcall): Likewise. (riscv_set_current_function): Add interrupt handler support.
- config/riscv/riscv.h (EPILOGUE_USES): Call riscv_epilogue_uses.
- config/riscv/riscv.md (UNSPECV_MRET): New. (GP_REGNUM): New. (riscv_frflags, riscv_fsflags): Use tab after opcode. (riscv_mret): New.
- doc/extend.texi (RISC-V Function Attributes) : New.

gcc/testsuite/
- gcc.target/riscv/interrupt-1.c: New.
- gcc.target/riscv/interrupt-2.c: New.
- gcc.target/riscv/interrupt-3.c: New.
- gcc.target/riscv/interrupt-4.c: New.
- gcc.target/riscv/interrupt-5.c: New.

e4749e2065c RISC-V: Add interrupt attribute support.
gcc/ChangeLog | 26 ++++++
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv.c | 127 +++++++++++++++++++++++----
gcc/config/riscv/riscv.h | 2 +-
gcc/config/riscv/riscv.md | 13 ++-
gcc/doc/extend.texi | 6 ++
gcc/testsuite/ChangeLog | 8 ++
gcc/testsuite/gcc.target/riscv/interrupt-1.c | 8 ++
gcc/testsuite/gcc.target/riscv/interrupt-2.c | 17 ++++
gcc/testsuite/gcc.target/riscv/interrupt-3.c | 9 ++
gcc/testsuite/gcc.target/riscv/interrupt-4.c | 18 ++++
gcc/testsuite/gcc.target/riscv/interrupt-5.c | 16 ++++
12 files changed, 233 insertions(+), 18 deletions(-)

Upstream: gcc.gnu.org


  • Share