On Mon, Apr 13, 2015 at 05:46:35PM +0200, Toon Moene wrote:
> [ Patch elided ]
> 
> The patch applied cleanly - this is what I got as a result:
> 
> https://gcc.gnu.org/ml/gcc-testresults/2015-04/msg01450.html
> 
> I hope this is useful.

Looks like the http://gcc.gnu.org/ml/gcc-patches/2014-08/msg01014.html
patch is bad, including a header of one particular FE in the middle-end
is just wrong.

#define TYPE_PTR_P(NODE)                        \
  (TREE_CODE (NODE) == POINTER_TYPE)

#define TYPE_OBJ_P(NODE)                        \
  (TREE_CODE (NODE) != REFERENCE_TYPE           \
   && !VOID_TYPE_P (NODE)                       \
   && TREE_CODE (NODE) != FUNCTION_TYPE         \
   && TREE_CODE (NODE) != METHOD_TYPE)

#define TYPE_PTROB_P(NODE)                                      \
  (TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE)))

is nothing that one couldn't just open-code in the middle-end,
like
  if (TREE_CODE (scev) == SSA_NAME
      && TREE_CODE (TREE_TYPE (scev)) == POINTER_TYPE
      && TREE_CODE (TREE_TYPE (TREE_TYPE ((scev)))) != REFERENCE_TYPE
      && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE ((scev))))
      && TREE_CODE (TREE_TYPE (TREE_TYPE ((scev)))) != FUNCTION_TYPE
      && TREE_CODE (TREE_TYPE (TREE_TYPE ((scev)))) != METHOD_TYPE)
but it is unclear why you want this check.  For the middle-end, most pointer
conversions are useless, so the distinction between pointers to objects and
pointers to something different, might be long time lost.
Don't you want just
  if (TREE_CODE (scev) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (scev)))
instead (i.e. just give up on all pointers/references)?  That is what the
middle-end usually tests...

        Jakub

Reply via email to