Commit 7af4b20d by Richard Biener Committed by Richard Biener

gimple-parser.c (c_parser_gimple_expr_list): Simplify.

2017-02-07  Richard Biener  <rguenther@suse.de>

	c/
	* gimple-parser.c (c_parser_gimple_expr_list): Simplify.
	(c_parser_gimple_postfix_expression_after_primary):
	Do not use c_build_function_call_vec to avoid folding and promotion.
	Simplify.

	* gcc.dg/gimplefe-23.c: New testcase.
	* gcc.dg/gimplefe-24.c: Likewise.

From-SVN: r245244
parent a4166fe5
2017-02-07 Richard Biener <rguenther@suse.de>
* gimple-parser.c (c_parser_gimple_expr_list): Simplify.
(c_parser_gimple_postfix_expression_after_primary):
Do not use c_build_function_call_vec to avoid folding and promotion.
Simplify.
2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com> 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
PR lto/79061 PR lto/79061
......
...@@ -73,8 +73,7 @@ static void c_parser_gimple_switch_stmt (c_parser *, gimple_seq *); ...@@ -73,8 +73,7 @@ static void c_parser_gimple_switch_stmt (c_parser *, gimple_seq *);
static void c_parser_gimple_return_stmt (c_parser *, gimple_seq *); static void c_parser_gimple_return_stmt (c_parser *, gimple_seq *);
static void c_finish_gimple_return (location_t, tree); static void c_finish_gimple_return (location_t, tree);
static tree c_parser_gimple_paren_condition (c_parser *); static tree c_parser_gimple_paren_condition (c_parser *);
static vec<tree, va_gc> *c_parser_gimple_expr_list (c_parser *, static void c_parser_gimple_expr_list (c_parser *, vec<tree> *);
vec<tree, va_gc> **, vec<location_t> *);
/* Parse the body of a function declaration marked with "__GIMPLE". */ /* Parse the body of a function declaration marked with "__GIMPLE". */
...@@ -898,10 +897,6 @@ c_parser_gimple_postfix_expression_after_primary (c_parser *parser, ...@@ -898,10 +897,6 @@ c_parser_gimple_postfix_expression_after_primary (c_parser *parser,
location_t expr_loc, location_t expr_loc,
struct c_expr expr) struct c_expr expr)
{ {
struct c_expr orig_expr;
vec<tree, va_gc> *exprlist;
vec<tree, va_gc> *origtypes = NULL;
vec<location_t> arg_loc = vNULL;
location_t start; location_t start;
location_t finish; location_t finish;
tree ident; tree ident;
...@@ -936,34 +931,16 @@ c_parser_gimple_postfix_expression_after_primary (c_parser *parser, ...@@ -936,34 +931,16 @@ c_parser_gimple_postfix_expression_after_primary (c_parser *parser,
{ {
/* Function call. */ /* Function call. */
c_parser_consume_token (parser); c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) auto_vec<tree> exprlist;
exprlist = NULL; if (! c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
else c_parser_gimple_expr_list (parser, &exprlist);
exprlist = c_parser_gimple_expr_list (parser, &origtypes,
&arg_loc);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>"); "expected %<)%>");
orig_expr = expr; expr.value = build_call_array_loc
start = expr.get_start (); (expr_loc, TREE_TYPE (TREE_TYPE (expr.value)),
finish = c_parser_tokens_buf (parser, 0)->get_finish (); expr.value, exprlist.length (), exprlist.address ());
expr.value = c_build_function_call_vec (expr_loc, arg_loc,
expr.value,
exprlist, origtypes);
set_c_expr_source_range (&expr, start, finish);
expr.original_code = ERROR_MARK; expr.original_code = ERROR_MARK;
if (TREE_CODE (expr.value) == INTEGER_CST
&& TREE_CODE (orig_expr.value) == FUNCTION_DECL
&& DECL_BUILT_IN_CLASS (orig_expr.value) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (orig_expr.value) == BUILT_IN_CONSTANT_P)
expr.original_code = C_MAYBE_CONST_EXPR;
expr.original_type = NULL; expr.original_type = NULL;
if (exprlist)
{
release_tree_vector (exprlist);
release_tree_vector (origtypes);
}
arg_loc.release ();
break; break;
} }
case CPP_DOT: case CPP_DOT:
...@@ -1058,41 +1035,19 @@ c_parser_gimple_postfix_expression_after_primary (c_parser *parser, ...@@ -1058,41 +1035,19 @@ c_parser_gimple_postfix_expression_after_primary (c_parser *parser,
*/ */
static vec<tree, va_gc> * static void
c_parser_gimple_expr_list (c_parser *parser, vec<tree, va_gc> **p_orig_types, c_parser_gimple_expr_list (c_parser *parser, vec<tree> *ret)
vec<location_t> *locations)
{ {
vec<tree, va_gc> *ret;
vec<tree, va_gc> *orig_types;
struct c_expr expr; struct c_expr expr;
location_t loc = c_parser_peek_token (parser)->location;
ret = make_tree_vector ();
if (p_orig_types == NULL)
orig_types = NULL;
else
orig_types = make_tree_vector ();
expr = c_parser_gimple_unary_expression (parser); expr = c_parser_gimple_unary_expression (parser);
vec_safe_push (ret, expr.value); ret->safe_push (expr.value);
if (orig_types)
vec_safe_push (orig_types, expr.original_type);
if (locations)
locations->safe_push (loc);
while (c_parser_next_token_is (parser, CPP_COMMA)) while (c_parser_next_token_is (parser, CPP_COMMA))
{ {
c_parser_consume_token (parser); c_parser_consume_token (parser);
loc = c_parser_peek_token (parser)->location;
expr = c_parser_gimple_unary_expression (parser); expr = c_parser_gimple_unary_expression (parser);
vec_safe_push (ret, expr.value); ret->safe_push (expr.value);
if (orig_types)
vec_safe_push (orig_types, expr.original_type);
if (locations)
locations->safe_push (loc);
} }
if (orig_types)
*p_orig_types = orig_types;
return ret;
} }
/* Parse gimple label. /* Parse gimple label.
......
2017-02-07 Richard Biener <rguenther@suse.de>
* gcc.dg/gimplefe-23.c: New testcase.
* gcc.dg/gimplefe-24.c: Likewise.
2017-02-07 Christophe Lyon <christophe.lyon@linaro.org> 2017-02-07 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.target/aarch64/test_frame_1.c: Scan epilogue with * gcc.target/aarch64/test_frame_1.c: Scan epilogue with
......
/* { dg-do compile } */
/* { dg-options "-fgimple" } */
short int __GIMPLE ()
foo (short int s)
{
short int D_1803;
bb_2:
D_1803 = s;
L0:
return D_1803;
}
int __GIMPLE ()
main (int argc, char * * argv)
{
short int s;
int D_1805;
int _1;
short _2;
bb_2:
s = (short int) argc;
_1 = (int) s;
_2 = foo (_1);
D_1805 = (int) _2;
L0:
return D_1805;
}
/* { dg-do compile } */
/* { dg-options "-fgimple" } */
int __GIMPLE foo(int a)
{
int t1;
t1_1 = __builtin_abs (a);
return t1_1;
}
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