62 #ifdef LSRA_DEBUG_VERBOSE
92 #if defined(ENABLE_STATISTICS)
96 #if defined(LSRA_DEBUG_CHECK)
109 #if defined(LSRA_DEBUG_CHECK)
112 while (b_index < jd->basicblockcount ) {
116 in=m->basicblocks[b_index].instack;
117 ind=m->basicblocks[b_index].indepth;
118 for (;ind != 0;in=in->
prev, ind--) {
120 #if defined(LSRA_DEBUG_VERBOSE)
124 printf(
"LOCALVAR in instack\n");
128 out=m->basicblocks[b_index].outstack;
129 outd=m->basicblocks[b_index].outdepth;
130 for (;outd != 0;out=out->
prev, outd--) {
132 {
log_text(
"ARGVAR in outstack\n"); assert(0); }
134 {
log_text(
"LOCALVAR in outstack\n"); assert(0); }
142 #if defined(LSRA_DEBUG_CHECK) || defined(LSRA_DEBUG_VERBOSE)
143 #if defined(LSRA_DEBUG_VERBOSE)
152 if (strcmp(m->
name.
begin(),
"toLowerCase")==0)
153 #if defined(LSRA_DEBUG_VERBOSE)
155 printf(
"12-------------------12\n");
157 {
int dummy=1; dummy++; }
163 #if defined(ENABLE_STATISTICS)
168 for (locals_start = ls->
lifetimecount-1; (locals_start >=0) &&
177 count_locals_conflicts += 2;
194 #if defined(ENABLE_LOOPS)
198 log_text(
"lsra not possible with loop optimization\n");
208 #ifdef LSRA_DEBUG_VERBOSE
210 printf(
"Lifetimes after LifenessAnalyse: \n");
217 #ifdef LSRA_DEBUG_VERBOSE
227 int i, j, iarg, farg;
230 bool *fltarg_used, *intarg_used;
261 intarg_used[i]=
false;
265 fltarg_used[i]=
false;
273 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
275 int_reg->
sav_reg[--int_sav_top] =
279 int_reg->
sav_reg[--int_sav_top] =
286 int_reg->
sav_reg[--int_sav_top] =
292 #if !defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
297 flt_reg->
sav_reg[--flt_sav_top] =
326 int argintreguse, argfltreguse;
337 int_reg->
tmp_top = INT_TMP_CNT +
338 MAX(0, (INT_ARG_CNT - argintreguse));
344 MAX(0 , (FLT_ARG_CNT - argfltreguse));
369 for (i = INT_SAV_CNT-1; i >= 0; i--)
371 for (i = FLT_SAV_CNT-1; i >= 0; i--)
379 for (i=lo+1; i<=hi; i++) {
397 x = ls->
lifetime[a[(lo+hi)/2]].i_start;
426 for (param_count=0; (param_count < lifetime_count) &&
429 if (param_count > 0) {
431 for (i=0; i < param_count -1; i++)
432 for (j=i+1; j < param_count; j++)
437 lifetime[
i]=lifetime[j];
445 #ifdef LSRA_DEBUG_VERBOSE
468 #ifdef LSRA_DEBUG_VERBOSE
471 for (i=0; i<int_reg.
sav_top; i++)
474 for (i=0; i<int_reg.
tmp_top; i++)
477 for (i=0; i<flt_reg.
sav_top; i++)
480 for (i=0; i<flt_reg.
tmp_top; i++)
492 if (lsra_reg_use > INT_SAV_CNT) lsra_reg_use=
INT_SAV_CNT;
498 if (lsra_reg_use > FLT_SAV_CNT) lsra_reg_use=
FLT_SAV_CNT;
504 #if defined(__I386__)
512 lsra_mem_use = rd->
memuse;
520 #ifdef LSRA_DEBUG_VERBOSE
522 printf(
"Int RA complete \n");
523 printf(
"Lifetimes after splitting int: \n");
526 printf(
"Flt RA complete \n");
527 printf(
"Lifetimes after splitting flt:\n");
530 printf(
"Rest RA complete \n");
531 printf(
"Lifetimes after leftt:\n");
539 void lsra_alloc(jitdata *jd,
int *lifet,
int lifetimecount,
int *mem_use)
557 for (lt_index = 0; lt_index < lifetimecount; lt_index ++) {
558 lt = ls->
lifetime + lifet[lt_index];
611 void _lsra_main( jitdata *jd,
int *lifet,
int lifetimecount,
625 #if !defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
631 for (lt_index = 0; lt_index < lifetimecount; lt_index++)
639 for (lt_index = 0; lt_index < lifetimecount; lt_index++) {
640 lt = &(ls->
lifetime[lifet[lt_index]]);
642 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
654 if (reg->
sav_top > regsneeded) {
655 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
665 if (reg->
tmp_top > regsneeded) {
667 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
676 if (reg->
sav_top > regsneeded) {
678 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
706 for(i = 0; (i < *active_top) && (active[i]->i_end < lt->
i_end); i++);
708 for(j = *active_top; j >
i; j--) active[j] = active[j-1];
720 &(jd->ls->active_tmp_top));
722 &(jd->ls->active_sav_top));
727 struct lifetime **active,
int *active_top)
731 for(i = 0; i < *active_top; i++) {
732 if (active[i]->i_end > lt->
i_start)
break;
738 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
747 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
770 for(k = 0, j = i; (j < *active_top); k++,j++)
771 active[k] = active[j];
803 if (*active_top == 0) {
815 for (; (i >= 0) && (active[i]->i_end >= lt->
i_end); i--) {
825 if ((active[i]->i_end >= lt->
i_end) &&
829 if (active[i]->i_end > lt->
i_end) {
832 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
842 for (j = i; j < *active_top; j++)
843 active[j] = active[j + 1];
857 int *icount_block, icount;
867 icount_block[0] = icount = 0 ;
869 if (ls->
sorted[i-1] != -1)
873 icount_block[
i] = icount;
876 #ifdef LSRA_DEBUG_VERBOSE
880 printf(
"(%3i-%3i) ",i, icount_block[i]);
886 for(lt_index = 0 ;lt_index < ls->
lifetimecount; lt_index++) {
889 ls->
lt_used[lifetimecount ++] = lt_index;
900 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
918 #if defined (__I386__)
931 #if defined(__I386__)
941 {
log_text(
"Unknown Type\n"); exit(1); }
958 printf(
"--------- Warning: variable not defined!------------------vi: %i start: %i end: %i\n", lt->
v_index, lt->
i_start, lt->
i_end);
971 printf(
"--------- Warning: variable not used! ---------");
982 printf(
"------- Error: Lt %3i Vi %4i invalid!\n",lt_index, lt->
v_index);
987 #ifdef USAGE_PER_INSTR
995 #ifdef LSRA_DEBUG_VERBOSE
1006 for (lt_index = 0; lt_index < lifetimecount; lt_index++) {
1008 printf(
"i_Start: %3i(%3i,%3i) i_stop: %3i(%3i,%3i) reg: %3i VI: %3i type: %3i flags: %3i usage: %3li ltflags: %xi \n",n->
i_start, ls->
sorted[n->
bb_first_def], n->
i_first_def,n->
i_end, ls->
sorted[n->
bb_last_use], n->
i_last_use,n->
regoff,n->
v_index,n->
type,n->
flags, n->
usagecount, n->
flags);
1010 printf(
"%3i Lifetimes printed \n",lt_index);
1023 for (lt_index = 0; lt_index < ls->
lifetimecount; lt_index++) {
1025 if (n->
type != -1) {
1026 printf(
"i_Start: %3i(%3i,%3i) i_stop: %3i(%3i,%3i) VI: %3i type: %3i flags: %3i usage: %3li ltflags: %xi \n",n->
i_start, ls->
sorted[n->
bb_first_def], n->
i_first_def,n->
i_end, ls->
sorted[n->
bb_last_use], n->
i_last_use,n->
v_index,n->
type,n->
flags, n->
usagecount, n->
flags);
1029 printf(
"%3i Lifetimes printed \n",lt_index);
#define IS_INT_LNG_TYPE(a)
void lsra_calc_lifetime_length(jitdata *)
void lsra_setup(jitdata *)
int varcount_with_indices
void lsra_alloc(jitdata *, int *, int, int *)
void lsra_qsort(struct lsradata *ls, int *a, int lo, int hi)
const char * string_java_lang_InternalError
void _spill_at_intervall(struct lifetime *, struct lifetime **, int *)
struct lifetime * lifetime
void lsra_reg_setup(jitdata *, struct lsra_register *, struct lsra_register *)
void lsra_main(jitdata *)
static int code_is_leafmethod(codeinfo *code)
struct freemem * lsra_getnewmem(int *)
#define IS_2_WORD_TYPE(a)
void spill_at_intervall(jitdata *, struct lifetime *)
void lsra_add_active(struct lifetime *, struct lifetime **, int *)
struct lifetime ** active_sav
Instruction::InstID tmp[]
This file contains the statistics framework.
void lsra_param_sort(struct lsradata *ls, int *lifetime, int lifetime_count)
int lsra_getmem(struct lifetime *, struct freemem *, int *)
basicblock ** basicblocks
void lsra_dump_stack(stackelement_t *)
void _lsra_main(jitdata *, int *, int, struct lsra_register *, int *)
#define PACK_REGS(low, high)
void _lsra_expire_old_intervalls(jitdata *, struct lifetime *, struct lsra_register *, struct lifetime **, int *)
byte_iterator begin() const
void print_lifetimes(jitdata *, int *, int)
void lsra_expire_old_intervalls(jitdata *, struct lifetime *, struct lsra_register *)
static java_object_t * next
struct lifetime ** active_tmp
#define STAT_DECLARE_VAR(type, var, init)
Declare an external statistics variable.
void print_all_lifetimes(jitdata *)
void lsra_insertion(struct lsradata *ls, int *a, int lo, int hi)