Commit 24277d34 by Alexandre Oliva Committed by Alexandre Oliva

var-tracking.c (dv_is_decl_p): Adjust NULL behavior to match comment.

* 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.

From-SVN: r151432
parent 5f1a9ebb
2009-09-04 Alexandre Oliva <aoliva@redhat.com>
* 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 <rguenther@suse.de> 2009-09-04 Richard Guenther <rguenther@suse.de>
PR middle-end/41257 PR middle-end/41257
......
...@@ -723,12 +723,24 @@ static inline bool ...@@ -723,12 +723,24 @@ static inline bool
dv_is_decl_p (decl_or_value dv) dv_is_decl_p (decl_or_value dv)
{ {
if (!dv) if (!dv)
return false; return true;
if (GET_CODE ((rtx)dv) == VALUE) /* Make sure relevant codes don't overlap. */
return false; 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. */ /* Return true if a decl_or_value is a VALUE rtl. */
...@@ -790,21 +802,13 @@ dv_pool (decl_or_value dv) ...@@ -790,21 +802,13 @@ dv_pool (decl_or_value dv)
return dv_onepart_p (dv) ? valvar_pool : var_pool; 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. */ /* Build a decl_or_value out of a decl. */
static inline decl_or_value static inline decl_or_value
dv_from_decl (tree decl) dv_from_decl (tree decl)
{ {
decl_or_value dv; decl_or_value dv;
gcc_assert (!decl || IS_DECL_CODE (TREE_CODE (decl)));
dv = decl; dv = decl;
gcc_assert (dv_is_decl_p (dv));
return dv; return dv;
} }
...@@ -813,8 +817,8 @@ static inline decl_or_value ...@@ -813,8 +817,8 @@ static inline decl_or_value
dv_from_value (rtx value) dv_from_value (rtx value)
{ {
decl_or_value dv; decl_or_value dv;
gcc_assert (value);
dv = value; dv = value;
gcc_assert (dv_is_value_p (dv));
return dv; return dv;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment