示例#1
0
/* Return true if is load/store with SYMBOL_REF addressing mode
   and memory mode is SImode.  */
bool
nds32_symbol_load_store_p (rtx_insn *insn)
{
  rtx mem_src = NULL_RTX;

  switch (get_attr_type (insn))
    {
    case TYPE_LOAD:
      mem_src = SET_SRC (PATTERN (insn));
      break;
    case TYPE_STORE:
      mem_src = SET_DEST (PATTERN (insn));
      break;
    default:
      break;
    }

  /* Find load/store insn with addressing mode is SYMBOL_REF.  */
  if (mem_src != NULL_RTX)
    {
      if ((GET_CODE (mem_src) == ZERO_EXTEND)
	  || (GET_CODE (mem_src) == SIGN_EXTEND))
	mem_src = XEXP (mem_src, 0);

      if ((GET_CODE (XEXP (mem_src, 0)) == SYMBOL_REF)
	   || (GET_CODE (XEXP (mem_src, 0)) == LO_SUM))
	return true;
    }

  return false;
}
示例#2
0
/**
 * @brief
 * 	Returns TRUE if the name passed in is an attribute.
 *
 * @note
 * 	This must not be called with object of type MGR_OBJ_SITE_HOOK or MGR_OBJ_PBS_HOOK.
 *
 * @param[in]	object - type of object
 * @param[in]	name  - name of the attribute
 * @param[in]	attr_type  - type of the attribute
 *
 * @eturn int
 * @retval	TRUE - means if the input is an attribute of the given 'object' type
 *        	    and 'attr_type'.
 * @retval	FALSE - otherwise.
 *
 */
int
is_attr(int object, char *name, int attr_type)
{
	struct ecl_attribute_def *attr_def = NULL;

	if ((object == MGR_OBJ_SITE_HOOK) || (object == MGR_OBJ_PBS_HOOK)) {
		return FALSE;
	}

	else if (object == MGR_OBJ_RSC) {
		return TRUE;
	}

	if ((attr_def = ecl_find_attr_in_def(ecl_svr_attr_def, name, ecl_svr_attr_size)) != NULL) {
		/* Make sure that the attribute types match */
		if (get_attr_type(*attr_def) & attr_type)
			return TRUE;
		else
			return FALSE;
	} else if ((attr_def = ecl_find_attr_in_def(ecl_node_attr_def, name, ecl_node_attr_size)) != NULL) {
		/* Make sure that the attribute types match */
		if (get_attr_type(*attr_def) & attr_type)
			return TRUE;
		else
			return FALSE;
	} else if ((attr_def = ecl_find_attr_in_def(ecl_que_attr_def, name, ecl_que_attr_size)) != NULL) {
		/* Make sure that the attribute types match */
		if (get_attr_type(*attr_def) & attr_type)
			return TRUE;
		else
			return FALSE;
	} else if ((attr_def = ecl_find_attr_in_def(ecl_sched_attr_def, name, ecl_sched_attr_size)) != NULL) {
		/* Make sure that the attribute types match */
		if (get_attr_type(*attr_def) & attr_type)
			return TRUE;
		else
			return FALSE;
	}

	return FALSE;
}
static bool
is_fmul_fmac_insn (rtx_insn *insn, bool fmul_ok)
{
  enum attr_type t;

  if (!NONDEBUG_INSN_P (insn))
    return false;

  if (recog_memoized (insn) < 0)
    return false;

  /* Only consider chain(s) this instruction is a root of if this is an FMUL or
     FMADD/FMSUB instruction.  This allows to avoid browsing chains of all
     instructions for FMUL or FMADD/FMSUB in them.  */
  t = get_attr_type (insn);
  return is_fmac_op (t) || (fmul_ok && is_fmul_op (t));
}
示例#4
0
void frame_draw_builder::set_attr(const std::string& name, const std::string& value)
{
	switch(get_attr_type(name)) {
	case ATTR_UNKNOWN:
		std::cerr << "Warning: unknown attribute \""<<name<<"\" in frame file.\n";
		break;
	case ATTR_STRING:
		string_attrs_[name] = value;
		break;
	case ATTR_BOOL:
	case ATTR_INT:
		formula_attrs_[name] = formula_ptr(new game_logic::formula(value));
		break;
	default:
		std::cerr << "Error: invalid attribute type returned\n";
		assert(false);
		break;
	}
}
示例#5
0
文件: show.c 项目: openhpi1/testrepo
static Pr_ret_t show_attrs(Attributes_t *Attrs, int delta, hpi_ui_print_cb_t proc)
{
	int		i, type, len, del;
	char		tmp[256], *name;
	char		buf[SHOW_BUF_SZ];
	union_type_t	val;
	SaErrorT	rv;
	Pr_ret_t	ret;

	memset(buf, ' ', SHOW_BUF_SZ);
	del = delta << 1;
	len = SHOW_BUF_SZ - del;
	for (i = 0; i < Attrs->n_attrs; i++) {
		name = get_attr_name(Attrs, i);
		if (name == (char *)NULL)
			break;
		rv = get_value(Attrs, i, &val);
		if (rv != SA_OK) continue;
		type = get_attr_type(Attrs, i);
		switch (type) {
			case NO_TYPE:	continue;
			case STRUCT_TYPE:
				snprintf(buf + del, len, "%s:\n", name);
				if (proc(buf) != 0) return(-1);
				rv = get_value(Attrs, i, &val);
				if (rv != SA_OK) continue;
				ret = show_attrs((Attributes_t *)(val.a),
					delta + 1, proc);
				if (ret != HPI_UI_OK) return(HPI_UI_END);
				continue;
			case LOOKUP_TYPE:
				strncpy(tmp, lookup_proc(Attrs->Attrs[i].lunum,
					val.i), 256);
				break;
			case DECODE_TYPE:
				rv = decode_proc(Attrs->Attrs[i].lunum, val.a,
					tmp, 256);
				if (rv != SA_OK) continue;
				break;
			case DECODE1_TYPE:
				rv = decode1_proc(Attrs->Attrs[i].lunum, val.i,
					tmp, 256);
				if (rv != SA_OK) continue;
				break;
			case READING_TYPE:
				if (thres_value(val.a, tmp, 256) != SA_OK)
					continue;
				break;
			case TEXT_BUFF_TYPE:
				snprintf(buf + del, len, "%s: ", name);
				if (proc(buf) != HPI_UI_OK) return(HPI_UI_END);
				ret = print_text_buffer(NULL, val.a, "\n", proc);
				if (ret != HPI_UI_OK) return(HPI_UI_END);
				continue;
			default:
				rv = get_value_as_string(Attrs, i, tmp, 256);
				if (rv != SA_OK) continue;
		};
		snprintf(buf + del, len, "%s: %s\n", name, tmp);
		if (proc(buf) != HPI_UI_OK) return(HPI_UI_END);
	};
	return(0);
}
示例#6
0
int	get_item_field_type(std::string name)
{
    return get_attr_type(name, item_attr_name_table);
}
示例#7
0
int	get_player_field_type(std::string name)
{
    return get_attr_type(name, player_attr_name_table);
}