这篇教程C++ DECL_ARGUMENTS函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DECL_ARGUMENTS函数的典型用法代码示例。如果您正苦于以下问题:C++ DECL_ARGUMENTS函数的具体用法?C++ DECL_ARGUMENTS怎么用?C++ DECL_ARGUMENTS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DECL_ARGUMENTS函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: compute_use_thunksstatic enum in_charge_usecompute_use_thunks (tree fn){ tree last_arg, fn_parm; if (DECL_HAS_VTT_PARM_P (fn)) return NO_THUNKS; if (flag_apple_kext) return NO_THUNKS; if (flag_clone_structors) return NO_THUNKS; /* Functions that are too small will just get inlined back in anyway. Let the inliner do something useful instead. */ if (flag_inline_functions && estimate_num_insns (DECL_SAVED_TREE (fn)) < MAX_INLINE_INSNS_AUTO) return NO_THUNKS; /* If function accepts variable arguments, give up. */ last_arg = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fn))); if ( ! VOID_TYPE_P (TREE_VALUE (last_arg))) return NO_THUNKS; /* If constructor expects vector (AltiVec) arguments, give up. */ for (fn_parm = DECL_ARGUMENTS (fn); fn_parm; fn_parm = TREE_CHAIN (fn_parm)) if (TREE_CODE (fn_parm) == VECTOR_TYPE) return NO_THUNKS; if (DECL_HAS_IN_CHARGE_PARM_P (fn)) { int parmno; struct thunk_tree_walk_data data; for (parmno = 0, fn_parm = DECL_ARGUMENTS (fn); fn_parm; ++parmno, fn_parm = TREE_CHAIN (fn_parm)) if (parmno == 1) { data.in_charge_parm = fn_parm; break; } /* If every use of the in-charge parameter ANDs it with 1, then the functions that have in-charge set to 1 and 3 are equivalent, likewise 0 and 2. Check for this (common in practice). Likewise, if every use tests for equality with 0, then values 1, 2 and 3 are equivalent. */ gcc_assert (data.in_charge_parm != NULL_TREE); data.in_charge_use = ALL_THUNKS; walk_tree_without_duplicates (&DECL_SAVED_TREE (fn), examine_tree_for_in_charge_use, &data); return data.in_charge_use; } return ALL_THUNKS;}
开发者ID:5432935,项目名称:crossbridge,代码行数:58,
示例2: suitable_for_tail_call_opt_pstatic boolsuitable_for_tail_call_opt_p (void){ tree param; /* alloca (until we have stack slot life analysis) inhibits sibling call optimizations, but not tail recursion. */ if (cfun->calls_alloca) return false; /* If we are using sjlj exceptions, we may need to add a call to _Unwind_SjLj_Unregister at exit of the function. Which means that we cannot do any sibcall transformations. */ if (targetm_common.except_unwind_info (&global_options) == UI_SJLJ && current_function_has_exception_handlers ()) return false; /* Any function that calls setjmp might have longjmp called from any called function. ??? We really should represent this properly in the CFG so that this needn't be special cased. */ if (cfun->calls_setjmp) return false; /* ??? It is OK if the argument of a function is taken in some cases, but not in all cases. See PR15387 and PR19616. Revisit for 4.1. */ for (param = DECL_ARGUMENTS (current_function_decl); param; param = DECL_CHAIN (param)) if (TREE_ADDRESSABLE (param)) return false; return true;}
开发者ID:CookieChen,项目名称:gcc,代码行数:33,
示例3: pp_c_parameter_type_listvoidpp_c_parameter_type_list (c_pretty_printer *pp, tree t){ bool want_parm_decl = DECL_P (t) && !(pp->flags & pp_c_flag_abstract); tree parms = want_parm_decl ? DECL_ARGUMENTS (t) : TYPE_ARG_TYPES (t); pp_c_left_paren (pp); if (parms == void_list_node) pp_c_identifier (pp, "void"); else { bool first = true; for ( ; parms && parms != void_list_node; parms = TREE_CHAIN (parms)) { if (!first) pp_separate_with (pp, ','); first = false; pp_declaration_specifiers (pp, want_parm_decl ? parms : TREE_VALUE (parms)); if (want_parm_decl) pp_declarator (pp, parms); else pp_abstract_declarator (pp, TREE_VALUE (parms)); } } pp_c_right_paren (pp);}
开发者ID:DmitrySkiba,项目名称:itoa-toolchain,代码行数:26,
示例4: build_capture_proxytreebuild_capture_proxy (tree member){ tree var, object, fn, closure, name, lam, type; if (PACK_EXPANSION_P (member)) member = PACK_EXPANSION_PATTERN (member); closure = DECL_CONTEXT (member); fn = lambda_function (closure); lam = CLASSTYPE_LAMBDA_EXPR (closure); /* The proxy variable forwards to the capture field. */ object = build_fold_indirect_ref (DECL_ARGUMENTS (fn)); object = finish_non_static_data_member (member, object, NULL_TREE); if (REFERENCE_REF_P (object)) object = TREE_OPERAND (object, 0); /* Remove the __ inserted by add_capture. */ if (DECL_NORMAL_CAPTURE_P (member)) name = get_identifier (IDENTIFIER_POINTER (DECL_NAME (member)) + 2); else name = DECL_NAME (member); type = lambda_proxy_type (object); if (DECL_VLA_CAPTURE_P (member)) { /* Rebuild the VLA type from the pointer and maxindex. */ tree field = next_initializable_field (TYPE_FIELDS (type)); tree ptr = build_simple_component_ref (object, field); field = next_initializable_field (DECL_CHAIN (field)); tree max = build_simple_component_ref (object, field); type = build_cplus_array_type (TREE_TYPE (TREE_TYPE (ptr)), build_index_type (max)); type = build_reference_type (type); REFERENCE_VLA_OK (type) = true; object = convert (type, ptr); } var = build_decl (input_location, VAR_DECL, name, type); SET_DECL_VALUE_EXPR (var, object); DECL_HAS_VALUE_EXPR_P (var) = 1; DECL_ARTIFICIAL (var) = 1; TREE_USED (var) = 1; DECL_CONTEXT (var) = fn; if (name == this_identifier) { gcc_assert (LAMBDA_EXPR_THIS_CAPTURE (lam) == member); LAMBDA_EXPR_THIS_CAPTURE (lam) = var; } if (fn == current_function_decl) insert_capture_proxy (var); else vec_safe_push (LAMBDA_EXPR_PENDING_PROXIES (lam), var); return var;}
开发者ID:alisw,项目名称:gcc-toolchain,代码行数:60,
示例5: needs_frame_header_pstatic boolneeds_frame_header_p (function *fn){ tree t; if (fn->decl == NULL) return true; if (fn->stdarg) return true; for (t = DECL_ARGUMENTS (fn->decl); t; t = TREE_CHAIN (t)) { if (!use_register_for_decl (t)) return true; /* Some 64-bit types may get copied to general registers using the frame header, see mips_output_64bit_xfer. Checking for SImode only may be overly restrictive but it is guaranteed to be safe. */ if (DECL_MODE (t) != SImode) return true; } return false;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:25,
示例6: init_parameter_lattice_valuesstatic voidinit_parameter_lattice_values (void){ tree parm, ssa_name; for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = DECL_CHAIN (parm)) if (is_complex_reg (parm) && (ssa_name = ssa_default_def (cfun, parm)) != NULL_TREE) complex_lattice_values[SSA_NAME_VERSION (ssa_name)] = VARYING;}
开发者ID:ChaosJohn,项目名称:gcc,代码行数:10,
示例7: write_ts_decl_non_common_tree_pointersstatic voidwrite_ts_decl_non_common_tree_pointers (struct output_block *ob, tree expr, bool ref_p){ if (TREE_CODE (expr) == FUNCTION_DECL) { stream_write_tree (ob, DECL_ARGUMENTS (expr), ref_p); stream_write_tree (ob, DECL_RESULT (expr), ref_p); } stream_write_tree (ob, DECL_VINDEX (expr), ref_p);}
开发者ID:TeLLie,项目名称:gcc,代码行数:11,
示例8: find_arg_number_treeunsigned int find_arg_number_tree(const_tree arg, const_tree func){ tree var; unsigned int argnum = 1; if (DECL_ARGUMENTS(func) == NULL_TREE) return CANNOT_FIND_ARG; if (TREE_CODE(arg) == SSA_NAME) arg = SSA_NAME_VAR(arg); for (var = DECL_ARGUMENTS(func); var; var = TREE_CHAIN(var), argnum++) { if (!operand_equal_p(arg, var, 0) && strcmp(DECL_NAME_POINTER(var), DECL_NAME_POINTER(arg))) continue; if (!skip_types(var)) return argnum; } return CANNOT_FIND_ARG;}
开发者ID:ephox-gcc-plugins,项目名称:size_overflow,代码行数:20,
示例9: init_parameter_lattice_valuesstatic voidinit_parameter_lattice_values (void){ tree parm, ssa_name; for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = TREE_CHAIN (parm)) if (is_complex_reg (parm) && var_ann (parm) != NULL && (ssa_name = gimple_default_def (cfun, parm)) != NULL_TREE) VEC_replace (complex_lattice_t, complex_lattice_values, SSA_NAME_VERSION (ssa_name), VARYING);}
开发者ID:applesnake,项目名称:cocotron-tools-gpl3,代码行数:12,
示例10: make_alias_fortreemake_alias_for (tree target, tree newid){ tree alias = build_decl (DECL_SOURCE_LOCATION (target), TREE_CODE (target), newid, TREE_TYPE (target)); DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (target); cxx_dup_lang_specific_decl (alias); DECL_CONTEXT (alias) = NULL; TREE_READONLY (alias) = TREE_READONLY (target); TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (target); TREE_PUBLIC (alias) = 0; DECL_INTERFACE_KNOWN (alias) = 1; if (DECL_LANG_SPECIFIC (alias)) { DECL_NOT_REALLY_EXTERN (alias) = 1; DECL_USE_TEMPLATE (alias) = 0; DECL_TEMPLATE_INFO (alias) = NULL; } DECL_EXTERNAL (alias) = 0; DECL_ARTIFICIAL (alias) = 1; DECL_TEMPLATE_INSTANTIATED (alias) = 0; if (TREE_CODE (alias) == FUNCTION_DECL) { DECL_SAVED_FUNCTION_DATA (alias) = NULL; DECL_DESTRUCTOR_P (alias) = 0; DECL_CONSTRUCTOR_P (alias) = 0; DECL_PENDING_INLINE_P (alias) = 0; DECL_DECLARED_INLINE_P (alias) = 0; DECL_INITIAL (alias) = error_mark_node; DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target)); } else TREE_STATIC (alias) = 1; TREE_ADDRESSABLE (alias) = 1; TREE_USED (alias) = 1; SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias)); TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1; return alias;}
开发者ID:fabio-d,项目名称:xc16plusplus-source,代码行数:39,
示例11: lto_input_ts_decl_non_common_tree_pointersstatic voidlto_input_ts_decl_non_common_tree_pointers (struct lto_input_block *ib, struct data_in *data_in, tree expr){ if (TREE_CODE (expr) == FUNCTION_DECL) { DECL_ARGUMENTS (expr) = stream_read_tree (ib, data_in); DECL_RESULT (expr) = stream_read_tree (ib, data_in); } else if (TREE_CODE (expr) == TYPE_DECL) DECL_ORIGINAL_TYPE (expr) = stream_read_tree (ib, data_in); DECL_VINDEX (expr) = stream_read_tree (ib, data_in);}
开发者ID:JuanMiguelBG,项目名称:gcc-4.7.0-PS3,代码行数:13,
示例12: xcoffout_begin_blockvoidxcoffout_begin_block (unsigned int line, unsigned int n){ tree decl = current_function_decl; /* The IBM AIX compiler does not emit a .bb for the function level scope, so we avoid it here also. */ if (n != 1) ASM_OUTPUT_LBB (asm_out_file, line, n); do_block = n; xcoffout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));}
开发者ID:0mp,项目名称:freebsd,代码行数:13,
示例13: set_decl_abstract_flagsvoidset_decl_abstract_flags (tree decl, int setting){ DECL_ABSTRACT (decl) = setting; if (TREE_CODE (decl) == FUNCTION_DECL) { tree arg; for (arg = DECL_ARGUMENTS (decl); arg; arg = DECL_CHAIN (arg)) DECL_ABSTRACT (arg) = setting; if (DECL_INITIAL (decl) != NULL_TREE && DECL_INITIAL (decl) != error_mark_node) set_block_abstract_flags (DECL_INITIAL (decl), setting); }}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:15,
示例14: cp_genericizevoidcp_genericize (tree fndecl){ tree t; struct pointer_set_t *p_set; /* Fix up the types of parms passed by invisible reference. */ for (t = DECL_ARGUMENTS (fndecl); t; t = TREE_CHAIN (t)) if (TREE_ADDRESSABLE (TREE_TYPE (t))) { /* If a function's arguments are copied to create a thunk, then DECL_BY_REFERENCE will be set -- but the type of the argument will be a pointer type, so we will never get here. */ gcc_assert (!DECL_BY_REFERENCE (t)); gcc_assert (DECL_ARG_TYPE (t) != TREE_TYPE (t)); TREE_TYPE (t) = DECL_ARG_TYPE (t); DECL_BY_REFERENCE (t) = 1; TREE_ADDRESSABLE (t) = 0; relayout_decl (t); } /* Do the same for the return value. */ if (TREE_ADDRESSABLE (TREE_TYPE (DECL_RESULT (fndecl)))) { t = DECL_RESULT (fndecl); TREE_TYPE (t) = build_reference_type (TREE_TYPE (t)); DECL_BY_REFERENCE (t) = 1; TREE_ADDRESSABLE (t) = 0; relayout_decl (t); } /* If we're a clone, the body is already GIMPLE. */ if (DECL_CLONED_FUNCTION_P (fndecl)) return; /* We do want to see every occurrence of the parms, so we can't just use walk_tree's hash functionality. */ p_set = pointer_set_create (); cp_walk_tree (&DECL_SAVED_TREE (fndecl), cp_genericize_r, p_set, NULL); pointer_set_destroy (p_set); /* Do everything else. */ c_genericize (fndecl); gcc_assert (bc_label[bc_break] == NULL); gcc_assert (bc_label[bc_continue] == NULL);}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:48,
示例15: execute_mudflap_function_declsstatic voidexecute_mudflap_function_decls (void){ /* Don't instrument functions such as the synthetic constructor built during mudflap_finish_file. */ if (mf_marked_p (current_function_decl) || DECL_ARTIFICIAL (current_function_decl)) return; push_gimplify_context (); mf_xform_decls (DECL_SAVED_TREE (current_function_decl), DECL_ARGUMENTS (current_function_decl)); pop_gimplify_context (NULL);}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:16,
示例16: handle_pre_genericvoidhandle_pre_generic (void *event_data, void *data){ tree fndecl = (tree) event_data; tree arg; for (arg = DECL_ARGUMENTS(fndecl); arg; arg = DECL_CHAIN (arg)) { tree attr; for (attr = DECL_ATTRIBUTES (arg); attr; attr = TREE_CHAIN (attr)) { tree attrname = TREE_PURPOSE (attr); tree attrargs = TREE_VALUE (attr); warning (0, G_("attribute '%s' on param '%s' of function %s"), IDENTIFIER_POINTER (attrname), IDENTIFIER_POINTER (DECL_NAME (arg)), IDENTIFIER_POINTER (DECL_NAME (fndecl)) ); } }}
开发者ID:MaxKellermann,项目名称:gcc,代码行数:18,
示例17: set_decl_origin_selfvoidset_decl_origin_self (tree decl){ if (DECL_ABSTRACT_ORIGIN (decl) == NULL_TREE) { DECL_ABSTRACT_ORIGIN (decl) = decl; if (TREE_CODE (decl) == FUNCTION_DECL) { tree arg; for (arg = DECL_ARGUMENTS (decl); arg; arg = DECL_CHAIN (arg)) DECL_ABSTRACT_ORIGIN (arg) = arg; if (DECL_INITIAL (decl) != NULL_TREE && DECL_INITIAL (decl) != error_mark_node) set_block_origin_self (DECL_INITIAL (decl)); } }}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:18,
示例18: execute_mudflap_function_declsstatic unsigned intexecute_mudflap_function_decls (void){ struct gimplify_ctx gctx; /* Don't instrument functions such as the synthetic constructor built during mudflap_finish_file. */ if (mf_marked_p (current_function_decl) || mf_artificial (current_function_decl)) return 0; push_gimplify_context (&gctx); mf_xform_decls (gimple_body (current_function_decl), DECL_ARGUMENTS (current_function_decl)); pop_gimplify_context (NULL); return 0;}
开发者ID:ChaosJohn,项目名称:gcc,代码行数:19,
示例19: execute_mudflap_function_declsstatic unsigned intexecute_mudflap_function_decls (void){ struct gimplify_ctx gctx; DEBUGLOG("Zahed: entering LBC pass1/n"); /* Don't instrument functions such as the synthetic constructor built during mudflap_finish_file. */ if (mf_marked_p (current_function_decl) || DECL_ARTIFICIAL (current_function_decl)) return 0; push_gimplify_context (&gctx); mf_xform_decls (gimple_body (current_function_decl), DECL_ARGUMENTS (current_function_decl)); pop_gimplify_context (NULL); return 0;}
开发者ID:sdzahed,项目名称:LBC-Plugin,代码行数:20,
示例20: build_decl/* * Create a DECL_... node of code CODE, name NAME * and data type TYPE. We do NOT enter this node * in any sort of symbol table. * * layout_decl is used to set up the decl's storage layout. * Other slots are initialized to 0 or null pointers. */treebuild_decl (enum tree_code code, tree name, tree type){ register tree t; t = make_node (code);#if (0) /*************************************/ /* * That is not done, deliberately, so that * having error_mark_node as the type can * suppress useless errors in the use of * this variable. */ if (type == error_mark_node) type = integer_type_node;#endif /*************************************/ DECL_NAME (t) = name; if (name) { DECL_PRINT_NAME (t) = IDENTIFIER_POINTER (name); DECL_ASSEMBLER_NAME (t) = IDENTIFIER_POINTER (name); } TREE_TYPE (t) = type; DECL_ARGUMENTS (t) = NULL_TREE; DECL_INITIAL (t) = NULL_TREE; if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL) layout_decl (t, 0); elif (code == FUNCTION_DECL) DECL_MODE (t) = FUNCTION_MODE; return (t);} /* end build_decl */
开发者ID:marioaugustorama,项目名称:tropix-cmd,代码行数:46,
示例21: tree_code_generate_returnvoidtree_code_generate_return (tree type, tree exp){ tree setret; tree param; for (param = DECL_ARGUMENTS (current_function_decl); param; param = TREE_CHAIN (param)) { if (DECL_CONTEXT (param) != current_function_decl) abort (); } if (exp) { setret = build (MODIFY_EXPR, type, DECL_RESULT (current_function_decl), build1 (CONVERT_EXPR, type, exp)); TREE_SIDE_EFFECTS (setret) = 1; TREE_USED (setret) = 1; expand_expr_stmt (setret); } expand_return (DECL_RESULT (current_function_decl));}
开发者ID:aosm,项目名称:gccfast,代码行数:24,
示例22: maybe_add_lambda_conv_opvoidmaybe_add_lambda_conv_op (tree type){ bool nested = (cfun != NULL); bool nested_def = decl_function_context (TYPE_MAIN_DECL (type)); tree callop = lambda_function (type); if (LAMBDA_EXPR_CAPTURE_LIST (CLASSTYPE_LAMBDA_EXPR (type)) != NULL_TREE) return; if (processing_template_decl) return; bool const generic_lambda_p = (DECL_TEMPLATE_INFO (callop) && DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (callop)) == callop); if (!generic_lambda_p && DECL_INITIAL (callop) == NULL_TREE) { /* If the op() wasn't instantiated due to errors, give up. */ gcc_assert (errorcount || sorrycount); return; } /* Non-template conversion operators are defined directly with build_call_a and using DIRECT_ARGVEC for arguments (including 'this'). Templates are deferred and the CALL is built in-place. In the case of a deduced return call op, the decltype expression, DECLTYPE_CALL, used as a substitute for the return type is also built in-place. The arguments of DECLTYPE_CALL in the return expression may differ in flags from those in the body CALL. In particular, parameter pack expansions are marked PACK_EXPANSION_LOCAL_P in the body CALL, but not in DECLTYPE_CALL. */ vec<tree, va_gc> *direct_argvec = 0; tree decltype_call = 0, call = 0; tree fn_result = TREE_TYPE (TREE_TYPE (callop)); if (generic_lambda_p) { /* Prepare the dependent member call for the static member function '_FUN' and, potentially, prepare another call to be used in a decltype return expression for a deduced return call op to allow for simple implementation of the conversion operator. */ tree instance = build_nop (type, null_pointer_node); tree objfn = build_min (COMPONENT_REF, NULL_TREE, instance, DECL_NAME (callop), NULL_TREE); int nargs = list_length (DECL_ARGUMENTS (callop)) - 1; call = prepare_op_call (objfn, nargs); if (type_uses_auto (fn_result)) decltype_call = prepare_op_call (objfn, nargs); } else { direct_argvec = make_tree_vector (); direct_argvec->quick_push (build1 (NOP_EXPR, TREE_TYPE (DECL_ARGUMENTS (callop)), null_pointer_node)); } /* Copy CALLOP's argument list (as per 'copy_list') as FN_ARGS in order to declare the static member function "_FUN" below. For each arg append to DIRECT_ARGVEC (for the non-template case) or populate the pre-allocated call args (for the template case). If a parameter pack is found, expand it, flagging it as PACK_EXPANSION_LOCAL_P for the body call. */ tree fn_args = NULL_TREE; { int ix = 0; tree src = DECL_CHAIN (DECL_ARGUMENTS (callop)); tree tgt; while (src) { tree new_node = copy_node (src); if (!fn_args) fn_args = tgt = new_node; else { TREE_CHAIN (tgt) = new_node; tgt = new_node; } mark_exp_read (tgt); if (generic_lambda_p) { if (DECL_PACK_P (tgt)) { tree a = make_pack_expansion (tgt); if (decltype_call) CALL_EXPR_ARG (decltype_call, ix) = copy_node (a); PACK_EXPANSION_LOCAL_P (a) = true; CALL_EXPR_ARG (call, ix) = a; } else { tree a = convert_from_reference (tgt);//.........这里部分代码省略.........
开发者ID:nguyentu1602,项目名称:gcc,代码行数:101,
示例23: lambda_expr_this_capturetreelambda_expr_this_capture (tree lambda, bool add_capture_p){ tree result; tree this_capture = LAMBDA_EXPR_THIS_CAPTURE (lambda); /* In unevaluated context this isn't an odr-use, so don't capture. */ if (cp_unevaluated_operand) add_capture_p = false; /* Try to default capture 'this' if we can. */ if (!this_capture && (!add_capture_p || LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda) != CPLD_NONE)) { tree lambda_stack = NULL_TREE; tree init = NULL_TREE; /* If we are in a lambda function, we can move out until we hit: 1. a non-lambda function or NSDMI, 2. a lambda function capturing 'this', or 3. a non-default capturing lambda function. */ for (tree tlambda = lambda; ;) { lambda_stack = tree_cons (NULL_TREE, tlambda, lambda_stack); if (LAMBDA_EXPR_EXTRA_SCOPE (tlambda) && TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (tlambda)) == FIELD_DECL) { /* In an NSDMI, we don't have a function to look up the decl in, but the fake 'this' pointer that we're using for parsing is in scope_chain. */ init = scope_chain->x_current_class_ptr; gcc_checking_assert (init && (TREE_TYPE (TREE_TYPE (init)) == current_nonlambda_class_type ())); break; } tree closure_decl = TYPE_NAME (LAMBDA_EXPR_CLOSURE (tlambda)); tree containing_function = decl_function_context (closure_decl); if (containing_function == NULL_TREE) /* We ran out of scopes; there's no 'this' to capture. */ break; if (!LAMBDA_FUNCTION_P (containing_function)) { /* We found a non-lambda function. */ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (containing_function)) /* First parameter is 'this'. */ init = DECL_ARGUMENTS (containing_function); break; } tlambda = CLASSTYPE_LAMBDA_EXPR (DECL_CONTEXT (containing_function)); if (LAMBDA_EXPR_THIS_CAPTURE (tlambda)) { /* An outer lambda has already captured 'this'. */ init = LAMBDA_EXPR_THIS_CAPTURE (tlambda); break; } if (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (tlambda) == CPLD_NONE) /* An outer lambda won't let us capture 'this'. */ break; } if (init) { if (add_capture_p) this_capture = add_default_capture (lambda_stack, /*id=*/this_identifier, init); else this_capture = init; } } if (cp_unevaluated_operand) result = this_capture; else if (!this_capture) { if (add_capture_p) { error ("%<this%> was not captured for this lambda function"); result = error_mark_node; } else result = NULL_TREE; } else { /* To make sure that current_class_ref is for the lambda. */ gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (current_class_ref))//.........这里部分代码省略.........
开发者ID:nguyentu1602,项目名称:gcc,代码行数:101,
示例24: print_node//.........这里部分代码省略......... } if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)) { print_node_brief (file, "abstract_origin", DECL_ABSTRACT_ORIGIN (node), indent + 4); } if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) { print_node (file, "result", DECL_RESULT_FLD (node), indent + 4); } lang_hooks.print_decl (file, node, indent); if (DECL_RTL_SET_P (node)) { indent_to (file, indent + 4); print_rtl (file, DECL_RTL (node)); } if (code == PARM_DECL) { print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4); if (DECL_INCOMING_RTL (node) != 0) { indent_to (file, indent + 4); fprintf (file, "incoming-rtl "); print_rtl (file, DECL_INCOMING_RTL (node)); } } else if (code == FUNCTION_DECL && DECL_STRUCT_FUNCTION (node) != 0) { print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4); indent_to (file, indent + 4); dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node)); } if ((code == VAR_DECL || code == PARM_DECL) && DECL_HAS_VALUE_EXPR_P (node)) print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4); /* Print the decl chain only if decl is at second level. */ if (indent == 4) print_node (file, "chain", TREE_CHAIN (node), indent + 4); else print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); break; case tcc_type: if (TYPE_UNSIGNED (node)) fputs (" unsigned", file); if (TYPE_NO_FORCE_BLK (node)) fputs (" no-force-blk", file); if (TYPE_STRING_FLAG (node)) fputs (" string-flag", file); if (TYPE_NEEDS_CONSTRUCTING (node)) fputs (" needs-constructing", file); if ((code == RECORD_TYPE || code == UNION_TYPE || code == QUAL_UNION_TYPE || code == ARRAY_TYPE)
开发者ID:RajibTheKing,项目名称:gcc,代码行数:67,
示例25: find_tail_callsstatic voidfind_tail_calls (basic_block bb, struct tailcall **ret){ tree ass_var = NULL_TREE, ret_var, func, param; gimple stmt, call = NULL; gimple_stmt_iterator gsi, agsi; bool tail_recursion; struct tailcall *nw; edge e; tree m, a; basic_block abb; size_t idx; tree var; if (!single_succ_p (bb)) return; for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi)) { stmt = gsi_stmt (gsi); /* Ignore labels, returns, clobbers and debug stmts. */ if (gimple_code (stmt) == GIMPLE_LABEL || gimple_code (stmt) == GIMPLE_RETURN || gimple_clobber_p (stmt) || is_gimple_debug (stmt)) continue; /* Check for a call. */ if (is_gimple_call (stmt)) { call = stmt; ass_var = gimple_call_lhs (stmt); break; } /* If the statement references memory or volatile operands, fail. */ if (gimple_references_memory_p (stmt) || gimple_has_volatile_ops (stmt)) return; } if (gsi_end_p (gsi)) { edge_iterator ei; /* Recurse to the predecessors. */ FOR_EACH_EDGE (e, ei, bb->preds) find_tail_calls (e->src, ret); return; } /* If the LHS of our call is not just a simple register, we can't transform this into a tail or sibling call. This situation happens, in (e.g.) "*p = foo()" where foo returns a struct. In this case we won't have a temporary here, but we need to carry out the side effect anyway, so tailcall is impossible. ??? In some situations (when the struct is returned in memory via invisible argument) we could deal with this, e.g. by passing 'p' itself as that argument to foo, but it's too early to do this here, and expand_call() will not handle it anyway. If it ever can, then we need to revisit this here, to allow that situation. */ if (ass_var && !is_gimple_reg (ass_var)) return; /* We found the call, check whether it is suitable. */ tail_recursion = false; func = gimple_call_fndecl (call); if (func && !DECL_BUILT_IN (func) && recursive_call_p (current_function_decl, func)) { tree arg; for (param = DECL_ARGUMENTS (func), idx = 0; param && idx < gimple_call_num_args (call); param = DECL_CHAIN (param), idx ++) { arg = gimple_call_arg (call, idx); if (param != arg) { /* Make sure there are no problems with copying. The parameter have a copyable type and the two arguments must have reasonably equivalent types. The latter requirement could be relaxed if we emitted a suitable type conversion statement. */ if (!is_gimple_reg_type (TREE_TYPE (param)) || !useless_type_conversion_p (TREE_TYPE (param), TREE_TYPE (arg))) break; /* The parameter should be a real operand, so that phi node created for it at the start of the function has the meaning of copying the value. This test implies is_gimple_reg_type from the previous condition, however this one could be relaxed by being more careful with copying the new value of the parameter (emitting appropriate GIMPLE_ASSIGN and updating the virtual operands). */ if (!is_gimple_reg (param)) break;//.........这里部分代码省略.........
开发者ID:CookieChen,项目名称:gcc,代码行数:101,
示例26: XIL_GenerateBlock//.........这里部分代码省略......... end_file = decl_file; end_line = decl_line; } // the begin/end points of the declaration should be in the same file. if (strcmp(decl_file, end_file)) TREE_UNEXPECTED(decl); XIL_Location end_loc = XIL_MakeLocation(end_file, end_line); XIL_CFGSetCommand(xil_command); XIL_CFGSetBeginLocation(begin_loc); XIL_CFGSetEndLocation(end_loc); xil_active_env.entry_point = xil_active_env.last_point = XIL_CFGAddPoint(begin_loc); xil_active_env.exit_point = XIL_CFGAddPoint(end_loc); XIL_CFGSetEntryPoint(xil_active_env.entry_point); XIL_CFGSetExitPoint(xil_active_env.exit_point); // add the decl variable to the active CFG. override any previous type we // had for the variable, to account for seeing multiple definitions of // a variable, which gcc allows, e.g. int buf[]; int buf[10]; if (!xil_has_annotation) XIL_CFGAddVar(xil_var, xil_type, 1); // current point for traversal of the function/initializer. XIL_PPoint point = xil_active_env.entry_point; bool is_function = (TREE_CODE(decl) == FUNCTION_DECL); if (is_function) { // handling for function definitions. tree defn = DECL_SAVED_TREE(decl); // add the parameters to the active CFG. skip this for destructors // to avoid the __in_chrg argument. if (!XIL_IsDestructor(decl)) { tree param = DECL_ARGUMENTS(decl); while (param) { gcc_assert(TREE_CODE(param) == PARM_DECL); XIL_TranslateVar(param); // forces insertion of the parameter. param = TREE_CHAIN(param); } } // generate edges for the function body. XIL_ActivePushScope(); MAKE_ENV(body_env, &point, NULL); XIL_TranslateTree(&body_env, defn); XIL_ActivePopScope(); } else { // handling for global variables. tree initial = DECL_INITIAL(decl); // make an assignment for any initializer. for compound initializers // this may get fairly involved. if (initial) { MAKE_ENV(initial_env, &point, NULL); initial_env.result_assign = XIL_ExpVar(xil_var); initial_env.result_assign_type = xil_type; XIL_TranslateTree(&initial_env, initial); } } // connect any fall through to the exit point. XIL_CFGEdgeSkip(point, xil_active_env.exit_point); // for debugging, bail out of compilation at the first error. //if (xil_active_env.dropped) { // printf("XIL: Bailing out/n"); // exit(1); //} // process any annotations read in from file for the function, // now that we know all locals. int count = XIL_GetAnnotationCount(name, !is_function, false); int ind = 0; for (; ind < count; ind++) { const char *where; const char *point_text, *annot_text; int trusted; XIL_GetAnnotation(name, !is_function, false, ind, &where, &point_text, &annot_text, &trusted); XIL_ProcessAnnotationRead(decl, where, point_text, annot_text, trusted); } // process annotations discovered for CSU types. while (xil_active_env.annots) { struct XIL_PendingAnnotation *annot = xil_active_env.annots; xil_active_env.annots = annot->next; XIL_ProcessAnnotationAttr(annot->type, annot->attr, NULL, NULL); } XIL_ClearActiveBlock(xil_active_env.dropped); XIL_ClearAssociate(XIL_AscBlock); memset(&xil_active_env, 0, sizeof(struct XIL_BlockEnv));}
开发者ID:killbug2004,项目名称:implementations,代码行数:101,
示例27: eliminate_tail_callstatic voideliminate_tail_call (struct tailcall *t){ tree param, rslt; gimple stmt, call; tree arg; size_t idx; basic_block bb, first; edge e; gimple phi; gimple_stmt_iterator gsi; gimple orig_stmt; stmt = orig_stmt = gsi_stmt (t->call_gsi); bb = gsi_bb (t->call_gsi); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Eliminated tail recursion in bb %d : ", bb->index); print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); fprintf (dump_file, "/n"); } gcc_assert (is_gimple_call (stmt)); first = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)); /* Remove the code after call_gsi that will become unreachable. The possibly unreachable code in other blocks is removed later in cfg cleanup. */ gsi = t->call_gsi; gsi_next (&gsi); while (!gsi_end_p (gsi)) { gimple t = gsi_stmt (gsi); /* Do not remove the return statement, so that redirect_edge_and_branch sees how the block ends. */ if (gimple_code (t) == GIMPLE_RETURN) break; gsi_remove (&gsi, true); release_defs (t); } /* Number of executions of function has reduced by the tailcall. */ e = single_succ_edge (gsi_bb (t->call_gsi)); decrease_profile (EXIT_BLOCK_PTR_FOR_FN (cfun), e->count, EDGE_FREQUENCY (e)); decrease_profile (ENTRY_BLOCK_PTR_FOR_FN (cfun), e->count, EDGE_FREQUENCY (e)); if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)) decrease_profile (e->dest, e->count, EDGE_FREQUENCY (e)); /* Replace the call by a jump to the start of function. */ e = redirect_edge_and_branch (single_succ_edge (gsi_bb (t->call_gsi)), first); gcc_assert (e); PENDING_STMT (e) = NULL; /* Add phi node entries for arguments. The ordering of the phi nodes should be the same as the ordering of the arguments. */ for (param = DECL_ARGUMENTS (current_function_decl), idx = 0, gsi = gsi_start_phis (first); param; param = DECL_CHAIN (param), idx++) { if (!arg_needs_copy_p (param)) continue; arg = gimple_call_arg (stmt, idx); phi = gsi_stmt (gsi); gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi))); add_phi_arg (phi, arg, e, gimple_location (stmt)); gsi_next (&gsi); } /* Update the values of accumulators. */ adjust_accumulator_values (t->call_gsi, t->mult, t->add, e); call = gsi_stmt (t->call_gsi); rslt = gimple_call_lhs (call); if (rslt != NULL_TREE) { /* Result of the call will no longer be defined. So adjust the SSA_NAME_DEF_STMT accordingly. */ SSA_NAME_DEF_STMT (rslt) = gimple_build_nop (); } gsi_remove (&t->call_gsi, true); release_defs (call);}
开发者ID:CookieChen,项目名称:gcc,代码行数:92,
示例28: dequeue_and_dump//.........这里部分代码省略......... dump_child ("cnst", DECL_INITIAL (t)); break; case DEBUG_EXPR_DECL: dump_int (di, "-uid", DEBUG_TEMP_UID (t)); /* Fall through. */ case VAR_DECL: case PARM_DECL: case FIELD_DECL: case RESULT_DECL: if (TREE_CODE (t) == PARM_DECL) dump_child ("argt", DECL_ARG_TYPE (t)); else dump_child ("init", DECL_INITIAL (t)); dump_child ("size", DECL_SIZE (t)); dump_int (di, "algn", DECL_ALIGN (t)); if (TREE_CODE (t) == FIELD_DECL) { if (DECL_FIELD_OFFSET (t)) dump_child ("bpos", bit_position (t)); } else if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL) { dump_int (di, "used", TREE_USED (t)); if (DECL_REGISTER (t)) dump_string_field (di, "spec", "register"); } break; case FUNCTION_DECL: dump_child ("args", DECL_ARGUMENTS (t)); if (DECL_EXTERNAL (t)) dump_string_field (di, "body", "undefined"); if (TREE_PUBLIC (t)) dump_string_field (di, "link", "extern"); else dump_string_field (di, "link", "static"); if (DECL_SAVED_TREE (t) && !dump_flag (di, TDF_SLIM, t)) dump_child ("body", DECL_SAVED_TREE (t)); break; case INTEGER_CST: if (TREE_INT_CST_HIGH (t)) dump_int (di, "high", TREE_INT_CST_HIGH (t)); dump_int (di, "low", TREE_INT_CST_LOW (t)); break; case STRING_CST: fprintf (di->stream, "strg: %-7s ", TREE_STRING_POINTER (t)); dump_int (di, "lngt", TREE_STRING_LENGTH (t)); break; case REAL_CST: dump_real (di, "valu", TREE_REAL_CST_PTR (t)); break; case FIXED_CST: dump_fixed (di, "valu", TREE_FIXED_CST_PTR (t)); break; case TRUTH_NOT_EXPR: case ADDR_EXPR: case INDIRECT_REF:
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:67,
注:本文中的DECL_ARGUMENTS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DECL_ARTIFICIAL函数代码示例 C++ DECL_ALIGN函数代码示例 |