void
ix86_target_macros (void)
{
  /* 32/64-bit won't change with target specific options, so do the assert and
     builtin_define_std calls here.  */
  if (TARGET_64BIT)
    {
      cpp_assert (parse_in, "cpu=x86_64");
      cpp_assert (parse_in, "machine=x86_64");
      cpp_define (parse_in, "__amd64");
      cpp_define (parse_in, "__amd64__");
      cpp_define (parse_in, "__x86_64");
      cpp_define (parse_in, "__x86_64__");
    }
  else
    {
      cpp_assert (parse_in, "cpu=i386");
      cpp_assert (parse_in, "machine=i386");
      builtin_define_std ("i386");
    }

  ix86_target_macros_internal (ix86_isa_flags,
			       ix86_arch,
			       ix86_tune,
			       ix86_fpmath,
			       cpp_define);
}
Beispiel #2
0
void
ix86_target_macros (void)
{
  /* 32/64-bit won't change with target specific options, so do the assert and
     builtin_define_std calls here.  */
  if (TARGET_64BIT)
    {
      cpp_assert (parse_in, "cpu=x86_64");
      cpp_assert (parse_in, "machine=x86_64");
      cpp_define (parse_in, "__amd64");
      cpp_define (parse_in, "__amd64__");
      cpp_define (parse_in, "__x86_64");
      cpp_define (parse_in, "__x86_64__");
      if (TARGET_X32)
	{
	  cpp_define (parse_in, "_ILP32");
	  cpp_define (parse_in, "__ILP32__");
	}
    }
  else
    {
      cpp_assert (parse_in, "cpu=i386");
      cpp_assert (parse_in, "machine=i386");
      builtin_define_std ("i386");
    }

  cpp_define_formatted (parse_in, "__ATOMIC_HLE_ACQUIRE=%d", IX86_HLE_ACQUIRE);
  cpp_define_formatted (parse_in, "__ATOMIC_HLE_RELEASE=%d", IX86_HLE_RELEASE);

  ix86_target_macros_internal (ix86_isa_flags,
			       ix86_arch,
			       ix86_tune,
			       ix86_fpmath,
			       cpp_define);
}
Beispiel #3
0
Datei: i386-c.c Projekt: kraj/gcc
void
ix86_target_macros (void)
{
    /* 32/64-bit won't change with target specific options, so do the assert and
       builtin_define_std calls here.  */
    if (TARGET_64BIT)
    {
        cpp_assert (parse_in, "cpu=x86_64");
        cpp_assert (parse_in, "machine=x86_64");
        cpp_define (parse_in, "__amd64");
        cpp_define (parse_in, "__amd64__");
        cpp_define (parse_in, "__x86_64");
        cpp_define (parse_in, "__x86_64__");
        if (TARGET_X32)
        {
            cpp_define (parse_in, "_ILP32");
            cpp_define (parse_in, "__ILP32__");
        }
    }
    else
    {
        cpp_assert (parse_in, "cpu=i386");
        cpp_assert (parse_in, "machine=i386");
        builtin_define_std ("i386");
    }

    if (!TARGET_80387)
        cpp_define (parse_in, "_SOFT_FLOAT");

    if (TARGET_LONG_DOUBLE_64)
        cpp_define (parse_in, "__LONG_DOUBLE_64__");

    if (TARGET_LONG_DOUBLE_128)
        cpp_define (parse_in, "__LONG_DOUBLE_128__");

    if (TARGET_128BIT_LONG_DOUBLE)
        cpp_define (parse_in, "__SIZEOF_FLOAT80__=16");
    else
        cpp_define (parse_in, "__SIZEOF_FLOAT80__=12");

    cpp_define (parse_in, "__SIZEOF_FLOAT128__=16");

    cpp_define_formatted (parse_in, "__ATOMIC_HLE_ACQUIRE=%d", IX86_HLE_ACQUIRE);
    cpp_define_formatted (parse_in, "__ATOMIC_HLE_RELEASE=%d", IX86_HLE_RELEASE);

    cpp_define (parse_in, "__GCC_ASM_FLAG_OUTPUTS__");

    ix86_target_macros_internal (ix86_isa_flags,
                                 ix86_isa_flags2,
                                 ix86_arch,
                                 ix86_tune,
                                 ix86_fpmath,
                                 cpp_define);

    cpp_define (parse_in, "__SEG_FS");
    cpp_define (parse_in, "__SEG_GS");
}
Beispiel #4
0
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;
}