00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "config.h"
00027 #include "system.h"
00028 #include "coretypes.h"
00029 #include "tm.h"
00030 #include "tree.h"
00031 #include "cp-tree.h"
00032 #include "c-common.h"
00033 #include "toplev.h"
00034 #include "tree-gimple.h"
00035 #include "hashtab.h"
00036 #include "pointer-set.h"
00037 #include "flags.h"
00038
00039 #ifdef KEY
00040 #include "gspin-gcc-interface.h"
00041 #endif
00042
00043
00044
00045 enum bc_t { bc_break = 0, bc_continue = 1 };
00046
00047
00048
00049 static tree bc_label[2];
00050
00051
00052
00053
00054
00055
00056 static tree
00057 begin_bc_block (enum bc_t bc)
00058 {
00059 tree label = create_artificial_label ();
00060 TREE_CHAIN (label) = bc_label[bc];
00061 bc_label[bc] = label;
00062 return label;
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00072 static tree
00073 finish_bc_block (enum bc_t bc, tree label, tree body)
00074 {
00075 gcc_assert (label == bc_label[bc]);
00076
00077 if (TREE_USED (label))
00078 {
00079 tree t, sl = NULL;
00080
00081 t = build1 (LABEL_EXPR, void_type_node, label);
00082
00083 append_to_statement_list (body, &sl);
00084 append_to_statement_list (t, &sl);
00085 body = sl;
00086 }
00087
00088 bc_label[bc] = TREE_CHAIN (label);
00089 TREE_CHAIN (label) = NULL_TREE;
00090 return body;
00091 }
00092
00093
00094
00095
00096 static tree
00097 build_bc_goto (enum bc_t bc)
00098 {
00099 tree label = bc_label[bc];
00100
00101 if (label == NULL_TREE)
00102 {
00103 if (bc == bc_break)
00104 error ("break statement not within loop or switch");
00105 else
00106 error ("continue statement not within loop or switch");
00107
00108 return NULL_TREE;
00109 }
00110
00111
00112 TREE_USED (label) = 1;
00113 return build1 (GOTO_EXPR, void_type_node, label);
00114 }
00115
00116
00117
00118 static void
00119 genericize_try_block (tree *stmt_p)
00120 {
00121 tree body = TRY_STMTS (*stmt_p);
00122 tree cleanup = TRY_HANDLERS (*stmt_p);
00123
00124 gimplify_stmt (&body);
00125
00126 if (CLEANUP_P (*stmt_p))
00127 ;
00128 else
00129 gimplify_stmt (&cleanup);
00130
00131 *stmt_p = build2 (TRY_CATCH_EXPR, void_type_node, body, cleanup);
00132 }
00133
00134
00135
00136 static void
00137 genericize_catch_block (tree *stmt_p)
00138 {
00139 tree type = HANDLER_TYPE (*stmt_p);
00140 tree body = HANDLER_BODY (*stmt_p);
00141
00142 gimplify_stmt (&body);
00143
00144
00145 *stmt_p = build2 (CATCH_EXPR, void_type_node, type, body);
00146 }
00147
00148
00149
00150
00151 static void
00152 genericize_eh_spec_block (tree *stmt_p)
00153 {
00154 tree body = EH_SPEC_STMTS (*stmt_p);
00155 tree allowed = EH_SPEC_RAISES (*stmt_p);
00156 tree failure = build_call (call_unexpected_node,
00157 tree_cons (NULL_TREE, build_exc_ptr (),
00158 NULL_TREE));
00159 gimplify_stmt (&body);
00160
00161 *stmt_p = gimple_build_eh_filter (body, allowed, failure);
00162 }
00163
00164
00165
00166 static void
00167 gimplify_if_stmt (tree *stmt_p)
00168 {
00169 tree stmt, cond, then_, else_;
00170
00171 stmt = *stmt_p;
00172 cond = IF_COND (stmt);
00173 then_ = THEN_CLAUSE (stmt);
00174 else_ = ELSE_CLAUSE (stmt);
00175
00176 if (!then_)
00177 then_ = build_empty_stmt ();
00178 if (!else_)
00179 else_ = build_empty_stmt ();
00180
00181 if (integer_nonzerop (cond) && !TREE_SIDE_EFFECTS (else_))
00182 stmt = then_;
00183 else if (integer_zerop (cond) && !TREE_SIDE_EFFECTS (then_))
00184 stmt = else_;
00185 else
00186 stmt = build3 (COND_EXPR, void_type_node, cond, then_, else_);
00187 *stmt_p = stmt;
00188 }
00189
00190
00191
00192
00193
00194
00195
00196
00197 static tree
00198 gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first)
00199 {
00200 tree top, entry, exit, cont_block, break_block, stmt_list, t;
00201 location_t stmt_locus;
00202
00203 stmt_locus = input_location;
00204 stmt_list = NULL_TREE;
00205 entry = NULL_TREE;
00206
00207 break_block = begin_bc_block (bc_break);
00208 cont_block = begin_bc_block (bc_continue);
00209
00210
00211 if (cond && integer_zerop (cond))
00212 {
00213 top = NULL_TREE;
00214 exit = NULL_TREE;
00215 if (cond_is_first)
00216 {
00217 t = build_bc_goto (bc_break);
00218 append_to_statement_list (t, &stmt_list);
00219 }
00220 }
00221 else
00222 {
00223
00224
00225
00226
00227 top = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
00228
00229
00230
00231
00232 exit = build_and_jump (&LABEL_EXPR_LABEL (top));
00233 if (cond && !integer_nonzerop (cond))
00234 {
00235 t = build_bc_goto (bc_break);
00236 exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t);
00237 gimplify_stmt (&exit);
00238
00239 if (cond_is_first)
00240 {
00241 if (incr)
00242 {
00243 entry = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
00244 t = build_and_jump (&LABEL_EXPR_LABEL (entry));
00245 }
00246 else
00247 t = build_bc_goto (bc_continue);
00248 append_to_statement_list (t, &stmt_list);
00249 }
00250 }
00251 }
00252
00253 gimplify_stmt (&body);
00254 gimplify_stmt (&incr);
00255
00256 body = finish_bc_block (bc_continue, cont_block, body);
00257
00258 append_to_statement_list (top, &stmt_list);
00259 append_to_statement_list (body, &stmt_list);
00260 append_to_statement_list (incr, &stmt_list);
00261 append_to_statement_list (entry, &stmt_list);
00262 append_to_statement_list (exit, &stmt_list);
00263
00264 annotate_all_with_locus (&stmt_list, stmt_locus);
00265
00266 return finish_bc_block (bc_break, break_block, stmt_list);
00267 }
00268
00269
00270
00271
00272 static void
00273 gimplify_for_stmt (tree *stmt_p, tree *pre_p)
00274 {
00275 tree stmt = *stmt_p;
00276
00277 if (FOR_INIT_STMT (stmt))
00278 gimplify_and_add (FOR_INIT_STMT (stmt), pre_p);
00279
00280 *stmt_p = gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt),
00281 FOR_EXPR (stmt), 1);
00282 }
00283
00284
00285
00286 static void
00287 gimplify_while_stmt (tree *stmt_p)
00288 {
00289 tree stmt = *stmt_p;
00290 *stmt_p = gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt),
00291 NULL_TREE, 1);
00292 }
00293
00294
00295
00296 static void
00297 gimplify_do_stmt (tree *stmt_p)
00298 {
00299 tree stmt = *stmt_p;
00300 *stmt_p = gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt),
00301 NULL_TREE, 0);
00302 }
00303
00304
00305
00306 static void
00307 gimplify_switch_stmt (tree *stmt_p)
00308 {
00309 tree stmt = *stmt_p;
00310 tree break_block, body;
00311 location_t stmt_locus = input_location;
00312
00313 break_block = begin_bc_block (bc_break);
00314
00315 body = SWITCH_STMT_BODY (stmt);
00316 if (!body)
00317 body = build_empty_stmt ();
00318
00319 *stmt_p = build3 (SWITCH_EXPR, SWITCH_STMT_TYPE (stmt),
00320 SWITCH_STMT_COND (stmt), body, NULL_TREE);
00321 SET_EXPR_LOCATION (*stmt_p, stmt_locus);
00322 gimplify_stmt (stmt_p);
00323
00324 *stmt_p = finish_bc_block (bc_break, break_block, *stmt_p);
00325 }
00326
00327
00328
00329
00330
00331
00332 static enum gimplify_status
00333 cp_gimplify_omp_for (tree *expr_p)
00334 {
00335 tree for_stmt = *expr_p;
00336 tree cont_block;
00337
00338
00339 if (OMP_FOR_GIMPLIFYING_P (for_stmt))
00340 return GS_UNHANDLED;
00341 OMP_FOR_GIMPLIFYING_P (for_stmt) = 1;
00342
00343
00344
00345
00346 cont_block = begin_bc_block (bc_continue);
00347
00348 gimplify_stmt (expr_p);
00349
00350 OMP_FOR_BODY (for_stmt)
00351 = finish_bc_block (bc_continue, cont_block, OMP_FOR_BODY (for_stmt));
00352 OMP_FOR_GIMPLIFYING_P (for_stmt) = 0;
00353
00354 return GS_ALL_DONE;
00355 }
00356
00357
00358
00359 static void
00360 gimplify_expr_stmt (tree *stmt_p)
00361 {
00362 tree stmt = EXPR_STMT_EXPR (*stmt_p);
00363
00364 if (stmt == error_mark_node)
00365 stmt = NULL;
00366
00367
00368
00369
00370
00371
00372
00373 if (stmt && (extra_warnings || warn_unused_value))
00374 {
00375 if (!TREE_SIDE_EFFECTS (stmt))
00376 {
00377 if (!IS_EMPTY_STMT (stmt)
00378 && !VOID_TYPE_P (TREE_TYPE (stmt))
00379 && !TREE_NO_WARNING (stmt))
00380 warning (OPT_Wextra, "statement with no effect");
00381 }
00382 else if (warn_unused_value)
00383 warn_if_unused_value (stmt, input_location);
00384 }
00385
00386 if (stmt == NULL_TREE)
00387 stmt = alloc_stmt_list ();
00388
00389 *stmt_p = stmt;
00390 }
00391
00392
00393
00394 static void
00395 cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p)
00396 {
00397 tree from = TREE_OPERAND (*expr_p, 1);
00398 tree to = TREE_OPERAND (*expr_p, 0);
00399 tree sub;
00400
00401
00402
00403
00404
00405 if (TREE_CODE (from) == TARGET_EXPR)
00406 from = TARGET_EXPR_INITIAL (from);
00407
00408
00409
00410 sub = expr_last (from);
00411
00412
00413
00414
00415
00416
00417 if (TREE_CODE (sub) == AGGR_INIT_EXPR)
00418 {
00419 gimplify_expr (&to, pre_p, post_p, is_gimple_lvalue, fb_lvalue);
00420 TREE_OPERAND (sub, 2) = to;
00421 *expr_p = from;
00422
00423
00424
00425 if (from != sub)
00426 TREE_TYPE (from) = void_type_node;
00427 }
00428 }
00429
00430
00431
00432 static void
00433 gimplify_must_not_throw_expr (tree *expr_p, tree *pre_p)
00434 {
00435 tree stmt = *expr_p;
00436 tree temp = voidify_wrapper_expr (stmt, NULL);
00437 tree body = TREE_OPERAND (stmt, 0);
00438
00439 gimplify_stmt (&body);
00440
00441 stmt = gimple_build_eh_filter (body, NULL_TREE,
00442 build_call (terminate_node, NULL_TREE));
00443
00444 if (temp)
00445 {
00446 append_to_statement_list (stmt, pre_p);
00447 *expr_p = temp;
00448 }
00449 else
00450 *expr_p = stmt;
00451 }
00452
00453
00454
00455 int
00456 cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
00457 {
00458 int saved_stmts_are_full_exprs_p = 0;
00459 enum tree_code code = TREE_CODE (*expr_p);
00460 enum gimplify_status ret;
00461
00462 if (STATEMENT_CODE_P (code))
00463 {
00464 saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
00465 current_stmt_tree ()->stmts_are_full_exprs_p
00466 = STMT_IS_FULL_EXPR_P (*expr_p);
00467 }
00468
00469 switch (code)
00470 {
00471 case PTRMEM_CST:
00472 *expr_p = cplus_expand_constant (*expr_p);
00473 ret = GS_OK;
00474 break;
00475
00476 case AGGR_INIT_EXPR:
00477 simplify_aggr_init_expr (expr_p);
00478 ret = GS_OK;
00479 break;
00480
00481 case THROW_EXPR:
00482
00483
00484 *expr_p = TREE_OPERAND (*expr_p, 0);
00485 ret = GS_OK;
00486 break;
00487
00488 case MUST_NOT_THROW_EXPR:
00489 gimplify_must_not_throw_expr (expr_p, pre_p);
00490 ret = GS_OK;
00491 break;
00492
00493
00494
00495
00496 case INIT_EXPR:
00497 cp_gimplify_init_expr (expr_p, pre_p, post_p);
00498 ret = GS_OK;
00499 break;
00500
00501 case EMPTY_CLASS_EXPR:
00502
00503 *expr_p = build_constructor (TREE_TYPE (*expr_p), NULL);
00504 ret = GS_OK;
00505 break;
00506
00507 case BASELINK:
00508 *expr_p = BASELINK_FUNCTIONS (*expr_p);
00509 ret = GS_OK;
00510 break;
00511
00512 case TRY_BLOCK:
00513 genericize_try_block (expr_p);
00514 ret = GS_OK;
00515 break;
00516
00517 case HANDLER:
00518 genericize_catch_block (expr_p);
00519 ret = GS_OK;
00520 break;
00521
00522 case EH_SPEC_BLOCK:
00523 genericize_eh_spec_block (expr_p);
00524 ret = GS_OK;
00525 break;
00526
00527 case USING_STMT:
00528
00529
00530 *expr_p = build_empty_stmt ();
00531 ret = GS_ALL_DONE;
00532 break;
00533
00534 case IF_STMT:
00535 gimplify_if_stmt (expr_p);
00536 ret = GS_OK;
00537 break;
00538
00539 case FOR_STMT:
00540 gimplify_for_stmt (expr_p, pre_p);
00541 ret = GS_ALL_DONE;
00542 break;
00543
00544 case WHILE_STMT:
00545 gimplify_while_stmt (expr_p);
00546 ret = GS_ALL_DONE;
00547 break;
00548
00549 case DO_STMT:
00550 gimplify_do_stmt (expr_p);
00551 ret = GS_ALL_DONE;
00552 break;
00553
00554 case SWITCH_STMT:
00555 gimplify_switch_stmt (expr_p);
00556 ret = GS_ALL_DONE;
00557 break;
00558
00559 case OMP_FOR:
00560 ret = cp_gimplify_omp_for (expr_p);
00561 break;
00562
00563 case CONTINUE_STMT:
00564 *expr_p = build_bc_goto (bc_continue);
00565 ret = GS_ALL_DONE;
00566 break;
00567
00568 case BREAK_STMT:
00569 *expr_p = build_bc_goto (bc_break);
00570 ret = GS_ALL_DONE;
00571 break;
00572
00573 case EXPR_STMT:
00574 gimplify_expr_stmt (expr_p);
00575 ret = GS_OK;
00576 break;
00577
00578 case UNARY_PLUS_EXPR:
00579 {
00580 tree arg = TREE_OPERAND (*expr_p, 0);
00581 tree type = TREE_TYPE (*expr_p);
00582 *expr_p = (TREE_TYPE (arg) != type) ? fold_convert (type, arg)
00583 : arg;
00584 ret = GS_OK;
00585 }
00586 break;
00587
00588 default:
00589 ret = c_gimplify_expr (expr_p, pre_p, post_p);
00590 break;
00591 }
00592
00593
00594 if (STATEMENT_CODE_P (code))
00595 current_stmt_tree ()->stmts_are_full_exprs_p
00596 = saved_stmts_are_full_exprs_p;
00597
00598 return ret;
00599 }
00600
00601 static inline bool
00602 is_invisiref_parm (tree t)
00603 {
00604 return ((TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL)
00605 && DECL_BY_REFERENCE (t));
00606 }
00607
00608
00609
00610 int
00611 cxx_int_tree_map_eq (const void *va, const void *vb)
00612 {
00613 const struct cxx_int_tree_map *a = (const struct cxx_int_tree_map *) va;
00614 const struct cxx_int_tree_map *b = (const struct cxx_int_tree_map *) vb;
00615 return (a->uid == b->uid);
00616 }
00617
00618
00619
00620 unsigned int
00621 cxx_int_tree_map_hash (const void *item)
00622 {
00623 return ((const struct cxx_int_tree_map *)item)->uid;
00624 }
00625
00626
00627
00628
00629 static tree
00630 cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
00631 {
00632 tree stmt = *stmt_p;
00633 struct pointer_set_t *p_set = (struct pointer_set_t*) data;
00634
00635 if (is_invisiref_parm (stmt)
00636
00637 && !(DECL_THUNK_P (current_function_decl)
00638 && TREE_CODE (stmt) == PARM_DECL))
00639 {
00640 *stmt_p = convert_from_reference (stmt);
00641 *walk_subtrees = 0;
00642 return NULL;
00643 }
00644
00645
00646
00647 if (cp_function_chain->extern_decl_map
00648 && (TREE_CODE (stmt) == FUNCTION_DECL || TREE_CODE (stmt) == VAR_DECL)
00649 && DECL_EXTERNAL (stmt))
00650 {
00651 struct cxx_int_tree_map *h, in;
00652 in.uid = DECL_UID (stmt);
00653 h = (struct cxx_int_tree_map *)
00654 htab_find_with_hash (cp_function_chain->extern_decl_map,
00655 &in, in.uid);
00656 if (h)
00657 {
00658 *stmt_p = h->to;
00659 *walk_subtrees = 0;
00660 return NULL;
00661 }
00662 }
00663
00664
00665 if (pointer_set_contains (p_set, stmt))
00666 {
00667 *walk_subtrees = 0;
00668 return NULL_TREE;
00669 }
00670
00671 if (TREE_CODE (stmt) == ADDR_EXPR
00672 && is_invisiref_parm (TREE_OPERAND (stmt, 0)))
00673 {
00674 *stmt_p = convert (TREE_TYPE (stmt), TREE_OPERAND (stmt, 0));
00675 *walk_subtrees = 0;
00676 }
00677 else if (TREE_CODE (stmt) == RETURN_EXPR
00678 && TREE_OPERAND (stmt, 0)
00679 && is_invisiref_parm (TREE_OPERAND (stmt, 0)))
00680
00681 *walk_subtrees = 0;
00682 else if (TREE_CODE (stmt) == OMP_CLAUSE)
00683 switch (OMP_CLAUSE_CODE (stmt))
00684 {
00685 case OMP_CLAUSE_PRIVATE:
00686 case OMP_CLAUSE_SHARED:
00687 case OMP_CLAUSE_FIRSTPRIVATE:
00688 case OMP_CLAUSE_LASTPRIVATE:
00689 case OMP_CLAUSE_COPYIN:
00690 case OMP_CLAUSE_COPYPRIVATE:
00691
00692 if (is_invisiref_parm (OMP_CLAUSE_DECL (stmt)))
00693 *walk_subtrees = 0;
00694 break;
00695 case OMP_CLAUSE_REDUCTION:
00696 gcc_assert (!is_invisiref_parm (OMP_CLAUSE_DECL (stmt)));
00697 break;
00698 default:
00699 break;
00700 }
00701 else if (IS_TYPE_OR_DECL_P (stmt))
00702 *walk_subtrees = 0;
00703
00704
00705
00706
00707 else if (TREE_CODE (stmt) == CLEANUP_STMT)
00708 *stmt_p = build2 (CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR
00709 : TRY_FINALLY_EXPR,
00710 void_type_node,
00711 CLEANUP_BODY (stmt),
00712 CLEANUP_EXPR (stmt));
00713
00714 pointer_set_insert (p_set, *stmt_p);
00715
00716 return NULL;
00717 }
00718
00719 void
00720 cp_genericize (tree fndecl)
00721 {
00722 tree t;
00723 struct pointer_set_t *p_set;
00724
00725
00726 for (t = DECL_ARGUMENTS (fndecl); t; t = TREE_CHAIN (t))
00727 if (TREE_ADDRESSABLE (TREE_TYPE (t)))
00728 {
00729
00730
00731
00732
00733 gcc_assert (!DECL_BY_REFERENCE (t));
00734 gcc_assert (DECL_ARG_TYPE (t) != TREE_TYPE (t));
00735 TREE_TYPE (t) = DECL_ARG_TYPE (t);
00736 DECL_BY_REFERENCE (t) = 1;
00737 TREE_ADDRESSABLE (t) = 0;
00738 relayout_decl (t);
00739 }
00740
00741
00742 if (TREE_ADDRESSABLE (TREE_TYPE (DECL_RESULT (fndecl))))
00743 {
00744 t = DECL_RESULT (fndecl);
00745 TREE_TYPE (t) = build_reference_type (TREE_TYPE (t));
00746 DECL_BY_REFERENCE (t) = 1;
00747 TREE_ADDRESSABLE (t) = 0;
00748 relayout_decl (t);
00749 }
00750
00751 #ifdef KEY
00752
00753
00754
00755
00756 if (!flag_spin_file)
00757 #endif
00758
00759 if (DECL_CLONED_FUNCTION_P (fndecl))
00760 return;
00761
00762
00763
00764 p_set = pointer_set_create ();
00765 walk_tree (&DECL_SAVED_TREE (fndecl), cp_genericize_r, p_set, NULL);
00766 pointer_set_destroy (p_set);
00767
00768
00769 c_genericize (fndecl);
00770
00771 gcc_assert (bc_label[bc_break] == NULL);
00772 gcc_assert (bc_label[bc_continue] == NULL);
00773 }
00774
00775
00776
00777
00778
00779 static tree
00780 cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
00781 {
00782 tree defparm, parm;
00783 int i;
00784
00785 if (fn == NULL)
00786 return NULL;
00787
00788 defparm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
00789 if (arg2)
00790 defparm = TREE_CHAIN (defparm);
00791
00792 if (TREE_CODE (TREE_TYPE (arg1)) == ARRAY_TYPE)
00793 {
00794 tree inner_type = TREE_TYPE (arg1);
00795 tree start1, end1, p1;
00796 tree start2 = NULL, p2 = NULL;
00797 tree ret = NULL, lab, t;
00798
00799 start1 = arg1;
00800 start2 = arg2;
00801 do
00802 {
00803 inner_type = TREE_TYPE (inner_type);
00804 start1 = build4 (ARRAY_REF, inner_type, start1,
00805 size_zero_node, NULL, NULL);
00806 if (arg2)
00807 start2 = build4 (ARRAY_REF, inner_type, start2,
00808 size_zero_node, NULL, NULL);
00809 }
00810 while (TREE_CODE (inner_type) == ARRAY_TYPE);
00811 start1 = build_fold_addr_expr (start1);
00812 if (arg2)
00813 start2 = build_fold_addr_expr (start2);
00814
00815 end1 = TYPE_SIZE_UNIT (TREE_TYPE (arg1));
00816 end1 = fold_convert (TREE_TYPE (start1), end1);
00817 end1 = build2 (PLUS_EXPR, TREE_TYPE (start1), start1, end1);
00818
00819 p1 = create_tmp_var (TREE_TYPE (start1), NULL);
00820 t = build2 (MODIFY_EXPR, void_type_node, p1, start1);
00821 append_to_statement_list (t, &ret);
00822
00823 if (arg2)
00824 {
00825 p2 = create_tmp_var (TREE_TYPE (start2), NULL);
00826 t = build2 (MODIFY_EXPR, void_type_node, p2, start2);
00827 append_to_statement_list (t, &ret);
00828 }
00829
00830 lab = create_artificial_label ();
00831 t = build1 (LABEL_EXPR, void_type_node, lab);
00832 append_to_statement_list (t, &ret);
00833
00834 t = tree_cons (NULL, p1, NULL);
00835 if (arg2)
00836 t = tree_cons (NULL, p2, t);
00837
00838 i = 1 + (arg2 != NULL);
00839 for (parm = defparm; parm != void_list_node; parm = TREE_CHAIN (parm))
00840 t = tree_cons (NULL, convert_default_arg (TREE_VALUE (parm),
00841 TREE_PURPOSE (parm),
00842 fn, i++), t);
00843 t = build_call (fn, nreverse (t));
00844 append_to_statement_list (t, &ret);
00845
00846 t = fold_convert (TREE_TYPE (p1), TYPE_SIZE_UNIT (inner_type));
00847 t = build2 (PLUS_EXPR, TREE_TYPE (p1), p1, t);
00848 t = build2 (MODIFY_EXPR, void_type_node, p1, t);
00849 append_to_statement_list (t, &ret);
00850
00851 if (arg2)
00852 {
00853 t = fold_convert (TREE_TYPE (p2), TYPE_SIZE_UNIT (inner_type));
00854 t = build2 (PLUS_EXPR, TREE_TYPE (p2), p2, t);
00855 t = build2 (MODIFY_EXPR, void_type_node, p2, t);
00856 append_to_statement_list (t, &ret);
00857 }
00858
00859 t = build2 (NE_EXPR, boolean_type_node, p1, end1);
00860 t = build3 (COND_EXPR, void_type_node, t, build_and_jump (&lab), NULL);
00861 append_to_statement_list (t, &ret);
00862
00863 return ret;
00864 }
00865 else
00866 {
00867 tree t = tree_cons (NULL, build_fold_addr_expr (arg1), NULL);
00868 if (arg2)
00869 t = tree_cons (NULL, build_fold_addr_expr (arg2), t);
00870
00871 i = 1 + (arg2 != NULL);
00872 for (parm = defparm; parm != void_list_node; parm = TREE_CHAIN (parm))
00873 t = tree_cons (NULL, convert_default_arg (TREE_VALUE (parm),
00874 TREE_PURPOSE (parm),
00875 fn, i++), t);
00876 return build_call (fn, nreverse (t));
00877 }
00878 }
00879
00880
00881
00882
00883 tree
00884 cxx_omp_clause_default_ctor (tree clause, tree decl)
00885 {
00886 tree info = CP_OMP_CLAUSE_INFO (clause);
00887 tree ret = NULL;
00888
00889 if (info)
00890 ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 0), decl, NULL);
00891
00892 return ret;
00893 }
00894
00895
00896
00897 tree
00898 cxx_omp_clause_copy_ctor (tree clause, tree dst, tree src)
00899 {
00900 tree info = CP_OMP_CLAUSE_INFO (clause);
00901 tree ret = NULL;
00902
00903 if (info)
00904 ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 0), dst, src);
00905 if (ret == NULL)
00906 ret = build2 (MODIFY_EXPR, void_type_node, dst, src);
00907
00908 return ret;
00909 }
00910
00911
00912
00913 tree
00914 cxx_omp_clause_assign_op (tree clause, tree dst, tree src)
00915 {
00916 tree info = CP_OMP_CLAUSE_INFO (clause);
00917 tree ret = NULL;
00918
00919 if (info)
00920 ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 2), dst, src);
00921 if (ret == NULL)
00922 ret = build2 (MODIFY_EXPR, void_type_node, dst, src);
00923
00924 return ret;
00925 }
00926
00927
00928
00929 tree
00930 cxx_omp_clause_dtor (tree clause, tree decl)
00931 {
00932 tree info = CP_OMP_CLAUSE_INFO (clause);
00933 tree ret = NULL;
00934
00935 if (info)
00936 ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 1), decl, NULL);
00937
00938 return ret;
00939 }
00940
00941
00942
00943
00944 bool
00945 cxx_omp_privatize_by_reference (tree decl)
00946 {
00947 return is_invisiref_parm (decl);
00948 }