Mercurial > hg > CbC > CbC_gcc
comparison gcc/genattrtab.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Generate code from machine description to compute values of attributes. | 1 /* Generate code from machine description to compute values of attributes. |
2 Copyright (C) 1991-2017 Free Software Foundation, Inc. | 2 Copyright (C) 1991-2018 Free Software Foundation, Inc. |
3 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) | 3 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify it under | 7 GCC is free software; you can redistribute it and/or modify it under |
226 static int *insn_n_alternatives; | 226 static int *insn_n_alternatives; |
227 | 227 |
228 /* Stores, for each insn code, a bitmap that has bits on for each possible | 228 /* Stores, for each insn code, a bitmap that has bits on for each possible |
229 alternative. */ | 229 alternative. */ |
230 | 230 |
231 static uint64_t *insn_alternatives; | 231 /* Keep this in sync with recog.h. */ |
232 typedef uint64_t alternative_mask; | |
233 static alternative_mask *insn_alternatives; | |
232 | 234 |
233 /* Used to simplify expressions. */ | 235 /* Used to simplify expressions. */ |
234 | 236 |
235 static rtx true_rtx, false_rtx; | 237 static rtx true_rtx, false_rtx; |
236 | 238 |
254 static char *attr_string (const char *, int); | 256 static char *attr_string (const char *, int); |
255 static char *attr_printf (unsigned int, const char *, ...) | 257 static char *attr_printf (unsigned int, const char *, ...) |
256 ATTRIBUTE_PRINTF_2; | 258 ATTRIBUTE_PRINTF_2; |
257 static rtx make_numeric_value (int); | 259 static rtx make_numeric_value (int); |
258 static struct attr_desc *find_attr (const char **, int); | 260 static struct attr_desc *find_attr (const char **, int); |
259 static rtx mk_attr_alt (uint64_t); | 261 static rtx mk_attr_alt (alternative_mask); |
260 static char *next_comma_elt (const char **); | 262 static char *next_comma_elt (const char **); |
261 static rtx insert_right_side (enum rtx_code, rtx, rtx, int, int); | 263 static rtx insert_right_side (enum rtx_code, rtx, rtx, int, int); |
262 static rtx copy_boolean (rtx); | 264 static rtx copy_boolean (rtx); |
263 static int compares_alternatives_p (rtx); | 265 static int compares_alternatives_p (rtx); |
264 static void make_internal_attr (const char *, rtx, int); | 266 static void make_internal_attr (const char *, rtx, int); |
492 XSTR (rt_val, 0) = arg0; | 494 XSTR (rt_val, 0) = arg0; |
493 XSTR (rt_val, 1) = arg1; | 495 XSTR (rt_val, 1) = arg1; |
494 } | 496 } |
495 } | 497 } |
496 else if (GET_RTX_LENGTH (code) == 2 | 498 else if (GET_RTX_LENGTH (code) == 2 |
497 && GET_RTX_FORMAT (code)[0] == 'i' | 499 && GET_RTX_FORMAT (code)[0] == 'w' |
498 && GET_RTX_FORMAT (code)[1] == 'i') | 500 && GET_RTX_FORMAT (code)[1] == 'w') |
499 { | 501 { |
500 int arg0 = va_arg (p, int); | 502 HOST_WIDE_INT arg0 = va_arg (p, HOST_WIDE_INT); |
501 int arg1 = va_arg (p, int); | 503 HOST_WIDE_INT arg1 = va_arg (p, HOST_WIDE_INT); |
502 | 504 |
503 hashcode = ((HOST_WIDE_INT) code + RTL_HASH (arg0) + RTL_HASH (arg1)); | 505 hashcode = ((HOST_WIDE_INT) code + RTL_HASH (arg0) + RTL_HASH (arg1)); |
504 for (h = attr_hash_table[hashcode % RTL_HASH_SIZE]; h; h = h->next) | 506 for (h = attr_hash_table[hashcode % RTL_HASH_SIZE]; h; h = h->next) |
505 if (h->hashcode == hashcode | 507 if (h->hashcode == hashcode |
506 && GET_CODE (h->u.rtl) == code | 508 && GET_CODE (h->u.rtl) == code |
507 && XINT (h->u.rtl, 0) == arg0 | 509 && XWINT (h->u.rtl, 0) == arg0 |
508 && XINT (h->u.rtl, 1) == arg1) | 510 && XWINT (h->u.rtl, 1) == arg1) |
509 return h->u.rtl; | 511 return h->u.rtl; |
510 | 512 |
511 if (h == 0) | 513 if (h == 0) |
512 { | 514 { |
513 rtl_obstack = hash_obstack; | 515 rtl_obstack = hash_obstack; |
514 rt_val = rtx_alloc (code); | 516 rt_val = rtx_alloc (code); |
515 XINT (rt_val, 0) = arg0; | 517 XWINT (rt_val, 0) = arg0; |
516 XINT (rt_val, 1) = arg1; | 518 XWINT (rt_val, 1) = arg1; |
517 } | 519 } |
518 } | 520 } |
519 else if (code == CONST_INT) | 521 else if (code == CONST_INT) |
520 { | 522 { |
521 HOST_WIDE_INT arg0 = va_arg (p, HOST_WIDE_INT); | 523 HOST_WIDE_INT arg0 = va_arg (p, HOST_WIDE_INT); |
561 case 'E': /* An RTX vector? */ | 563 case 'E': /* An RTX vector? */ |
562 XVEC (rt_val, i) = va_arg (p, rtvec); | 564 XVEC (rt_val, i) = va_arg (p, rtvec); |
563 break; | 565 break; |
564 | 566 |
565 default: | 567 default: |
568 /* Don't need to handle 'p' for attributes. */ | |
566 gcc_unreachable (); | 569 gcc_unreachable (); |
567 } | 570 } |
568 } | 571 } |
569 return rt_val; | 572 return rt_val; |
570 } | 573 } |
700 { | 703 { |
701 attr_desc *attr2 = find_attr (&XSTR (exp, 0), 0); | 704 attr_desc *attr2 = find_attr (&XSTR (exp, 0), 0); |
702 if (attr2 == NULL) | 705 if (attr2 == NULL) |
703 { | 706 { |
704 if (! strcmp (XSTR (exp, 0), "alternative")) | 707 if (! strcmp (XSTR (exp, 0), "alternative")) |
705 return mk_attr_alt (((uint64_t) 1) << atoi (XSTR (exp, 1))); | 708 return mk_attr_alt (((alternative_mask) 1) |
709 << atoi (XSTR (exp, 1))); | |
706 else | 710 else |
707 fatal_at (loc, "unknown attribute `%s' in definition of" | 711 fatal_at (loc, "unknown attribute `%s' in definition of" |
708 " attribute `%s'", XSTR (exp, 0), attr->name); | 712 " attribute `%s'", XSTR (exp, 0), attr->name); |
709 } | 713 } |
710 | 714 |
747 { | 751 { |
748 int set = 0; | 752 int set = 0; |
749 | 753 |
750 name_ptr = XSTR (exp, 1); | 754 name_ptr = XSTR (exp, 1); |
751 while ((p = next_comma_elt (&name_ptr)) != NULL) | 755 while ((p = next_comma_elt (&name_ptr)) != NULL) |
752 set |= ((uint64_t) 1) << atoi (p); | 756 set |= ((alternative_mask) 1) << atoi (p); |
753 | 757 |
754 return mk_attr_alt (set); | 758 return mk_attr_alt (set); |
755 } | 759 } |
756 else | 760 else |
757 { | 761 { |
1221 static struct attr_value * | 1225 static struct attr_value * |
1222 get_attr_value (file_location loc, rtx value, struct attr_desc *attr, | 1226 get_attr_value (file_location loc, rtx value, struct attr_desc *attr, |
1223 int insn_code) | 1227 int insn_code) |
1224 { | 1228 { |
1225 struct attr_value *av; | 1229 struct attr_value *av; |
1226 uint64_t num_alt = 0; | 1230 alternative_mask num_alt = 0; |
1227 | 1231 |
1228 value = make_canonical (loc, attr, value); | 1232 value = make_canonical (loc, attr, value); |
1229 if (compares_alternatives_p (value)) | 1233 if (compares_alternatives_p (value)) |
1230 { | 1234 { |
1231 if (insn_code < 0 || insn_alternatives == NULL) | 1235 if (insn_code < 0 || insn_alternatives == NULL) |
1865 If so, we can optimize. Similarly for IOR's of EQ_ATTR. | 1869 If so, we can optimize. Similarly for IOR's of EQ_ATTR. |
1866 | 1870 |
1867 This routine is passed an expression and either AND or IOR. It returns a | 1871 This routine is passed an expression and either AND or IOR. It returns a |
1868 bitmask indicating which alternatives are mentioned within EXP. */ | 1872 bitmask indicating which alternatives are mentioned within EXP. */ |
1869 | 1873 |
1870 static uint64_t | 1874 static alternative_mask |
1871 compute_alternative_mask (rtx exp, enum rtx_code code) | 1875 compute_alternative_mask (rtx exp, enum rtx_code code) |
1872 { | 1876 { |
1873 const char *string; | 1877 const char *string; |
1874 if (GET_CODE (exp) == code) | 1878 if (GET_CODE (exp) == code) |
1875 return compute_alternative_mask (XEXP (exp, 0), code) | 1879 return compute_alternative_mask (XEXP (exp, 0), code) |
1884 && XSTR (exp, 0) == alternative_name) | 1888 && XSTR (exp, 0) == alternative_name) |
1885 string = XSTR (exp, 1); | 1889 string = XSTR (exp, 1); |
1886 | 1890 |
1887 else if (GET_CODE (exp) == EQ_ATTR_ALT) | 1891 else if (GET_CODE (exp) == EQ_ATTR_ALT) |
1888 { | 1892 { |
1889 if (code == AND && XINT (exp, 1)) | 1893 if (code == AND && XWINT (exp, 1)) |
1890 return XINT (exp, 0); | 1894 return XWINT (exp, 0); |
1891 | 1895 |
1892 if (code == IOR && !XINT (exp, 1)) | 1896 if (code == IOR && !XWINT (exp, 1)) |
1893 return XINT (exp, 0); | 1897 return XWINT (exp, 0); |
1894 | 1898 |
1895 return 0; | 1899 return 0; |
1896 } | 1900 } |
1897 else | 1901 else |
1898 return 0; | 1902 return 0; |
1899 | 1903 |
1900 if (string[1] == 0) | 1904 if (string[1] == 0) |
1901 return ((uint64_t) 1) << (string[0] - '0'); | 1905 return ((alternative_mask) 1) << (string[0] - '0'); |
1902 return ((uint64_t) 1) << atoi (string); | 1906 return ((alternative_mask) 1) << atoi (string); |
1903 } | 1907 } |
1904 | 1908 |
1905 /* Given I, a single-bit mask, return RTX to compare the `alternative' | 1909 /* Given I, a single-bit mask, return RTX to compare the `alternative' |
1906 attribute with the value represented by that bit. */ | 1910 attribute with the value represented by that bit. */ |
1907 | 1911 |
1908 static rtx | 1912 static rtx |
1909 make_alternative_compare (uint64_t mask) | 1913 make_alternative_compare (alternative_mask mask) |
1910 { | 1914 { |
1911 return mk_attr_alt (mask); | 1915 return mk_attr_alt (mask); |
1912 } | 1916 } |
1913 | 1917 |
1914 /* If we are processing an (eq_attr "attr" "value") test, we find the value | 1918 /* If we are processing an (eq_attr "attr" "value") test, we find the value |
2283 /* Returns true if S1 is a subset of S2. */ | 2287 /* Returns true if S1 is a subset of S2. */ |
2284 | 2288 |
2285 static bool | 2289 static bool |
2286 attr_alt_subset_p (rtx s1, rtx s2) | 2290 attr_alt_subset_p (rtx s1, rtx s2) |
2287 { | 2291 { |
2288 switch ((XINT (s1, 1) << 1) | XINT (s2, 1)) | 2292 switch ((XWINT (s1, 1) << 1) | XWINT (s2, 1)) |
2289 { | 2293 { |
2290 case (0 << 1) | 0: | 2294 case (0 << 1) | 0: |
2291 return !(XINT (s1, 0) &~ XINT (s2, 0)); | 2295 return !(XWINT (s1, 0) &~ XWINT (s2, 0)); |
2292 | 2296 |
2293 case (0 << 1) | 1: | 2297 case (0 << 1) | 1: |
2294 return !(XINT (s1, 0) & XINT (s2, 0)); | 2298 return !(XWINT (s1, 0) & XWINT (s2, 0)); |
2295 | 2299 |
2296 case (1 << 1) | 0: | 2300 case (1 << 1) | 0: |
2297 return false; | 2301 return false; |
2298 | 2302 |
2299 case (1 << 1) | 1: | 2303 case (1 << 1) | 1: |
2300 return !(XINT (s2, 0) &~ XINT (s1, 0)); | 2304 return !(XWINT (s2, 0) &~ XWINT (s1, 0)); |
2301 | 2305 |
2302 default: | 2306 default: |
2303 gcc_unreachable (); | 2307 gcc_unreachable (); |
2304 } | 2308 } |
2305 } | 2309 } |
2307 /* Returns true if S1 is a subset of complement of S2. */ | 2311 /* Returns true if S1 is a subset of complement of S2. */ |
2308 | 2312 |
2309 static bool | 2313 static bool |
2310 attr_alt_subset_of_compl_p (rtx s1, rtx s2) | 2314 attr_alt_subset_of_compl_p (rtx s1, rtx s2) |
2311 { | 2315 { |
2312 switch ((XINT (s1, 1) << 1) | XINT (s2, 1)) | 2316 switch ((XWINT (s1, 1) << 1) | XWINT (s2, 1)) |
2313 { | 2317 { |
2314 case (0 << 1) | 0: | 2318 case (0 << 1) | 0: |
2315 return !(XINT (s1, 0) & XINT (s2, 0)); | 2319 return !(XWINT (s1, 0) & XWINT (s2, 0)); |
2316 | 2320 |
2317 case (0 << 1) | 1: | 2321 case (0 << 1) | 1: |
2318 return !(XINT (s1, 0) & ~XINT (s2, 0)); | 2322 return !(XWINT (s1, 0) & ~XWINT (s2, 0)); |
2319 | 2323 |
2320 case (1 << 1) | 0: | 2324 case (1 << 1) | 0: |
2321 return !(XINT (s2, 0) &~ XINT (s1, 0)); | 2325 return !(XWINT (s2, 0) &~ XWINT (s1, 0)); |
2322 | 2326 |
2323 case (1 << 1) | 1: | 2327 case (1 << 1) | 1: |
2324 return false; | 2328 return false; |
2325 | 2329 |
2326 default: | 2330 default: |
2331 /* Return EQ_ATTR_ALT expression representing intersection of S1 and S2. */ | 2335 /* Return EQ_ATTR_ALT expression representing intersection of S1 and S2. */ |
2332 | 2336 |
2333 static rtx | 2337 static rtx |
2334 attr_alt_intersection (rtx s1, rtx s2) | 2338 attr_alt_intersection (rtx s1, rtx s2) |
2335 { | 2339 { |
2336 int result; | 2340 alternative_mask result; |
2337 | 2341 |
2338 switch ((XINT (s1, 1) << 1) | XINT (s2, 1)) | 2342 switch ((XWINT (s1, 1) << 1) | XWINT (s2, 1)) |
2339 { | 2343 { |
2340 case (0 << 1) | 0: | 2344 case (0 << 1) | 0: |
2341 result = XINT (s1, 0) & XINT (s2, 0); | 2345 result = XWINT (s1, 0) & XWINT (s2, 0); |
2342 break; | 2346 break; |
2343 case (0 << 1) | 1: | 2347 case (0 << 1) | 1: |
2344 result = XINT (s1, 0) & ~XINT (s2, 0); | 2348 result = XWINT (s1, 0) & ~XWINT (s2, 0); |
2345 break; | 2349 break; |
2346 case (1 << 1) | 0: | 2350 case (1 << 1) | 0: |
2347 result = XINT (s2, 0) & ~XINT (s1, 0); | 2351 result = XWINT (s2, 0) & ~XWINT (s1, 0); |
2348 break; | 2352 break; |
2349 case (1 << 1) | 1: | 2353 case (1 << 1) | 1: |
2350 result = XINT (s1, 0) | XINT (s2, 0); | 2354 result = XWINT (s1, 0) | XWINT (s2, 0); |
2351 break; | 2355 break; |
2352 default: | 2356 default: |
2353 gcc_unreachable (); | 2357 gcc_unreachable (); |
2354 } | 2358 } |
2355 | 2359 |
2356 return attr_rtx (EQ_ATTR_ALT, result, XINT (s1, 1) & XINT (s2, 1)); | 2360 return attr_rtx (EQ_ATTR_ALT, result, XWINT (s1, 1) & XWINT (s2, 1)); |
2357 } | 2361 } |
2358 | 2362 |
2359 /* Return EQ_ATTR_ALT expression representing union of S1 and S2. */ | 2363 /* Return EQ_ATTR_ALT expression representing union of S1 and S2. */ |
2360 | 2364 |
2361 static rtx | 2365 static rtx |
2362 attr_alt_union (rtx s1, rtx s2) | 2366 attr_alt_union (rtx s1, rtx s2) |
2363 { | 2367 { |
2364 int result; | 2368 alternative_mask result; |
2365 | 2369 |
2366 switch ((XINT (s1, 1) << 1) | XINT (s2, 1)) | 2370 switch ((XWINT (s1, 1) << 1) | XWINT (s2, 1)) |
2367 { | 2371 { |
2368 case (0 << 1) | 0: | 2372 case (0 << 1) | 0: |
2369 result = XINT (s1, 0) | XINT (s2, 0); | 2373 result = XWINT (s1, 0) | XWINT (s2, 0); |
2370 break; | 2374 break; |
2371 case (0 << 1) | 1: | 2375 case (0 << 1) | 1: |
2372 result = XINT (s2, 0) & ~XINT (s1, 0); | 2376 result = XWINT (s2, 0) & ~XWINT (s1, 0); |
2373 break; | 2377 break; |
2374 case (1 << 1) | 0: | 2378 case (1 << 1) | 0: |
2375 result = XINT (s1, 0) & ~XINT (s2, 0); | 2379 result = XWINT (s1, 0) & ~XWINT (s2, 0); |
2376 break; | 2380 break; |
2377 case (1 << 1) | 1: | 2381 case (1 << 1) | 1: |
2378 result = XINT (s1, 0) & XINT (s2, 0); | 2382 result = XWINT (s1, 0) & XWINT (s2, 0); |
2379 break; | 2383 break; |
2380 default: | 2384 default: |
2381 gcc_unreachable (); | 2385 gcc_unreachable (); |
2382 } | 2386 } |
2383 | 2387 |
2384 return attr_rtx (EQ_ATTR_ALT, result, XINT (s1, 1) | XINT (s2, 1)); | 2388 return attr_rtx (EQ_ATTR_ALT, result, XWINT (s1, 1) | XWINT (s2, 1)); |
2385 } | 2389 } |
2386 | 2390 |
2387 /* Return EQ_ATTR_ALT expression representing complement of S. */ | 2391 /* Return EQ_ATTR_ALT expression representing complement of S. */ |
2388 | 2392 |
2389 static rtx | 2393 static rtx |
2390 attr_alt_complement (rtx s) | 2394 attr_alt_complement (rtx s) |
2391 { | 2395 { |
2392 return attr_rtx (EQ_ATTR_ALT, XINT (s, 0), 1 - XINT (s, 1)); | 2396 return attr_rtx (EQ_ATTR_ALT, XWINT (s, 0), |
2397 ((HOST_WIDE_INT) 1) - XWINT (s, 1)); | |
2393 } | 2398 } |
2394 | 2399 |
2395 /* Return EQ_ATTR_ALT expression representing set containing elements set | 2400 /* Return EQ_ATTR_ALT expression representing set containing elements set |
2396 in E. */ | 2401 in E. */ |
2397 | 2402 |
2398 static rtx | 2403 static rtx |
2399 mk_attr_alt (uint64_t e) | 2404 mk_attr_alt (alternative_mask e) |
2400 { | 2405 { |
2401 return attr_rtx (EQ_ATTR_ALT, (int)e, 0); | 2406 return attr_rtx (EQ_ATTR_ALT, (HOST_WIDE_INT) e, (HOST_WIDE_INT) 0); |
2402 } | 2407 } |
2403 | 2408 |
2404 /* Given an expression, see if it can be simplified for a particular insn | 2409 /* Given an expression, see if it can be simplified for a particular insn |
2405 code based on the values of other attributes being tested. This can | 2410 code based on the values of other attributes being tested. This can |
2406 eliminate nested get_attr_... calls. | 2411 eliminate nested get_attr_... calls. |
2416 rtx left, right; | 2421 rtx left, right; |
2417 struct attr_desc *attr; | 2422 struct attr_desc *attr; |
2418 struct attr_value *av; | 2423 struct attr_value *av; |
2419 struct insn_ent *ie; | 2424 struct insn_ent *ie; |
2420 struct attr_value_list *iv; | 2425 struct attr_value_list *iv; |
2421 uint64_t i; | 2426 alternative_mask i; |
2422 rtx newexp = exp; | 2427 rtx newexp = exp; |
2423 bool left_alt, right_alt; | 2428 bool left_alt, right_alt; |
2424 | 2429 |
2425 /* Don't re-simplify something we already simplified. */ | 2430 /* Don't re-simplify something we already simplified. */ |
2426 if (ATTR_IND_SIMPLIFIED_P (exp) || ATTR_CURR_SIMPLIFIED_P (exp)) | 2431 if (ATTR_IND_SIMPLIFIED_P (exp) || ATTR_CURR_SIMPLIFIED_P (exp)) |
2481 if (GET_CODE (left) == NOT) | 2486 if (GET_CODE (left) == NOT) |
2482 left_alt = (GET_CODE (XEXP (left, 0)) == EQ_ATTR | 2487 left_alt = (GET_CODE (XEXP (left, 0)) == EQ_ATTR |
2483 && XSTR (XEXP (left, 0), 0) == alternative_name); | 2488 && XSTR (XEXP (left, 0), 0) == alternative_name); |
2484 else | 2489 else |
2485 left_alt = (GET_CODE (left) == EQ_ATTR_ALT | 2490 left_alt = (GET_CODE (left) == EQ_ATTR_ALT |
2486 && XINT (left, 1)); | 2491 && XWINT (left, 1)); |
2487 | 2492 |
2488 if (GET_CODE (right) == NOT) | 2493 if (GET_CODE (right) == NOT) |
2489 right_alt = (GET_CODE (XEXP (right, 0)) == EQ_ATTR | 2494 right_alt = (GET_CODE (XEXP (right, 0)) == EQ_ATTR |
2490 && XSTR (XEXP (right, 0), 0) == alternative_name); | 2495 && XSTR (XEXP (right, 0), 0) == alternative_name); |
2491 else | 2496 else |
2492 right_alt = (GET_CODE (right) == EQ_ATTR_ALT | 2497 right_alt = (GET_CODE (right) == EQ_ATTR_ALT |
2493 && XINT (right, 1)); | 2498 && XWINT (right, 1)); |
2494 | 2499 |
2495 if (insn_code >= 0 | 2500 if (insn_code >= 0 |
2496 && (GET_CODE (left) == AND | 2501 && (GET_CODE (left) == AND |
2497 || left_alt | 2502 || left_alt |
2498 || GET_CODE (right) == AND | 2503 || GET_CODE (right) == AND |
2599 in this tree. Optimize if so. */ | 2604 in this tree. Optimize if so. */ |
2600 | 2605 |
2601 else if (insn_code >= 0 | 2606 else if (insn_code >= 0 |
2602 && (GET_CODE (left) == IOR | 2607 && (GET_CODE (left) == IOR |
2603 || (GET_CODE (left) == EQ_ATTR_ALT | 2608 || (GET_CODE (left) == EQ_ATTR_ALT |
2604 && !XINT (left, 1)) | 2609 && !XWINT (left, 1)) |
2605 || (GET_CODE (left) == EQ_ATTR | 2610 || (GET_CODE (left) == EQ_ATTR |
2606 && XSTR (left, 0) == alternative_name) | 2611 && XSTR (left, 0) == alternative_name) |
2607 || GET_CODE (right) == IOR | 2612 || GET_CODE (right) == IOR |
2608 || (GET_CODE (right) == EQ_ATTR_ALT | 2613 || (GET_CODE (right) == EQ_ATTR_ALT |
2609 && !XINT (right, 1)) | 2614 && !XWINT (right, 1)) |
2610 || (GET_CODE (right) == EQ_ATTR | 2615 || (GET_CODE (right) == EQ_ATTR |
2611 && XSTR (right, 0) == alternative_name))) | 2616 && XSTR (right, 0) == alternative_name))) |
2612 { | 2617 { |
2613 i = compute_alternative_mask (exp, IOR); | 2618 i = compute_alternative_mask (exp, IOR); |
2614 if (i & ~insn_alternatives[insn_code]) | 2619 if (i & ~insn_alternatives[insn_code]) |
2685 newexp = attr_rtx (NOT, left); | 2690 newexp = attr_rtx (NOT, left); |
2686 } | 2691 } |
2687 break; | 2692 break; |
2688 | 2693 |
2689 case EQ_ATTR_ALT: | 2694 case EQ_ATTR_ALT: |
2690 if (!XINT (exp, 0)) | 2695 if (!XWINT (exp, 0)) |
2691 return XINT (exp, 1) ? true_rtx : false_rtx; | 2696 return XWINT (exp, 1) ? true_rtx : false_rtx; |
2692 break; | 2697 break; |
2693 | 2698 |
2694 case EQ_ATTR: | 2699 case EQ_ATTR: |
2695 if (XSTR (exp, 0) == alternative_name) | 2700 if (XSTR (exp, 0) == alternative_name) |
2696 { | 2701 { |
2697 newexp = mk_attr_alt (((uint64_t) 1) << atoi (XSTR (exp, 1))); | 2702 newexp = mk_attr_alt (((alternative_mask) 1) |
2703 << atoi (XSTR (exp, 1))); | |
2698 break; | 2704 break; |
2699 } | 2705 } |
2700 | 2706 |
2701 /* Look at the value for this insn code in the specified attribute. | 2707 /* Look at the value for this insn code in the specified attribute. |
2702 We normally can replace this comparison with the condition that | 2708 We normally can replace this comparison with the condition that |
3565 write_test_expr (outf, XEXP (exp, 0), attrs_cached, flags); | 3571 write_test_expr (outf, XEXP (exp, 0), attrs_cached, flags); |
3566 break; | 3572 break; |
3567 | 3573 |
3568 case EQ_ATTR_ALT: | 3574 case EQ_ATTR_ALT: |
3569 { | 3575 { |
3570 int set = XINT (exp, 0), bit = 0; | 3576 alternative_mask set = XWINT (exp, 0); |
3577 int bit = 0; | |
3571 | 3578 |
3572 if (flags & FLG_BITWISE) | 3579 if (flags & FLG_BITWISE) |
3573 fatal ("EQ_ATTR_ALT not valid inside comparison"); | 3580 fatal ("EQ_ATTR_ALT not valid inside comparison"); |
3574 | 3581 |
3575 if (!set) | 3582 if (!set) |
3576 fatal ("Empty EQ_ATTR_ALT should be optimized out"); | 3583 fatal ("Empty EQ_ATTR_ALT should be optimized out"); |
3577 | 3584 |
3578 if (!(set & (set - 1))) | 3585 if (!(set & (set - 1))) |
3579 { | 3586 { |
3587 if (!(set & 0xffffffff)) | |
3588 { | |
3589 bit += 32; | |
3590 set >>= 32; | |
3591 } | |
3580 if (!(set & 0xffff)) | 3592 if (!(set & 0xffff)) |
3581 { | 3593 { |
3582 bit += 16; | 3594 bit += 16; |
3583 set >>= 16; | 3595 set >>= 16; |
3584 } | 3596 } |
3599 } | 3611 } |
3600 if (!(set & 1)) | 3612 if (!(set & 1)) |
3601 bit++; | 3613 bit++; |
3602 | 3614 |
3603 fprintf (outf, "which_alternative %s= %d", | 3615 fprintf (outf, "which_alternative %s= %d", |
3604 XINT (exp, 1) ? "!" : "=", bit); | 3616 XWINT (exp, 1) ? "!" : "=", bit); |
3605 } | 3617 } |
3606 else | 3618 else |
3607 { | 3619 { |
3608 fprintf (outf, "%s((1 << which_alternative) & %#x)", | 3620 fprintf (outf, "%s((1ULL << which_alternative) & %#" PRIx64 |
3609 XINT (exp, 1) ? "!" : "", set); | 3621 "ULL)", |
3622 XWINT (exp, 1) ? "!" : "", set); | |
3610 } | 3623 } |
3611 } | 3624 } |
3612 break; | 3625 break; |
3613 | 3626 |
3614 /* Comparison test of an attribute with a value. Most of these will | 3627 /* Comparison test of an attribute with a value. Most of these will |
5070 write_header (FILE *outf) | 5083 write_header (FILE *outf) |
5071 { | 5084 { |
5072 fprintf (outf, "/* Generated automatically by the program `genattrtab'\n" | 5085 fprintf (outf, "/* Generated automatically by the program `genattrtab'\n" |
5073 " from the machine description file `md'. */\n\n"); | 5086 " from the machine description file `md'. */\n\n"); |
5074 | 5087 |
5088 fprintf (outf, "#define IN_TARGET_CODE 1\n"); | |
5075 fprintf (outf, "#include \"config.h\"\n"); | 5089 fprintf (outf, "#include \"config.h\"\n"); |
5076 fprintf (outf, "#include \"system.h\"\n"); | 5090 fprintf (outf, "#include \"system.h\"\n"); |
5077 fprintf (outf, "#include \"coretypes.h\"\n"); | 5091 fprintf (outf, "#include \"coretypes.h\"\n"); |
5078 fprintf (outf, "#include \"backend.h\"\n"); | 5092 fprintf (outf, "#include \"backend.h\"\n"); |
5079 fprintf (outf, "#include \"predict.h\"\n"); | 5093 fprintf (outf, "#include \"predict.h\"\n"); |
5216 /* Expand DEFINE_DELAY information into new attribute. */ | 5230 /* Expand DEFINE_DELAY information into new attribute. */ |
5217 expand_delays (); | 5231 expand_delays (); |
5218 | 5232 |
5219 /* Make `insn_alternatives'. */ | 5233 /* Make `insn_alternatives'. */ |
5220 int num_insn_codes = get_num_insn_codes (); | 5234 int num_insn_codes = get_num_insn_codes (); |
5221 insn_alternatives = oballocvec (uint64_t, num_insn_codes); | 5235 insn_alternatives = oballocvec (alternative_mask, num_insn_codes); |
5222 for (id = defs; id; id = id->next) | 5236 for (id = defs; id; id = id->next) |
5223 if (id->insn_code >= 0) | 5237 if (id->insn_code >= 0) |
5224 insn_alternatives[id->insn_code] | 5238 insn_alternatives[id->insn_code] |
5225 = (((uint64_t) 1) << id->num_alternatives) - 1; | 5239 = (((alternative_mask) 1) << id->num_alternatives) - 1; |
5226 | 5240 |
5227 /* Make `insn_n_alternatives'. */ | 5241 /* Make `insn_n_alternatives'. */ |
5228 insn_n_alternatives = oballocvec (int, num_insn_codes); | 5242 insn_n_alternatives = oballocvec (int, num_insn_codes); |
5229 for (id = defs; id; id = id->next) | 5243 for (id = defs; id; id = id->next) |
5230 if (id->insn_code >= 0) | 5244 if (id->insn_code >= 0) |