示例#1
0
void cone_of_influencet::get_succs(
    goto_programt::instructionst::const_reverse_iterator rit,
    expr_sett &targets) {
  if (rit == program.instructions.rbegin()) {
    return;
  }

  goto_programt::instructionst::const_reverse_iterator next = rit;
  --next;

  if (rit->is_goto()) {
    if (!rit->guard.is_false()) {
      // Branch can be taken.
      for (goto_programt::targetst::const_iterator t = rit->targets.begin();
           t != rit->targets.end();
           ++t) {
        unsigned int loc = (*t)->location_number;
        expr_sett &s = cone_map[loc];
        targets.insert(s.begin(), s.end());
      }
    }

    if (rit->guard.is_true()) {
      return;
    }
  } else if (rit->is_assume() || rit->is_assert()) {
    if (rit->guard.is_false()) {
      return;
    }
  }
  
  unsigned int loc = next->location_number;
  expr_sett &s = cone_map[loc];
  targets.insert(s.begin(), s.end());
}
示例#2
0
void cone_of_influencet::cone_of_influence(
  const goto_programt::instructiont &i,
  const expr_sett &curr,
  expr_sett &next)
{
  next.insert(curr.begin(), curr.end());

  if(i.is_assign())
  {
    const code_assignt &assignment=to_code_assign(i.code);
    expr_sett lhs_syms;
    bool care=false;

    gather_rvalues(assignment.lhs(), lhs_syms);

    for(const auto &expr : lhs_syms)
      if(curr.find(expr)!=curr.end())
      {
        care=true;
        break;
      }

    next.erase(assignment.lhs());

    if(care)
    {
      gather_rvalues(assignment.rhs(), next);
    }
  }
}
示例#3
0
void cone_of_influencet::gather_rvalues(const exprt &expr, expr_sett &rvals) {
  if (expr.id() == ID_symbol ||
      expr.id() == ID_index ||
      expr.id() == ID_member ||
      expr.id() == ID_dereference) {
    rvals.insert(expr);
  } else {
    forall_operands(it, expr) {
      gather_rvalues(*it, rvals);
    }
  }
示例#4
0
void acceleration_utilst::gather_rvalues(const exprt &expr,
    expr_sett &rvalues) {
  if (expr.id() == ID_symbol ||
      expr.id() == ID_index ||
      expr.id() == ID_member ||
      expr.id() == ID_dereference) {
    rvalues.insert(expr);
  } else {
    forall_operands(it, expr) {
      gather_rvalues(*it, rvalues);
    }
  }