1 /* src/vm/jit/codegen-common.cpp - architecture independent code generator stuff
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 All functions assume the following code area / data area layout:
27 | code area | code area grows to higher addresses
29 +-----------+ <-- start of procedure
31 | data area | data area grows to lower addresses
35 The functions first write into a temporary code/data area allocated by
36 "codegen_init". "codegen_finish" copies the code and data area into permanent
37 memory. All functions writing values into the data area return the offset
38 relative the begin of the code area (start of procedure).
54 #include "mm/memory.h"
56 #include "toolbox/avl.h"
57 #include "toolbox/list.h"
58 #include "toolbox/logging.h"
60 #include "native/llni.h"
61 #include "native/localref.h"
62 #include "native/native.h"
64 #include "threads/thread.hpp"
66 #include "vm/jit/builtin.hpp"
67 #include "vm/exceptions.hpp"
68 #include "vm/method.h"
69 #include "vm/options.h"
70 #include "vm/string.hpp"
72 # include "vm/statistics.h"
75 #include "vm/jit/abi.h"
76 #include "vm/jit/asmpart.h"
77 #include "vm/jit/code.hpp"
78 #include "vm/jit/codegen-common.hpp"
80 #if defined(ENABLE_DISASSEMBLER)
81 # include "vm/jit/disass.h"
84 #include "vm/jit/dseg.h"
85 #include "vm/jit/emit-common.hpp"
86 #include "vm/jit/jit.hpp"
87 #include "vm/jit/linenumbertable.h"
88 #include "vm/jit/methodheader.h"
89 #include "vm/jit/methodtree.h"
90 #include "vm/jit/patcher-common.hpp"
91 #include "vm/jit/replace.hpp"
92 #if defined(ENABLE_SSA)
93 # include "vm/jit/optimizing/lsra.h"
94 # include "vm/jit/optimizing/ssa.h"
96 #include "vm/jit/stacktrace.hpp"
97 #include "vm/jit/trace.hpp"
99 #if defined(ENABLE_INTRP)
100 #include "vm/jit/intrp/intrp.h"
103 #if defined(ENABLE_VMLOG)
104 #include <vmlog_cacao.h>
110 /* codegen_init ****************************************************************
114 *******************************************************************************/
116 void codegen_init(void)
121 /* codegen_setup ***************************************************************
123 Allocates and initialises code area, data area and references.
125 *******************************************************************************/
127 void codegen_setup(jitdata *jd)
132 /* get required compiler data */
137 /* initialize members */
141 cd->mcodebase = (u1*) DumpMemory::allocate(MCODEINITSIZE);
142 cd->mcodeend = cd->mcodebase + MCODEINITSIZE;
143 cd->mcodesize = MCODEINITSIZE;
145 /* initialize mcode variables */
147 cd->mcodeptr = cd->mcodebase;
148 cd->lastmcodeptr = cd->mcodebase;
150 #if defined(ENABLE_INTRP)
151 /* native dynamic superinstructions variables */
154 cd->ncodebase = (u1*) DumpMemory::allocate(NCODEINITSIZE);
155 cd->ncodesize = NCODEINITSIZE;
157 /* initialize ncode variables */
159 cd->ncodeptr = cd->ncodebase;
161 cd->lastinstwithoutdispatch = ~0; /* no inst without dispatch */
162 cd->superstarts = NULL;
169 cd->jumpreferences = NULL;
171 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
172 cd->datareferences = NULL;
175 cd->brancheslabel = list_create_dump(OFFSET(branch_label_ref_t, linkage));
176 cd->linenumbers = list_create_dump(OFFSET(linenumbertable_list_entry_t, linkage));
180 /* codegen_reset ***************************************************************
182 Resets the codegen data structure so we can recompile the method.
184 *******************************************************************************/
186 static void codegen_reset(jitdata *jd)
192 /* get required compiler data */
197 /* reset error flag */
199 cd->flags &= ~CODEGENDATA_FLAG_ERROR;
201 /* reset some members, we reuse the code memory already allocated
202 as this should have almost the correct size */
204 cd->mcodeptr = cd->mcodebase;
205 cd->lastmcodeptr = cd->mcodebase;
210 cd->jumpreferences = NULL;
212 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
213 cd->datareferences = NULL;
216 cd->brancheslabel = list_create_dump(OFFSET(branch_label_ref_t, linkage));
217 cd->linenumbers = list_create_dump(OFFSET(linenumbertable_list_entry_t, linkage));
219 /* We need to clear the mpc and the branch references from all
220 basic blocks as they will definitely change. */
222 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
224 bptr->branchrefs = NULL;
227 /* We need to clear all the patcher references from the codeinfo
228 since they all will be regenerated */
230 patcher_list_reset(code);
232 #if defined(ENABLE_REPLACEMENT)
233 code->rplpoints = NULL;
234 code->rplpointcount = 0;
235 code->regalloc = NULL;
236 code->regalloccount = 0;
237 code->globalcount = 0;
242 /* codegen_generate ************************************************************
244 Generates the code for the currently compiled method.
246 *******************************************************************************/
248 bool codegen_generate(jitdata *jd)
252 /* get required compiler data */
256 /* call the machine-dependent code generation function */
258 if (!codegen_emit(jd))
261 /* check for an error */
263 if (CODEGENDATA_HAS_FLAG_ERROR(cd)) {
264 /* check for long-branches flag, if it is set we recompile the
269 log_message_method("Re-generating code: ", jd->m);
272 /* XXX maybe we should tag long-branches-methods for recompilation */
274 if (CODEGENDATA_HAS_FLAG_LONGBRANCHES(cd)) {
275 /* we have to reset the codegendata structure first */
279 /* and restart the compiler run */
281 if (!codegen_emit(jd))
285 vm_abort("codegen_generate: unknown error occurred during codegen_emit: flags=%x\n", cd->flags);
290 log_message_method("Re-generating code done: ", jd->m);
294 /* reallocate the memory and finish the code generation */
298 /* everything's ok */
304 /* codegen_close ***************************************************************
308 *******************************************************************************/
310 void codegen_close(void)
312 /* TODO: release avl tree on i386 and x86_64 */
316 /* codegen_increase ************************************************************
320 *******************************************************************************/
322 void codegen_increase(codegendata *cd)
326 /* save old mcodebase pointer */
328 oldmcodebase = cd->mcodebase;
330 /* reallocate to new, doubled memory */
332 cd->mcodebase = (u1*) DumpMemory::reallocate(cd->mcodebase,
336 cd->mcodeend = cd->mcodebase + cd->mcodesize;
338 /* set new mcodeptr */
340 cd->mcodeptr = cd->mcodebase + (cd->mcodeptr - oldmcodebase);
342 #if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(__M68K__) || defined(ENABLE_INTRP) \
343 || defined(__SPARC_64__)
344 /* adjust the pointer to the last patcher position */
346 if (cd->lastmcodeptr != NULL)
347 cd->lastmcodeptr = cd->mcodebase + (cd->lastmcodeptr - oldmcodebase);
352 /* codegen_ncode_increase ******************************************************
356 *******************************************************************************/
358 #if defined(ENABLE_INTRP)
359 u1 *codegen_ncode_increase(codegendata *cd, u1 *ncodeptr)
363 /* save old ncodebase pointer */
365 oldncodebase = cd->ncodebase;
367 /* reallocate to new, doubled memory */
369 cd->ncodebase = DMREALLOC(cd->ncodebase,
375 /* return the new ncodeptr */
377 return (cd->ncodebase + (ncodeptr - oldncodebase));
382 /* codegen_add_branch_ref ******************************************************
384 Prepends an branch to the list.
386 *******************************************************************************/
388 void codegen_add_branch_ref(codegendata *cd, basicblock *target, s4 condition, s4 reg, u4 options)
393 STATISTICS(count_branches_unresolved++);
395 /* calculate the mpc of the branch instruction */
397 branchmpc = cd->mcodeptr - cd->mcodebase;
399 br = (branchref*) DumpMemory::allocate(sizeof(branchref));
401 br->branchmpc = branchmpc;
402 br->condition = condition;
404 br->options = options;
405 br->next = target->branchrefs;
407 target->branchrefs = br;
411 /* codegen_resolve_branchrefs **************************************************
413 Resolves and patches the branch references of a given basic block.
415 *******************************************************************************/
417 void codegen_resolve_branchrefs(codegendata *cd, basicblock *bptr)
422 /* Save the mcodeptr because in the branch emitting functions
423 we generate code somewhere inside already generated code,
424 but we're still in the actual code generation phase. */
426 mcodeptr = cd->mcodeptr;
428 /* just to make sure */
430 assert(bptr->mpc >= 0);
432 for (br = bptr->branchrefs; br != NULL; br = br->next) {
433 /* temporary set the mcodeptr */
435 cd->mcodeptr = cd->mcodebase + br->branchmpc;
437 /* emit_bccz and emit_branch emit the correct code, even if we
438 pass condition == BRANCH_UNCONDITIONAL or reg == -1. */
440 emit_bccz(cd, bptr, br->condition, br->reg, br->options);
443 /* restore mcodeptr */
445 cd->mcodeptr = mcodeptr;
449 /* codegen_branch_label_add ****************************************************
451 Append an branch to the label-branch list.
453 *******************************************************************************/
455 void codegen_branch_label_add(codegendata *cd, s4 label, s4 condition, s4 reg, u4 options)
458 branch_label_ref_t *br;
461 /* Get the label list. */
463 l = cd->brancheslabel;
465 /* calculate the current mpc */
467 mpc = cd->mcodeptr - cd->mcodebase;
469 br = (branch_label_ref_t*) DumpMemory::allocate(sizeof(branch_label_ref_t));
473 br->condition = condition;
475 br->options = options;
477 /* Add the branch to the list. */
479 list_add_last(l, br);
483 /* codegen_set_replacement_point_notrap ****************************************
485 Record the position of a non-trappable replacement point.
487 *******************************************************************************/
489 #if defined(ENABLE_REPLACEMENT)
491 void codegen_set_replacement_point_notrap(codegendata *cd, s4 type)
493 void codegen_set_replacement_point_notrap(codegendata *cd)
496 assert(cd->replacementpoint);
497 assert(cd->replacementpoint->type == type);
498 assert(cd->replacementpoint->flags & RPLPOINT_FLAG_NOTRAP);
500 cd->replacementpoint->pc = (u1*) (ptrint) (cd->mcodeptr - cd->mcodebase);
502 cd->replacementpoint++;
504 #endif /* defined(ENABLE_REPLACEMENT) */
507 /* codegen_set_replacement_point ***********************************************
509 Record the position of a trappable replacement point.
511 *******************************************************************************/
513 #if defined(ENABLE_REPLACEMENT)
515 void codegen_set_replacement_point(codegendata *cd, s4 type)
517 void codegen_set_replacement_point(codegendata *cd)
520 assert(cd->replacementpoint);
521 assert(cd->replacementpoint->type == type);
522 assert(!(cd->replacementpoint->flags & RPLPOINT_FLAG_NOTRAP));
524 cd->replacementpoint->pc = (u1*) (ptrint) (cd->mcodeptr - cd->mcodebase);
526 cd->replacementpoint++;
529 /* XXX actually we should use an own REPLACEMENT_NOPS here! */
530 if (opt_TestReplacement)
534 /* XXX assert(cd->lastmcodeptr <= cd->mcodeptr); */
536 cd->lastmcodeptr = cd->mcodeptr + PATCHER_CALL_SIZE;
538 #endif /* defined(ENABLE_REPLACEMENT) */
541 /* codegen_finish **************************************************************
543 Finishes the code generation. A new memory, large enough for both
544 data and code, is allocated and data and code are copied together
545 to their final layout, unresolved jumps are resolved, ...
547 *******************************************************************************/
549 void codegen_finish(jitdata *jd)
554 #if defined(ENABLE_INTRP)
562 /* get required compiler data */
567 /* prevent compiler warning */
569 #if defined(ENABLE_INTRP)
573 /* calculate the code length */
575 mcodelen = (s4) (cd->mcodeptr - cd->mcodebase);
577 #if defined(ENABLE_STATISTICS)
579 count_code_len += mcodelen;
580 count_data_len += cd->dseglen;
584 alignedmcodelen = MEMORY_ALIGN(mcodelen, MAX_ALIGN);
586 #if defined(ENABLE_INTRP)
588 ncodelen = cd->ncodeptr - cd->ncodebase;
590 ncodelen = 0; /* avoid compiler warning */
594 cd->dseglen = MEMORY_ALIGN(cd->dseglen, MAX_ALIGN);
595 alignedlen = alignedmcodelen + cd->dseglen;
597 #if defined(ENABLE_INTRP)
599 alignedlen += ncodelen;
603 /* allocate new memory */
605 code->mcodelength = mcodelen + cd->dseglen;
606 code->mcode = CNEW(u1, alignedlen);
608 /* set the entrypoint of the method */
610 assert(code->entrypoint == NULL);
611 code->entrypoint = epoint = (code->mcode + cd->dseglen);
613 /* fill the data segment (code->entrypoint must already be set!) */
617 /* copy code to the new location */
619 MCOPY((void *) code->entrypoint, cd->mcodebase, u1, mcodelen);
621 #if defined(ENABLE_INTRP)
622 /* relocate native dynamic superinstruction code (if any) */
625 cd->mcodebase = code->entrypoint;
628 u1 *ncodebase = code->mcode + cd->dseglen + alignedmcodelen;
630 MCOPY((void *) ncodebase, cd->ncodebase, u1, ncodelen);
632 /* flush the instruction and data caches */
634 md_cacheflush(ncodebase, ncodelen);
636 /* set some cd variables for dynamic_super_rerwite */
638 cd->ncodebase = ncodebase;
641 cd->ncodebase = NULL;
644 dynamic_super_rewrite(cd);
648 /* Create the exception table. */
650 exceptiontable_create(jd);
652 /* Create the linenumber table. */
654 linenumbertable_create(jd);
656 /* jump table resolving */
658 for (jr = cd->jumpreferences; jr != NULL; jr = jr->next)
659 *((functionptr *) ((ptrint) epoint + jr->tablepos)) =
660 (functionptr) ((ptrint) epoint + (ptrint) jr->target->mpc);
662 /* patcher resolving */
666 #if defined(ENABLE_REPLACEMENT)
667 /* replacement point resolving */
672 rp = code->rplpoints;
673 for (i=0; i<code->rplpointcount; ++i, ++rp) {
674 rp->pc = (u1*) ((ptrint) epoint + (ptrint) rp->pc);
677 #endif /* defined(ENABLE_REPLACEMENT) */
679 /* Insert method into methodtree to find the entrypoint. */
681 methodtree_insert(code->entrypoint, code->entrypoint + mcodelen);
683 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
684 /* resolve data segment references */
686 dseg_resolve_datareferences(jd);
689 /* flush the instruction and data caches */
691 md_cacheflush(code->mcode, code->mcodelength);
695 /* codegen_start_native_call ***************************************************
697 Prepares the stuff required for a native (JNI) function call:
699 - adds a stackframe info structure to the chain, for stacktraces
700 - prepares the local references table on the stack
702 The layout of the native stub stackframe should look like this:
704 +---------------------------+ <- java SP (of parent Java function)
706 +---------------------------+ <- data SP
708 | stackframe info structure |
710 +---------------------------+
712 | local references table |
714 +---------------------------+
716 | saved registers (if any) |
718 +---------------------------+
720 | arguments (if any) |
722 +---------------------------+ <- current SP (native stub)
724 *******************************************************************************/
726 java_handle_t *codegen_start_native_call(u1 *sp, u1 *pv)
728 stackframeinfo_t *sfi;
738 STATISTICS(count_calls_java_to_native++);
740 /* Get the methodinfo. */
742 m = code_get_methodinfo_for_pv(pv);
746 framesize = *((int32_t *) (pv + FrameSize));
748 assert(framesize >= (int32_t) (sizeof(stackframeinfo_t) + sizeof(localref_table)));
750 /* calculate needed values */
752 #if defined(__ALPHA__) || defined(__ARM__)
753 datasp = sp + framesize - SIZEOF_VOID_P;
754 javasp = sp + framesize;
755 arg_regs = (uint64_t *) sp;
756 arg_stack = (uint64_t *) javasp;
757 #elif defined(__MIPS__)
758 /* MIPS always uses 8 bytes to store the RA */
759 datasp = sp + framesize - 8;
760 javasp = sp + framesize;
761 #elif defined(__S390__)
762 datasp = sp + framesize - 8;
763 javasp = sp + framesize;
764 arg_regs = (uint64_t *) (sp + 96);
765 arg_stack = (uint64_t *) javasp;
766 #elif defined(__I386__) || defined(__M68K__) || defined(__X86_64__)
767 datasp = sp + framesize;
768 javasp = sp + framesize + SIZEOF_VOID_P;
769 arg_regs = (uint64_t *) sp;
770 arg_stack = (uint64_t *) javasp;
771 #elif defined(__POWERPC__)
772 datasp = sp + framesize;
773 javasp = sp + framesize;
774 arg_regs = (uint64_t *) (sp + LA_SIZE + 4 * SIZEOF_VOID_P);
775 arg_stack = (uint64_t *) javasp;
776 #elif defined(__POWERPC64__)
777 datasp = sp + framesize;
778 javasp = sp + framesize;
779 arg_regs = (uint64_t *) (sp + PA_SIZE + LA_SIZE + 4 * SIZEOF_VOID_P);
780 arg_stack = (uint64_t *) javasp;
782 /* XXX is was unable to do this port for SPARC64, sorry. (-michi) */
783 /* XXX maybe we need to pass the RA as argument there */
784 vm_abort("codegen_start_native_call: unsupported architecture");
787 /* get data structures from stack */
789 sfi = (stackframeinfo_t *) (datasp - sizeof(stackframeinfo_t));
790 lrt = (localref_table *) (datasp - sizeof(stackframeinfo_t) -
791 sizeof(localref_table));
793 #if defined(ENABLE_JNI)
794 /* add current JNI local references table to this thread */
796 localref_table_add(lrt);
800 # if defined(__ALPHA__) || defined(__I386__) || defined(__M68K__) || defined(__POWERPC__) || defined(__POWERPC64__) || defined(__S390__) || defined(__X86_64__)
801 /* print the call-trace if necesarry */
802 /* BEFORE: filling the local reference table */
804 if (opt_TraceJavaCalls)
805 trace_java_call_enter(m, arg_regs, arg_stack);
809 #if defined(ENABLE_HANDLES)
810 /* place all references into the local reference table */
811 /* BEFORE: creating stackframeinfo */
813 localref_native_enter(m, arg_regs, arg_stack);
816 /* Add a stackframeinfo for this native method. We don't have RA
817 and XPC here. These are determined in
818 stacktrace_stackframeinfo_add. */
820 stacktrace_stackframeinfo_add(sfi, pv, sp, NULL, NULL);
822 /* Return a wrapped classinfo for static methods. */
824 if (m->flags & ACC_STATIC)
825 return (java_handle_t *) LLNI_classinfo_wrap(m->clazz);
831 /* codegen_finish_native_call **************************************************
833 Removes the stuff required for a native (JNI) function call.
834 Additionally it checks for an exceptions and in case, get the
835 exception object and clear the pointer.
837 *******************************************************************************/
839 java_object_t *codegen_finish_native_call(u1 *sp, u1 *pv)
841 stackframeinfo_t *sfi;
851 /* get information from method header */
853 code = code_get_codeinfo_for_pv(pv);
855 framesize = *((int32_t *) (pv + FrameSize));
859 /* get the methodinfo */
864 /* calculate needed values */
866 #if defined(__ALPHA__) || defined(__ARM__)
867 datasp = sp + framesize - SIZEOF_VOID_P;
868 ret_regs = (uint64_t *) sp;
869 #elif defined(__MIPS__)
870 /* MIPS always uses 8 bytes to store the RA */
871 datasp = sp + framesize - 8;
872 #elif defined(__S390__)
873 datasp = sp + framesize - 8;
874 ret_regs = (uint64_t *) (sp + 96);
875 #elif defined(__I386__)
876 datasp = sp + framesize;
877 ret_regs = (uint64_t *) (sp + 2 * SIZEOF_VOID_P);
878 #elif defined(__M68K__)
879 datasp = sp + framesize;
880 ret_regs = (uint64_t *) (sp + 2 * 8);
881 #elif defined(__X86_64__)
882 datasp = sp + framesize;
883 ret_regs = (uint64_t *) sp;
884 #elif defined(__POWERPC__)
885 datasp = sp + framesize;
886 ret_regs = (uint64_t *) (sp + LA_SIZE + 2 * SIZEOF_VOID_P);
887 #elif defined(__POWERPC64__)
888 datasp = sp + framesize;
889 ret_regs = (uint64_t *) (sp + PA_SIZE + LA_SIZE + 2 * SIZEOF_VOID_P);
891 vm_abort("codegen_finish_native_call: unsupported architecture");
894 /* get data structures from stack */
896 sfi = (stackframeinfo_t *) (datasp - sizeof(stackframeinfo_t));
898 /* Remove current stackframeinfo from chain. */
900 stacktrace_stackframeinfo_remove(sfi);
902 #if defined(ENABLE_HANDLES)
903 /* unwrap the return value from the local reference table */
904 /* AFTER: removing the stackframeinfo */
905 /* BEFORE: releasing the local reference table */
907 localref_native_exit(m, ret_regs);
910 /* get and unwrap the exception */
911 /* AFTER: removing the stackframe info */
912 /* BEFORE: releasing the local reference table */
914 e = exceptions_get_and_clear_exception();
917 #if defined(ENABLE_JNI)
918 /* release JNI local references table for this thread */
920 localref_frame_pop_all();
921 localref_table_remove();
925 # if defined(__ALPHA__) || defined(__I386__) || defined(__M68K__) || defined(__POWERPC__) || defined(__POWERPC64__) || defined(__S390__) || defined(__X86_64__)
926 /* print the call-trace if necesarry */
927 /* AFTER: unwrapping the return value */
929 if (opt_TraceJavaCalls)
930 trace_java_call_exit(m, ret_regs);
938 /* codegen_reg_of_var **********************************************************
940 This function determines a register, to which the result of an
941 operation should go, when it is ultimatively intended to store the
942 result in pseudoregister v. If v is assigned to an actual
943 register, this register will be returned. Otherwise (when v is
944 spilled) this function returns tempregnum. If not already done,
945 regoff and flags are set in the stack location.
947 *******************************************************************************/
949 s4 codegen_reg_of_var(u2 opcode, varinfo *v, s4 tempregnum)
951 if (!(v->flags & INMEMORY))
958 /* codegen_reg_of_dst **********************************************************
960 This function determines a register, to which the result of an
961 operation should go, when it is ultimatively intended to store the
962 result in iptr->dst.var. If dst.var is assigned to an actual
963 register, this register will be returned. Otherwise (when it is
964 spilled) this function returns tempregnum. If not already done,
965 regoff and flags are set in the stack location.
967 *******************************************************************************/
969 s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum)
971 return codegen_reg_of_var(iptr->opc, VAROP(iptr->dst), tempregnum);
975 /* codegen_emit_phi_moves ****************************************************
977 Emits phi moves at the end of the basicblock.
979 *******************************************************************************/
981 #if defined(ENABLE_SSA)
982 void codegen_emit_phi_moves(jitdata *jd, basicblock *bptr)
995 /* Moves from phi functions with highest indices have to be */
996 /* inserted first, since this is the order as is used for */
997 /* conflict resolution */
999 for(i = ls->num_phi_moves[bptr->nr] - 1; i >= 0 ; i--) {
1000 lt_d = ls->phi_moves[bptr->nr][i][0];
1001 lt_s = ls->phi_moves[bptr->nr][i][1];
1002 #if defined(SSA_DEBUG_VERBOSE)
1004 printf("BB %3i Move %3i <- %3i ", bptr->nr, lt_d, lt_s);
1006 if (lt_s == UNUSED) {
1007 #if defined(SSA_DEBUG_VERBOSE)
1009 printf(" ... not processed \n");
1014 d = VAR(ls->lifetime[lt_d].v_index);
1015 s = VAR(ls->lifetime[lt_s].v_index);
1018 if (d->type == -1) {
1019 #if defined(SSA_DEBUG_VERBOSE)
1021 printf("...returning - phi lifetimes where joined\n");
1026 if (s->type == -1) {
1027 #if defined(SSA_DEBUG_VERBOSE)
1029 printf("...returning - phi lifetimes where joined\n");
1035 tmp_i.s1.varindex = ls->lifetime[lt_s].v_index;
1036 tmp_i.dst.varindex = ls->lifetime[lt_d].v_index;
1037 emit_copy(jd, &tmp_i);
1039 #if defined(SSA_DEBUG_VERBOSE)
1040 if (compileverbose) {
1041 if (IS_INMEMORY(d->flags) && IS_INMEMORY(s->flags)) {
1043 printf("M%3i <- M%3i",d->vv.regoff,s->vv.regoff);
1045 else if (IS_INMEMORY(s->flags)) {
1047 printf("R%3i <- M%3i",d->vv.regoff,s->vv.regoff);
1049 else if (IS_INMEMORY(d->flags)) {
1051 printf("M%3i <- R%3i",d->vv.regoff,s->vv.regoff);
1055 printf("R%3i <- R%3i",d->vv.regoff,s->vv.regoff);
1059 #endif /* defined(SSA_DEBUG_VERBOSE) */
1062 #endif /* defined(ENABLE_SSA) */
1065 /* REMOVEME When we have exception handling in C. */
1067 void *md_asm_codegen_get_pv_from_pc(void *ra)
1069 return md_codegen_get_pv_from_pc(ra);
1074 * These are local overrides for various environment variables in Emacs.
1075 * Please do not remove this and leave it at the end of the file, where
1076 * Emacs will automagically detect them.
1077 * ---------------------------------------------------------------------
1080 * indent-tabs-mode: t
1084 * vim:noexpandtab:sw=4:ts=4: