1 /* src/vm/jit/lsra.inc - lifetime anaylsis
3 Copyright (C) 2005, 2006 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 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., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Ullrich
35 #include "mm/memory.h"
37 #include "toolbox/bitvector.h"
38 #include "toolbox/worklist.h"
40 #include "vm/builtin.h"
41 #include "vm/resolve.h"
42 #include "vm/exceptions.h"
43 #include "vm/stringlocal.h"
45 #include "vm/jit/jit.h"
47 #include "vm/jit/optimizing/graph.h"
48 #include "vm/jit/optimizing/lsra.h"
49 #include "vm/jit/optimizing/ssa.h"
50 #include "vm/jit/optimizing/lifetimes.h"
52 #ifdef LT_DEBUG_VERBOSE
53 #include "vmcore/options.h"
59 /* function prototypes */
60 void _lt_scanlifetimes(jitdata *jd, graphdata *gd, basicblock *bptr, int);
61 void lt_usage(jitdata *, s4 , int , int , int );
64 void lt_lifeoutatblock(lsradata *ls, graphdata *gd, int *M, int b_index,
65 struct lifetime *lt, worklist *W);
66 void lt_lifeatstatement(lsradata *ls, graphdata *gd, int b_index,
67 int iindex, struct lifetime *lt, bool life_in,
70 void lt_lifeinatstatement(lsradata *ls, graphdata *gd, int *M, int b_index,
71 int iindex, struct lifetime *lt);
72 void lt_lifeoutatstatement(lsradata *ls, graphdata *gd, int *M, int b_index,
73 int iindex, struct lifetime *lt);
76 void lt_get_nesting(lsradata *ls, graphdata *gd, dominatordata *dd);
79 void lt_set_use_site(struct lifetime *lt, struct site *use_site) {
82 struct site *lt_get_first_use_site(struct lifetime *lt, lt_iterator *iter) {
83 return ((*iter) = lt->use);
86 struct site *lt_get_next_site(lt_iterator *iter) {
90 return ((*iter) = (*iter)->next);
93 struct site *lt_get_first_def_site(struct lifetime *lt, lt_iterator *iter) {
94 return ((*iter) = lt->def);
97 bool lt_v_is_defined_at_s(lsradata *ls, int b_index, int iindex,
98 struct lifetime * lt) {
99 struct site *def_site;
100 bool is_defined_at_s;
103 is_defined_at_s = ((def_site->b_index == b_index)
104 && (def_site->iindex == iindex));
105 return is_defined_at_s;
108 /****************************************************************************
110 ****************************************************************************/
111 void lt_scanlifetimes(jitdata *jd, graphdata *gd, dominatordata *dd) {
125 lt_get_nesting(ls, gd, dd);
128 #if defined(LT_DEBUG_VERBOSE)
129 if (compileverbose) {
131 for (i=0; i < ls->basicblockcount; i++) {
134 l = ls->basicblocks[l]->nr;
135 printf("%3i(%3i) ", ls->sorted[i], l);
138 printf("Sorted_rev: ");
139 for (i=0; i < ls->basicblockcount; i++)
140 printf("%3i ", ls->sorted_rev[i]);
145 for(i = ls->basicblockcount - 1; i>= 0; i--)
146 if (ls->sorted[i] != -1)
147 _lt_scanlifetimes(jd, gd, ls->basicblocks[ls->sorted[i]],
150 /* Parameter initialisiation for locals [0 .. paramcount[ */
151 /* -> add local var write access at (bb=0,iindex=0) */
153 for (p = 0, l = 0; p < md->paramcount; p++) {
154 t = md->paramtypes[p].type;
155 i = jd->local_map[l * 5 + t];
157 if (IS_2_WORD_TYPE(t)) /* increment local counter for 2 word types */
162 /* _LT_ASSERT( i < jd->cd->maxlocals); */
163 #ifdef LT_DEBUG_VERBOSE
165 printf("param %3i -> L %3i/%3i",p,i,t);
167 _LT_ASSERT(t == VAR(i)->type);
169 /* Param to Local init happens before normal Code */
171 #ifdef LT_DEBUG_VERBOSE
175 lt_usage(jd, i, 0, 0, LT_DEF);
180 bool lt_is_simple_lt(struct lifetime *lt) {
181 lt_iterator i_def, i_use;
182 struct site *def, *use;
183 bool all_in_same_block;
186 def = lt_get_first_def_site(lt, &i_def);
187 use = lt_get_first_use_site(lt, &i_use);
188 all_in_same_block = true;
189 for (; (all_in_same_block && (use != NULL));
190 use = lt_get_next_site(&i_use)) {
192 (use->iindex >= 0) && (use->b_index == def->b_index);
194 return all_in_same_block;
197 void lt_is_live(lsradata *ls, struct lifetime *lt, int b_index, int iindex) {
200 bb_sorted = ls->sorted_rev[b_index];
202 if ((lt->bb_last_use < bb_sorted) ||
203 ((lt->bb_last_use == bb_sorted) && (lt->i_last_use < iindex))) {
204 lt->bb_last_use = bb_sorted;
205 lt->i_last_use = iindex;
207 if ((lt->bb_first_def > bb_sorted) ||
208 ((lt->bb_first_def == bb_sorted) && (lt->i_first_def > iindex))) {
209 lt->bb_first_def = bb_sorted;
210 lt->i_first_def = iindex;
214 void lt_set_simple_use(lsradata *ls, struct lifetime *lt) {
218 /* SAVEDVAR is nowhere set!!!! */
220 /* Def is first use */
221 /* lt->bb_first_def = ls->sorted_rev[lt->def->b_index]; */
222 /* lt->i_first_def = lt->def->iindex; */
224 lt_is_live(ls, lt, lt->def->b_index, lt->def->iindex);
227 use = lt_get_first_use_site(lt, &i_use);
228 /* lt->bb_last_use = ls->sorted_rev[use->b_index]; */
229 /* lt->i_last_use = use->iindex; */
230 for (; (use != NULL); use = lt_get_next_site(&i_use))
231 lt_is_live(ls, lt, use->b_index, use->iindex);
232 /* if (use->iindex > lt->i_last_use) */
233 /* lt->i_last_use = use->iindex; */
236 void lt_lifeness_analysis(jitdata *jd, graphdata *gd) {
237 int *M; /* bit_vecor of visited blocks */
238 int *use; /* bit_vecor of blocks with use sites visited */
239 worklist *W; /* Worklist of Basic Blocks, where lt is life-out */
241 struct site *use_site, *u_site;
242 lt_iterator iter, iter1;
243 graphiterator pred_iter;
245 int lt_index, i, pred, iindex, iindex1, b_index;
248 /* #define MEASURE_RT */
250 struct timespec time_start,time_end;
261 if (clock_gettime(CLOCK_THREAD_CPUTIME_ID,&(time_start)) != 0) {
262 fprintf(stderr,"could not get time: %s\n",strerror(errno));
267 M = bv_new(ls->basicblockcount);
268 use = bv_new(ls->basicblockcount);
269 W = wl_new(ls->basicblockcount);
271 #ifdef LT_DEBUG_VERBOSE
273 printf("LT_ANALYSE: \n");
275 for(lt_index = 0; lt_index < ls->lifetimecount; lt_index++) {
276 lt = &(ls->lifetime[lt_index]);
279 #ifdef LT_DEBUG_VERBOSE
281 printf("LT: %3i:", lt_index);
286 _LT_ASSERT(lt->def != NULL);
287 _LT_ASSERT(lt->def->next == NULL); /* SSA! */
288 /* _LT_ASSERT(lt->use != NULL); */
290 lt->bb_last_use = -1;
291 lt->bb_first_def = ls->basicblockcount;
293 bv_reset(M, ls->basicblockcount);
294 bv_reset(use, ls->basicblockcount);
295 wl_reset(W, ls->basicblockcount);
297 use_site = lt_get_first_use_site(lt, &iter);
299 /* Make unused Vars life at their Def Site */
301 if (use_site == NULL) {
302 lt_is_live(ls, lt, lt->def->b_index, lt->def->iindex);
303 if (lt->def->iindex < 0) {
305 /* def only in phi function */
307 lt_is_live(ls, lt, lt->def->b_index, 0);
310 for (;use_site != NULL; use_site = lt_get_next_site(&iter)) {
311 iindex = use_site->iindex;
312 if ((lt->def->b_index == use_site->b_index) &&
314 (iindex <= lt->def->iindex)) {
316 /* bv_set_bit(use, use_site->b_index); */
317 /* do normal analysis */
318 /* there is a use in a phi function before def site */
321 else if (bv_get_bit(use, use_site->b_index)) {
325 bv_set_bit(use, use_site->b_index);
327 /* use sites of this basic block not visited till now */
328 /* get use site of this bb with highest iindex lower than */
333 for(iter1= iter; u_site != NULL;
334 u_site = lt_get_next_site(&iter1)) {
335 if ((u_site->b_index == use_site->b_index) &&
336 (lt->def->b_index == use_site->b_index) &&
337 (u_site->iindex >= 0) &&
338 (u_site->iindex < lt->def->iindex) &&
339 (u_site->iindex > iindex1)) {
340 iindex1 = u_site->iindex;
342 if ((u_site->b_index == use_site->b_index) &&
343 (u_site->iindex > iindex))
344 iindex = u_site->iindex;
351 #ifdef LT_DEBUG_VERBOSE
353 printf("(%3i,%3i)", use_site->b_index, iindex);
358 /* use in phi function */
359 /* ls->phi[use_site->b_index][-use_site->iindex-1]*/
361 lt_is_live(ls, lt, use_site->b_index, iindex);
363 phi = ls->phi[use_site->b_index][-iindex-1];
364 _LT_ASSERT(phi != NULL);
366 pred = graph_get_first_predecessor(gd, use_site->b_index,
368 for(i = 1; (pred != -1); i++,pred =
369 graph_get_next(&pred_iter))
370 if (lt->v_index == phi[i]) {
372 /* Add "Life out Basic Blocks to Worklist */
377 else /* lt is live-in at this statement */
378 lt_lifeatstatement(ls, gd, use_site->b_index,
379 iindex, lt, true, W);
380 } /* for (;use_site != NULL; use_site = lt_get_next_site(&iter)) */
382 /* process Worklist */
384 while (!wl_is_empty(W)) {
386 lt_lifeoutatblock(ls, gd, M, b_index, lt, W);
390 #ifdef LT_DEBUG_VERBOSE
395 } /* for(lt_index = 0; lt_index < ls->lifetimecount; lt_index++) */
398 if (clock_gettime(CLOCK_THREAD_CPUTIME_ID,&(time_end)) != 0) {
399 fprintf(stderr,"could not get time: %s\n",strerror(errno));
407 diff = (time_end.tv_nsec - time_start.tv_nsec) / 1000;
408 atime = time_start.tv_sec;
409 while (atime < time_end.tv_sec) {
413 printf("%8li %s.%s.%s\n",diff, m->class->name->text, m->name->text,
414 m->descriptor->text);
419 /*******************************************************************************
423 IN: lsradata *ls pointer to worklist created with wl_new
425 int b_index Basic block index of instruction
426 int iindex index of instruction in Basic Block
427 struct lifetime *lt Pointer to lifetime structure
428 bool life_in TRUE lifetime lt is life 'into' that instruction
429 FALSE lifetime lt is life 'out' of that instruction
431 IN/OUT: worklist *W Worklist of Basic Blocks, where lt is life-out
432 *******************************************************************************/
433 void lt_lifeatstatement(lsradata *ls, graphdata *gd, int b_index,
434 int iindex, struct lifetime *lt, bool life_in,
437 int prev_iindex; /* Statement before iindex */
439 graphiterator pred_iter;
444 #ifdef LT_DEBUG_VERBOSE
445 if ((compileverbose) && (iindex >= 0))
446 printf("LO@ST: vi %3i bi %3i ii %3i\n",
447 lt->v_index, b_index, iindex);
450 /* lt->v_index is life-out at statement at (b_index,iindex) */
452 /* Once a interference graph is needed, add here an edge (v,w) */
453 /* to the ig, for each variable w defined at this instruction */
454 /* except v=lt->v_index */
456 if (!lt_v_is_defined_at_s(ls, b_index, iindex, lt)) {
458 /* v is life in at out of statement -> check if the SAVEDVAR */
459 /* flag is needed to be set */
461 if ((iindex >= 0) && (b_index != 0)) {
463 /* real ICMD, no phi-function, no param initialisation */
465 _LT_ASSERT(ls->basicblocks[b_index]->iinstr != NULL);
466 iptr = ls->basicblocks[b_index]->iinstr + iindex;
467 if (icmd_table[iptr->opc].flags & ICMDTABLE_CALLS)
468 lt->savedvar = SAVEDVAR;
471 /* lt stays life-in at statement */
476 /* print LO verbose message only for phi functions, which */
477 /* define this var */
479 #ifdef LT_DEBUG_VERBOSE
480 if ((compileverbose) && (iindex < 0))
481 printf("LO@ST: vi %3i bi %3i ii %3i\n",
482 lt->v_index, b_index, iindex);
483 if ((compileverbose))
484 printf("--> definition\n");
487 lt_is_live(ls, lt, b_index, iindex);
489 /* Stop - lt is defined and not life before this instruction */
497 /* lt->v_index is live-in at statement (b_index,iindex) */
499 #ifdef LT_DEBUG_VERBOSE
500 if ((compileverbose) && (iindex >= 0))
501 printf("LI@ST: vi %3i bi %3i ii %3i\n",
502 lt->v_index, b_index, iindex);
505 lt_is_live(ls, lt, b_index, iindex);
508 if (iindex == -ls->varcount-1) {
510 #ifdef LT_DEBUG_VERBOSE
511 if ((compileverbose))
512 printf("LI@ST: vi %3i bi %3i ii %3i\n",
513 lt->v_index, b_index, iindex);
515 /* iindex is the first statement of b_index */
516 /* Statements -ls->max_vars-1 .. -1 are possible phi functions*/
517 /* lt->v_index is live-in at b_index */
519 pred = graph_get_first_predecessor(gd, b_index, &pred_iter);
521 /* Add "Life out Basic Blocks to Worklist */
523 for(; pred != -1; pred = graph_get_next(&pred_iter))
526 /* Stop here - beginning of Basic Block reached */
531 prev_iindex = iindex - 1;
534 /* look through phi functions */
536 for(; prev_iindex > -ls->varcount-1; prev_iindex--)
537 if (ls->phi[b_index][-prev_iindex-1] != NULL)
540 /* lt is live out at instruction prev_iindex */
542 iindex = prev_iindex;
550 void lt_lifeoutatblock(lsradata *ls, graphdata *gd, int *M, int b_index,
551 struct lifetime *lt, worklist *W) {
553 #if defined(LT_DEBUG_VERBOSE)
554 if (compileverbose) {
555 printf("V %3i LO at BB %3i\n",lt->v_index, b_index);
559 /* lt->v_index is life out of Block b_index */
560 if (!bv_get_bit(M, b_index)) { /* BB b_index not visited till now */
561 bv_set_bit(M, b_index);
563 /* lt->v_index is life out of last Statement of b_index */
567 i = ls->basicblocks[b_index]->icount - 1;
568 for (;((i>0) && (ls->basicblocks[b_index]->iinstr+i == ICMD_NOP));
570 lt_lifeatstatement(ls, gd, b_index, i, lt, false, W);
573 lt_lifeatstatement(ls, gd, b_index, 0, lt, false, W);
577 void lt_move_use_sites(struct lifetime *from, struct lifetime *to) {
580 _LT_ASSERT(from->use != NULL);
581 if (from->use == NULL)
583 for(s = from->use; s->next != NULL; s = s->next);
590 void lt_add_use_site(struct lifetime *lt, int block, int iindex) {
593 n = DNEW(struct site);
599 /* CFG is analysed from the end to the start -> so first found use site */
600 /* is the last use of the Local Var */
602 if (lt->last_use == NULL)
606 void lt_remove_use_site(struct lifetime *lt, int block, int iindex) {
609 /* check lt->use itself */
611 if ((lt->use->b_index == block) && (lt->use->iindex == iindex)) {
613 lt->use = lt->use->next;
616 /* look through list */
618 for (n = lt->use; (n->next != NULL) && ((n->next->b_index != block) ||
619 (n->next->iindex != iindex)); n = n->next);
621 /* assert, that lt was found */
623 _LT_ASSERT(n->next != NULL);
624 _LT_ASSERT(n->next->b_index == block);
625 _LT_ASSERT(n->next->iindex == iindex);
627 n->next = n->next->next;
631 void lt_add_def_site(struct lifetime *lt, int block, int iindex) {
634 /* SSA <-> only one definition per lifetime! */
636 _LT_ASSERT(lt->def == NULL);
637 n = DNEW(struct site);
644 void lt_usage(jitdata *jd,s4 v_index, int block, int instr,
652 n = ls->lifetime + v_index;
654 if (n->type == -1) { /* new local lifetime */
657 n->type=VAR(v_index)->type;
658 /* TODO: check!!!! */
659 /* All var are SAVEDVARS or this gets reset afterwards???? */
660 n->savedvar = SAVEDVAR;
665 n->bb_first_def = -1;
671 _LT_ASSERT(VAR(v_index)->type == n->type);
673 /* add access at (block, instr) to instruction list */
674 /* remember last USE, so only write, if USE Field is undefined (==-1) */
675 /* count store as use, too -> defined and not used vars would overwrite */
678 if (store == LT_USE) {
680 n->usagecount += ls->nesting[block];
682 lt_add_use_site(n, block, instr);
684 if (store == LT_DEF) {
685 lt_add_def_site(n, block, instr);
689 /***************************************************************************
690 use sites: dead code elemination, LifenessAnalysis
691 def sites: dead code elemination
692 ***************************************************************************/
693 void _lt_scanlifetimes(jitdata *jd, graphdata *gd, basicblock *bptr,
696 /* methodinfo *lm; */
697 builtintable_entry *bte;
700 int iindex/*, b_index*/;
708 #ifdef LT_DEBUG_VERBOSE
710 printf("_lt_scanlifetimes: BB %3i flags %3i\n", b_index, bptr->flags);
713 if (bptr->flags >= BBREACHED) {
715 /* b_index = bptr->nr; */
717 /* get instruction count for BB */
719 iindex = bptr->icount - 1;
721 /* regard not setup new BB with maybe just in and outstack */
726 /* Regard phi_functions (Definition of target, Use of source) */
728 for(i = 0; i < ls->ssavarcount; i++) {
729 if (ls->phi[b_index][i] != NULL) {
730 /* Phi Function for var i at b_index exists */
731 v = ls->phi[b_index][i][0];
732 _LT_ASSERT( v != ls->varcount_with_indices);
735 /* Add definition of target add - phi index -1*/
736 #ifdef LT_DEBUG_VERBOSE
738 printf("_lt_scanlifetimes: phi_def: v: %3i\n i: %3i\n",
741 lt_usage(jd, v, b_index, -i-1, LT_DEF);
743 /* Add Use of sources */
745 for (j = 1; j <= graph_get_num_predecessor(gd, b_index); j++) {
746 if (ls->phi[b_index][i][j] != ls->varcount_with_indices)
747 if (ls->phi[b_index][i][j] != UNUSED)
748 lt_usage(jd, ls->phi[b_index][i][j], b_index,
755 if (bptr->iinstr != NULL) {
756 /* set iptr to last instruction of BB */
757 iptr = bptr->iinstr + iindex;
761 for (;iindex >= 0; iindex--, iptr--) {
765 if (icmd_table[iptr->opc].dataflow >= DF_DST_BASE)
766 v = iptr->dst.varindex;
768 /* check for use (s1, s2, s3 or special (argp) ) */
769 /* and definitions (dst) */
770 switch(icmd_table[iptr->opc].dataflow) {
772 case DF_3_TO_1: /* icmd has s1, s2 and s3 */
773 lt_usage(jd, iptr->sx.s23.s3.varindex, b_index, iindex, LT_USE);
775 /* now "fall through" for handling of s2 and s1 */
778 case DF_2_TO_1: /* icmd has s1 and s2 */
779 lt_usage(jd, iptr->sx.s23.s2.varindex, b_index, iindex, LT_USE);
781 /* now "fall through" for handling of s1 */
786 case DF_COPY: /* icmd has s1 */
787 lt_usage(jd, iptr->s1.varindex, b_index, iindex, LT_USE);
791 INSTRUCTION_GET_METHODDESC(iptr,md);
793 if (md->returntype.type == TYPE_VOID)
798 bte = iptr->sx.s23.s3.bte;
801 if (md->returntype.type == TYPE_VOID)
806 i = iptr->s1.argcount;
812 argp = iptr->sx.s23.s2.args;
814 lt_usage(jd, *argp, b_index, iindex, LT_USE);
820 lt_usage(jd, v, b_index, iindex, LT_DEF);
822 } /* for (;iindex >= 0; iindex--, iptr--) */
823 } /* if (bptr->flags >= BBREACHED) */
824 } /* scan_lifetimes */
828 /*******************************************************************************
829 true, if i dominates j
830 *******************************************************************************/
831 bool dominates(dominatordata *dd, int i, int j) {
832 bool dominates = false;
834 while(!dominates && (dd->idom[j] != -1)) {
835 dominates = (i == dd->idom[j]);
841 /*******************************************************************************
844 Look for loops in the CFG and set the nesting depth of all Basicblocks in
847 The Loop Header BB h is an element of DF[n] for all Basicblocks n of this loop
848 So Look through all x element of DF[n] for a backedge n->x. If this
849 exists, increment nesting for all n with x in DF[n]
850 *******************************************************************************/
851 void lt_get_nesting(lsradata *ls, graphdata *gd, dominatordata *dd) {
853 bitvector loop_header;
854 worklist *loop, *loop1;
864 /* init nesting to 1 and get loop_headers */
865 ls->nesting = DMNEW(long, ls->basicblockcount);
866 loop_header = bv_new(ls->basicblockcount);
867 loop = wl_new(ls->basicblockcount);
869 for(i = 0; i < ls->basicblockcount; i++) {
872 for(succ = graph_get_first_successor(gd, i, &iter); succ != -1;
873 succ = graph_get_next(&iter)) {
874 for (j = 0; j < dd->num_DF[i]; j++) {
875 if (succ == dd->DF[i][j]) {
876 /* There is an edge from i to DF[i][j] */
878 /* look if DF[i][j] dominates i -> backedge */
879 if (dominates(dd, dd->DF[i][j], i)) {
880 /* this edge is a backedge */
881 /* -> DF[i][j] is a loop header */
882 _LT_CHECK_BOUNDS(dd->DF[i][j], 0, ls->basicblockcount);
883 if (!bv_get_bit(loop_header, dd->DF[i][j])) {
884 /* new loop_header found */
886 bv_set_bit(loop_header, dd->DF[i][j]);
887 ls->nesting[dd->DF[i][j]] = 10;
889 wl_add(loop, dd->DF[i][j]);
896 loop_parent = DMNEW(int , ls->basicblockcount);
897 loop1 = wl_new(ls->basicblockcount);
899 /* look for direct parents of nested loopheaders */
900 /* (DF[loop_header[i]] has the element loop_header[j] with i != j */
901 /* TODO: BULLSHIT:unfortunately not such an easy condition ;( */
902 while(!wl_is_empty(loop)) {
906 loop_parent[lh] = -1;
908 for (j = 0; j < dd->num_DF[lh]; j++) {
909 _LT_CHECK_BOUNDS(dd->DF[lh][j], 0, ls->basicblockcount);
910 if (lh != dd->DF[lh][j]) {
911 if (bv_get_bit(loop_header, dd->DF[lh][j])) {
912 #ifdef LT_DEBUG_VERBOSE
914 if (loop_parent[lh] != -1)
915 printf("Warning: LoopHeader has more than one parent\n");
917 /* _LT_ASSERT( loop_parent[lh] == -1); */
918 loop_parent[lh] = dd->DF[lh][j];
924 /* create nesting for loopheaders */
925 while(!wl_is_empty(loop1)) {
927 for (lh_p = lh; lh_p != -1; lh_p = loop_parent[lh_p]) {
928 ls->nesting[lh] *= 10;
933 /* copy loopheader nesting to loop body */
934 for(i = 0; i < ls->basicblockcount; i++) {
935 if (!bv_get_bit(loop_header, i)) {
936 /* Do not touch the nesting of a loopheader itself */
937 for(j = 0; j < dd->num_DF[i]; j++) {
938 _LT_CHECK_BOUNDS(dd->DF[i][j], 0, ls->basicblockcount);
939 if (bv_get_bit(loop_header, dd->DF[i][j])) {
940 /* DF[i][j] is a loop header -> copy nesting for i */
941 #ifdef LT_DEBUG_VERBOSE
943 if (ls->nesting[i] != 1)
944 printf("Warning: More than one loopheader for one BB\n");
945 /* _LT_ASSERT(ls->nesting[i] == 1); */
947 ls->nesting[i] = ls->nesting[dd->DF[i][j]];
953 #ifdef LT_DEBUG_VERBOSE
954 if (compileverbose) {
955 printf("Num Loops: %3i\n",num_loops);
956 for(i = 0; i < ls->basicblockcount; i++)
957 printf("(BB%3i->N%3li) ",i, ls->nesting[i]);
966 * These are local overrides for various environment variables in Emacs.
967 * Please do not remove this and leave it at the end of the file, where
968 * Emacs will automagically detect them.
969 * ---------------------------------------------------------------------
972 * indent-tabs-mode: t