RISC-V: Add naked function support

Programming / Compilers / GCC - wilson [138bc75d-0d04-0410-961f-82ee72b054a4] - 10 January 2018 23:00 EST

2018-01-10 Kito Cheng

gcc/
- config/riscv/riscv-protos.h (riscv_output_return): New.
- config/riscv/riscv.c (struct machine_function): New naked_p field. (riscv_attribute_table, riscv_output_return), (riscv_handle_fndecl_attribute, riscv_naked_function_p), (riscv_allocate_stack_slots_for_args, riscv_warn_func_return): New. (riscv_compute_frame_info): Only compute frame->mask if not a naked function. (riscv_expand_prologue): Add early return for naked function. (riscv_expand_epilogue): Likewise. (riscv_function_ok_for_sibcall): Return false for naked function. (riscv_set_current_function): New. (TARGET_SET_CURRENT_FUNCTION, TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS), (TARGET_ATTRIBUTE_TABLE, TARGET_WARN_FUNC_RETURN): New.
- config/riscv/riscv.md (simple_return): Call riscv_output_return.
- doc/extend.texi (RISC-V Function Attributes): New.

ccd1609fb23 RISC-V: Add naked function support.
gcc/ChangeLog | 19 +++++
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv.c | 157 +++++++++++++++++++++++++++++++++++-----
gcc/config/riscv/riscv.md | 4 +-
gcc/doc/extend.texi | 19 +++++
5 files changed, 182 insertions(+), 18 deletions(-)

Upstream: gcc.gnu.org


  • Share