| 1 |
/* { dg-do compile } */ |
| 2 |
|
| 3 |
typedef union rtunion_def { |
| 4 |
struct rtx_def *rtx; |
| 5 |
} rtunion; |
| 6 |
typedef struct rtx_def { |
| 7 |
unsigned short code; |
| 8 |
rtunion fld[1]; |
| 9 |
} *rtx; |
| 10 |
extern rtx recog_operand[]; |
| 11 |
extern rtx *recog_operand_loc[]; |
| 12 |
extern int reload_n_operands; |
| 13 |
extern void find_dummy_reload (int, int); |
| 14 |
extern int asm_noperands (rtx); |
| 15 |
extern int n_occurrences (char **); |
| 16 |
char operands_match[10][10]; |
| 17 |
void find_reloads (rtx insn, int n_alternatives, int commutative) |
| 18 |
{ |
| 19 |
register int i, j; |
| 20 |
int noperands; |
| 21 |
char *constraints[10]; |
| 22 |
int address_reloaded[10]; |
| 23 |
int this_alternative[10]; |
| 24 |
char this_alternative_win[10]; |
| 25 |
int this_alternative_matches[10]; |
| 26 |
int this_alternative_number; |
| 27 |
rtx body = ((insn)->fld[3].rtx); |
| 28 |
int operand_mode[10]; |
| 29 |
if (body->code == 1) |
| 30 |
{ |
| 31 |
reload_n_operands = noperands = asm_noperands (body); |
| 32 |
n_alternatives = n_occurrences (constraints); |
| 33 |
} |
| 34 |
for (this_alternative_number = 0; |
| 35 |
this_alternative_number < n_alternatives; |
| 36 |
this_alternative_number++) |
| 37 |
for (i = 0; |
| 38 |
i < noperands; |
| 39 |
i++) |
| 40 |
{ |
| 41 |
register char *p = constraints[i]; |
| 42 |
register int win = 0; |
| 43 |
int badop = 1; |
| 44 |
int c; |
| 45 |
register rtx operand = recog_operand[i]; |
| 46 |
int force_reload = 0; |
| 47 |
this_alternative_win[i] = 0; |
| 48 |
this_alternative[i] = 1; |
| 49 |
while (*p && (c = *p++) != ',') |
| 50 |
switch (c) |
| 51 |
{ |
| 52 |
case '4': |
| 53 |
c -= '0'; |
| 54 |
this_alternative_matches[i] = c; |
| 55 |
if ((c != commutative |
| 56 |
|| i != commutative + 1) |
| 57 |
&& operands_match[c][i]) |
| 58 |
win = this_alternative_win[c]; |
| 59 |
else |
| 60 |
find_dummy_reload (operand_mode[i], this_alternative[c]); |
| 61 |
if (! win || force_reload) |
| 62 |
for (j = 0; j < i; j++) |
| 63 |
if (this_alternative_matches[j] |
| 64 |
== this_alternative_matches[i]) |
| 65 |
badop = 1; |
| 66 |
break; |
| 67 |
case '<': |
| 68 |
if (operand->code == 2 |
| 69 |
&& ! address_reloaded[i] |
| 70 |
&& operand->fld[0].rtx->code == 3) |
| 71 |
win = 1; |
| 72 |
} |
| 73 |
} |
| 74 |
} |