RISC-V: Add interrupt attribute support.
commite4749e2065cd2b547dfd6a6d0beaf095a0bd1a96
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 May 2018 22:29:17 +0000 (25 22:29 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 May 2018 22:29:17 +0000 (25 22:29 +0000)
treefd44a708cc3f3ebbd9eab6e79f8573f972a67663
parent4a2ec4d662148441f06c80c27f1b8f0a56441c79
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260785 138bc75d-0d04-0410-961f-82ee72b054a4
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]