Exemple #1
0
void check_generic_arguments(expression args, typelist gparms)
{
  expression arg;
  typelist_scanner scan_gparms;

  typelist_scan(gparms, &scan_gparms);
  scan_expression (arg, args)
    {
      location l = arg->location;
      type gparm_type = typelist_next(&scan_gparms);

      if (!gparm_type)
	{
	  error_with_location(l, "too many arguments");
	  return;
	}

      if (arg->type == error_type || !check_constant_once(arg, cst_numerical))
	continue;

      if (!arg->cst || !constant_integral(arg->cst))
	error_with_location(l, "constant expression expected");
      else
	{
	  if (!cval_inrange(arg->cst->cval, gparm_type))
	    error_with_location(l, "constant out of range for argument type");
	}
    }
Exemple #2
0
void wire_scheduler(module m)
{
  rp_interface taskuse;
  cgraph cg = m->cdecl->connections, userg = m->cdecl->user_connections;
  struct endp m_end, scheduler_end;

  if (!scheduler_interface)
    {
      declaration task;
      static int use_module = 0;

      /* If all_tasks is non-null, we have a problem: a task that needs to
	 be wired, but the scheduler is not yet available. Report as an error.
      */
      scan_declaration (task, all_tasks)
	{
	  error_with_location(task->location, "scheduler depends on a task");
	  if (!use_module)
	    {
	      use_module = 1;
	      error_with_location(task->location,
				  "The -fnesc_scheduler flag should specify a module");
	      error_with_location(task->location,
				  "(the module with the scheduling code, even if the scheduler is a configuration)");
	    }
	}
Exemple #3
0
void load_scheduler(void)
{
  scheduler = load(l_component, toplevel_location, scheduler_name, FALSE);
  if (scheduler_name)
    {
      data_declaration intf = env_lookup(scheduler->env->id_env,
					 scheduler_interface_name, TRUE);

      /* Check interface for validity. It must be the provided, have a
	 single parameter and be the right interface type.
	 Also, no generic interfaces please. */
      if (intf && intf->kind == decl_interface_ref && !intf->required &&
	  intf->gparms && !intf->itype->abstract &&
	  !strcmp(intf->itype->name, scheduler_interfacedef_name))
	{
	  typelist_scanner dummy;

	  typelist_scan(intf->gparms, &dummy);
	  if (typelist_next(&dummy) && !typelist_next(&dummy))
	    scheduler_interface = intf;
	}
      if (!scheduler_interface)
	error_with_location(toplevel_location,
			    "Scheduler `%s' has no scheduling interface named `%s'",
			    scheduler_name, scheduler_interface_name);
    }
}
Exemple #4
0
/* Return a reference to attribute tag 
   (different from xref_tag because there is no implicit declaration) */
tag_ref lookup_attribute(word tag)
{
  tag_ref tref = newkind_tag_ref(parse_region, kind_attribute_ref,
				 tag->location, tag, NULL, NULL, FALSE);
  tag_declaration tdecl = lookup_tag(tref, FALSE);

  if (!tdecl)
    error_with_location(tag->location, "unknown attribute `%s'",
			tag->cstring.data);
  tref->tdecl = tdecl;

  return tref;
}
Exemple #5
0
void check_interface_parameter_types(declaration parms)
{
  declaration parm;

  scan_declaration (parm, parms)
    {
      data_decl dd = CAST(data_decl, parm);
      variable_decl vd = CAST(variable_decl, dd->decls);

      if (!vd->ddecl)
	{
	  error_with_location(vd->location,
			      "integral type required for generic parameter");
	  vd->ddecl = bad_decl;
	}
      else if (!type_integral(vd->ddecl->type))
      	{
	  error_with_location(vd->location,
			      "integral type required for generic parameter `%s'",
			      vd->ddecl->name);
	  vd->ddecl->type = int_type;
	}
    }