Skip to content

Potential GP_REG t6 (x31) prologue/epilogue save to stack issue in pulp-riscv-gcc/gcc/config/riscv/riscv.c #32

@JamInJar

Description

@JamInJar

Hi,
There might be a minor issue related to prologue and epilogue GP registers saving:

Context

I was trying to remove the limitation related to the ISRs regarding functions calls, that is to say allowing such calls at my own risk. I reasoned that I should save all caller-saved regs instead on simply the ones used by the ISR. I managed to do so but was a bit puzzled as t6 (x31) did not appear as part of the regs saved to the stack during my ISR prologue (and respectively retrieved from it during the epilogue).

Issue

I found at lines 4233 (riscv_for_each_saved_reg), 4365 (riscv_adjust_lib_call_cfi_prologue) and 4506 (riscv_adjust_lib_call_cfi_epilogue) a "for" loop that might contain a typo:
for (int regno = GP_REG_FIRST; regno <= GP_REG_LAST-1; regno++)

Trial

I did not know if it was done purposefully but anyway made the following modification:
for (int regno = GP_REG_FIRST; regno <= GP_REG_LAST; regno++)
This time t6 was saved on the stack.

Thank you !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions