This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH RFC] gimplefe: expose MULT_HIGHPART_EXPR


For testing generic expansion of MULT_HIGHPART_EXPR I chose to expose it
via the GIMPLE FE with the following patch.

"h*" is how tree-pretty-print dumps MULT_HIGHPART_EXPR.

This patch accepts "h<whitespace>*" which ideally shouldn't happen, but
I don't see a simple way to fix that.

Is this desirable for trunk?

Is there general policy for how fancy tree codes should be exposed in
the GIMPLE FE?

	* c/gimple-parser.c (c_parser_gimple_statement): Add "h*" for
	MULT_HIGHPART_EXPR.

diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index 1be5d14dc2d..cf05c936166 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -450,6 +450,7 @@ c_parser_gimple_statement (c_parser *parser, gimple_seq *seq)
 
    gimple-binary-expression:
      gimple-unary-expression * gimple-unary-expression
+     gimple-unary-expression h* gimple-unary-expression
      gimple-unary-expression / gimple-unary-expression
      gimple-unary-expression % gimple-unary-expression
      gimple-unary-expression + gimple-unary-expression
@@ -544,6 +545,18 @@ c_parser_gimple_binary_expression (c_parser *parser)
     case CPP_OR_OR:
       c_parser_error (parser, "%<||%> not valid in GIMPLE");
       return ret;
+    case CPP_NAME:
+	{
+	  tree id = c_parser_peek_token (parser)->value;
+	  if (strcmp (IDENTIFIER_POINTER (id), "h") == 0
+	      && c_parser_peek_2nd_token (parser)->type == CPP_MULT)
+	    {
+	      c_parser_consume_token (parser);
+	      code = MULT_HIGHPART_EXPR;
+	      break;
+	    }
+	}
+      /* Fallthru.  */
     default:
       /* Not a binary expression.  */
       return lhs;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]