[llvm] [M68k] always use movem for register spills (PR #106715)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 06:56:48 PDT 2024


0x59616e wrote:

> To be honest, I have no idea how to test for the correct spill size. 

How about this one: 
```
$ llc ./test.ll -O0 -regalloc=fast -o - -march=m68k -stop-after=regallocfast
```

We can tell from this snippet that there is a spill slot of 2 bytes:
```
stack:
  - { id: 0, name: prev_state, type: default, offset: 0, size: 1, alignment: 1,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
  - { id: 1, name: '', type: spill-slot, offset: 0, size: 2, alignment: 2,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }

```

Also, we can also check from this snippet that the spill instruction is movem, because it stores to the spill slot (which is %stack.1)  
```
    dead $bd1 = SUB8dd $bd1, killed $bd2, implicit-def $ccr
    MOVM16pm_P 0, %stack.1, killed $bd0 :: (store (s16) into %stack.1)
    Bne8 %bb.3, implicit killed $ccr

```

https://github.com/llvm/llvm-project/pull/106715


More information about the llvm-commits mailing list