Commit 4d01c30f by Richard Stallman

(GO_IF_LEGITIMATE_INDEX): Check explicitly for

upper and lower bounds of valid INDEX.

From-SVN: r4584
parent 6e498949
...@@ -678,31 +678,34 @@ enum reg_class ...@@ -678,31 +678,34 @@ enum reg_class
/* A C statement (sans semicolon) to jump to LABEL for legitimate index RTXs /* A C statement (sans semicolon) to jump to LABEL for legitimate index RTXs
used by the macro GO_IF_LEGITIMATE_ADDRESS. Floating point indices can used by the macro GO_IF_LEGITIMATE_ADDRESS. Floating point indices can
only be small constants. */ only be small constants. */
#define GO_IF_LEGITIMATE_INDEX(MODE, BASE_REGNO, INDEX, LABEL) \ #define GO_IF_LEGITIMATE_INDEX(MODE, BASE_REGNO, INDEX, LABEL) \
do \ do \
{ \ { \
int range; \ int range; \
\ \
if (GET_MODE_CLASS (MODE) == MODE_FLOAT) \ if (GET_MODE_CLASS (MODE) == MODE_FLOAT) \
range = 1024; \ range = 1024; \
else \ else \
{ \ { \
if (INDEX_REGISTER_RTX_P (INDEX)) \ if (INDEX_REGISTER_RTX_P (INDEX)) \
goto LABEL; \ goto LABEL; \
if (GET_MODE_SIZE (MODE) <= 4 && GET_CODE (INDEX) == MULT) \ if (GET_MODE_SIZE (MODE) <= 4 && GET_CODE (INDEX) == MULT) \
{ \ { \
rtx xiop0 = XEXP (INDEX, 0); \ rtx xiop0 = XEXP (INDEX, 0); \
rtx xiop1 = XEXP (INDEX, 1); \ rtx xiop1 = XEXP (INDEX, 1); \
if (INDEX_REGISTER_RTX_P (xiop0) && power_of_two_operand (xiop1, SImode)) \ if (INDEX_REGISTER_RTX_P (xiop0) \
goto LABEL; \ && power_of_two_operand (xiop1, SImode)) \
if (INDEX_REGISTER_RTX_P (xiop1) && power_of_two_operand (xiop0, SImode)) \ goto LABEL; \
goto LABEL; \ if (INDEX_REGISTER_RTX_P (xiop1) \
} \ && power_of_two_operand (xiop0, SImode)) \
range = 4096; \ goto LABEL; \
} \ } \
\ range = 4096; \
if (GET_CODE (INDEX) == CONST_INT && abs (INTVAL (INDEX)) < range) \ } \
goto LABEL; \ \
if (GET_CODE (INDEX) == CONST_INT && INTVAL (INDEX) < range \
&& INTVAL (INDEX) > -range) \
goto LABEL; \
} while (0) } while (0)
/* Jump to LABEL if X is a valid address RTX. This must also take /* Jump to LABEL if X is a valid address RTX. This must also take
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment