• Xavier Leroy's avatar
    RISC-V: fix FP calling conventions · 88567ce6
    Xavier Leroy authored
    This is a follow-up to e81d015e.
    
    In the RISC-V ABI, FP arguments to functions are passed in integer registers
    (or pairs of integer registers) in two cases:
    1- the FP argument is a variadic argument
    2- the FP argument is a fixed argument but all 8 FP registers reserved for
       parameter passing have been used already.
    
    The previous implementation handled only case 1, with some problems.
    
    This commit implements both 1 and 2.  To this end, 8 extra FP
    caller-save registers are used to hold the values of the FP arguments
    that must be passed in integer registers.  Fixup code moves these FP
    registers to integer registers / register pairs.  Symmetrically, at
    function entry, the integer registers / register pairs are moved back
    to the FP registers.
    
    8 extra FP registers is enough because there are only 8 integer
    registers used for parameter passing, so at most 8 FP arguments may
    need to be moved to integer registers.
    88567ce6
TargetPrinter.ml 27.5 KB