Home > Back-end >  What is the name of the default code model used by gcc for MIPS 64?
What is the name of the default code model used by gcc for MIPS 64?

Time:01-12

gcc for MIPS 64 is using a complex method to locate and invoke a function not present in the compilation unit.  What is the name of this code model (and where is it documented)?  I searched but did not find it forthcoming.  It involves $28/$gp and $25/$t9 as some kind of parameter to pass to the called function.

And, is there a bug in this translation (either in code gen or the textual output)?

The following code sequence:

extern int g(int);

int f(int x)
{
    return g(x)   2;
}

generates this output:

        daddiu  $sp,$sp,-16
        sd      $28,0($sp)
        lui     $28,%hi(%neg(%gp_rel(f(int))))
        daddu   $28,$28,$25                             <--- sourcing $25/$t9 
        daddiu  $28,$28,%lo(%neg(%gp_rel(f(int))))
        ld      $25,           
  •  Tags:  
  • Related