comparison gcc/c-family/c-gimplify.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* Tree lowering pass. This pass gimplifies the tree representation built 1 /* Tree lowering pass. This pass gimplifies the tree representation built
2 by the C-based front ends. The structure of gimplified, or 2 by the C-based front ends. The structure of gimplified, or
3 language-independent, trees is dictated by the grammar described in this 3 language-independent, trees is dictated by the grammar described in this
4 file. 4 file.
5 Copyright (C) 2002-2017 Free Software Foundation, Inc. 5 Copyright (C) 2002-2018 Free Software Foundation, Inc.
6 Lowering of expressions contributed by Sebastian Pop <s.pop@laposte.net> 6 Lowering of expressions contributed by Sebastian Pop <s.pop@laposte.net>
7 Re-written to support lowering of whole function trees, documentation 7 Re-written to support lowering of whole function trees, documentation
8 and miscellaneous cleanups by Diego Novillo <dnovillo@redhat.com> 8 and miscellaneous cleanups by Diego Novillo <dnovillo@redhat.com>
9 9
10 This file is part of GCC. 10 This file is part of GCC.
34 #include "cgraph.h" 34 #include "cgraph.h"
35 #include "c-pretty-print.h" 35 #include "c-pretty-print.h"
36 #include "gimplify.h" 36 #include "gimplify.h"
37 #include "langhooks.h" 37 #include "langhooks.h"
38 #include "dumpfile.h" 38 #include "dumpfile.h"
39 #include "cilk.h"
40 #include "c-ubsan.h" 39 #include "c-ubsan.h"
41 40
42 /* The gimplification pass converts the language-dependent trees 41 /* The gimplification pass converts the language-dependent trees
43 (ld-trees) emitted by the parser into language-independent trees 42 (ld-trees) emitted by the parser into language-independent trees
44 (li-trees) that are the target of SSA analysis and transformations. 43 (li-trees) that are the target of SSA analysis and transformations.
244 if (!VECTOR_TYPE_P (TREE_TYPE (*op1_p)) 243 if (!VECTOR_TYPE_P (TREE_TYPE (*op1_p))
245 && !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)), 244 && !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
246 unsigned_type_node) 245 unsigned_type_node)
247 && !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)), 246 && !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
248 integer_type_node)) 247 integer_type_node))
249 *op1_p = convert (unsigned_type_node, *op1_p); 248 /* Make sure to unshare the result, tree sharing is invalid
249 during gimplification. */
250 *op1_p = unshare_expr (convert (unsigned_type_node, *op1_p));
250 break; 251 break;
251 } 252 }
252 253
253 case DECL_EXPR: 254 case DECL_EXPR:
254 /* This is handled mostly by gimplify.c, but we have to deal with 255 /* This is handled mostly by gimplify.c, but we have to deal with
275 return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type); 276 return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type);
276 } 277 }
277 break; 278 break;
278 } 279 }
279 280
280 case CILK_SPAWN_STMT:
281 gcc_assert(fn_contains_cilk_spawn_p (cfun)
282 && cilk_detect_spawn_and_unwrap (expr_p));
283
284 if (!seen_error ())
285 return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
286 return GS_ERROR;
287
288 case MODIFY_EXPR:
289 case INIT_EXPR:
290 case CALL_EXPR:
291 if (fn_contains_cilk_spawn_p (cfun)
292 && cilk_detect_spawn_and_unwrap (expr_p)
293 /* If an error is found, the spawn wrapper is removed and the
294 original expression (MODIFY/INIT/CALL_EXPR) is processes as
295 it is supposed to be. */
296 && !seen_error ())
297 return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
298
299 default:; 281 default:;
300 } 282 }
301 283
302 return GS_UNHANDLED; 284 return GS_UNHANDLED;
303 } 285 }