RISC-V: Add interrupt attribute support.
authorJim Wilson <jimw@sifive.com>
Fri, 25 May 2018 22:29:17 +0000 (22:29 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Fri, 25 May 2018 22:29:17 +0000 (15:29 -0700)
commitd0ebdd9fce00f5fbfec615d72f1dedf0cd7762a6
treefd44a708cc3f3ebbd9eab6e79f8573f972a67663
parentc0e8f02b27afc1a07f30a7597f8ae34094821f9d
RISC-V: Add interrupt attribute support.

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) <interrupt>: 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.

From-SVN: r260785
12 files changed:
gcc/ChangeLog
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv.c
gcc/config/riscv/riscv.h
gcc/config/riscv/riscv.md
gcc/doc/extend.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/riscv/interrupt-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/interrupt-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/interrupt-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/interrupt-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/interrupt-5.c [new file with mode: 0644]