addr_space_t seg;
};
-extern int ix86_decompose_address (rtx, struct ix86_address *);
+extern bool ix86_decompose_address (rtx, struct ix86_address *);
extern int memory_address_length (rtx, bool);
extern void x86_output_aligned_bss (FILE *, tree, const char *,
unsigned HOST_WIDE_INT, unsigned);
}
\f
/* Extract the parts of an RTL expression that is a valid memory address
- for an instruction. Return 0 if the structure of the address is
+ for an instruction. Return false if the structure of the address is
grossly off. */
-int
+bool
ix86_decompose_address (rtx addr, struct ix86_address *out)
{
rtx base = NULL_RTX, index = NULL_RTX, disp = NULL_RTX;
{
addr = XEXP (addr, 0);
if (CONST_INT_P (addr))
- return 0;
+ return false;
}
else if (GET_CODE (addr) == AND
&& const_32bit_mask (XEXP (addr, 1), DImode))
{
addr = lowpart_subreg (SImode, XEXP (addr, 0), DImode);
if (addr == NULL_RTX)
- return 0;
+ return false;
if (CONST_INT_P (addr))
- return 0;
+ return false;
}
else if (GET_CODE (addr) == AND)
{
{
addr = SUBREG_REG (addr);
if (CONST_INT_P (addr))
- return 0;
+ return false;
}
}
if (REG_P (SUBREG_REG (addr)))
base = addr;
else
- return 0;
+ return false;
}
else if (GET_CODE (addr) == PLUS)
{
do
{
if (n >= 4)
- return 0;
+ return false;
addends[n++] = XEXP (op, 1);
op = XEXP (op, 0);
}
while (GET_CODE (op) == PLUS);
if (n >= 4)
- return 0;
+ return false;
addends[n] = op;
for (i = n; i >= 0; --i)
{
case MULT:
if (index)
- return 0;
+ return false;
index = XEXP (op, 0);
scale_rtx = XEXP (op, 1);
break;
case ASHIFT:
if (index)
- return 0;
+ return false;
index = XEXP (op, 0);
tmp = XEXP (op, 1);
if (!CONST_INT_P (tmp))
- return 0;
+ return false;
scale = INTVAL (tmp);
if ((unsigned HOST_WIDE_INT) scale > 3)
- return 0;
+ return false;
scale = 1 << scale;
break;
case ZERO_EXTEND:
op = XEXP (op, 0);
if (GET_CODE (op) != UNSPEC)
- return 0;
+ return false;
/* FALLTHRU */
case UNSPEC:
&& seg == ADDR_SPACE_GENERIC)
seg = DEFAULT_TLS_SEG_REG;
else
- return 0;
+ return false;
break;
case SUBREG:
if (!REG_P (SUBREG_REG (op)))
- return 0;
+ return false;
/* FALLTHRU */
case REG:
else if (!index)
index = op;
else
- return 0;
+ return false;
break;
case CONST:
case SYMBOL_REF:
case LABEL_REF:
if (disp)
- return 0;
+ return false;
disp = op;
break;
default:
- return 0;
+ return false;
}
}
}
index = XEXP (addr, 0);
tmp = XEXP (addr, 1);
if (!CONST_INT_P (tmp))
- return 0;
+ return false;
scale = INTVAL (tmp);
if ((unsigned HOST_WIDE_INT) scale > 3)
- return 0;
+ return false;
scale = 1 << scale;
}
else
&& REG_P (SUBREG_REG (index)))
;
else
- return 0;
+ return false;
}
/* Extract the integral value of scale. */
if (scale_rtx)
{
if (!CONST_INT_P (scale_rtx))
- return 0;
+ return false;
scale = INTVAL (scale_rtx);
}
out->scale = scale;
out->seg = seg;
- return 1;
+ return true;
}
\f
/* Return cost of the memory address x.