Mercurial > hg > CbC > CbC_gcc
comparison gcc/rtl.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
1 /* RTL utility routines. | 1 /* RTL utility routines. |
2 Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002, | 2 Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002, |
3 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. | 3 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
4 Free Software Foundation, Inc. | |
4 | 5 |
5 This file is part of GCC. | 6 This file is part of GCC. |
6 | 7 |
7 GCC is free software; you can redistribute it and/or modify it under | 8 GCC is free software; you can redistribute it and/or modify it under |
8 the terms of the GNU General Public License as published by the Free | 9 the terms of the GNU General Public License as published by the Free |
32 #include "rtl.h" | 33 #include "rtl.h" |
33 #include "ggc.h" | 34 #include "ggc.h" |
34 #ifdef GENERATOR_FILE | 35 #ifdef GENERATOR_FILE |
35 # include "errors.h" | 36 # include "errors.h" |
36 #else | 37 #else |
37 # include "toplev.h" | 38 # include "diagnostic-core.h" |
38 #endif | 39 #endif |
39 | 40 |
40 | 41 |
41 /* Indexed by rtx code, gives number of operands for an rtx with that code. | 42 /* Indexed by rtx code, gives number of operands for an rtx with that code. |
42 Does NOT include rtx header data (code and links). */ | 43 Does NOT include rtx header data (code and links). */ |
147 rtvec | 148 rtvec |
148 rtvec_alloc (int n) | 149 rtvec_alloc (int n) |
149 { | 150 { |
150 rtvec rt; | 151 rtvec rt; |
151 | 152 |
152 rt = ggc_alloc_rtvec (n); | 153 rt = ggc_alloc_rtvec_sized (n); |
153 /* Clear out the vector. */ | 154 /* Clear out the vector. */ |
154 memset (&rt->elem[0], 0, n * sizeof (rtx)); | 155 memset (&rt->elem[0], 0, n * sizeof (rtx)); |
155 | 156 |
156 PUT_NUM_ELEM (rt, n); | 157 PUT_NUM_ELEM (rt, n); |
157 | 158 |
191 all the rest is initialized to zero. */ | 192 all the rest is initialized to zero. */ |
192 | 193 |
193 rtx | 194 rtx |
194 rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL) | 195 rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL) |
195 { | 196 { |
196 rtx rt; | 197 rtx rt = ggc_alloc_zone_rtx_def_stat (&rtl_zone, RTX_CODE_SIZE (code) |
197 | 198 PASS_MEM_STAT); |
198 rt = (rtx) ggc_alloc_zone_pass_stat (RTX_CODE_SIZE (code), &rtl_zone); | |
199 | 199 |
200 /* We want to clear everything up to the FLD array. Normally, this | 200 /* We want to clear everything up to the FLD array. Normally, this |
201 is one int, but we don't want to assume that and it isn't very | 201 is one int, but we don't want to assume that and it isn't very |
202 portable anyway; this is. */ | 202 portable anyway; this is. */ |
203 | 203 |
335 | 335 |
336 rtx | 336 rtx |
337 shallow_copy_rtx_stat (const_rtx orig MEM_STAT_DECL) | 337 shallow_copy_rtx_stat (const_rtx orig MEM_STAT_DECL) |
338 { | 338 { |
339 const unsigned int size = rtx_size (orig); | 339 const unsigned int size = rtx_size (orig); |
340 rtx const copy = (rtx) ggc_alloc_zone_pass_stat (size, &rtl_zone); | 340 rtx const copy = ggc_alloc_zone_rtx_def_stat (&rtl_zone, size PASS_MEM_STAT); |
341 return (rtx) memcpy (copy, orig, size); | 341 return (rtx) memcpy (copy, orig, size); |
342 } | 342 } |
343 | 343 |
344 /* Nonzero when we are generating CONCATs. */ | 344 /* Nonzero when we are generating CONCATs. */ |
345 int generating_concat_p; | 345 int generating_concat_p; |
405 case SCRATCH: | 405 case SCRATCH: |
406 case CONST_DOUBLE: | 406 case CONST_DOUBLE: |
407 case CONST_INT: | 407 case CONST_INT: |
408 case CONST_FIXED: | 408 case CONST_FIXED: |
409 return 0; | 409 return 0; |
410 | |
411 case DEBUG_IMPLICIT_PTR: | |
412 return DEBUG_IMPLICIT_PTR_DECL (x) | |
413 == DEBUG_IMPLICIT_PTR_DECL (y); | |
410 | 414 |
411 default: | 415 default: |
412 break; | 416 break; |
413 } | 417 } |
414 | 418 |
426 break; | 430 break; |
427 | 431 |
428 case 'n': | 432 case 'n': |
429 case 'i': | 433 case 'i': |
430 if (XINT (x, i) != XINT (y, i)) | 434 if (XINT (x, i) != XINT (y, i)) |
431 return 0; | 435 { |
436 #ifndef GENERATOR_FILE | |
437 if (((code == ASM_OPERANDS && i == 6) | |
438 || (code == ASM_INPUT && i == 1)) | |
439 && locator_eq (XINT (x, i), XINT (y, i))) | |
440 break; | |
441 #endif | |
442 return 0; | |
443 } | |
432 break; | 444 break; |
433 | 445 |
434 case 'V': | 446 case 'V': |
435 case 'E': | 447 case 'E': |
436 /* Two vectors must have the same length. */ | 448 /* Two vectors must have the same length. */ |
526 case CONST_DOUBLE: | 538 case CONST_DOUBLE: |
527 case CONST_INT: | 539 case CONST_INT: |
528 case CONST_FIXED: | 540 case CONST_FIXED: |
529 return 0; | 541 return 0; |
530 | 542 |
543 case DEBUG_IMPLICIT_PTR: | |
544 return DEBUG_IMPLICIT_PTR_DECL (x) | |
545 == DEBUG_IMPLICIT_PTR_DECL (y); | |
546 | |
531 default: | 547 default: |
532 break; | 548 break; |
533 } | 549 } |
534 | 550 |
535 /* Compare the elements. If any pair of corresponding elements | 551 /* Compare the elements. If any pair of corresponding elements |
546 break; | 562 break; |
547 | 563 |
548 case 'n': | 564 case 'n': |
549 case 'i': | 565 case 'i': |
550 if (XINT (x, i) != XINT (y, i)) | 566 if (XINT (x, i) != XINT (y, i)) |
551 return 0; | 567 { |
568 #ifndef GENERATOR_FILE | |
569 if (((code == ASM_OPERANDS && i == 6) | |
570 || (code == ASM_INPUT && i == 1)) | |
571 && locator_eq (XINT (x, i), XINT (y, i))) | |
572 break; | |
573 #endif | |
574 return 0; | |
575 } | |
552 break; | 576 break; |
553 | 577 |
554 case 'V': | 578 case 'V': |
555 case 'E': | 579 case 'E': |
556 /* Two vectors must have the same length. */ | 580 /* Two vectors must have the same length. */ |
590 default: | 614 default: |
591 gcc_unreachable (); | 615 gcc_unreachable (); |
592 } | 616 } |
593 } | 617 } |
594 return 1; | 618 return 1; |
619 } | |
620 | |
621 /* Iteratively hash rtx X. */ | |
622 | |
623 hashval_t | |
624 iterative_hash_rtx (const_rtx x, hashval_t hash) | |
625 { | |
626 enum rtx_code code; | |
627 enum machine_mode mode; | |
628 int i, j; | |
629 const char *fmt; | |
630 | |
631 if (x == NULL_RTX) | |
632 return hash; | |
633 code = GET_CODE (x); | |
634 hash = iterative_hash_object (code, hash); | |
635 mode = GET_MODE (x); | |
636 hash = iterative_hash_object (mode, hash); | |
637 switch (code) | |
638 { | |
639 case REG: | |
640 i = REGNO (x); | |
641 return iterative_hash_object (i, hash); | |
642 case CONST_INT: | |
643 return iterative_hash_object (INTVAL (x), hash); | |
644 case SYMBOL_REF: | |
645 if (XSTR (x, 0)) | |
646 return iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1, | |
647 hash); | |
648 return hash; | |
649 case LABEL_REF: | |
650 case DEBUG_EXPR: | |
651 case VALUE: | |
652 case SCRATCH: | |
653 case CONST_DOUBLE: | |
654 case CONST_FIXED: | |
655 case DEBUG_IMPLICIT_PTR: | |
656 return hash; | |
657 default: | |
658 break; | |
659 } | |
660 | |
661 fmt = GET_RTX_FORMAT (code); | |
662 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) | |
663 switch (fmt[i]) | |
664 { | |
665 case 'w': | |
666 hash = iterative_hash_object (XWINT (x, i), hash); | |
667 break; | |
668 case 'n': | |
669 case 'i': | |
670 hash = iterative_hash_object (XINT (x, i), hash); | |
671 break; | |
672 case 'V': | |
673 case 'E': | |
674 j = XVECLEN (x, i); | |
675 hash = iterative_hash_object (j, hash); | |
676 for (j = 0; j < XVECLEN (x, i); j++) | |
677 hash = iterative_hash_rtx (XVECEXP (x, i, j), hash); | |
678 break; | |
679 case 'e': | |
680 hash = iterative_hash_rtx (XEXP (x, i), hash); | |
681 break; | |
682 case 'S': | |
683 case 's': | |
684 if (XSTR (x, i)) | |
685 hash = iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1, | |
686 hash); | |
687 break; | |
688 default: | |
689 break; | |
690 } | |
691 return hash; | |
595 } | 692 } |
596 | 693 |
597 void | 694 void |
598 dump_rtx_statistics (void) | 695 dump_rtx_statistics (void) |
599 { | 696 { |