GCC (LRA): error: unable to find a register to spill

Maxim Blinov maxim.a.blinov@gmail.com
Sun Jun 25 17:52:00 GMT 2017


Some context: my target has 2 general purpose registers and 1 stack
pointer: %a, %b, %sp.

%sp can only be written to from %a, and cannot be read;
However it can be used as an address operand with an offset, as follows:
move *( %sp + offset), %r

file test.c:
int main() {
    int a = 2;
}

fails to compile with the following message:

test.c: In function 'main':
test.c:4:1: error: unable to find a register to spill
 }
 ^
test.c:4:1: error: this is the insn:
(insn 5 16 17 2 (set (reg:HI 12)
        (const_int 2 [0x2])) test.c:3 1 {movhi}
     (nil))
test.c:4: confused by earlier errors, bailing out

(reg:HI 12) must be referring to a pseudo, as I only have 4 registers total.

Does this mean that I simply do not have any free registers to start
pushing values onto the stack?

Potentially relevant excerpt from my macro definitions, currently
arbitrarily defined:

// Frame Registers
#define STACK_POINTER_REGNUM 2 // Stack pointer register
#define FRAME_POINTER_REGNUM 0 // register A
#define ARG_POINTER_REGNUM 0
#define STATIC_CHAIN_REGNUM 1 // register B



More information about the Gcc-help mailing list