Skip to content
  • Jakob Stoklund Olesen's avatar
    Implement LowerReturn_64 for SPARC v9. · edaf66b0
    Jakob Stoklund Olesen authored
    Integer return values are sign or zero extended by the callee, and
    structs up to 32 bytes in size can be returned in registers.
    
    The CC_Sparc64 CallingConv definition is shared between
    LowerFormalArguments_64 and LowerReturn_64. Function arguments and
    return values are passed in the same registers.
    
    The inreg flag is also used for return values. This is required to handle
    C functions returning structs containing floats and ints:
    
      struct ifp {
        int i;
        float f;
      };
    
      struct ifp f(void);
    
    LLVM IR:
    
      define inreg { i32, float } @f() {
         ...
         ret { i32, float } %retval
      }
    
    The ABI requires that %retval.i is returned in the high bits of %i0
    while %retval.f goes in %f1.
    
    Without the inreg return value attribute, %retval.i would go in %i0 and
    %retval.f would go in %f3 which is a more efficient way of returning
    %multiple values, but it is not ABI compliant for returning C structs.
    
    llvm-svn: 178966
    edaf66b0
Loading