/* Hook to validate the current #pragma GCC target and set the arch custom mode state. If ARGS is NULL, then POP_TARGET is used to reset the options. */ static bool arm_pragma_target_parse (tree args, tree pop_target) { tree prev_tree = build_target_option_node (&global_options); tree cur_tree; struct cl_target_option *prev_opt; struct cl_target_option *cur_opt; if (! args) { cur_tree = ((pop_target) ? pop_target : target_option_default_node); cl_target_option_restore (&global_options, TREE_TARGET_OPTION (cur_tree)); } else { cur_tree = arm_valid_target_attribute_tree (args, &global_options, &global_options_set); if (cur_tree == NULL_TREE) { cl_target_option_restore (&global_options, TREE_TARGET_OPTION (prev_tree)); return false; } } target_option_current_node = cur_tree; arm_reset_previous_fndecl (); /* Figure out the previous mode. */ prev_opt = TREE_TARGET_OPTION (prev_tree); cur_opt = TREE_TARGET_OPTION (cur_tree); gcc_assert (prev_opt); gcc_assert (cur_opt); if (cur_opt->x_target_flags != prev_opt->x_target_flags) { /* For the definitions, ensure all newly defined macros are considered as used for -Wunused-macros. There is no point warning about the compiler predefined macros. */ cpp_options *cpp_opts = cpp_get_options (parse_in); unsigned char saved_warn_unused_macros = cpp_opts->warn_unused_macros; cpp_opts->warn_unused_macros = 0; /* Update macros. */ gcc_assert (cur_opt->x_target_flags == target_flags); arm_cpu_builtins (parse_in); cpp_opts->warn_unused_macros = saved_warn_unused_macros; } return true; }
static bool aarch64_pragma_target_parse (tree args, tree pop_target) { /* If args is not NULL then process it and setup the target-specific information that it specifies. */ if (args) { if (!aarch64_process_target_attr (args, "pragma")) return false; aarch64_override_options_internal (&global_options); } /* args is NULL, restore to the state described in pop_target. */ else { pop_target = pop_target ? pop_target : target_option_default_node; cl_target_option_restore (&global_options, TREE_TARGET_OPTION (pop_target)); } target_option_current_node = build_target_option_node (&global_options); aarch64_reset_previous_fndecl (); /* For the definitions, ensure all newly defined macros are considered as used for -Wunused-macros. There is no point warning about the compiler predefined macros. */ cpp_options *cpp_opts = cpp_get_options (parse_in); unsigned char saved_warn_unused_macros = cpp_opts->warn_unused_macros; cpp_opts->warn_unused_macros = 0; aarch64_update_cpp_builtins (parse_in); cpp_opts->warn_unused_macros = saved_warn_unused_macros; /* Initialize SIMD builtins if we haven't already. Set current_target_pragma to NULL for the duration so that the builtin initialization code doesn't try to tag the functions being built with the attributes specified by any current pragma, thus going into an infinite recursion. */ if (TARGET_SIMD) { tree saved_current_target_pragma = current_target_pragma; current_target_pragma = NULL; aarch64_init_simd_builtins (); current_target_pragma = saved_current_target_pragma; } return true; }
static bool s390_pragma_target_parse (tree args, tree pop_target) { tree prev_tree = build_target_option_node (&global_options); tree cur_tree; if (! args) cur_tree = pop_target; else { cur_tree = s390_valid_target_attribute_tree (args, &global_options, &global_options_set, true); if (!cur_tree || cur_tree == error_mark_node) { cl_target_option_restore (&global_options, TREE_TARGET_OPTION (prev_tree)); return false; } } target_option_current_node = cur_tree; s390_activate_target_options (target_option_current_node); { struct cl_target_option *prev_opt; struct cl_target_option *cur_opt; /* Figure out the previous/current differences. */ prev_opt = TREE_TARGET_OPTION (prev_tree); cur_opt = TREE_TARGET_OPTION (cur_tree); /* For the definitions, ensure all newly defined macros are considered as used for -Wunused-macros. There is no point warning about the compiler predefined macros. */ cpp_options *cpp_opts = cpp_get_options (parse_in); unsigned char saved_warn_unused_macros = cpp_opts->warn_unused_macros; cpp_opts->warn_unused_macros = 0; /* Define all of the macros for new options that were just turned on. */ s390_cpu_cpp_builtins_internal (parse_in, cur_opt, prev_opt); cpp_opts->warn_unused_macros = saved_warn_unused_macros; } return true; }
static bool ix86_pragma_target_parse (tree args, tree pop_target) { tree prev_tree = build_target_option_node (&global_options); tree cur_tree; struct cl_target_option *prev_opt; struct cl_target_option *cur_opt; HOST_WIDE_INT prev_isa; HOST_WIDE_INT cur_isa; HOST_WIDE_INT diff_isa; enum processor_type prev_arch; enum processor_type prev_tune; enum processor_type cur_arch; enum processor_type cur_tune; if (! args) { cur_tree = (pop_target ? pop_target : target_option_default_node); cl_target_option_restore (&global_options, TREE_TARGET_OPTION (cur_tree)); } else { cur_tree = ix86_valid_target_attribute_tree (args, &global_options, &global_options_set); if (!cur_tree || cur_tree == error_mark_node) { cl_target_option_restore (&global_options, TREE_TARGET_OPTION (prev_tree)); return false; } } target_option_current_node = cur_tree; ix86_reset_previous_fndecl (); /* Figure out the previous/current isa, arch, tune and the differences. */ prev_opt = TREE_TARGET_OPTION (prev_tree); cur_opt = TREE_TARGET_OPTION (cur_tree); prev_isa = prev_opt->x_ix86_isa_flags; cur_isa = cur_opt->x_ix86_isa_flags; diff_isa = (prev_isa ^ cur_isa); prev_arch = (enum processor_type) prev_opt->arch; prev_tune = (enum processor_type) prev_opt->tune; cur_arch = (enum processor_type) cur_opt->arch; cur_tune = (enum processor_type) cur_opt->tune; /* If the same processor is used for both previous and current options, don't change the macros. */ if (cur_arch == prev_arch) cur_arch = prev_arch = PROCESSOR_max; if (cur_tune == prev_tune) cur_tune = prev_tune = PROCESSOR_max; /* Undef all of the macros for that are no longer current. */ ix86_target_macros_internal (prev_isa & diff_isa, prev_arch, prev_tune, (enum fpmath_unit) prev_opt->x_ix86_fpmath, cpp_undef); /* For the definitions, ensure all newly defined macros are considered as used for -Wunused-macros. There is no point warning about the compiler predefined macros. */ cpp_options *cpp_opts = cpp_get_options (parse_in); unsigned char saved_warn_unused_macros = cpp_opts->warn_unused_macros; cpp_opts->warn_unused_macros = 0; /* Define all of the macros for new options that were just turned on. */ ix86_target_macros_internal (cur_isa & diff_isa, cur_arch, cur_tune, (enum fpmath_unit) cur_opt->x_ix86_fpmath, cpp_define); cpp_opts->warn_unused_macros = saved_warn_unused_macros; return true; }
static bool ix86_pragma_target_parse (tree args, tree pop_target) { tree prev_tree = build_target_option_node (); tree cur_tree; struct cl_target_option *prev_opt; struct cl_target_option *cur_opt; int prev_isa; int cur_isa; int diff_isa; enum processor_type prev_arch; enum processor_type prev_tune; enum processor_type cur_arch; enum processor_type cur_tune; if (! args) { cur_tree = ((pop_target) ? pop_target : target_option_default_node); cl_target_option_restore (TREE_TARGET_OPTION (cur_tree)); } else { cur_tree = ix86_valid_target_attribute_tree (args); if (!cur_tree) return false; } target_option_current_node = cur_tree; /* Figure out the previous/current isa, arch, tune and the differences. */ prev_opt = TREE_TARGET_OPTION (prev_tree); cur_opt = TREE_TARGET_OPTION (cur_tree); prev_isa = prev_opt->ix86_isa_flags; cur_isa = cur_opt->ix86_isa_flags; diff_isa = (prev_isa ^ cur_isa); prev_arch = (enum processor_type) prev_opt->arch; prev_tune = (enum processor_type) prev_opt->tune; cur_arch = (enum processor_type) cur_opt->arch; cur_tune = (enum processor_type) cur_opt->tune; /* If the same processor is used for both previous and current options, don't change the macros. */ if (cur_arch == prev_arch) cur_arch = prev_arch = PROCESSOR_max; if (cur_tune == prev_tune) cur_tune = prev_tune = PROCESSOR_max; /* Undef all of the macros for that are no longer current. */ ix86_target_macros_internal (prev_isa & diff_isa, prev_arch, prev_tune, (enum fpmath_unit) prev_opt->fpmath, cpp_undef); /* Define all of the macros for new options that were just turned on. */ ix86_target_macros_internal (cur_isa & diff_isa, cur_arch, cur_tune, (enum fpmath_unit) cur_opt->fpmath, cpp_define); return true; }
/* Hook to validate the current #pragma GCC target and set the arch custom mode state. If ARGS is NULL, then POP_TARGET is used to reset the options. */ static bool arm_pragma_target_parse (tree args, tree pop_target) { tree prev_tree = build_target_option_node (&global_options); tree cur_tree; struct cl_target_option *prev_opt; struct cl_target_option *cur_opt; if (! args) { cur_tree = ((pop_target) ? pop_target : target_option_default_node); cl_target_option_restore (&global_options, TREE_TARGET_OPTION (cur_tree)); } else { cur_tree = arm_valid_target_attribute_tree (args, &global_options, &global_options_set); if (cur_tree == NULL_TREE) { cl_target_option_restore (&global_options, TREE_TARGET_OPTION (prev_tree)); return false; } } target_option_current_node = cur_tree; arm_reset_previous_fndecl (); /* Figure out the previous mode. */ prev_opt = TREE_TARGET_OPTION (prev_tree); cur_opt = TREE_TARGET_OPTION (cur_tree); gcc_assert (prev_opt); gcc_assert (cur_opt); if (cur_opt != prev_opt) { /* For the definitions, ensure all newly defined macros are considered as used for -Wunused-macros. There is no point warning about the compiler predefined macros. */ cpp_options *cpp_opts = cpp_get_options (parse_in); unsigned char saved_warn_unused_macros = cpp_opts->warn_unused_macros; unsigned char saved_warn_builtin_macro_redefined = cpp_opts->warn_builtin_macro_redefined; cpp_opts->warn_unused_macros = 0; cpp_opts->warn_builtin_macro_redefined = 0; /* Update macros. */ gcc_assert (cur_opt->x_target_flags == target_flags); /* Don't warn for macros that have context sensitive values depending on other attributes. See warn_of_redefinition, Reset after cpp_create_definition. */ tree acond_macro = get_identifier ("__ARM_NEON_FP"); C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL ; acond_macro = get_identifier ("__ARM_FP"); C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL; acond_macro = get_identifier ("__ARM_FEATURE_LDREX"); C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL; arm_cpu_builtins (parse_in); cpp_opts->warn_builtin_macro_redefined = saved_warn_builtin_macro_redefined; cpp_opts->warn_unused_macros = saved_warn_unused_macros; } return true; }
static bool arm_pragma_target_parse (tree args, tree pop_target) { tree prev_tree = build_target_option_node (&global_options); tree cur_tree; struct cl_target_option *prev_opt; struct cl_target_option *cur_opt; if (! args) { cur_tree = ((pop_target) ? pop_target : target_option_default_node); cl_target_option_restore (&global_options, TREE_TARGET_OPTION (cur_tree)); } else { cur_tree = arm_valid_target_attribute_tree (args, &global_options, &global_options_set); if (cur_tree == NULL_TREE) { cl_target_option_restore (&global_options, TREE_TARGET_OPTION (prev_tree)); return false; } } /* Figure out the previous mode. */ prev_opt = TREE_TARGET_OPTION (prev_tree); cur_opt = TREE_TARGET_OPTION (cur_tree); gcc_assert (prev_opt); gcc_assert (cur_opt); if (cur_opt != prev_opt) { /* For the definitions, ensure all newly defined macros are considered as used for -Wunused-macros. There is no point warning about the compiler predefined macros. */ cpp_options *cpp_opts = cpp_get_options (parse_in); unsigned char saved_warn_unused_macros = cpp_opts->warn_unused_macros; cpp_opts->warn_unused_macros = 0; /* Update macros. */ gcc_assert (cur_opt->x_target_flags == target_flags); /* Don't warn for macros that have context sensitive values depending on other attributes. See warn_of_redefinition, reset after cpp_create_definition. */ tree acond_macro = get_identifier ("__ARM_NEON_FP"); C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL ; acond_macro = get_identifier ("__ARM_FP"); C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL; acond_macro = get_identifier ("__ARM_FEATURE_LDREX"); C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL; arm_cpu_builtins (parse_in); cpp_opts->warn_unused_macros = saved_warn_unused_macros; /* Make sure that target_reinit is called for next function, since TREE_TARGET_OPTION might change with the #pragma even if there is no target attribute attached to the function. */ arm_reset_previous_fndecl (); /* If going to the default mode, we restore the initial states. if cur_tree is a new target, states will be saved/restored on a per function basis in arm_set_current_function. */ if (cur_tree == target_option_default_node) save_restore_target_globals (cur_tree); } return true; }