- size_t i;
- if (f->builtin != 0) {
- oprintf("%sfunction %s = builtin %i\n", ind, f->name, -f->builtin);
- return;
- }
- oprintf("%sfunction %s\n", ind, f->name);
- strncat(ind, "\t", IND_BUFSZ);
- if (f->locals_count)
- {
- oprintf("%s%i locals:\n", ind, (int)f->locals_count);
- for (i = 0; i < f->locals_count; ++i) {
- oprintf("%s\t", ind);
- ir_value_dump(f->locals[i], oprintf);
- oprintf("\n");
- }
- }
- if (f->blocks_count)
- {
- oprintf("%slife passes (check): %i\n", ind, (int)f->run_id);
- for (i = 0; i < f->blocks_count; ++i) {
- if (f->blocks[i]->run_id != f->run_id) {
- oprintf("%slife pass check fail! %i != %i\n", ind, (int)f->blocks[i]->run_id, (int)f->run_id);
- }
- ir_block_dump(f->blocks[i], ind, oprintf);
- }
-
- }
- ind[strlen(ind)-1] = 0;
- oprintf("%sendfunction %s\n", ind, f->name);
+ size_t i;
+ if (f->builtin != 0) {
+ oprintf("%sfunction %s = builtin %i\n", ind, f->name, -f->builtin);
+ return;
+ }
+ oprintf("%sfunction %s\n", ind, f->name);
+ strncat(ind, "\t", IND_BUFSZ);
+ if (vec_size(f->locals))
+ {
+ oprintf("%s%i locals:\n", ind, (int)vec_size(f->locals));
+ for (i = 0; i < vec_size(f->locals); ++i) {
+ oprintf("%s\t", ind);
+ ir_value_dump(f->locals[i], oprintf);
+ oprintf("\n");
+ }
+ }
+ oprintf("%sliferanges:\n", ind);
+ for (i = 0; i < vec_size(f->locals); ++i) {
+ size_t l;
+ ir_value *v = f->locals[i];
+ oprintf("%s\t%s: unique ", ind, v->name);
+ for (l = 0; l < vec_size(v->life); ++l) {
+ oprintf("[%i,%i] ", v->life[l].start, v->life[l].end);
+ }
+ oprintf("\n");
+ }
+ for (i = 0; i < vec_size(f->values); ++i) {
+ size_t l;
+ ir_value *v = f->values[i];
+ oprintf("%s\t%s: @%i ", ind, v->name, (int)v->code.local);
+ for (l = 0; l < vec_size(v->life); ++l) {
+ oprintf("[%i,%i] ", v->life[l].start, v->life[l].end);
+ }
+ oprintf("\n");
+ }
+ if (vec_size(f->blocks))
+ {
+ oprintf("%slife passes (check): %i\n", ind, (int)f->run_id);
+ for (i = 0; i < vec_size(f->blocks); ++i) {
+ if (f->blocks[i]->run_id != f->run_id) {
+ oprintf("%slife pass check fail! %i != %i\n", ind, (int)f->blocks[i]->run_id, (int)f->run_id);
+ }
+ ir_block_dump(f->blocks[i], ind, oprintf);
+ }
+
+ }
+ ind[strlen(ind)-1] = 0;
+ oprintf("%sendfunction %s\n", ind, f->name);