From 5d8a44e03a2619c1ef2f61b9cbe41e45183865c7 Mon Sep 17 00:00:00 2001 From: aoliva Date: Fri, 4 Sep 2009 18:55:25 +0000 Subject: [PATCH] * var-tracking.c (dv_is_decl_p): Adjust NULL behavior to match comment. Use switch statement to catch overlaps between rtx and tree codes. Accept FUNCTION_DECLs in addition to those in... (IS_DECL_CODE): ... here. Remove. (check_value_is_not_decl): Remove. (dv_from_decl, dv_from_value): Check after conversion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151432 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/var-tracking.c | 32 ++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6af6c2b1ab0..ceafb4536ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-09-04 Alexandre Oliva + + * var-tracking.c (dv_is_decl_p): Adjust NULL behavior to match + comment. Use switch statement to catch overlaps between rtx + and tree codes. Accept FUNCTION_DECLs in addition to those in... + (IS_DECL_CODE): ... here. Remove. + (check_value_is_not_decl): Remove. + (dv_from_decl, dv_from_value): Check after conversion. + 2009-09-04 Richard Guenther PR middle-end/41257 diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 4d30324569b..475ba57553e 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -723,12 +723,24 @@ static inline bool dv_is_decl_p (decl_or_value dv) { if (!dv) - return false; + return true; - if (GET_CODE ((rtx)dv) == VALUE) - return false; + /* 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)COMPONENT_REF: + return true; - return true; + case (int)VALUE: + return false; + + default: + gcc_unreachable (); + } } /* Return true if a decl_or_value is a VALUE rtl. */ @@ -790,21 +802,13 @@ dv_pool (decl_or_value dv) return dv_onepart_p (dv) ? valvar_pool : var_pool; } -#define IS_DECL_CODE(C) ((C) == VAR_DECL || (C) == PARM_DECL \ - || (C) == RESULT_DECL || (C) == COMPONENT_REF) - -/* Check that VALUE won't ever look like a DECL. */ -static char check_value_is_not_decl [(!IS_DECL_CODE ((enum tree_code)VALUE)) - ? 1 : -1] ATTRIBUTE_UNUSED; - - /* Build a decl_or_value out of a decl. */ static inline decl_or_value dv_from_decl (tree decl) { decl_or_value dv; - gcc_assert (!decl || IS_DECL_CODE (TREE_CODE (decl))); dv = decl; + gcc_assert (dv_is_decl_p (dv)); return dv; } @@ -813,8 +817,8 @@ static inline decl_or_value dv_from_value (rtx value) { decl_or_value dv; - gcc_assert (value); dv = value; + gcc_assert (dv_is_value_p (dv)); return dv; } -- 2.11.0