CACAO
ssa2.cpp
Go to the documentation of this file.
1 /* src/vm/optimizing/ssa2.cpp
2 
3  Copyright (C) 2008-2013
4  CACAOVM - Verein zu Foerderung der freien virtuellen Machine CACAO
5 
6  This file is part of CACAO.
7 
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.
12 
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.
17 
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
21  02110-1301, USA.
22 
23  Reimplementation of code in ssa.c.
24  Uses the new dominator tree and the new CFG.
25 */
26 
27 #include "config.h"
28 
29 #include "mm/dumpmemory.hpp"
30 
31 #include "toolbox/bitvector.hpp"
32 #include "toolbox/set.hpp"
33 #include "toolbox/worklist.hpp"
34 
35 #include "vm/global.hpp"
36 #include "vm/jit/jit.hpp"
37 #include "vm/jit/show.hpp"
38 
39 #if 1
40 #define printf(...) do { if (getenv("VERB")) printf(__VA_ARGS__); } while (0)
41 #define show_method(...) do { if (getenv("VERB")) show_method(__VA_ARGS__); } while (0)
42 #endif
43 
44 typedef struct phi_function {
46  s4 *args;
47 } phi_function;
48 
49 typedef struct basicblock_info {
52  unsigned phi_count;
55 
56 typedef struct var_info {
58  unsigned num_defs;
59 
60  unsigned offset;
61 
62  unsigned count;
63  unsigned *stack;
64  unsigned *stack_top;
65 
66 } var_info;
67 
68 typedef struct ssa_info {
71  unsigned vars_count;
73 } ssa_info;
74 
75 static inline basicblock_info *bb_info(basicblock *bb) {
76  return (basicblock_info *)(bb->vp);
77 }
78 
79 static ssa_info *ssa_init(jitdata *jd) {
80  unsigned i;
81  ssa_info *ssa;
82 
83  ssa = DNEW(ssa_info);
84  ssa->jd = jd;
85  ssa->vars_count = jd->localcount;
86 
87  ssa->vars = DMNEW(var_info, ssa->vars_count);
88  MZERO(ssa->vars, var_info, ssa->vars_count);
89  for (i = 0; i < ssa->vars_count; ++i) {
90  ssa->vars[i].work = set_new(jd->basicblockcount);
91  }
92 
93  return ssa;
94 }
95 
97 
98  basicblock *bptr, *Y, *n, **itdf;
99  basicblock_info *bbi;
100  instruction *iptr;
101  s4 a;
102  set *work;
103 
104  for (bptr = ssa->jd->basicblocks; bptr; bptr = bptr->next) {
105 
106  bbi = DNEW(basicblock_info);
107  bbi->defines = bv_new(ssa->vars_count);
108  bbi->phi = bv_new(ssa->vars_count);
109  bbi->phi_count = 0;
110 
111  bptr->vp = bbi;
112 
113  for (iptr = bptr->iinstr; iptr != bptr->iinstr + bptr->icount; ++iptr) {
114  if (instruction_has_dst(iptr)) {
115  if (
116  var_is_local(ssa->jd, iptr->dst.varindex)
117  ) {
118  /* A_orig */
119  bv_set_bit(bbi->defines, iptr->dst.varindex);
120  /* defsites */
121  set_insert(ssa->vars[iptr->dst.varindex].work, bptr);
122  /* Accout definition */
123  ssa->vars[iptr->dst.varindex].num_defs += 1;
124  }
125  }
126  }
127  }
128 
129  bptr = ssa->jd->basicblocks;
130  bbi = bb_info(bptr);
131  for (a = 0; a < ssa->vars_count; ++a) {
132  bv_set_bit(bbi->defines, a);
133  set_insert(ssa->vars[a].work, bptr);
134  ssa->vars[a].num_defs += 1;
135  }
136 
137  for (a = 0; a < ssa->vars_count; ++a) {
138  work = ssa->vars[a].work;
139  while (! set_empty(work)) {
140  n = (basicblock *)set_pop(work);
141  for (
142  itdf = n->domfrontier;
143  itdf != n->domfrontier + n->domfrontiercount;
144  ++itdf
145  ) {
146  Y = *itdf;
147  if (! bv_get_bit(bb_info(Y)->phi, a)) {
148  bv_set_bit(bb_info(Y)->phi, a);
149  printf(" *** BB %d: phi for var %d\n", Y->nr, a);
150  bb_info(Y)->phi_count += 1;
151  ssa->vars[a].num_defs += 1;
152  if (! bv_get_bit(bb_info(Y)->defines, a)) {
153  set_insert(work, Y);
154  }
155  }
156  }
157  }
158  }
159 }
160 
162  unsigned i, j;
163  basicblock_info *bbi;
164  basicblock *bptr;
165  phi_function *itph;
166 
167  for (bptr = ssa->jd->basicblocks; bptr; bptr = bptr->next) {
168 
169  bbi = bb_info(bptr);
171  itph = bbi->phi_functions;
172 
173  for (i = 0; i < ssa->vars_count; ++i) {
174  if (bv_get_bit(bbi->phi, i)) {
175  itph->dst = i;
176  itph->args = DMNEW(s4, bptr->predecessorcount);
177  for (j = 0; j < bptr->predecessorcount; ++j) {
178  itph->args[j] = i;
179  }
180  itph += 1;
181  }
182  }
183  }
184 }
185 
187  int i;
188  unsigned cur_offset = ssa->jd->localcount;
189 
190  ssa->total_local_count = 0;
191 
192  for (i = 0; i < ssa->vars_count; ++i) {
193 
194  ssa->vars[i].offset = cur_offset;
195 
196  ssa->total_local_count += ssa->vars[i].num_defs;
197 
198  if (ssa->vars[i].num_defs > 1) {
199  cur_offset += (ssa->vars[i].num_defs - 1);
200  }
201  }
202 }
203 
204 
205 static s4 ssa_rename_var(ssa_info *ssa, s4 var, unsigned index) {
206  s4 ret;
207 #define return ret=
208  if (var_is_local(ssa->jd, var)) {
209  assert(0 < index && index <= ssa->vars[var].num_defs);
210  if (index == 1) {
211  return var;
212  } else {
213  return ssa->vars[var].offset + (index - 2);
214  }
215  assert(ret < ssa->total_local_count);
216  } else {
217  return ssa->total_local_count + (var - ssa->vars_count);
218  }
219 #undef return
220  printf(" *** rename %c %d vers %d => %d\n", var_is_local(ssa->jd, var) ? 'L' : 'O', var, index, ret);
221  return ret;
222 }
223 
224 static void ssa_rename_uses(ssa_info *ssa, s4 *uses, unsigned uses_count) {
225  while (uses_count > 0) {
226  if (var_is_local(ssa->jd, *uses)) {
227  *uses = ssa_rename_var(ssa, *uses, *(ssa->vars[*uses].stack_top));
228  } else {
229  *uses = ssa_rename_var(ssa, *uses, 0);
230  }
231  uses_count -= 1;
232  uses += 1;
233  }
234 }
235 
236 static void ssa_rename_definition(ssa_info *ssa, s4 *pdef) {
237  s4 def = *pdef;
238  unsigned i = 0;
239 
240  if (var_is_local(ssa->jd, def)) {
241  ssa->vars[def].count += 1;
242  i = ssa->vars[def].count;
243  ssa->vars[def].stack_top += 1;
244  *(ssa->vars[def].stack_top) = i;
245  }
246 
247  *pdef = ssa_rename_var(ssa, def, i);
248 }
249 
250 static void ssa_rename_block(ssa_info *ssa, basicblock *bptr) {
251 
252  basicblock_info *bbi = bb_info(bptr);
253  s4 s[3];
254  s4 *uses;
255  unsigned uses_count;
256  instruction *iptr;
257  basicblock **itsucc, **itpred, **itdsucc, *Y;
258  phi_function *itph;
259  unsigned j;
260  s4 i, tmp;
261  s4 a;
262  u4 **orig_stack_top;
263 
264  /* XXX */
265  orig_stack_top = DMNEW(u4 *, ssa->vars_count);
266  for (a = 0; a < ssa->vars_count; ++a) orig_stack_top[a] = ssa->vars[a].stack_top;
267 
268  int jj;
269 
270 printf(" *** === %d ===========\n", bptr->nr);
271 
272  ssa_rename_uses(ssa, bptr->invars, bptr->indepth);
273 
274  /* Phi functions are the first instructions in the block */
275 printf(" *** --- phis ---------\n");
276  for (
277  itph = bbi->phi_functions;
278  itph != bbi->phi_functions + bbi->phi_count;
279  ++itph
280  ) {
281  ssa_rename_definition(ssa, &(itph->dst));
282  }
283 
284 printf(" *** --- vars ---------\n");
285 
286  if (bptr == ssa->jd->basicblocks) {
287  for (i = 0; i < ssa->jd->localcount; ++i) {
288  tmp = i;
289  ssa_rename_definition(ssa, &tmp);
290  }
291  }
292 
293  for (iptr = bptr->iinstr; iptr != bptr->iinstr + bptr->icount; ++iptr) {
294 
295  /* Determine uses */
296 
297  uses_count = 0;
298 
299  switch (icmd_table[iptr->opc].dataflow) {
300  case DF_3_TO_0:
301  case DF_3_TO_1:
302  s[2] = iptr->sx.s23.s3.varindex;
303  uses_count += 1;
304 
305  case DF_2_TO_0:
306  case DF_2_TO_1:
307  s[1] = iptr->sx.s23.s2.varindex;
308  uses_count += 1;
309 
310  case DF_1_TO_0:
311  case DF_1_TO_1:
312  case DF_COPY:
313  case DF_MOVE:
314  s[0] = iptr->s1.varindex;
315  uses_count += 1;
316 
317  uses = s;
318  break;
319 
320  case DF_N_TO_1:
321  case DF_INVOKE:
322  case DF_BUILTIN:
323 
324  uses = iptr->sx.s23.s2.args;
325  uses_count = iptr->s1.argcount;
326  break;
327 
328  }
329 
330  printf(" *** %s uses ", icmd_table[iptr->opc].name);
331  for (jj = 0; jj < uses_count; ++jj) printf("%d ",uses[jj]);
332  printf("\n");
333 
334  if (uses_count > 0) {
335  /* Update uses, if there are any */
336 
337  ssa_rename_uses(ssa, uses, uses_count);
338 
339  /* If uses were s, then we need to update the instruction */
340 
341  if (uses == s) {
342  switch (uses_count) {
343  case 3:
344  iptr->sx.s23.s3.varindex = s[2];
345  case 2:
346  iptr->sx.s23.s2.varindex = s[1];
347  case 1:
348  iptr->s1.varindex = s[0];
349  }
350  }
351  }
352 
353  /* Rename definitions */
354 
355  if (instruction_has_dst(iptr)) {
356  printf(" *** %s defines %d\n", icmd_table[iptr->opc].name, iptr->dst.varindex);
357  ssa_rename_definition(ssa, &(iptr->dst.varindex));
358  }
359 
360  }
361 
362  for (i = 0; i < bptr->outdepth; ++i) {
363  ssa_rename_definition(ssa, bptr->outvars + i);
364  }
365 
366  /* Successors */
367 
368  printf(" *** succs %d\n", bptr->successorcount);
369 
370  for (
371  itsucc = bptr->successors;
372  itsucc != bptr->successors + bptr->successorcount;
373  ++itsucc
374  ) {
375  Y = *itsucc;
376 
377  for (
378  itpred = Y->predecessors, j = 0;
379  itpred != Y->predecessors + Y->predecessorcount;
380  ++itpred, ++j
381  ) {
382  if (*itpred == bptr) break;
383  }
384 
385  assert(j != Y->predecessorcount);
386 
387  for (
388  itph = bb_info(Y)->phi_functions;
389  itph != bb_info(Y)->phi_functions + bb_info(Y)->phi_count;
390  ++itph
391  ) {
392  ssa_rename_uses(ssa, itph->args + j, 1);
393  }
394  }
395 
396  /* Recurse */
397 
398  for (
399  itdsucc = bptr->domsuccessors;
400  itdsucc != bptr->domsuccessors + bptr->domsuccessorcount;
401  ++itdsucc
402  ) {
403  ssa_rename_block(ssa, *itdsucc);
404  }
405 
406  /* For each definition of some variable a in the original S, pop stack */
407 
408  /* XXX */
409  for (a = 0; a < ssa->vars_count; ++a) ssa->vars[a].stack_top = orig_stack_top[a];
410 }
411 
412 static void ssa_rename(ssa_info *ssa) {
413  unsigned i;
414 
415  for (i = 0; i < ssa->vars_count; ++i) {
416  ssa->vars[i].stack = DMNEW(unsigned, ssa->vars[i].num_defs + 1);
417  ssa->vars[i].stack[0] = 0;
418  ssa->vars[i].stack_top = ssa->vars[i].stack;
419  }
420 
421  ssa_rename_block(ssa, ssa->jd->basicblocks);
422 }
423 
424 static void ssa_export(ssa_info *ssa) {
425  unsigned i, j;
426  jitdata *jd = ssa->jd;
427  methoddesc *md = jd->m->parseddesc;
428  varinfo *vars, *it;
429  s4 vartop, varindex;
430 
431  vartop = ssa->total_local_count + jd->vartop - jd->localcount;
432  vars = DMNEW(varinfo, vartop);
433 
434  printf(" *** vartop(%d) = ssa->total_local_count(%d) + jd->vartop(%d) - jd->localcount(%d)\n",
435  vartop , ssa->total_local_count , jd->vartop , jd->localcount);
436 
437  it = vars;
438 
439  /* Version 1 of each local */
440 
441  for (i = 0; i < jd->localcount; ++i) {
442  *(it++) = jd->var[i];
443  }
444 
445  /* Other versions of each local */
446 
447  for (i = 0; i < jd->localcount; ++i) {
448  for (j = 1; j < ssa->vars[i].num_defs; ++j) {
449  *(it++) = jd->var[i];
450  }
451  }
452 
453  /* Other vars */
454 
455  for (i = jd->localcount; i < jd->vartop; ++i) {
456  *(it++) = jd->var[i];
457  }
458 
459  jd->var = vars;
460  jd->vartop = jd->varcount = vartop;
461 
462  jd->local_map = DMREALLOC(jd->local_map, s4, 5 * jd->maxlocals, 5 * (jd->maxlocals + ssa->total_local_count - jd->localcount));
463 
464  for (i = 0; i < ssa->total_local_count - jd->localcount; ++i) {
465  for (j = 0; j < 5; ++j) {
466  varindex = jd->localcount + i;
467  if (jd->var[varindex].type != j) {
468  varindex = jitdata::UNUSED;
469  }
470  jd->local_map[((jd->maxlocals + i) * 5) + j] = varindex;
471  }
472  }
473 
474  jd->maxlocals += (ssa->total_local_count - jd->localcount);
475  jd->localcount = ssa->total_local_count;
476 
477  printf(" *** jd->localcount %d, jd->maxlocals %d\n", jd->localcount , jd->maxlocals);
478 }
479 
481  basicblock **itpred;
482  unsigned j = 0;
483 
484  for (itpred = to->predecessors; itpred != to->predecessors + to->predecessorcount; ++itpred) {
485  if (*itpred == from) break;
486  j++;
487  }
488 
489  if (j == to->predecessorcount) {
490  printf(" *** %d => %d\n", from->nr, to->nr);
491  assert(j != to->predecessorcount);
492  }
493 
494  return j;
495 }
496 
498  basicblock *mid;
499  basicblock_info *toi;
500  instruction *iptr;
501  phi_function *itph;
502  unsigned j = get_predecessor_index(from, to);
503 
504  mid = DNEW(basicblock);
505  MZERO(mid, basicblock, 1);
506 
507  toi = bb_info(to);
508  assert(toi);
509 
510  mid->nr = ssa->jd->basicblockcount;
511  ssa->jd->basicblockcount += 1;
512  mid->mpc = -1;
513  mid->type = (basicblock::Type) 666;
514  mid->icount = toi->phi_count + 1;
515  iptr = mid->iinstr = DMNEW(instruction, mid->icount);
516  MZERO(mid->iinstr, instruction, mid->icount);
517 
518  for (itph = toi->phi_functions; itph != toi->phi_functions + toi->phi_count; ++itph) {
519  iptr->opc = ICMD_COPY;
520  iptr->dst.varindex = itph->dst;
521  iptr->s1.varindex = itph->args[j];
522  assert(itph->dst < ssa->total_local_count);
523  assert(itph->args[j] < ssa->total_local_count);
524  iptr++;
525  }
526 
527  iptr->opc = ICMD_GOTO;
528  iptr->dst.block = to;
529 
530  while (from->next) {
531  from = from->next;
532  }
533 
534  from->next = mid;
535 
536  return mid;
537 }
538 
539 static void crate_fallthrough(ssa_info *ssa, basicblock *bptr) {
540  unsigned j;
541  basicblock_info *toi;
542  instruction *iptr;
543  phi_function *itph;
544 
545  if (bptr->next == NULL) return;
546 
547  j = get_predecessor_index(bptr, bptr->next);
548 
549  toi = bb_info(bptr->next);
550  assert(toi);
551 
552  bptr->iinstr = DMREALLOC(bptr->iinstr, instruction, bptr->icount, bptr->icount + toi->phi_count);
553  iptr = bptr->iinstr + bptr->icount;
554  bptr->icount += toi->phi_count;
555 
556  for (itph = toi->phi_functions; itph != toi->phi_functions + toi->phi_count; ++itph) {
557  iptr->opc = ICMD_COPY;
558  iptr->dst.varindex = itph->dst;
559  iptr->s1.varindex = itph->args[j];
560  assert(itph->dst < ssa->total_local_count);
561  assert(itph->args[j] < ssa->total_local_count);
562  iptr++;
563  }
564 
565 }
566 
568  basicblock *bptr;
569  instruction *iptr;
570 
571  s4 i, l;
572  branch_target_t *table;
573  lookup_target_t *lookup;
574  bool gt;
575 
576  for (bptr = ssa->jd->basicblocks; bptr; bptr = bptr->next) {
577  if (bptr->type == basicblock::Type(666)) {
578  bptr->type = basicblock::TYPE_STD;
579  continue;
580  }
581  if (! bptr->vp) continue;
582  if (! (bptr->state >= basicblock::REACHED)) continue;
583  gt = false;
584  for (iptr = bptr->iinstr; iptr != bptr->iinstr + bptr->icount; ++iptr) {
585  switch (icmd_table[iptr->opc].controlflow) {
586  case CF_IF:
587  case CF_RET:
588  case CF_GOTO:
589  iptr->dst.block = create_block(ssa, bptr, iptr->dst.block);
590  break;
591  case CF_TABLE:
592  table = iptr->dst.table;
593  l = iptr->sx.s23.s2.tablelow;
594  i = iptr->sx.s23.s3.tablehigh;
595  i = i - l + 1;
596  i += 1; /* default */
597  while (--i >= 0) {
598  table->block = create_block(ssa, bptr, table->block);
599  ++table;
600  }
601  break;
602  case CF_LOOKUP:
603  lookup = iptr->dst.lookup;
604  i = iptr->sx.s23.s2.lookupcount;
605  while (--i >= 0) {
606  lookup->target.block = create_block(ssa, bptr, lookup->target.block);
607  lookup++;
608  }
609  iptr->sx.s23.s3.lookupdefault.block = create_block(ssa, bptr, iptr->sx.s23.s3.lookupdefault.block);
610  break;
611  case CF_JSR:
612  iptr->sx.s23.s3.jsrtarget.block = create_block(ssa, bptr, iptr->sx.s23.s3.jsrtarget.block);
613  break;
614  }
615  if ((iptr->opc == ICMD_GOTO) || icmd_table[iptr->opc].controlflow == CF_END)
616  gt = true;
617  else if (iptr->opc != ICMD_NOP)
618  gt = false;
619  }
620  if (! bptr->next) continue;
621  if (! (bptr->next->state >= basicblock::REACHED)) continue;
622  if (bptr->next->type == basicblock::Type(666)) continue;
623  if (!gt) crate_fallthrough(ssa, bptr);
624  }
625 }
626 
627 void xssa(jitdata *jd) {
628  ssa_info *ssa = ssa_init(jd);
629 
630  printf("=============== [ before %s ] =========================\n", jd->m->name.begin());
631  show_method(jd, 3);
632  printf("=============== [ /before ] =========================\n");
633 
637  ssa_rename(ssa);
638  ssa_export(ssa);
640 
641  printf("=============== [ after ] =========================\n");
642  show_method(jd, 3);
643  printf("=============== [ /after ] =========================\n");
644 }
645 
646 /*
647  * These are local overrides for various environment variables in Emacs.
648  * Please do not remove this and leave it at the end of the file, where
649  * Emacs will automagically detect them.
650  * ---------------------------------------------------------------------
651  * Local variables:
652  * mode: c++
653  * indent-tabs-mode: t
654  * c-basic-offset: 4
655  * tab-width: 4
656  * End:
657  * vim:noexpandtab:sw=4:ts=4:
658  */
Utf8String name
Definition: method.hpp:71
void * set_pop(set *s)
Definition: set.cpp:167
std::size_t index
int * bitvector
Definition: bitvector.hpp:34
basicblock * block
set * set_new(unsigned capacity)
Definition: set.cpp:59
bitvector defines
Definition: ssa2.cpp:50
static void ssa_rename_block(ssa_info *ssa, basicblock *bptr)
Definition: ssa2.cpp:250
#define DF_1_TO_0
Definition: icmd.hpp:335
#define CF_GOTO
Definition: icmd.hpp:376
basicblock * basicblocks
Definition: jit.hpp:141
Definition: jit.hpp:126
static void ssa_rename_definition(ssa_info *ssa, s4 *pdef)
Definition: ssa2.cpp:236
#define DF_2_TO_0
Definition: icmd.hpp:336
#define DF_1_TO_1
Definition: icmd.hpp:342
static bool instruction_has_dst(const instruction *iptr)
s4 localcount
Definition: jit.hpp:152
#define CF_RET
Definition: icmd.hpp:380
argument_type from
struct phi_function phi_function
State state
Definition: jit.hpp:313
#define DMREALLOC(ptr, type, num1, num2)
Definition: dumpmemory.hpp:372
s4 maxlocals
Definition: jit.hpp:162
s4 * invars
Definition: jit.hpp:323
basicblock * next
Definition: jit.hpp:337
bool set_empty(const set *s)
Definition: set.cpp:137
static s4 ssa_rename_var(ssa_info *ssa, s4 var, unsigned index)
Definition: ssa2.cpp:205
void set_insert(set *s, void *element)
Definition: set.cpp:78
s4 outdepth
Definition: jit.hpp:326
int32_t argcount
Definition: instruction.hpp:64
varinfo * var
Definition: jit.hpp:148
unsigned * stack
Definition: ssa2.cpp:63
#define show_method(...)
Definition: ssa2.cpp:41
#define CF_JSR
Definition: icmd.hpp:379
s4 successorcount
Definition: jit.hpp:331
unsigned phi_count
Definition: ssa2.cpp:52
s4 mpc
Definition: jit.hpp:345
int32_t varindex
Definition: instruction.hpp:63
var_info * vars
Definition: ssa2.cpp:70
const char * name
Definition: icmd.hpp:393
s4 vartop
Definition: jit.hpp:149
#define CF_TABLE
Definition: icmd.hpp:377
#define CF_END
Definition: icmd.hpp:375
static basicblock_info * bb_info(basicblock *bb)
Definition: ssa2.cpp:75
#define DF_3_TO_0
Definition: icmd.hpp:337
bool bv_get_bit(bitvector bv, int bit)
Definition: bitvector.cpp:148
Type type
Definition: reg.hpp:44
jitdata * jd
Definition: ssa2.cpp:69
phi_function * phi_functions
Definition: ssa2.cpp:53
#define DF_3_TO_1
Definition: icmd.hpp:344
lookup_target_t * lookup
struct var_info var_info
instruction * iinstr
Definition: jit.hpp:319
unsigned * stack_top
Definition: ssa2.cpp:64
static void ssa_create_phi_functions(ssa_info *ssa)
Definition: ssa2.cpp:161
Definition: reg.hpp:43
s4 icount
Definition: jit.hpp:318
#define MZERO(ptr, type, num)
Definition: memory.hpp:105
static bool var_is_local(const jitdata *jd, s4 i)
Definition: jit.hpp:254
#define DNEW(type)
Definition: dumpmemory.hpp:370
s4 varcount
Definition: jit.hpp:151
unsigned vars_count
Definition: ssa2.cpp:71
static void ssa_rename(ssa_info *ssa)
Definition: ssa2.cpp:412
#define DF_N_TO_1
Definition: icmd.hpp:345
static void ssa_rename_uses(ssa_info *ssa, s4 *uses, unsigned uses_count)
Definition: ssa2.cpp:224
branch_target_t target
Definition: instruction.hpp:57
dst_operand_t dst
Instruction::InstID tmp[]
Definition: Matcher.cpp:55
basicblock ** predecessors
Definition: jit.hpp:332
int32_t dataflow
Definition: icmd.hpp:395
s4 predecessorcount
Definition: jit.hpp:330
void ssa_init(jitdata *jd)
Definition: ssa.cpp:275
Definition: set.cpp:44
#define CF_IF
Definition: icmd.hpp:371
#define DF_COPY
Definition: icmd.hpp:350
s4 indepth
Definition: jit.hpp:325
s4 * local_map
Definition: jit.hpp:153
MIIterator i
static void ssa_create_phi_moves(ssa_info *ssa)
Definition: ssa2.cpp:567
int32_t s4
Definition: types.hpp:45
static basicblock * create_block(ssa_info *ssa, basicblock *from, basicblock *to)
Definition: ssa2.cpp:497
#define DF_MOVE
Definition: icmd.hpp:351
s4 * outvars
Definition: jit.hpp:324
union instruction::@12 sx
struct ssa_info ssa_info
#define CF_LOOKUP
Definition: icmd.hpp:378
set * work
Definition: ssa2.cpp:57
int32_t varindex
static unsigned get_predecessor_index(basicblock *from, basicblock *to)
Definition: ssa2.cpp:480
icmdtable_entry_t icmd_table[256]
Definition: icmd.cpp:60
s1_operand_t s1
uint32_t u4
Definition: types.hpp:46
basicblock * block
Definition: instruction.hpp:50
int32_t controlflow
Definition: icmd.hpp:396
byte_iterator begin() const
Definition: utf8.hpp:106
methoddesc * parseddesc
Definition: method.hpp:78
bitvector phi
Definition: ssa2.cpp:51
unsigned offset
Definition: ssa2.cpp:60
s4 * args
Definition: ssa2.cpp:46
methodinfo * m
Definition: jit.hpp:127
static void ssa_calculate_offsets(ssa_info *ssa)
Definition: ssa2.cpp:186
#define DF_INVOKE
Definition: icmd.hpp:347
s4 nr
Definition: jit.hpp:312
s4 basicblockcount
Definition: jit.hpp:144
#define DMNEW(type, num)
Definition: dumpmemory.hpp:371
unsigned count
Definition: ssa2.cpp:62
struct instruction::@12::@13 s23
basicblock ** successors
Definition: jit.hpp:333
void ssa(jitdata *jd)
Definition: ssa.cpp:105
static void crate_fallthrough(ssa_info *ssa, basicblock *bptr)
Definition: ssa2.cpp:539
static void ssa_export(ssa_info *ssa)
Definition: ssa2.cpp:424
bitvector bv_new(int size)
Definition: bitvector.cpp:122
void bv_set_bit(bitvector bv, int bit)
Definition: bitvector.cpp:166
#define DF_BUILTIN
Definition: icmd.hpp:348
Type type
Definition: jit.hpp:315
#define printf(...)
Definition: ssa2.cpp:40
struct basicblock_info basicblock_info
Definition: dominators.cpp:280
#define DF_2_TO_1
Definition: icmd.hpp:343
branch_target_t * table
unsigned num_defs
Definition: ssa2.cpp:58
void xssa(jitdata *jd)
Definition: ssa2.cpp:627
unsigned total_local_count
Definition: ssa2.cpp:72
static void ssa_place_phi_functions(ssa_info *ssa)
Definition: ssa2.cpp:96