comparison gcc/genattrtab.c @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
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, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2 Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc.
4 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) 5 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 6
6 This file is part of GCC. 7 This file is part of GCC.
7 8
8 GCC is free software; you can redistribute it and/or modify it under 9 GCC is free software; you can redistribute it and/or modify it under
316 #define RTL_HASH_SIZE 4093 317 #define RTL_HASH_SIZE 4093
317 static struct attr_hash *attr_hash_table[RTL_HASH_SIZE]; 318 static struct attr_hash *attr_hash_table[RTL_HASH_SIZE];
318 319
319 /* Here is how primitive or already-shared RTL's hash 320 /* Here is how primitive or already-shared RTL's hash
320 codes are made. */ 321 codes are made. */
321 #define RTL_HASH(RTL) ((long) (RTL) & 0777777) 322 #define RTL_HASH(RTL) ((intptr_t) (RTL) & 0777777)
322 323
323 /* Add an entry to the hash table for RTL with hash code HASHCODE. */ 324 /* Add an entry to the hash table for RTL with hash code HASHCODE. */
324 325
325 static void 326 static void
326 attr_hash_add_rtx (int hashcode, rtx rtl) 327 attr_hash_add_rtx (int hashcode, rtx rtl)
1635 { 1636 {
1636 length_or = ~length_or; 1637 length_or = ~length_or;
1637 for (length_unit_log = 0; length_or & 1; length_or >>= 1) 1638 for (length_unit_log = 0; length_or & 1; length_or >>= 1)
1638 length_unit_log++; 1639 length_unit_log++;
1639 } 1640 }
1640 printf ("const int length_unit_log = %u;\n", length_unit_log); 1641 printf ("EXPORTED_CONST int length_unit_log = %u;\n", length_unit_log);
1641 } 1642 }
1642 1643
1643 /* Take a COND expression and see if any of the conditions in it can be 1644 /* Take a COND expression and see if any of the conditions in it can be
1644 simplified. If any are known true or known false for the particular insn 1645 simplified. If any are known true or known false for the particular insn
1645 code, the COND can be further simplified. 1646 code, the COND can be further simplified.
1938 if (! strcmp_check (XSTR (value, 0), XSTR (exp, 1))) 1939 if (! strcmp_check (XSTR (value, 0), XSTR (exp, 1)))
1939 newexp = true_rtx; 1940 newexp = true_rtx;
1940 else 1941 else
1941 newexp = false_rtx; 1942 newexp = false_rtx;
1942 break; 1943 break;
1943 1944
1944 case SYMBOL_REF: 1945 case SYMBOL_REF:
1945 { 1946 {
1946 char *p; 1947 char *p;
1947 char string[256]; 1948 char string[256];
1948 1949
1949 gcc_assert (GET_CODE (exp) == EQ_ATTR); 1950 gcc_assert (GET_CODE (exp) == EQ_ATTR);
1950 gcc_assert (strlen (XSTR (exp, 0)) + strlen (XSTR (exp, 1)) + 2 1951 gcc_assert (strlen (XSTR (exp, 0)) + strlen (XSTR (exp, 1)) + 2
1951 <= 256); 1952 <= 256);
1952 1953
1953 strcpy (string, XSTR (exp, 0)); 1954 strcpy (string, XSTR (exp, 0));
1954 strcat (string, "_"); 1955 strcat (string, "_");
1955 strcat (string, XSTR (exp, 1)); 1956 strcat (string, XSTR (exp, 1));
1956 for (p = string; *p; p++) 1957 for (p = string; *p; p++)
1957 *p = TOUPPER (*p); 1958 *p = TOUPPER (*p);
1958 1959
1959 newexp = attr_rtx (EQ, value, 1960 newexp = attr_rtx (EQ, value,
1960 attr_rtx (SYMBOL_REF, 1961 attr_rtx (SYMBOL_REF,
1961 DEF_ATTR_STRING (string))); 1962 DEF_ATTR_STRING (string)));
1962 break; 1963 break;
1963 } 1964 }
1964 1965
1965 case COND: 1966 case COND:
1966 /* We construct an IOR of all the cases for which the 1967 /* We construct an IOR of all the cases for which the
1967 requested attribute value is present. Since we start with 1968 requested attribute value is present. Since we start with
1968 FALSE, if it is not present, FALSE will be returned. 1969 FALSE, if it is not present, FALSE will be returned.
1969 1970
1970 Each case is the AND of the NOT's of the previous conditions with the 1971 Each case is the AND of the NOT's of the previous conditions with the
1971 current condition; in the default case the current condition is TRUE. 1972 current condition; in the default case the current condition is TRUE.
1972 1973
1973 For each possible COND value, call ourselves recursively. 1974 For each possible COND value, call ourselves recursively.
1974 1975
1975 The extra TRUE and FALSE expressions will be eliminated by another 1976 The extra TRUE and FALSE expressions will be eliminated by another
1976 call to the simplification routine. */ 1977 call to the simplification routine. */
1977 1978
1978 orexp = false_rtx; 1979 orexp = false_rtx;
1979 andexp = true_rtx; 1980 andexp = true_rtx;
2105 if (attr_alt_subset_of_compl_p (*pterm, exp)) 2106 if (attr_alt_subset_of_compl_p (*pterm, exp))
2106 return false_rtx; 2107 return false_rtx;
2107 2108
2108 if (attr_alt_subset_p (exp, *pterm)) 2109 if (attr_alt_subset_p (exp, *pterm))
2109 *pterm = true_rtx; 2110 *pterm = true_rtx;
2110 2111
2111 return exp; 2112 return exp;
2112 } 2113 }
2113 2114
2114 else if (GET_CODE (exp) == EQ_ATTR && GET_CODE (*pterm) == EQ_ATTR) 2115 else if (GET_CODE (exp) == EQ_ATTR && GET_CODE (*pterm) == EQ_ATTR)
2115 { 2116 {
4304 decl->default_latency = XINT (def, 1); 4305 decl->default_latency = XINT (def, 1);
4305 decl->condexp = check_attr_test (XEXP (def, 2), 0, 0); 4306 decl->condexp = check_attr_test (XEXP (def, 2), 0, 0);
4306 decl->insn_num = n_insn_reservs; 4307 decl->insn_num = n_insn_reservs;
4307 decl->bypassed = false; 4308 decl->bypassed = false;
4308 decl->next = 0; 4309 decl->next = 0;
4309 4310
4310 *last_insn_reserv_p = decl; 4311 *last_insn_reserv_p = decl;
4311 last_insn_reserv_p = &decl->next; 4312 last_insn_reserv_p = &decl->next;
4312 n_insn_reservs++; 4313 n_insn_reservs++;
4313 } 4314 }
4314 4315
4389 if (n_insn_reservs == 0) 4390 if (n_insn_reservs == 0)
4390 return; 4391 return;
4391 4392
4392 code_exp = rtx_alloc (COND); 4393 code_exp = rtx_alloc (COND);
4393 lats_exp = rtx_alloc (COND); 4394 lats_exp = rtx_alloc (COND);
4394 4395
4395 XVEC (code_exp, 0) = rtvec_alloc (n_insn_reservs * 2); 4396 XVEC (code_exp, 0) = rtvec_alloc (n_insn_reservs * 2);
4396 XVEC (lats_exp, 0) = rtvec_alloc (n_insn_reservs * 2); 4397 XVEC (lats_exp, 0) = rtvec_alloc (n_insn_reservs * 2);
4397 4398
4398 XEXP (code_exp, 1) = make_numeric_value (n_insn_reservs + 1); 4399 XEXP (code_exp, 1) = make_numeric_value (n_insn_reservs + 1);
4399 XEXP (lats_exp, 1) = make_numeric_value (0); 4400 XEXP (lats_exp, 1) = make_numeric_value (0);
4402 decl; 4403 decl;
4403 decl = decl->next, i += 2) 4404 decl = decl->next, i += 2)
4404 { 4405 {
4405 XVECEXP (code_exp, 0, i) = decl->condexp; 4406 XVECEXP (code_exp, 0, i) = decl->condexp;
4406 XVECEXP (lats_exp, 0, i) = decl->condexp; 4407 XVECEXP (lats_exp, 0, i) = decl->condexp;
4407 4408
4408 XVECEXP (code_exp, 0, i+1) = make_numeric_value (decl->insn_num); 4409 XVECEXP (code_exp, 0, i+1) = make_numeric_value (decl->insn_num);
4409 XVECEXP (lats_exp, 0, i+1) = make_numeric_value (decl->default_latency); 4410 XVECEXP (lats_exp, 0, i+1) = make_numeric_value (decl->default_latency);
4410 } 4411 }
4411 4412
4412 if (n_bypasses == 0) 4413 if (n_bypasses == 0)