summaryrefslogtreecommitdiff
path: root/testasmcomp/mips.S
blob: 48eba1327d8746af2a51fd65b408f3884682eaee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/***********************************************************************/
/*                                                                     */
/*                           Objective Caml                            */
/*                                                                     */
/*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         */
/*                                                                     */
/*  Copyright 1996 Institut National de Recherche en Informatique et   */
/*  Automatique.  Distributed only by permission.                      */
/*                                                                     */
/***********************************************************************/

/* $Id$ */

        .globl  call_gen_code
        .ent    call_gen_code
call_gen_code:
	subu    $sp, $sp, 88
        sw      $31, 84($sp)
    /* Save all callee-save registers */
        sw      $16, 0($sp)
        sw      $17, 4($sp)
        sw      $18, 8($sp)
        sw      $19, 12($sp)
        sw      $20, 16($sp)
        sw      $21, 20($sp)
        sw      $22, 24($sp)
        sw      $23, 28($sp)
        sw      $30, 32($sp)
        s.d     $f20, 36($sp)
        s.d     $f22, 44($sp)
        s.d     $f24, 52($sp)
        s.d     $f26, 60($sp)
        s.d     $f28, 68($sp)
        s.d     $f30, 76($sp)
    /* Shuffle arguments */
        move    $8, $5
        move    $9, $6
        move    $10, $7
#ifdef _PIC
        move    $25, $4
#endif
        jal     $4
    /* Restore registers */
        lw      $31, 84($sp)
        lw      $16, 0($sp)
        lw      $17, 4($sp)
        lw      $18, 8($sp)
        lw      $19, 12($sp)
        lw      $20, 16($sp)
        lw      $21, 20($sp)
        lw      $22, 24($sp)
        lw      $23, 28($sp)
        lw      $30, 32($sp)
        l.d     $f20, 36($sp)
        l.d     $f22, 44($sp)
        l.d     $f24, 52($sp)
        l.d     $f26, 60($sp)
        l.d     $f28, 68($sp)
        l.d     $f30, 76($sp)
        addu    $sp, $sp, 88
        j       $31

        .end    call_gen_code

/* Call a C function */

        .globl  caml_c_call
        .ent    caml_c_call
caml_c_call:
#ifdef _PIC
        move    $25, $24
#endif
        j       $24
        .end    caml_c_call