Restrict a routine to use a limited set of registers

后端 未结 1 745
灰色年华
灰色年华 2021-01-23 18:56

Using compiler option, is it possible to restrict a routine from using certain set of registers?

For example: Restrict a routine to use only R0-R8;

Purpose: If s

1条回答
  •  暖寄归人
    2021-01-23 19:22

    When this was last discussed, the consensus was that it is not possible on a function-by-function basis.

    There are ways to restrict register use throughout an entire compilation, so if you put your interrupt routines in a separate compilation unit, you can use the gcc switch -ffixed-reg. I believe it would be used like -ffixed-R0 if you wanted the compiler to not generate code using R0.

    0 讨论(0)
提交回复
热议问题