diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-01-21 01:39:57 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-01-21 01:39:57 +0100 |
commit | a85caf9e0bafa1be233b7b6d864ee96ae2dce042 (patch) | |
tree | 0b400aa654c131eb52ad2bd56d6fc35e961de71d /gcc | |
parent | a22d08aabf99a7886a9f7023b899a49c82d9b859 (diff) | |
download | gcc-a85caf9e0bafa1be233b7b6d864ee96ae2dce042.zip gcc-a85caf9e0bafa1be233b7b6d864ee96ae2dce042.tar.gz gcc-a85caf9e0bafa1be233b7b6d864ee96ae2dce042.tar.bz2 |
var-tracking.c (check_value_val): Add a compile time assertion.
* var-tracking.c (check_value_val): Add a compile time assertion.
(dv_is_decl_p): Simplify.
(dv_as_decl, dv_as_value, dv_from_decl, dv_from_value): Only use
gcc_assert if ENABLE_CHECKING.
From-SVN: r156101
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/var-tracking.c | 36 |
2 files changed, 23 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b926d9e..6726e44 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-01-20 Jakub Jelinek <jakub@redhat.com> + + * var-tracking.c (check_value_val): Add a compile time assertion. + (dv_is_decl_p): Simplify. + (dv_as_decl, dv_as_value, dv_from_decl, dv_from_value): Only use + gcc_assert if ENABLE_CHECKING. + 2010-01-20 Alexandre Oliva <aoliva@redhat.com> PR debug/42782 diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index d3eee44..5ac3222e 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -110,6 +110,13 @@ #include "cselib.h" #include "target.h" +/* var-tracking.c assumes that tree code with the same value as VALUE rtx code + has no chance to appear in REG_EXPR/MEM_EXPRs and isn't a decl. + Currently the value is the same as IDENTIFIER_NODE, which has such + a property. If this compile time assertion ever fails, make sure that + the new tree code that equals (int) VALUE has the same property. */ +extern char check_value_val[(int) VALUE == (int) IDENTIFIER_NODE ? 1 : -1]; + /* Type of micro operation. */ enum micro_operation_type { @@ -723,26 +730,7 @@ adjust_stack_reference (rtx mem, HOST_WIDE_INT adjustment) static inline bool dv_is_decl_p (decl_or_value dv) { - if (!dv) - return true; - - /* Make sure relevant codes don't overlap. */ - switch ((int)TREE_CODE ((tree)dv)) - { - case (int)VAR_DECL: - case (int)PARM_DECL: - case (int)RESULT_DECL: - case (int)FUNCTION_DECL: - case (int)DEBUG_EXPR_DECL: - case (int)COMPONENT_REF: - return true; - - case (int)VALUE: - return false; - - default: - gcc_unreachable (); - } + return !dv || (int) TREE_CODE ((tree) dv) != (int) VALUE; } /* Return true if a decl_or_value is a VALUE rtl. */ @@ -756,7 +744,9 @@ dv_is_value_p (decl_or_value dv) static inline tree dv_as_decl (decl_or_value dv) { +#ifdef ENABLE_CHECKING gcc_assert (dv_is_decl_p (dv)); +#endif return (tree) dv; } @@ -764,7 +754,9 @@ dv_as_decl (decl_or_value dv) static inline rtx dv_as_value (decl_or_value dv) { +#ifdef ENABLE_CHECKING gcc_assert (dv_is_value_p (dv)); +#endif return (rtx)dv; } @@ -810,7 +802,9 @@ dv_from_decl (tree decl) { decl_or_value dv; dv = decl; +#ifdef ENABLE_CHECKING gcc_assert (dv_is_decl_p (dv)); +#endif return dv; } @@ -820,7 +814,9 @@ dv_from_value (rtx value) { decl_or_value dv; dv = value; +#ifdef ENABLE_CHECKING gcc_assert (dv_is_value_p (dv)); +#endif return dv; } |