2000-07-07 06:55:02 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Objective Caml */
|
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
|
|
|
/* under the terms of the Q Public License version 1.0. */
|
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2000-07-07 07:26:02 -07:00
|
|
|
#define ST8OFF(a,b,d) st8 [a] = b, d
|
|
|
|
#define LD8OFF(a,b,d) ld8 a = [b], d
|
|
|
|
#define STFDOFF(a,b,d) stfd [a] = b, d
|
|
|
|
#define LDFDOFF(a,b,d) ldfd a = [b], d
|
|
|
|
#define STFSPILLOFF(a,b,d) stf.spill [a] = b, d
|
|
|
|
#define LDFFILLOFF(a,b,d) ldf.fill a = [b], d
|
|
|
|
|
2001-07-12 05:54:24 -07:00
|
|
|
.text
|
2000-07-07 06:55:02 -07:00
|
|
|
.align 16
|
|
|
|
|
|
|
|
.global call_gen_code#
|
|
|
|
.proc call_gen_code#
|
|
|
|
|
|
|
|
call_gen_code:
|
|
|
|
/* Allocate 64 "out" registers (for the Caml code) and no locals */
|
2001-07-12 05:54:24 -07:00
|
|
|
alloc r3 = ar.pfs, 0, 0, 64, 0
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
/* Save PFS, return address and GP on stack */
|
2000-07-21 01:08:44 -07:00
|
|
|
add sp = -368, sp ;;
|
2000-07-18 05:05:07 -07:00
|
|
|
add r2 = 16, sp ;;
|
|
|
|
ST8OFF(r2,r3,8) ;;
|
|
|
|
mov r3 = b0 ;;
|
|
|
|
ST8OFF(r2,r3,8) ;;
|
|
|
|
ST8OFF(r2,gp,8) ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
/* Save predicates on stack */
|
2000-07-18 05:05:07 -07:00
|
|
|
mov r3 = pr ;;
|
2000-07-07 07:26:02 -07:00
|
|
|
st8 [r2] = r3
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
/* Save callee-save floating-point registers on stack */
|
|
|
|
add r2 = 48, sp
|
2000-07-18 05:05:07 -07:00
|
|
|
add r3 = 64, sp ;;
|
|
|
|
STFSPILLOFF(r2,f2,16) ;;
|
|
|
|
STFSPILLOFF(r3,f3,16) ;;
|
|
|
|
STFSPILLOFF(r2,f4,16) ;;
|
|
|
|
STFSPILLOFF(r3,f5,16) ;;
|
|
|
|
STFSPILLOFF(r2,f16,16) ;;
|
|
|
|
STFSPILLOFF(r3,f17,16) ;;
|
|
|
|
STFSPILLOFF(r2,f18,16) ;;
|
|
|
|
STFSPILLOFF(r3,f19,16) ;;
|
|
|
|
STFSPILLOFF(r2,f20,16) ;;
|
|
|
|
STFSPILLOFF(r3,f21,16) ;;
|
|
|
|
STFSPILLOFF(r2,f22,16) ;;
|
|
|
|
STFSPILLOFF(r3,f23,16) ;;
|
|
|
|
STFSPILLOFF(r2,f24,16) ;;
|
|
|
|
STFSPILLOFF(r3,f25,16) ;;
|
|
|
|
STFSPILLOFF(r2,f26,16) ;;
|
|
|
|
STFSPILLOFF(r3,f27,16) ;;
|
|
|
|
STFSPILLOFF(r2,f28,16) ;;
|
|
|
|
STFSPILLOFF(r3,f29,16) ;;
|
|
|
|
STFSPILLOFF(r2,f30,16) ;;
|
|
|
|
STFSPILLOFF(r3,f31,16) ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
/* Recover entry point and gp from the function pointer in in0 */
|
2000-07-18 05:05:07 -07:00
|
|
|
LD8OFF(r2,r32,8) ;;
|
|
|
|
ld8 r3 = [r32] ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
mov b6 = r2
|
2000-07-18 05:05:07 -07:00
|
|
|
mov gp = r3 ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
/* Shift arguments r33 ... r35 to r32 ... r34 */
|
|
|
|
mov r32 = r33
|
|
|
|
mov r33 = r34
|
2000-07-07 07:26:02 -07:00
|
|
|
mov r34 = r35
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
/* Do the call */
|
2000-07-18 05:05:07 -07:00
|
|
|
br.call.sptk b0 = b6 ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
/* Restore the saved floating-point registers */
|
|
|
|
add r2 = 48, sp
|
2000-07-18 05:05:07 -07:00
|
|
|
add r3 = 64, sp ;;
|
|
|
|
LDFFILLOFF(f2,r2,16) ;;
|
|
|
|
LDFFILLOFF(f3,r3,16) ;;
|
|
|
|
LDFFILLOFF(f4,r2,16) ;;
|
|
|
|
LDFFILLOFF(f5,r3,16) ;;
|
|
|
|
LDFFILLOFF(f16,r2,16) ;;
|
|
|
|
LDFFILLOFF(f17,r3,16) ;;
|
|
|
|
LDFFILLOFF(f18,r2,16) ;;
|
|
|
|
LDFFILLOFF(f19,r3,16) ;;
|
|
|
|
LDFFILLOFF(f20,r2,16) ;;
|
|
|
|
LDFFILLOFF(f21,r3,16) ;;
|
|
|
|
LDFFILLOFF(f22,r2,16) ;;
|
|
|
|
LDFFILLOFF(f23,r3,16) ;;
|
|
|
|
LDFFILLOFF(f24,r2,16) ;;
|
|
|
|
LDFFILLOFF(f25,r3,16) ;;
|
|
|
|
LDFFILLOFF(f26,r2,16) ;;
|
|
|
|
LDFFILLOFF(f27,r3,16) ;;
|
|
|
|
LDFFILLOFF(f28,r2,16) ;;
|
|
|
|
LDFFILLOFF(f29,r3,16) ;;
|
|
|
|
LDFFILLOFF(f30,r2,16) ;;
|
|
|
|
LDFFILLOFF(f31,r3,16) ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
/* Restore gp, predicates and return */
|
2000-07-18 05:05:07 -07:00
|
|
|
add r2 = 16, sp ;;
|
|
|
|
LD8OFF(r3,r2,8) ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
mov ar.pfs = r3
|
2000-07-18 05:05:07 -07:00
|
|
|
LD8OFF(r3,r2,8) ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
mov b0 = r3
|
2000-07-18 05:05:07 -07:00
|
|
|
LD8OFF(gp,r2,8) ;;
|
|
|
|
LD8OFF(r3,r2,8) ;;
|
2000-07-07 07:26:02 -07:00
|
|
|
mov pr = r3, -1
|
2000-07-07 06:55:02 -07:00
|
|
|
|
2000-07-18 05:05:07 -07:00
|
|
|
br.ret.sptk.many b0 ;;
|
2000-07-07 06:55:02 -07:00
|
|
|
|
|
|
|
.endp call_gen_code#
|