Beispiel #1
0
static bool
determine_max_movement (tree stmt, bool must_preserve_exec)
{
  basic_block bb = bb_for_stmt (stmt);
  struct loop *loop = bb->loop_father;
  struct loop *level;
  struct lim_aux_data *lim_data = LIM_DATA (stmt);
  tree val;
  ssa_op_iter iter;
  
  if (must_preserve_exec)
    level = ALWAYS_EXECUTED_IN (bb);
  else
    level = superloop_at_depth (loop, 1);
  lim_data->max_loop = level;

  FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_USE)
    if (!add_dependency (val, lim_data, loop, true))
      return false;

  FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_VIRTUAL_USES)
    if (!add_dependency (val, lim_data, loop, false))
      return false;

  lim_data->cost += stmt_cost (stmt);

  return true;
}
Beispiel #2
0
/*
 * Read the dependencies of 'n'.
 */
static int read_depends(FILE * f, struct trie *nodes, struct node *n,
			unsigned int *nnodesp)
{
    int err, len, newline, escaped = 0;
    int nnodes = 0;
    char token[LINE_MAX + 1];

    do {
	len = next_token(f, token, LINE_MAX + 1, &newline);
	if (len > 0 && strcmp(token, "\\") == 0)
	    escaped = 1;
	else if (len > 0) {
	    struct node *d;
	    escaped = 0;
	    d = get_node(nodes, token, nnodesp);
	    if (!d)
		return -1;
	    err = add_dependency(n, d);
	    if (err)
		return -1;
	}
    } while (len != EOF && (!newline || escaped));

    return nnodes;
}
Beispiel #3
0
void ACE_Config_Scheduler::add_dependency (RtecScheduler::handle_t handle,
                                           RtecScheduler::handle_t dependency,
                                           CORBA::Long number_of_calls,
                                           RtecScheduler::Dependency_Type_t
                                             dependency_type)
{

  RtecScheduler::RT_Info* rt_info = 0;
  switch (impl->lookup_rt_info (handle, rt_info))
    {
    case BaseSchedImplType::SUCCEEDED:
      {
        RtecScheduler::Dependency_Info dep;
        dep.rt_info = dependency;
        dep.number_of_calls = number_of_calls;
        dep.dependency_type = dependency_type;
#if defined (TAO_USES_STRATEGY_SCHEDULER)
        impl->add_dependency (rt_info, dep);
#else
        BaseSchedImplType::add_dependency (rt_info, dep);
#endif /* defined (TAO_USES_STRATEGY_SCHEDULER) */

      }
      break;
    case BaseSchedImplType::FAILED:
    case BaseSchedImplType::ST_UNKNOWN_TASK:
    default:
      ORBSVCS_ERROR ((LM_ERROR,
                  "cannot find %d to add dependency", handle));
      // TODO: throw something.
      break;
    }
}
 void DepTree::add_dependency( const PackageSpec &spec, DepTree::SpecTree::iterator where ) {
   try {
     string depstr = Info::instance().get_dependencystring( spec );
     vector<PackageSpec> v;
     Info::instance().list_dependencies( depstr, v );
     for( vector<PackageSpec>::iterator i = v.begin();
         i != v.end(); ++i ) {
       i->verify();
       where = tree.insert( where, *i );
       add_dependency( *i, where.first_child() );
     } 
   } catch( PackageError &e ) {
     std::cerr << format(_("Error while building dependency graph: \"%1%\"\n"))%e.what();
   }
 }
Beispiel #5
0
void
form_dependency_graph (command_stream_t c_stream)
{
  // If there is only one command, the graph is done
  if(c_stream == NULL || c_stream->stream_size == 1)
    return;

  int i, j;
  command_t independent = NULL;
  command_t dependent = NULL;

  // We offset the beginning of our loop by 1 as the first command is always independent
  for(i = 1; i < c_stream->stream_size; i++)
    {
      dependent = c_stream->commands[i];
      for(j = 0; j < i; j++)
        {
          independent = c_stream->commands[j];
          if(check_dependence (independent, dependent))
            add_dependency (dependent, independent);
        }
    }
}
 void DepTree::doreload()
 { add_dependency( *spec, tree.begin() ); }
Beispiel #7
0
/* Parses a single module dependency line */
int parse_dep_line(char *line,select_menu *parent)
{
	char *mod_name,*mod_dep,*mod_desc,*p;
	int name_len,desc_len,dep_len;
	select_item *item;

	mod_name = line+1;
	int len = strlen(line)-1;
	p = memchr(line,'=',len);
	if (!p) {
		fprintf(output,"Malformed dep line\n");
		return -1;
	}

	name_len = p - mod_name;
	mod_name[name_len]=0;

	/* Is this still the previous module ? */
	if (name_len == prev_module_len && memcmp(prev_module,mod_name,name_len) == 0) {
		/* Previously found module with multiple deps.
		 * Just add the new dependency */
		fprintf(output,"found prev module %s with extra deps\n",mod_name);

		mod_dep = p+1;
		dep_len = (line+len) - mod_dep;
		mod_dep[dep_len]=0;

		if (add_dependency(prev_item,mod_dep) < 0) {
			fprintf(output,"Failed to add dependency\n");
			return -1;
		}
	} else {
		fprintf(output,"found new module %s\n",mod_name);

		/* nope, new module, get description */
		mod_desc=p+1;
		p = memchr(mod_desc,'|',line+len-mod_desc);
		if (!p) {
			fprintf(output,"Malformed desc line\n");
			return -1;
		}

		desc_len = p-mod_desc;
		mod_desc[desc_len]=0;

		item = create_item(mod_name,mod_desc);
		if (item == NULL) {
			fprintf(output,"Failed to create item\n");
			return -1;
		}

		mod_dep = p+1;
		dep_len = (line+len) - mod_dep;
		mod_dep[dep_len]=0;

		/* Add the dependency */
		if (add_dependency(item,mod_dep) < 0) {
			fprintf(output,"Failed to add dependency\n");
			return -1;
		}

		/* And link it */
		link_item(parent,item);
		prev_item = item;

		strcpy(prev_module,mod_name);
		prev_module_len = name_len;
	}

	return 0;
}
Beispiel #8
0
void node::add_dependency(const node & dest) {
	add_dependency(dest.token);
}
		ddl::defn_node ffnn_ev_controller_defn::get_defn(ddl::specifier& spc)
		{
			auto available_input_names_fn = ddl::enum_defn_node::enum_values_str_fn_t{ [this](ddl::navigator nav)
			{
//				auto sys_defn = sys_defn_fn_(nav);

				// Get a list of agents using this evolved controller
				// TODO: !!! this. process will be similar to below in generate() where we find num_outputs
				//auto attached_agents = get_attached_agents();

				// Get list of available state values
				// TODO: For now assuming just 1 agent, but ideally want to use the intersection of state values
				// for each attached agent.
				// TODO: Should be using get_agent_sensor_names(), or some agent-relative call
//				auto available_inputs = sys_defn->get_system_state_values(nav);	// todo: deps
				//auto num_available_inputs = available_inputs.size();

				auto available_inputs = sv_fn_(nav);

				ddl::enum_defn_node::enum_str_set_t enum_values;
				for(auto const& ip : available_inputs)
				{
					enum_values.insert(std::end(enum_values), ip.to_string());
				}
				return enum_values;
			}
			};
			available_input_names_fn.add_dependency(sv_fn_);// sys_defn_fn_);

			ddl::defn_node inputs = spc.enumeration("inputs")
				(ddl::spc_range < size_t > { 1, boost::none })
				(ddl::define_enum_func{ available_input_names_fn })
				;

			ddl::defn_node hl_neuron_count = spc.integer("hl_neuron_count")
				(ddl::spc_min < ddl::integer_defn_node::value_t > { 1 })
				(ddl::spc_default < ddl::integer_defn_node::value_t > { 1 })	// todo: dependent upon current sel count of inputs?
				;

			ddl::defn_node hidden_layer = spc.composite("hidden_layer")(ddl::define_children{}
				("num_neurons", hl_neuron_count)
				// todo:
				);

			ddl::defn_node hidden_layer_list = spc.list("hidden_layer_list")
				(ddl::spc_item{ hidden_layer })
				;

			
			auto af_vals = ddl::define_enum_fixed{};
			for(size_t fn = 0; fn < (size_t)nnet::ActivationFnType::Count; ++fn)
			{
				af_vals = af_vals(std::string{ nnet::ActivationFnNames2[fn] });
			}

			ddl::defn_node act_fn = spc.enumeration("act_fn")
				(ddl::spc_range < size_t > { 1, 1 })
				(ddl::spc_default < ddl::enum_defn_node::str_value_t > { { nnet::ActivationFnNames2[(int)nnet::ActivationFnType::SigmoidSymmetric] } })
				(af_vals)
				;

			ddl::defn_node steepness = spc.realnum("steepness")
				(ddl::spc_min < ddl::realnum_defn_node::value_t > { 0.0 })
				(ddl::spc_default < ddl::realnum_defn_node::value_t > { 0.5 })
				;

			//////////TODO other location in param tree
			ddl::defn_node temp_mutation = gene_mutation_defn_.get_defn(spc);

			return spc.composite("ffnn_ev_controller")(ddl::define_children{}
				("inputs", inputs)
				("hidden_layer_list", hidden_layer_list)
				("hidden_act_fn", act_fn)
				("hidden_steepness", steepness)
				("output_act_fn", act_fn)
				("output_steepness", steepness)
				("temp_mutation", temp_mutation)
				);
		}