1 /* src/vm/jit/mips/emit.c - MIPS code emitter functions
3 Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 $Id: emit.c 4398 2006-01-31 23:43:08Z twisti $
36 #include "vm/jit/mips/codegen.h"
37 #include "vm/jit/mips/md-abi.h"
39 #include "mm/memory.h"
41 #if defined(ENABLE_THREADS)
42 # include "threads/native/lock.h"
45 #include "vm/builtin.h"
46 #include "vm/exceptions.h"
47 #include "vm/stringlocal.h" /* XXX for gen_resolvebranch */
49 #include "vm/jit/abi.h"
50 #include "vm/jit/abi-asm.h"
51 #include "vm/jit/asmpart.h"
52 #include "vm/jit/dseg.h"
53 #include "vm/jit/emit-common.h"
54 #include "vm/jit/jit.h"
55 #include "vm/jit/replace.h"
57 #include "vmcore/options.h"
60 /* emit_load *******************************************************************
62 Emits a possible load of an operand.
64 *******************************************************************************/
66 s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
72 /* get required compiler data */
76 if (src->flags & INMEMORY) {
79 disp = src->vv.regoff * 8;
82 #if SIZEOF_VOID_P == 8
86 M_LLD(tempreg, REG_SP, disp);
91 M_ILD(tempreg, REG_SP, disp);
94 M_LLD(tempreg, REG_SP, disp);
98 M_FLD(tempreg, REG_SP, disp);
101 M_DLD(tempreg, REG_SP, disp);
104 vm_abort("emit_load: unknown type %d", src->type);
110 reg = src->vv.regoff;
116 /* emit_load_low ***************************************************************
118 Emits a possible load of the low 32-bits of an operand.
120 *******************************************************************************/
122 #if SIZEOF_VOID_P == 4
123 s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
129 assert(src->type == TYPE_LNG);
131 /* get required compiler data */
135 if (src->flags & INMEMORY) {
138 disp = src->vv.regoff * 8;
140 #if WORDS_BIGENDIAN == 1
141 M_ILD(tempreg, REG_SP, disp + 4);
143 M_ILD(tempreg, REG_SP, disp);
149 reg = GET_LOW_REG(src->vv.regoff);
153 #endif /* SIZEOF_VOID_P == 4 */
156 /* emit_load_high **************************************************************
158 Emits a possible load of the high 32-bits of an operand.
160 *******************************************************************************/
162 #if SIZEOF_VOID_P == 4
163 s4 emit_load_high(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
169 assert(src->type == TYPE_LNG);
171 /* get required compiler data */
175 if (src->flags & INMEMORY) {
178 disp = src->vv.regoff * 8;
180 #if WORDS_BIGENDIAN == 1
181 M_ILD(tempreg, REG_SP, disp);
183 M_ILD(tempreg, REG_SP, disp + 4);
189 reg = GET_HIGH_REG(src->vv.regoff);
193 #endif /* SIZEOF_VOID_P == 4 */
196 /* emit_store ******************************************************************
198 Emits a possible store to variable.
200 *******************************************************************************/
202 void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
207 /* get required compiler data */
211 if (dst->flags & INMEMORY) {
214 disp = dst->vv.regoff * 8;
217 #if SIZEOF_VOID_P == 8
221 M_LST(d, REG_SP, disp);
226 M_IST(d, REG_SP, disp);
229 M_LST(d, REG_SP, disp);
233 M_FST(d, REG_SP, disp);
236 M_DST(d, REG_SP, disp);
239 vm_abort("emit_store: unknown type %d", dst->type);
245 /* emit_copy *******************************************************************
247 Generates a register/memory to register/memory copy.
249 *******************************************************************************/
251 void emit_copy(jitdata *jd, instruction *iptr)
258 /* get required compiler data */
262 /* get source and destination variables */
264 src = VAROP(iptr->s1);
265 dst = VAROP(iptr->dst);
267 if ((src->vv.regoff != dst->vv.regoff) ||
268 ((src->flags ^ dst->flags) & INMEMORY)) {
270 if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
271 /* emit nothing, as the value won't be used anyway */
275 /* If one of the variables resides in memory, we can eliminate
276 the register move from/to the temporary register with the
277 order of getting the destination register and the load. */
279 if (IS_INMEMORY(src->flags)) {
280 #if SIZEOF_VOID_P == 4
281 if (IS_2_WORD_TYPE(src->type))
282 d = codegen_reg_of_var(iptr->opc, dst, REG_ITMP12_PACKED);
285 d = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
286 s1 = emit_load(jd, iptr, src, d);
289 s1 = emit_load(jd, iptr, src, REG_IFTMP);
290 #if SIZEOF_VOID_P == 4
291 if (IS_2_WORD_TYPE(src->type))
292 d = codegen_reg_of_var(iptr->opc, dst, REG_ITMP12_PACKED);
295 d = codegen_reg_of_var(iptr->opc, dst, s1);
300 #if SIZEOF_VOID_P == 8
322 vm_abort("emit_copy: unknown type %d", dst->type);
326 emit_store(jd, iptr, dst, d);
331 /* emit_iconst *****************************************************************
335 *******************************************************************************/
337 void emit_iconst(codegendata *cd, s4 d, s4 value)
341 if ((value >= -32768) && (value <= 32767))
342 M_IADD_IMM(REG_ZERO, value, d);
343 else if ((value >= 0) && (value <= 0xffff))
344 M_OR_IMM(REG_ZERO, value, d);
346 disp = dseg_add_s4(cd, value);
347 M_ILD(d, REG_PV, disp);
352 /* emit_lconst *****************************************************************
356 *******************************************************************************/
358 void emit_lconst(codegendata *cd, s4 d, s8 value)
362 #if SIZEOF_VOID_P == 8
363 if ((value >= -32768) && (value <= 32767))
364 M_LADD_IMM(REG_ZERO, value, d);
365 else if ((value >= 0) && (value <= 0xffff))
366 M_OR_IMM(REG_ZERO, value, d);
368 disp = dseg_add_s8(cd, value);
369 M_LLD(d, REG_PV, disp);
372 disp = dseg_add_s8(cd, value);
373 M_LLD(d, REG_PV, disp);
378 /* emit_branch *****************************************************************
380 Emits the code for conditional and unconditional branchs.
382 NOTE: The reg argument may contain two packed registers.
384 *******************************************************************************/
386 void emit_branch(codegendata *cd, s4 disp, s4 condition, s4 reg, u4 opt)
391 /* calculate the different displacements */
393 checkdisp = (disp - 4);
394 branchdisp = (disp - 4) >> 2;
396 /* check which branch to generate */
398 if (condition == BRANCH_UNCONDITIONAL) {
399 /* check displacement for overflow */
401 if ((checkdisp < (s4) 0xffff8000) || (checkdisp > (s4) 0x00007fff)) {
402 /* if the long-branches flag isn't set yet, do it */
404 if (!CODEGENDATA_HAS_FLAG_LONGBRANCHES(cd)) {
405 cd->flags |= (CODEGENDATA_FLAG_ERROR |
406 CODEGENDATA_FLAG_LONGBRANCHES);
409 vm_abort("emit_branch: emit unconditional long-branch code");
417 /* and displacement for overflow */
419 if ((checkdisp < (s4) 0xffff8000) || (checkdisp > (s4) 0x00007fff)) {
420 /* if the long-branches flag isn't set yet, do it */
422 if (!CODEGENDATA_HAS_FLAG_LONGBRANCHES(cd)) {
423 cd->flags |= (CODEGENDATA_FLAG_ERROR |
424 CODEGENDATA_FLAG_LONGBRANCHES);
429 M_BNE(GET_HIGH_REG(reg), GET_LOW_REG(reg), 5);
432 M_BEQ(GET_HIGH_REG(reg), GET_LOW_REG(reg), 5);
447 vm_abort("emit_branch: unknown condition %d", condition);
450 /* The actual branch code which is over-jumped (NOTE: we
451 don't use a branch delay slot here). */
453 M_LUI(REG_ITMP3, branchdisp >> 16);
454 M_OR_IMM(REG_ITMP3, branchdisp, REG_ITMP3);
455 M_AADD(REG_PV, REG_ITMP3, REG_ITMP3);
463 M_BEQ(GET_HIGH_REG(reg), GET_LOW_REG(reg), branchdisp);
466 M_BNE(GET_HIGH_REG(reg), GET_LOW_REG(reg), branchdisp);
469 M_BLTZ(reg, branchdisp);
472 M_BGEZ(reg, branchdisp);
475 M_BGTZ(reg, branchdisp);
478 M_BLEZ(reg, branchdisp);
481 vm_abort("emit_branch: unknown condition %d", condition);
491 /* emit_arithmetic_check *******************************************************
493 Emit an ArithmeticException check.
495 *******************************************************************************/
497 void emit_arithmetic_check(codegendata *cd, instruction *iptr, s4 reg)
499 if (INSTRUCTION_MUST_CHECK(iptr)) {
502 M_ALD_INTERN(REG_ZERO, REG_ZERO, EXCEPTION_HARDWARE_ARITHMETIC);
507 /* emit_arrayindexoutofbounds_check ********************************************
509 Emit an ArrayIndexOutOfBoundsException check.
511 *******************************************************************************/
513 void emit_arrayindexoutofbounds_check(codegendata *cd, instruction *iptr, s4 s1, s4 s2)
515 if (INSTRUCTION_MUST_CHECK(iptr)) {
516 M_ILD_INTERN(REG_ITMP3, s1, OFFSET(java_arrayheader, size));
517 M_CMPULT(s2, REG_ITMP3, REG_ITMP3);
518 M_BNEZ(REG_ITMP3, 2);
520 M_ALD_INTERN(s2, REG_ZERO, EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS);
525 /* emit_classcast_check ********************************************************
527 Emit a ClassCastException check.
529 *******************************************************************************/
531 void emit_classcast_check(codegendata *cd, instruction *iptr, s4 condition, s4 reg, s4 s1)
533 if (INSTRUCTION_MUST_CHECK(iptr)) {
548 vm_abort("emit_classcast_check: unknown condition %d", condition);
552 M_ALD_INTERN(s1, REG_ZERO, EXCEPTION_HARDWARE_CLASSCAST);
557 /* emit_nullpointer_check ******************************************************
559 Emit a NullPointerException check.
561 *******************************************************************************/
563 void emit_nullpointer_check(codegendata *cd, instruction *iptr, s4 reg)
565 if (INSTRUCTION_MUST_CHECK(iptr)) {
568 M_ALD_INTERN(REG_ZERO, REG_ZERO, EXCEPTION_HARDWARE_NULLPOINTER);
573 /* emit_exception_check ********************************************************
575 Emit an Exception check.
577 *******************************************************************************/
579 void emit_exception_check(codegendata *cd, instruction *iptr)
581 if (INSTRUCTION_MUST_CHECK(iptr)) {
582 M_BNEZ(REG_RESULT, 2);
584 M_ALD_INTERN(REG_RESULT, REG_ZERO, EXCEPTION_HARDWARE_EXCEPTION);
589 /* emit_patcher_stubs **********************************************************
591 Generates the code for the patcher stubs.
593 *******************************************************************************/
595 void emit_patcher_stubs(jitdata *jd)
605 /* get required compiler data */
609 /* generate code patching stub call code */
613 /* for (pr = list_first_unsynced(cd->patchrefs); pr != NULL; */
614 /* pr = list_next_unsynced(cd->patchrefs, pr)) { */
615 for (pr = cd->patchrefs; pr != NULL; pr = pr->next) {
616 /* check code segment size */
620 /* Get machine code which is patched back in later. The
621 call is 2 instruction words long. */
623 tmpmcodeptr = (u1 *) (cd->mcodebase + pr->branchpos);
625 /* We use 2 loads here as an unaligned 8-byte read on 64-bit
626 MIPS causes a SIGSEGV and using the same code for both
627 architectures is much better. */
629 mcode[0] = ((u4 *) tmpmcodeptr)[0];
630 mcode[1] = ((u4 *) tmpmcodeptr)[1];
632 mcode[2] = ((u4 *) tmpmcodeptr)[2];
633 mcode[3] = ((u4 *) tmpmcodeptr)[3];
634 mcode[4] = ((u4 *) tmpmcodeptr)[4];
636 /* Patch in the call to call the following code (done at
639 savedmcodeptr = cd->mcodeptr; /* save current mcodeptr */
640 cd->mcodeptr = tmpmcodeptr; /* set mcodeptr to patch position */
642 disp = ((u4 *) savedmcodeptr) - (((u4 *) tmpmcodeptr) + 1);
644 /* if ((disp < (s4) 0xffff8000) || (disp > (s4) 0x00007fff)) { */
645 /* Recalculate the displacement to be relative to PV. */
647 disp = savedmcodeptr - cd->mcodebase;
649 M_LUI(REG_ITMP3, disp >> 16);
650 M_OR_IMM(REG_ITMP3, disp, REG_ITMP3);
651 M_AADD(REG_PV, REG_ITMP3, REG_ITMP3);
663 cd->mcodeptr = savedmcodeptr; /* restore the current mcodeptr */
665 /* create stack frame */
667 M_ASUB_IMM(REG_SP, 8 * 8, REG_SP);
669 /* calculate return address and move it onto the stack */
671 M_LDA(REG_ITMP3, REG_PV, pr->branchpos);
672 M_AST(REG_ITMP3, REG_SP, 7 * 8);
674 /* move pointer to java_objectheader onto stack */
676 #if defined(ENABLE_THREADS)
677 /* create a virtual java_objectheader */
679 (void) dseg_add_unique_address(cd, NULL); /* flcword */
680 (void) dseg_add_unique_address(cd, lock_get_initial_lock_word());
681 disp = dseg_add_unique_address(cd, NULL); /* vftbl */
683 M_LDA(REG_ITMP3, REG_PV, disp);
684 M_AST(REG_ITMP3, REG_SP, 6 * 8);
689 /* move machine code onto stack */
691 disp = dseg_add_s4(cd, mcode[0]);
692 M_ILD(REG_ITMP3, REG_PV, disp);
693 M_IST(REG_ITMP3, REG_SP, 3 * 8 + 0);
695 disp = dseg_add_s4(cd, mcode[1]);
696 M_ILD(REG_ITMP3, REG_PV, disp);
697 M_IST(REG_ITMP3, REG_SP, 3 * 8 + 4);
699 disp = dseg_add_s4(cd, mcode[2]);
700 M_ILD(REG_ITMP3, REG_PV, disp);
701 M_IST(REG_ITMP3, REG_SP, 4 * 8 + 0);
703 disp = dseg_add_s4(cd, mcode[3]);
704 M_ILD(REG_ITMP3, REG_PV, disp);
705 M_IST(REG_ITMP3, REG_SP, 4 * 8 + 4);
707 disp = dseg_add_s4(cd, mcode[4]);
708 M_ILD(REG_ITMP3, REG_PV, disp);
709 M_IST(REG_ITMP3, REG_SP, 5 * 8 + 0);
711 /* move class/method/field reference onto stack */
713 disp = dseg_add_address(cd, pr->ref);
714 M_ALD(REG_ITMP3, REG_PV, disp);
715 M_AST(REG_ITMP3, REG_SP, 2 * 8);
717 /* move data segment displacement onto stack */
719 disp = dseg_add_s4(cd, pr->disp);
720 M_ILD(REG_ITMP3, REG_PV, disp);
721 M_IST(REG_ITMP3, REG_SP, 1 * 8);
723 /* move patcher function pointer onto stack */
725 disp = dseg_add_functionptr(cd, pr->patcher);
726 M_ALD(REG_ITMP3, REG_PV, disp);
727 M_AST(REG_ITMP3, REG_SP, 0 * 8);
729 if (targetdisp == 0) {
730 targetdisp = ((u4 *) cd->mcodeptr) - ((u4 *) cd->mcodebase);
732 disp = dseg_add_functionptr(cd, asm_patcher_wrapper);
733 M_ALD(REG_ITMP3, REG_PV, disp);
738 disp = (((u4 *) cd->mcodebase) + targetdisp) -
739 (((u4 *) cd->mcodeptr) + 1);
748 /* emit_replacement_stubs ******************************************************
750 Generates the code for the replacement stubs.
752 *******************************************************************************/
754 #if defined(ENABLE_REPLACEMENT)
755 void emit_replacement_stubs(jitdata *jd)
766 /* get required compiler data */
771 rplp = code->rplpoints;
773 /* store beginning of replacement stubs */
775 code->replacementstubs = (u1*) (cd->mcodeptr - cd->mcodebase);
777 for (i = 0; i < code->rplpointcount; ++i, ++rplp) {
778 /* do not generate stubs for non-trappable points */
780 if (rplp->flags & RPLPOINT_FLAG_NOTRAP)
783 /* check code segment size */
788 savedmcodeptr = cd->mcodeptr;
791 /* create stack frame - 16-byte aligned */
793 M_ASUB_IMM(REG_SP, 2 * 8, REG_SP);
795 /* push address of `rplpoint` struct */
797 disp = dseg_add_address(cd, rplp);
798 M_ALD(REG_ITMP3, REG_PV, disp);
799 M_AST(REG_ITMP3, REG_SP, 0 * 8);
801 /* jump to replacement function */
803 disp = dseg_add_functionptr(cd, asm_replacement_out);
804 M_ALD(REG_ITMP3, REG_PV, disp);
806 M_NOP; /* delay slot */
808 assert((cd->mcodeptr - savedmcodeptr) == 4*REPLACEMENT_STUB_SIZE);
811 #endif /* defined(ENABLE_REPLACEMENT) */
814 /* emit_verbosecall_enter ******************************************************
816 Generates the code for the call trace.
818 *******************************************************************************/
821 void emit_verbosecall_enter(jitdata *jd)
830 /* get required compiler data */
838 /* mark trace code */
842 M_LDA(REG_SP, REG_SP, -(PA_SIZE + (2 + ARG_CNT + TMP_CNT) * 8));
843 M_AST(REG_RA, REG_SP, PA_SIZE + 1 * 8);
845 /* save argument registers (we store the registers as address
846 types, so it's correct for MIPS32 too) */
848 for (i = 0; i < INT_ARG_CNT; i++)
849 M_AST(abi_registers_integer_argument[i], REG_SP, PA_SIZE + (2 + i) * 8);
851 for (i = 0; i < FLT_ARG_CNT; i++)
852 M_DST(abi_registers_float_argument[i], REG_SP, PA_SIZE + (2 + INT_ARG_CNT + i) * 8);
854 /* save temporary registers for leaf methods */
856 if (jd->isleafmethod) {
857 for (i = 0; i < INT_TMP_CNT; i++)
858 M_AST(rd->tmpintregs[i], REG_SP, PA_SIZE + (2 + ARG_CNT + i) * 8);
860 for (i = 0; i < FLT_TMP_CNT; i++)
861 M_DST(rd->tmpfltregs[i], REG_SP, PA_SIZE + (2 + ARG_CNT + INT_TMP_CNT + i) * 8);
864 /* Load float arguments into integer registers. MIPS32 has less
865 float argument registers than integer ones, we need to check
868 for (i = 0; i < md->paramcount && i < INT_ARG_CNT && i < FLT_ARG_CNT; i++) {
869 t = md->paramtypes[i].type;
871 if (IS_FLT_DBL_TYPE(t)) {
872 if (IS_2_WORD_TYPE(t)) {
873 M_DST(abi_registers_float_argument[i], REG_SP, 0 * 8);
874 M_LLD(abi_registers_integer_argument[i], REG_SP, 0 * 8);
877 M_FST(abi_registers_float_argument[i], REG_SP, 0 * 8);
878 M_ILD(abi_registers_integer_argument[i], REG_SP, 0 * 8);
883 #if SIZEOF_VOID_P == 4
884 for (i = 0, j = 0; i < md->paramcount && i < TRACE_ARGS_NUM; i++) {
885 t = md->paramtypes[i].type;
887 if (IS_INT_LNG_TYPE(t)) {
888 if (IS_2_WORD_TYPE(t)) {
889 M_ILD(abi_registers_integer_argument[j], REG_SP, PA_SIZE + (2 + i) * 8);
890 M_ILD(abi_registers_integer_argument[j + 1], REG_SP, PA_SIZE + (2 + i) * 8 + 4);
893 # if WORDS_BIGENDIAN == 1
894 M_MOV(REG_ZERO, abi_registers_integer_argument[j]);
895 M_ILD(abi_registers_integer_argument[j + 1], REG_SP, PA_SIZE + (2 + i) * 8);
897 M_ILD(abi_registers_integer_argument[j], REG_SP, PA_SIZE + (2 + i) * 8);
898 M_MOV(REG_ZERO, abi_registers_integer_argument[j + 1]);
906 disp = dseg_add_address(cd, m);
907 M_ALD(REG_ITMP1, REG_PV, disp);
908 M_AST(REG_ITMP1, REG_SP, PA_SIZE + 0 * 8);
909 disp = dseg_add_functionptr(cd, builtin_verbosecall_enter);
910 M_ALD(REG_ITMP3, REG_PV, disp);
911 M_JSR(REG_RA, REG_ITMP3);
914 /* restore argument registers */
916 for (i = 0; i < INT_ARG_CNT; i++)
917 M_ALD(abi_registers_integer_argument[i], REG_SP, PA_SIZE + (2 + i) * 8);
919 for (i = 0; i < FLT_ARG_CNT; i++)
920 M_DLD(abi_registers_float_argument[i], REG_SP, PA_SIZE + (2 + INT_ARG_CNT + i) * 8);
922 /* restore temporary registers for leaf methods */
924 if (jd->isleafmethod) {
925 for (i = 0; i < INT_TMP_CNT; i++)
926 M_ALD(rd->tmpintregs[i], REG_SP, PA_SIZE + (2 + ARG_CNT + i) * 8);
928 for (i = 0; i < FLT_TMP_CNT; i++)
929 M_DLD(rd->tmpfltregs[i], REG_SP, PA_SIZE + (2 + ARG_CNT + INT_TMP_CNT + i) * 8);
932 M_ALD(REG_RA, REG_SP, PA_SIZE + 1 * 8);
933 M_LDA(REG_SP, REG_SP, PA_SIZE + (2 + ARG_CNT + TMP_CNT) * 8);
935 /* mark trace code */
939 #endif /* !defined(NDEBUG) */
942 /* emit_verbosecall_exit *******************************************************
944 Generates the code for the call trace.
946 void builtin_verbosecall_exit(s8 l, double d, float f, methodinfo *m);
948 *******************************************************************************/
951 void emit_verbosecall_exit(jitdata *jd)
959 /* get required compiler data */
967 /* mark trace code */
971 #if SIZEOF_VOID_P == 8
972 M_ASUB_IMM(REG_SP, 4 * 8, REG_SP); /* keep stack 16-byte aligned */
973 M_AST(REG_RA, REG_SP, 0 * 8);
975 M_LST(REG_RESULT, REG_SP, 1 * 8);
976 M_DST(REG_FRESULT, REG_SP, 2 * 8);
978 M_MOV(REG_RESULT, REG_A0);
979 M_DMOV(REG_FRESULT, REG_FA1);
980 M_FMOV(REG_FRESULT, REG_FA2);
982 disp = dseg_add_address(cd, m);
983 M_ALD(REG_A4, REG_PV, disp);
985 M_ASUB_IMM(REG_SP, (8*4 + 4 * 8), REG_SP);
986 M_AST(REG_RA, REG_SP, 8*4 + 0 * 8);
988 M_LST(REG_RESULT_PACKED, REG_SP, 8*4 + 1 * 8);
989 M_DST(REG_FRESULT, REG_SP, 8*4 + 2 * 8);
991 switch (md->returntype.type) {
993 M_LNGMOVE(REG_RESULT_PACKED, REG_A0_A1_PACKED);
997 # if WORDS_BIGENDIAN == 1
998 M_MOV(REG_ZERO, REG_A0);
999 M_MOV(REG_RESULT, REG_A1);
1001 M_MOV(REG_RESULT, REG_A0);
1002 M_MOV(REG_ZERO, REG_A1);
1006 M_LLD(REG_A2_A3_PACKED, REG_SP, 8*4 + 2 * 8);
1007 M_FST(REG_FRESULT, REG_SP, 4*4 + 0 * 4);
1009 disp = dseg_add_address(cd, m);
1010 M_ALD(REG_ITMP1, REG_PV, disp);
1011 M_AST(REG_ITMP1, REG_SP, 4*4 + 1 * 4);
1014 disp = dseg_add_functionptr(cd, builtin_verbosecall_exit);
1015 M_ALD(REG_ITMP3, REG_PV, disp);
1016 M_JSR(REG_RA, REG_ITMP3);
1019 #if SIZEOF_VOID_P == 8
1020 M_DLD(REG_FRESULT, REG_SP, 2 * 8);
1021 M_LLD(REG_RESULT, REG_SP, 1 * 8);
1023 M_ALD(REG_RA, REG_SP, 0 * 8);
1024 M_AADD_IMM(REG_SP, 4 * 8, REG_SP);
1026 M_DLD(REG_FRESULT, REG_SP, 8*4 + 2 * 8);
1027 M_LLD(REG_RESULT_PACKED, REG_SP, 8*4 + 1 * 8);
1029 M_ALD(REG_RA, REG_SP, 8*4 + 0 * 8);
1030 M_AADD_IMM(REG_SP, 8*4 + 4 * 8, REG_SP);
1033 /* mark trace code */
1037 #endif /* !defined(NDEBUG) */
1041 * These are local overrides for various environment variables in Emacs.
1042 * Please do not remove this and leave it at the end of the file, where
1043 * Emacs will automagically detect them.
1044 * ---------------------------------------------------------------------
1047 * indent-tabs-mode: t
1051 * vim:noexpandtab:sw=4:ts=4: