On Sun, Jun 25, 2017 at 06:52:37PM +0100, Maxim Blinov wrote: > 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; Then you have a problem. Can it not be read in any way, like, with a "lea" instruction or similar? Or store it to some memory (push it to the stack, for example)? GCC needs to be able to get the value of the stack pointer some way, for example to initialise the frame pointer. > 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? Perhaps. Two regs is very few. Segher