This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for STRIP_MAIN_TYPE_NOPS
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 13 May 2003 14:50:42 -0400
- Subject: PATCH for STRIP_MAIN_TYPE_NOPS
Sometimes we don't care about the cv-qualification of an expression, but we
do care about its type identity. So we want something stronger than
STRIP_SIGN_NOPS, but not quite as strong as STRIP_TYPE_NOPS.
Applied to trunk and tree-ssa.
2003-05-13 Jason Merrill <jason@redhat.com>
* tree.h (STRIP_MAIN_TYPE_NOPS): New macro.
*** tree.h.~1~ 2003-05-12 05:09:05.000000000 -0400
--- tree.h 2003-05-09 01:01:37.000000000 -0400
*************** extern void tree_operand_check_failed PA
*** 488,493 ****
--- 488,504 ----
== TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
(EXP) = TREE_OPERAND (EXP, 0)
+ /* Like STRIP_NOPS, but don't alter the TREE_TYPE main variant either. */
+
+ #define STRIP_MAIN_TYPE_NOPS(EXP) \
+ while ((TREE_CODE (EXP) == NOP_EXPR \
+ || TREE_CODE (EXP) == CONVERT_EXPR \
+ || TREE_CODE (EXP) == NON_LVALUE_EXPR) \
+ && TREE_OPERAND (EXP, 0) != error_mark_node \
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (EXP)) \
+ == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
+ (EXP) = TREE_OPERAND (EXP, 0)
+
/* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */
#define STRIP_TYPE_NOPS(EXP) \