summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-06-26 07:10:38 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-06-26 07:10:38 -0700
commite7e782527af100a7802b6903b15524fac6cd5da2 (patch)
treec9144e287fb31ca14ba4b4d9cd9ad9010d3a5bb2
parent7388eea120ca6de25f3de5dc58fc885c22d70c0a (diff)
downloadgcc-e7e782527af100a7802b6903b15524fac6cd5da2.tar.gz
Replace ISA_X86_64/SA_X32 with ABI_64/ABI_X32
-rw-r--r--gcc/ChangeLog.mx3220
-rw-r--r--gcc/config/i386/biarch64.h2
-rw-r--r--gcc/config/i386/biarchx32.h2
-rw-r--r--gcc/config/i386/i386.c69
-rw-r--r--gcc/config/i386/i386.h5
-rw-r--r--gcc/config/i386/i386.opt4
6 files changed, 68 insertions, 34 deletions
diff --git a/gcc/ChangeLog.mx32 b/gcc/ChangeLog.mx32
index 84e2de78d62..a362f0782b3 100644
--- a/gcc/ChangeLog.mx32
+++ b/gcc/ChangeLog.mx32
@@ -1,3 +1,23 @@
+2012-06-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/biarch64.h (TARGET_64BIT_DEFAULT): Replace
+ OPTION_MASK_ISA_X86_64 with OPTION_MASK_ABI_64.
+
+ * config/i386/biarchx32.h (TARGET_64BIT_DEFAULT): Replace
+ OPTION_MASK_ISA_X32 with OPTION_MASK_ABI_X32.
+
+ * config/i386/i386.c (isa_opts): Remove -m64.
+ (ix86_target_string): Properly handle -m32/-m64/-mx32.
+ (ix86_option_override_internal): Properly set OPTION_MASK_ISA_64BIT,
+ OPTION_MASK_ABI_64 and OPTION_MASK_ABI_X32.
+
+ * config/i386/i386.h (TARGET_X32): Replace OPTION_ISA_X32
+ with OPTION_ABI_X32. Moved after TARGET_LP64.
+ (TARGET_LP64): Changed to OPTION_ABI_64.
+
+ * config/i386/i386.opt (m64): Replace ISA_64BIT with ABI_64.
+ (mx32): Replace ISA_X32 with ABI_X32.
+
2011-12-12 H.J. Lu <hongjiu.lu@intel.com>
* config.gcc: Check --with-multilib-list for x86-64 Linux targets
diff --git a/gcc/config/i386/biarch64.h b/gcc/config/i386/biarch64.h
index 3dc988923c6..0c3811e3f33 100644
--- a/gcc/config/i386/biarch64.h
+++ b/gcc/config/i386/biarch64.h
@@ -25,5 +25,5 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#define TARGET_64BIT_DEFAULT (OPTION_MASK_ISA_64BIT | OPTION_MASK_ISA_X86_64)
+#define TARGET_64BIT_DEFAULT (OPTION_MASK_ISA_64BIT | OPTION_MASK_ABI_64)
#define TARGET_BI_ARCH 1
diff --git a/gcc/config/i386/biarchx32.h b/gcc/config/i386/biarchx32.h
index 963e390d53d..69d672216ac 100644
--- a/gcc/config/i386/biarchx32.h
+++ b/gcc/config/i386/biarchx32.h
@@ -24,5 +24,5 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#define TARGET_64BIT_DEFAULT (OPTION_MASK_ISA_64BIT | OPTION_MASK_ISA_X32)
+#define TARGET_64BIT_DEFAULT (OPTION_MASK_ISA_64BIT | OPTION_MASK_ABI_X32)
#define TARGET_BI_ARCH 2
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 82444f2f598..e98c4dd2dcc 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3084,7 +3084,6 @@ ix86_target_string (int isa, int flags, const char *arch, const char *tune,
preceding options while match those first. */
static struct ix86_target_opts isa_opts[] =
{
- { "-m64", OPTION_MASK_ISA_64BIT },
{ "-mfma4", OPTION_MASK_ISA_FMA4 },
{ "-mfma", OPTION_MASK_ISA_FMA },
{ "-mxop", OPTION_MASK_ISA_XOP },
@@ -3154,6 +3153,7 @@ ix86_target_string (int isa, int flags, const char *arch, const char *tune,
size_t len;
size_t line_len;
size_t sep_len;
+ const char *abi;
memset (opts, '\0', sizeof (opts));
@@ -3171,6 +3171,21 @@ ix86_target_string (int isa, int flags, const char *arch, const char *tune,
opts[num++][1] = tune;
}
+ /* Add -m32/-m64/-mx32. */
+ if ((isa & OPTION_MASK_ISA_64BIT) != 0)
+ {
+ if ((isa & OPTION_MASK_ABI_64) != 0)
+ abi = "-m64";
+ else
+ abi = "-mx32";
+ isa &= ~ (OPTION_MASK_ISA_64BIT
+ | OPTION_MASK_ABI_64
+ | OPTION_MASK_ABI_X32);
+ }
+ else
+ abi = "-m32";
+ opts[num++][0] = abi;
+
/* Pick out the options in isa options. */
for (i = 0; i < ARRAY_SIZE (isa_opts); i++)
{
@@ -3496,35 +3511,27 @@ ix86_option_override_internal (bool main_args_p)
sw = "attribute";
}
-#ifdef SUBTARGET_OVERRIDE_OPTIONS
- SUBTARGET_OVERRIDE_OPTIONS;
-#endif
-
-#ifdef SUBSUBTARGET_OVERRIDE_OPTIONS
- SUBSUBTARGET_OVERRIDE_OPTIONS;
-#endif
-
- /* Turn off both OPTION_MASK_ISA_X86_64 and OPTION_MASK_ISA_X32 if
- TARGET_64BIT is false. */
- if (!TARGET_64BIT)
- ix86_isa_flags &= ~(OPTION_MASK_ISA_X86_64 | OPTION_MASK_ISA_X32);
+ /* Turn off both OPTION_MASK_ABI_64 and OPTION_MASK_ABI_X32 if
+ TARGET_64BIT_DEFAULT is true and TARGET_64BIT is false. */
+ if (TARGET_64BIT_DEFAULT && !TARGET_64BIT)
+ ix86_isa_flags &= ~(OPTION_MASK_ABI_64 | OPTION_MASK_ABI_X32);
#ifdef TARGET_BI_ARCH
else
{
#if TARGET_BI_ARCH == 1
- /* When TARGET_BI_ARCH == 1, by default, OPTION_MASK_ISA_X86_64
- is on and OPTION_MASK_ISA_X32 is off. We turn off
- OPTION_MASK_ISA_X86_64 if OPTION_MASK_ISA_X32 is turned on by
+ /* When TARGET_BI_ARCH == 1, by default, OPTION_MASK_ABI_64
+ is on and OPTION_MASK_ABI_X32 is off. We turn off
+ OPTION_MASK_ABI_64 if OPTION_MASK_ABI_X32 is turned on by
-mx32. */
if (TARGET_X32)
- ix86_isa_flags &= ~OPTION_MASK_ISA_X86_64;
+ ix86_isa_flags &= ~OPTION_MASK_ABI_64;
#else
- /* When TARGET_BI_ARCH == 2, by default, OPTION_MASK_ISA_X32 is
- on and OPTION_MASK_ISA_X86_64 is off. We turn off
- OPTION_MASK_ISA_X32 if OPTION_MASK_ISA_X86_64 is turned on by
+ /* When TARGET_BI_ARCH == 2, by default, OPTION_MASK_ABI_X32 is
+ on and OPTION_MASK_ABI_64 is off. We turn off
+ OPTION_MASK_ABI_X32 if OPTION_MASK_ABI_64 is turned on by
-m64. */
- if (TARGET_X86_64)
- ix86_isa_flags &= ~OPTION_MASK_ISA_X32;
+ if (TARGET_LP64)
+ ix86_isa_flags &= ~OPTION_MASK_ABI_X32;
#endif
}
#endif
@@ -3532,18 +3539,26 @@ ix86_option_override_internal (bool main_args_p)
if (TARGET_X32)
{
/* Always turn on OPTION_MASK_ISA_64BIT and turn off
- OPTION_MASK_ISA_X86_64 for TARGET_X32. */
+ OPTION_MASK_ABI_64 for TARGET_X32. */
ix86_isa_flags |= OPTION_MASK_ISA_64BIT;
- ix86_isa_flags &= ~OPTION_MASK_ISA_X86_64;
+ ix86_isa_flags &= ~OPTION_MASK_ABI_64;
}
- else if (TARGET_X86_64)
+ else if (TARGET_LP64)
{
/* Always turn on OPTION_MASK_ISA_64BIT and turn off
- OPTION_MASK_ISA_X32 for TARGET_X86_64. */
+ OPTION_MASK_ABI_X32 for TARGET_LP64. */
ix86_isa_flags |= OPTION_MASK_ISA_64BIT;
- ix86_isa_flags &= ~OPTION_MASK_ISA_X32;
+ ix86_isa_flags &= ~OPTION_MASK_ABI_X32;
}
+#ifdef SUBTARGET_OVERRIDE_OPTIONS
+ SUBTARGET_OVERRIDE_OPTIONS;
+#endif
+
+#ifdef SUBSUBTARGET_OVERRIDE_OPTIONS
+ SUBSUBTARGET_OVERRIDE_OPTIONS;
+#endif
+
/* -fPIC is the default for x86_64. */
if (TARGET_MACHO && TARGET_64BIT)
flag_pic = 2;
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 93105dea4ef..030b72d0b58 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -41,9 +41,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Redefines for option macros. */
-#define TARGET_X86_64 OPTION_ISA_X86_64
#define TARGET_64BIT OPTION_ISA_64BIT
-#define TARGET_X32 OPTION_ISA_X32
#define TARGET_MMX OPTION_ISA_MMX
#define TARGET_3DNOW OPTION_ISA_3DNOW
#define TARGET_3DNOW_A OPTION_ISA_3DNOW_A
@@ -74,7 +72,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_RDRND OPTION_ISA_RDRND
#define TARGET_F16C OPTION_ISA_F16C
-#define TARGET_LP64 TARGET_X86_64
+#define TARGET_LP64 OPTION_ABI_64
+#define TARGET_X32 OPTION_ABI_X32
/* SSE4.1 defines round instructions */
#define OPTION_MASK_ISA_ROUND OPTION_MASK_ISA_SSE4_1
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index c9d60e12e15..f67b5eb3270 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -277,11 +277,11 @@ Target RejectNegative Negative(m64) Report InverseMask(ISA_64BIT) Var(ix86_isa_f
Generate 32bit i386 code
m64
-Target RejectNegative Negative(mx32) Report Mask(ISA_X86_64) Var(ix86_isa_flags) Save
+Target RejectNegative Negative(mx32) Report Mask(ABI_64) Var(ix86_isa_flags) Save
Generate 64bit x86-64 code
mx32
-Target RejectNegative Negative(m32) Report Mask(ISA_X32) Var(ix86_isa_flags) Save
+Target RejectNegative Negative(m32) Report Mask(ABI_X32) Var(ix86_isa_flags) Save
Generate 32bit x86-64 code
mx86-64