本文整理汇总了C++中GET_RTX_LENGTH函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_RTX_LENGTH函数的具体用法?C++ GET_RTX_LENGTH怎么用?C++ GET_RTX_LENGTH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_RTX_LENGTH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PyGccRtl_get_operands
PyObject *
PyGccRtl_get_operands(struct PyGccRtl *self, void *closure)
{
const int length = GET_RTX_LENGTH (GET_CODE (self->insn.inner));
PyObject *result;
int i;
const char *format_ptr;
result = PyTuple_New(length);
if (!result) {
return NULL;
}
format_ptr = GET_RTX_FORMAT (GET_CODE (self->insn.inner));
for (i = 0; i < length; i++) {
PyObject *item = get_operand_as_object(self->insn.inner, i, *format_ptr++);
if (!item) {
Py_DECREF(result);
return NULL;
}
PyTuple_SET_ITEM(result, i, item);
}
return result;
}
示例2: nonpic_symbol_mentioned_p
/* Return TRUE if X references a SYMBOL_REF or LABEL_REF whose symbol
isn't protected by a PIC unspec. */
int
nonpic_symbol_mentioned_p (rtx x)
{
const char *fmt;
int i;
if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF
|| GET_CODE (x) == PC)
return 1;
/* We don't want to look into the possible MEM location of a
CONST_DOUBLE, since we're not going to use it, in general. */
if (GET_CODE (x) == CONST_DOUBLE)
return 0;
if (GET_CODE (x) == UNSPEC)
return 0;
fmt = GET_RTX_FORMAT (GET_CODE (x));
for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
{
if (fmt[i] == 'E')
{
int j;
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
if (nonpic_symbol_mentioned_p (XVECEXP (x, i, j)))
return 1;
}
else if (fmt[i] == 'e' && nonpic_symbol_mentioned_p (XEXP (x, i)))
return 1;
}
return 0;
}
示例3: purge_mem_unchanging_flag
static void
purge_mem_unchanging_flag (rtx x)
{
RTX_CODE code;
int i, j;
const char *fmt;
if (x == NULL_RTX)
return;
code = GET_CODE (x);
if (code == MEM)
{
if (RTX_UNCHANGING_P (x)
&& (XEXP (x, 0) == current_function_internal_arg_pointer
|| (GET_CODE (XEXP (x, 0)) == PLUS
&& XEXP (XEXP (x, 0), 0) ==
current_function_internal_arg_pointer
&& GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)))
RTX_UNCHANGING_P (x) = 0;
return;
}
/* Scan all subexpressions. */
fmt = GET_RTX_FORMAT (code);
for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
{
if (*fmt == 'e')
purge_mem_unchanging_flag (XEXP (x, i));
else if (*fmt == 'E')
for (j = 0; j < XVECLEN (x, i); j++)
purge_mem_unchanging_flag (XVECEXP (x, i, j));
}
}
示例4: max_operand_1
static void
max_operand_1 (rtx x)
{
RTX_CODE code;
int i;
int len;
const char *fmt;
if (x == 0)
return;
code = GET_CODE (x);
if (code == MATCH_OPERAND || code == MATCH_OPERATOR
|| code == MATCH_PARALLEL)
max_opno = MAX (max_opno, XINT (x, 0));
fmt = GET_RTX_FORMAT (code);
len = GET_RTX_LENGTH (code);
for (i = 0; i < len; i++)
{
if (fmt[i] == 'e' || fmt[i] == 'u')
max_operand_1 (XEXP (x, i));
else if (fmt[i] == 'E')
{
int j;
for (j = 0; j < XVECLEN (x, i); j++)
max_operand_1 (XVECEXP (x, i, j));
}
}
}
示例5: unknown
/* Return true if X contains memory or some UNSPEC. We can not just
check insn operands as memory or unspec might be not an operand
itself but contain an operand. Insn with memory access is not
profitable for rematerialization. Rematerialization of UNSPEC
might result in wrong code generation as the UNPEC effect is
unknown (e.g. generating a label). */
static bool
bad_for_rematerialization_p (rtx x)
{
int i, j;
const char *fmt;
enum rtx_code code;
if (MEM_P (x) || GET_CODE (x) == UNSPEC || GET_CODE (x) == UNSPEC_VOLATILE)
return true;
code = GET_CODE (x);
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e')
{
if (bad_for_rematerialization_p (XEXP (x, i)))
return true;
}
else if (fmt[i] == 'E')
{
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
if (bad_for_rematerialization_p (XVECEXP (x, i, j)))
return true;
}
}
return false;
}
示例6: rtl_check_failed_bounds
void
rtl_check_failed_bounds (const_rtx r, int n, const char *file, int line,
const char *func)
{
internal_error
("RTL check: access of elt %d of '%s' with last elt %d in %s, at %s:%d",
n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r)) - 1,
func, trim_filename (file), line);
}
示例7: collect_insn_data
static void
collect_insn_data (rtx pattern, int *palt, int *pmax)
{
const char *fmt;
enum rtx_code code;
int i, j, len;
code = GET_CODE (pattern);
switch (code)
{
case MATCH_OPERAND:
i = n_alternatives (XSTR (pattern, 2));
*palt = (i > *palt ? i : *palt);
/* Fall through. */
case MATCH_OPERATOR:
case MATCH_SCRATCH:
case MATCH_PARALLEL:
case MATCH_INSN:
i = XINT (pattern, 0);
if (i > *pmax)
*pmax = i;
break;
default:
break;
}
fmt = GET_RTX_FORMAT (code);
len = GET_RTX_LENGTH (code);
for (i = 0; i < len; i++)
{
switch (fmt[i])
{
case 'e': case 'u':
collect_insn_data (XEXP (pattern, i), palt, pmax);
break;
case 'V':
if (XVEC (pattern, i) == NULL)
break;
/* Fall through. */
case 'E':
for (j = XVECLEN (pattern, i) - 1; j >= 0; --j)
collect_insn_data (XVECEXP (pattern, i, j), palt, pmax);
break;
case 'i': case 'w': case '0': case 's': case 'S': case 'T':
break;
default:
abort ();
}
}
}
示例8: that
/* Process MEMs in SET_DEST destinations. We must not process this together
with REG SET_DESTs, but must do it separately, lest when we see
[(set (reg:SI foo) (bar))
(set (mem:SI (reg:SI foo) (baz)))]
struct_equiv_block_eq could get confused to assume that (reg:SI foo)
is not live before this instruction. */
static bool
set_dest_addr_equiv_p (rtx x, rtx y, struct equiv_info *info)
{
enum rtx_code code = GET_CODE (x);
int length;
const char *format;
int i;
if (code != GET_CODE (y))
return false;
if (code == MEM)
return rtx_equiv_p (&XEXP (x, 0), XEXP (y, 0), 1, info);
/* Process subexpressions. */
length = GET_RTX_LENGTH (code);
format = GET_RTX_FORMAT (code);
for (i = 0; i < length; ++i)
{
switch (format[i])
{
case 'V':
case 'E':
if (XVECLEN (x, i) != XVECLEN (y, i))
return false;
if (XVEC (x, i) != 0)
{
int j;
for (j = 0; j < XVECLEN (x, i); ++j)
{
if (! set_dest_addr_equiv_p (XVECEXP (x, i, j),
XVECEXP (y, i, j), info))
return false;
}
}
break;
case 'e':
if (! set_dest_addr_equiv_p (XEXP (x, i), XEXP (y, i), info))
return false;
break;
default:
break;
}
}
return true;
}
示例9: substitute
/* Change pseudos in *LOC on their coalescing group
representatives. */
static bool
substitute (rtx *loc)
{
int i, regno;
const char *fmt;
enum rtx_code code;
bool res;
if (*loc == NULL_RTX)
return false;
code = GET_CODE (*loc);
if (code == REG)
{
regno = REGNO (*loc);
if (regno < FIRST_PSEUDO_REGISTER
|| first_coalesced_pseudo[regno] == regno)
return false;
*loc = regno_reg_rtx[first_coalesced_pseudo[regno]];
return true;
}
res = false;
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e')
{
if (substitute (&XEXP (*loc, i)))
res = true;
}
else if (fmt[i] == 'E')
{
int j;
for (j = XVECLEN (*loc, i) - 1; j >= 0; j--)
if (substitute (&XVECEXP (*loc, i, j)))
res = true;
}
}
return res;
}
示例10: references_value_p
int
references_value_p (const_rtx x, int only_useless)
{
const enum rtx_code code = GET_CODE (x);
const char *fmt = GET_RTX_FORMAT (code);
int i, j;
if (GET_CODE (x) == VALUE
&& (! only_useless || CSELIB_VAL_PTR (x)->locs == 0))
return 1;
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e' && references_value_p (XEXP (x, i), only_useless))
return 1;
else if (fmt[i] == 'E')
for (j = 0; j < XVECLEN (x, i); j++)
if (references_value_p (XVECEXP (x, i, j), only_useless))
return 1;
}
return 0;
}
示例11: uses_addressof
static int
uses_addressof (rtx x)
{
RTX_CODE code;
int i, j;
const char *fmt;
if (x == NULL_RTX)
return 0;
code = GET_CODE (x);
if (code == ADDRESSOF || x == current_function_internal_arg_pointer)
return 1;
if (code == MEM)
return 0;
/* Scan all subexpressions. */
fmt = GET_RTX_FORMAT (code);
for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
{
if (*fmt == 'e')
{
if (uses_addressof (XEXP (x, i)))
return 1;
}
else if (*fmt == 'E')
{
for (j = 0; j < XVECLEN (x, i); j++)
if (uses_addressof (XVECEXP (x, i, j)))
return 1;
}
}
return 0;
}
示例12: mark_not_eliminable
//.........这里部分代码省略.........
else if (REG_P (XEXP (x, 0))
&& REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER)
{
/* If we modify the source of an elimination rule, disable
it. Do the same if it is the destination and not the
hard frame register. */
for (ep = reg_eliminate;
ep < ®_eliminate[NUM_ELIMINABLE_REGS];
ep++)
if (ep->from_rtx == XEXP (x, 0)
|| (ep->to_rtx == XEXP (x, 0)
&& ep->to_rtx != hard_frame_pointer_rtx))
setup_can_eliminate (ep, false);
}
return;
case USE:
if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
/* If using a hard register that is the source of an eliminate
we still think can be performed, note it cannot be
performed since we don't know how this hard register is
used. */
for (ep = reg_eliminate;
ep < ®_eliminate[NUM_ELIMINABLE_REGS];
ep++)
if (ep->from_rtx == XEXP (x, 0)
&& ep->to_rtx != hard_frame_pointer_rtx)
setup_can_eliminate (ep, false);
return;
case CLOBBER:
if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
/* If clobbering a hard register that is the replacement
register for an elimination we still think can be
performed, note that it cannot be performed. Otherwise, we
need not be concerned about it. */
for (ep = reg_eliminate;
ep < ®_eliminate[NUM_ELIMINABLE_REGS];
ep++)
if (ep->to_rtx == XEXP (x, 0)
&& ep->to_rtx != hard_frame_pointer_rtx)
setup_can_eliminate (ep, false);
return;
case SET:
if (SET_DEST (x) == stack_pointer_rtx
&& GET_CODE (SET_SRC (x)) == PLUS
&& XEXP (SET_SRC (x), 0) == SET_DEST (x)
&& CONST_INT_P (XEXP (SET_SRC (x), 1)))
{
curr_sp_change += INTVAL (XEXP (SET_SRC (x), 1));
return;
}
if (! REG_P (SET_DEST (x))
|| REGNO (SET_DEST (x)) >= FIRST_PSEUDO_REGISTER)
mark_not_eliminable (SET_DEST (x), mem_mode);
else
{
/* See if this is setting the replacement hard register for
an elimination.
If DEST is the hard frame pointer, we do nothing because
we assume that all assignments to the frame pointer are
for non-local gotos and are being done at a time when
they are valid and do not disturb anything else. Some
machines want to eliminate a fake argument pointer (or
even a fake frame pointer) with either the real frame
pointer or the stack pointer. Assignments to the hard
frame pointer must not prevent this elimination. */
for (ep = reg_eliminate;
ep < ®_eliminate[NUM_ELIMINABLE_REGS];
ep++)
if (ep->to_rtx == SET_DEST (x)
&& SET_DEST (x) != hard_frame_pointer_rtx)
setup_can_eliminate (ep, false);
}
mark_not_eliminable (SET_SRC (x), mem_mode);
return;
case MEM:
/* Our only special processing is to pass the mode of the MEM to
our recursive call. */
mark_not_eliminable (XEXP (x, 0), GET_MODE (x));
return;
default:
break;
}
fmt = GET_RTX_FORMAT (code);
for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
{
if (*fmt == 'e')
mark_not_eliminable (XEXP (x, i), mem_mode);
else if (*fmt == 'E')
for (j = 0; j < XVECLEN (x, i); j++)
mark_not_eliminable (XVECEXP (x, i, j), mem_mode);
}
}
示例13: rtx_hash
/* Recursive hash function for RTL X. */
static hashval_t
rtx_hash (rtx x)
{
int i, j;
enum rtx_code code;
const char *fmt;
hashval_t val = 0;
if (x == 0)
return val;
code = GET_CODE (x);
val += (int) code + 4095;
/* Some RTL can be compared nonrecursively. */
switch (code)
{
case REG:
return val + REGNO (x);
case LABEL_REF:
return iterative_hash_object (XEXP (x, 0), val);
case SYMBOL_REF:
return iterative_hash_object (XSTR (x, 0), val);
case SCRATCH:
case CONST_DOUBLE:
case CONST_INT:
case CONST_VECTOR:
return val;
default:
break;
}
/* Hash the elements. */
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
switch (fmt[i])
{
case 'w':
val += XWINT (x, i);
break;
case 'n':
case 'i':
val += XINT (x, i);
break;
case 'V':
case 'E':
val += XVECLEN (x, i);
for (j = 0; j < XVECLEN (x, i); j++)
val += rtx_hash (XVECEXP (x, i, j));
break;
case 'e':
val += rtx_hash (XEXP (x, i));
break;
case 'S':
case 's':
val += htab_hash_string (XSTR (x, i));
break;
case 'u':
case '0':
case 't':
break;
/* It is believed that rtx's at this level will never
contain anything but integers and other rtx's, except for
within LABEL_REFs and SYMBOL_REFs. */
default:
abort ();
}
}
return val;
}
示例14: iterative_hash_rtx
hashval_t
iterative_hash_rtx (const_rtx x, hashval_t hash)
{
enum rtx_code code;
enum machine_mode mode;
int i, j;
const char *fmt;
if (x == NULL_RTX)
return hash;
code = GET_CODE (x);
hash = iterative_hash_object (code, hash);
mode = GET_MODE (x);
hash = iterative_hash_object (mode, hash);
switch (code)
{
case REG:
i = REGNO (x);
return iterative_hash_object (i, hash);
case CONST_INT:
return iterative_hash_object (INTVAL (x), hash);
case SYMBOL_REF:
if (XSTR (x, 0))
return iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1,
hash);
return hash;
case LABEL_REF:
case DEBUG_EXPR:
case VALUE:
case SCRATCH:
case CONST_DOUBLE:
case CONST_FIXED:
case DEBUG_IMPLICIT_PTR:
case DEBUG_PARAMETER_REF:
return hash;
default:
break;
}
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
switch (fmt[i])
{
case 'w':
hash = iterative_hash_object (XWINT (x, i), hash);
break;
case 'n':
case 'i':
hash = iterative_hash_object (XINT (x, i), hash);
break;
case 'V':
case 'E':
j = XVECLEN (x, i);
hash = iterative_hash_object (j, hash);
for (j = 0; j < XVECLEN (x, i); j++)
hash = iterative_hash_rtx (XVECEXP (x, i, j), hash);
break;
case 'e':
hash = iterative_hash_rtx (XEXP (x, i), hash);
break;
case 'S':
case 's':
if (XSTR (x, i))
hash = iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1,
hash);
break;
default:
break;
}
return hash;
}
示例15: rtx_equal_p
int
rtx_equal_p (const_rtx x, const_rtx y)
{
int i;
int j;
enum rtx_code code;
const char *fmt;
if (x == y)
return 1;
if (x == 0 || y == 0)
return 0;
code = GET_CODE (x);
/* Rtx's of different codes cannot be equal. */
if (code != GET_CODE (y))
return 0;
/* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
(REG:SI x) and (REG:HI x) are NOT equivalent. */
if (GET_MODE (x) != GET_MODE (y))
return 0;
/* MEMs referring to different address space are not equivalent. */
if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
return 0;
/* Some RTL can be compared nonrecursively. */
switch (code)
{
case REG:
return (REGNO (x) == REGNO (y));
case LABEL_REF:
return XEXP (x, 0) == XEXP (y, 0);
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
case DEBUG_EXPR:
case VALUE:
case SCRATCH:
case CONST_DOUBLE:
case CONST_INT:
case CONST_FIXED:
return 0;
case DEBUG_IMPLICIT_PTR:
return DEBUG_IMPLICIT_PTR_DECL (x)
== DEBUG_IMPLICIT_PTR_DECL (y);
case DEBUG_PARAMETER_REF:
return DEBUG_PARAMETER_REF_DECL (x)
== DEBUG_PARAMETER_REF_DECL (y);
case ENTRY_VALUE:
return rtx_equal_p (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y));
default:
break;
}
/* Compare the elements. If any pair of corresponding elements
fail to match, return 0 for the whole thing. */
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
switch (fmt[i])
{
case 'w':
if (XWINT (x, i) != XWINT (y, i))
return 0;
break;
case 'n':
case 'i':
if (XINT (x, i) != XINT (y, i))
{
#ifndef GENERATOR_FILE
if (((code == ASM_OPERANDS && i == 6)
|| (code == ASM_INPUT && i == 1))
&& locator_eq (XINT (x, i), XINT (y, i)))
break;
#endif
return 0;
}
break;
case 'V':
case 'E':
/* Two vectors must have the same length. */
if (XVECLEN (x, i) != XVECLEN (y, i))
return 0;
/* And the corresponding elements must match. */
for (j = 0; j < XVECLEN (x, i); j++)
if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
return 0;
//.........这里部分代码省略.........