RISC-V: Add interrupt attribute modes.
authorJim Wilson <jimw@sifive.com>
Wed, 6 Jun 2018 19:08:36 +0000 (19:08 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Wed, 6 Jun 2018 19:08:36 +0000 (12:08 -0700)
commitec74725ce3ed5c96783b76992940d99563c82a47
tree655961162cdfc53ad9be35b0f98b4fa69610333d
parent1b58c736db9d28975f596f5175c9f9470723c166
RISC-V: Add interrupt attribute modes.

gcc/
* config/riscv/riscv.c (enum riscv_privilege_levels): New.
(struct machine_function): New field interrupt_mode.
(riscv_handle_type_attribute): New function.  Add forward declaration.
(riscv_attribute_table) <interrupt>: Use riscv_handle_type_attribute.
(riscv_expand_epilogue): Check interrupt_mode field.
(riscv_set_current_function): Check interrupt attribute args and
set interrupt_mode field.
* config/riscv/riscv.md (UNSPECV_SRET, UNSPECV_URET): New.
(riscv_sret, riscv_uret): New.
* doc/extend.texi (RISC-V Function Attributes) <interrupt>: Document
new arguments to interrupt attribute.

gcc/testsuite/
* gcc.target/riscv/interrupt-5.c (sub3): Add new test.
* gcc.target/riscv/interrupt-mmode.c: New.
* gcc.target/riscv/interrupt-smode.c: New.
* gcc.target/riscv/interrupt-umode.c: New.

From-SVN: r261244
gcc/ChangeLog
gcc/config/riscv/riscv.c
gcc/config/riscv/riscv.md
gcc/doc/extend.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/riscv/interrupt-5.c
gcc/testsuite/gcc.target/riscv/interrupt-mmode.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/interrupt-smode.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/interrupt-umode.c [new file with mode: 0644]