t-crest / patmos

Patmos is a time-predictable VLIW processor, and the processor for the T-CREST project
http://patmos.compute.dtu.dk
BSD 2-Clause "Simplified" License
135 stars 72 forks source link

Handbook: ABI inconsistency around r20 #131

Closed Emoun closed 1 year ago

Emoun commented 2 years ago

The handbook defines the register calling convention.

In section "4.2 Register Usage Conventions" it says:

  • r20 through r31 are callee-saved saved registers.

However, if we look in section "2.3 Register Files" figure 2.2(a) r20 is given the label (scratch) as if it is caller-saved. It clearly cannot be both.

Looking at the compiler, I can see that PatmosRegisterInfo.cpp defines Patmos::R21 through Patmos::R28 as calleesaved (in the function PatmosRegisterInfo::getCalleeSavedRegs).

Therefore, I suspect section 4.2 is wrong and should have r21 as the first callee-saved register.

schoeberl commented 2 years ago

Yes, the compiler source (and the Patmos source) are the final truth. Thanks for pointing this out. Maybe fix the handbook.

Emoun commented 1 year ago

fixed in 615a98811a7250fe4d7c0e6d317d0febe47b819b