示例#1
0
文件: arm-c.c 项目: ollie314/gcc
void
arm_cpu_cpp_builtins (struct cpp_reader * pfile)
{
  builtin_assert ("cpu=arm");
  builtin_assert ("machine=arm");

  arm_cpu_builtins (pfile);
}
示例#2
0
文件: arm-c.c 项目: hemantjain95/gcc
/* 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;
}
示例#3
0
文件: arm-c.c 项目: ollie314/gcc
static bool
arm_pragma_target_parse (tree args, tree pop_target)
{
  tree prev_tree = target_option_current_node;
  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;
	}

      /* handle_pragma_pop_options and handle_pragma_reset_options will set
       target_option_current_node, but not handle_pragma_target.  */
      target_option_current_node = cur_tree;
    }

  /* Update macros if target_node changes. The global state will be restored
     by arm_set_current_function.  */
  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;
}
示例#4
0
文件: arm-c.c 项目: ewang1986/gcc
/* 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;
}