Esempio n. 1
0
File: fwprop.c Progetto: AHelper/gcc
void
single_def_use_dom_walker::before_dom_children (basic_block bb)
{
  int bb_index = bb->index;
  struct df_md_bb_info *md_bb_info = df_md_get_bb_info (bb_index);
  struct df_lr_bb_info *lr_bb_info = df_lr_get_bb_info (bb_index);
  rtx_insn *insn;

  bitmap_copy (local_md, &md_bb_info->in);
  bitmap_copy (local_lr, &lr_bb_info->in);

  /* Push a marker for the leave_block callback.  */
  reg_defs_stack.safe_push (NULL);

  process_uses (df_get_artificial_uses (bb_index), DF_REF_AT_TOP);
  process_defs (df_get_artificial_defs (bb_index), DF_REF_AT_TOP);

  /* We don't call df_simulate_initialize_forwards, as it may overestimate
     the live registers if there are unused artificial defs.  We prefer
     liveness to be underestimated.  */

  FOR_BB_INSNS (bb, insn)
    if (INSN_P (insn))
      {
        unsigned int uid = INSN_UID (insn);
        process_uses (DF_INSN_UID_USES (uid), 0);
        process_uses (DF_INSN_UID_EQ_USES (uid), 0);
        process_defs (DF_INSN_UID_DEFS (uid), 0);
	df_simulate_one_insn_forwards (bb, insn, local_lr);
      }

  process_uses (df_get_artificial_uses (bb_index), 0);
  process_defs (df_get_artificial_defs (bb_index), 0);
}
Esempio n. 2
0
void def_use::process_phi(container_node *c, bool defs, bool uses) {

	for (node_iterator I = c->begin(), E = c->end(); I != E; ++I) {
		node *n = *I;
		if (uses)
			process_uses(n);
		if (defs)
			process_defs(n, n->dst, false);
	}
}
Esempio n. 3
0
void def_use::process_defs(node *n, vvec &vv, bool arr_def) {

	for (vvec::iterator I = vv.begin(), E = vv.end(); I != E; ++I) {
		value *v = *I;
		if (!v)
			continue;

		if (arr_def)
			v->adef = n;
		else
			v->def = n;

		v->delete_uses();

		if (v->is_rel()) {
			process_defs(n, v->mdef, true);
		}
	}
}
Esempio n. 4
0
void def_use::run_on(node* n, bool defs) {

	bool is_region = (n->type == NT_REGION);
	bool is_op = (n->type == NT_OP || n->type == NT_IF);

	if (is_op) {

		if (0) {
			sblog << "def_use processing op ";
			dump::dump_op(n);
			sblog << "\n";
		}

		if (defs)
			process_defs(n, n->dst, false);
		else
			process_uses(n);
	} else if (is_region & defs) {
		region_node *r = static_cast<region_node*>(n);
		if (r->loop_phi)
			process_phi(r->loop_phi, true, false);
	}

	if (n->is_container() && n->subtype != NST_ALU_PACKED_INST) {
		container_node *c = static_cast<container_node*>(n);
		for (node_iterator I = c->begin(), E = c->end(); I != E; ++I) {
			run_on(*I, defs);
		}
	}

	if (is_region) {
		region_node *r = static_cast<region_node*>(n);
		if (r->phi)
			process_phi(r->phi, defs, !defs);
		if (r->loop_phi && !defs)
			process_phi(r->loop_phi, false, true);
	}
}