aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2023-10-10 12:34:04 -0600
committerJeff Law <jlaw@ventanamicro.com>2023-10-10 16:10:30 -0600
commit71f906498ada9ec2780660b03bd6e27a93ad350c (patch)
tree4ac244ad959572f39c2d8da42577f724423f238c /libgcc
parentbd5719bd7f7cb23e5ed96a1f1a28efbb3dec4a31 (diff)
downloadgcc-71f906498ada9ec2780660b03bd6e27a93ad350c.zip
gcc-71f906498ada9ec2780660b03bd6e27a93ad350c.tar.gz
gcc-71f906498ada9ec2780660b03bd6e27a93ad350c.tar.bz2
RISC-V: far-branch: Handle far jumps and branches for functions larger than 1MB
On RISC-V, branches further than +/-1MB require a longer instruction sequence (3 instructions): we can reuse the jump-construction in the assmbler (which clobbers $ra) and a temporary to set up the jump destination. gcc/ChangeLog: * config/riscv/riscv.cc (struct machine_function): Track if a far-branch/jump is used within a function (and $ra needs to be saved). (riscv_print_operand): Implement 'N' (inverse integer branch). (riscv_far_jump_used_p): Implement. (riscv_save_return_addr_reg_p): New function. (riscv_save_reg_p): Use riscv_save_return_addr_reg_p. * config/riscv/riscv.h (FIXED_REGISTERS): Update $ra. (CALL_USED_REGISTERS): Update $ra. * config/riscv/riscv.md: Add new types "ret" and "jalr". (length attribute): Handle long conditional and unconditional branches. (conditional branch pattern): Handle case where jump can not reach the intended target. (indirect_jump, tablejump): Use new "jalr" type. (simple_return): Use new "ret" type. (simple_return_internal, eh_return_internal): Likewise. (gpr_restore_return, riscv_mret): Likewise. (riscv_uret, riscv_sret): Likewise. * config/riscv/generic.md (generic_branch): Also recognize jalr & ret types. * config/riscv/sifive-7.md (sifive_7_jump): Likewise. Co-authored-by: Philipp Tomsich <philipp.tomsich@vrull.eu> Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions