summaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2008-10-12 12:37:09 +0000
committerH.J. Lu <hjl.tools@gmail.com>2008-10-12 12:37:09 +0000
commitfbf3f584572f8529711c8d11662950961d9ccda4 (patch)
tree787d0b67f3bf684c8d9f8f96be50ea4429ff6bee /gas/config
parent7022097db9d1fda4b03953bc5e880cd1ef6e0da2 (diff)
downloadbinutils-gdb-fbf3f584572f8529711c8d11662950961d9ccda4.tar.gz
gas/
2008-10-12 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (processor_type): Moved to tc-i386.h. (cpu_arch_tune): Make it global. (cpu_arch_isa): Likewise. (cpu_arch_isa_flags): Likewise. (i386_align_code): Check fragP->tc_frag_data.isa, fragP->tc_frag_data.isa_flags and cpu_arch_tune instead of cpu_arch_isa, cpu_arch_isa_flags and cpu_arch_tune, respectively. * config/tc-i386.h (processor_type): Moved from tc-i386.c. (cpu_arch_tune): New. (cpu_arch_isa): Likewise. (cpu_arch_isa_flags): Likewise. (i386_tc_frag_data): Likewise. (TC_FRAG_TYPE): Likewise. (TC_FRAG_INIT): Likewise. gas/testsuite/ 2008-10-12 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/i386.exp: Run nops-5, nops-5-i686, x86-64-nops-5 and x86-64-nops-5-k8. * gas/i386/nops-5.d: New. * gas/i386/nops-5.s: Likewise. * gas/i386/nops-5-i686.d: Likewise. * gas/i386/x86-64-nops-5.d: Likewise. * gas/i386/x86-64-nops-5-k8.d: Likewise.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c35
-rw-r--r--gas/config/tc-i386.h44
2 files changed, 52 insertions, 27 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index df76ae93800..71abb01bbab 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -150,25 +150,6 @@ typedef struct
}
sib_byte;
-enum processor_type
-{
- PROCESSOR_UNKNOWN,
- PROCESSOR_I386,
- PROCESSOR_I486,
- PROCESSOR_PENTIUM,
- PROCESSOR_PENTIUMPRO,
- PROCESSOR_PENTIUM4,
- PROCESSOR_NOCONA,
- PROCESSOR_CORE,
- PROCESSOR_CORE2,
- PROCESSOR_K6,
- PROCESSOR_ATHLON,
- PROCESSOR_K8,
- PROCESSOR_GENERIC32,
- PROCESSOR_GENERIC64,
- PROCESSOR_AMDFAM10
-};
-
/* x86 arch names, types and features */
typedef struct
{
@@ -468,16 +449,16 @@ static i386_cpu_flags cpu_arch_flags = CPU_UNKNOWN_FLAGS;
static int cpu_arch_tune_set = 0;
/* Cpu we are generating instructions for. */
-static enum processor_type cpu_arch_tune = PROCESSOR_UNKNOWN;
+enum processor_type cpu_arch_tune = PROCESSOR_UNKNOWN;
/* CPU feature flags of cpu we are generating instructions for. */
static i386_cpu_flags cpu_arch_tune_flags;
/* CPU instruction set architecture used. */
-static enum processor_type cpu_arch_isa = PROCESSOR_UNKNOWN;
+enum processor_type cpu_arch_isa = PROCESSOR_UNKNOWN;
/* CPU feature flags of instruction set architecture used. */
-static i386_cpu_flags cpu_arch_isa_flags;
+i386_cpu_flags cpu_arch_isa_flags;
/* If set, conditional jumps are not automatically promoted to handle
larger than a byte offset. */
@@ -993,7 +974,7 @@ i386_align_code (fragS *fragP, int count)
{
const char *const *patt = NULL;
- if (cpu_arch_isa == PROCESSOR_UNKNOWN)
+ if (fragP->tc_frag_data.isa == PROCESSOR_UNKNOWN)
{
/* PROCESSOR_UNKNOWN means that all ISAs may be used. */
switch (cpu_arch_tune)
@@ -1001,7 +982,7 @@ i386_align_code (fragS *fragP, int count)
case PROCESSOR_UNKNOWN:
/* We use cpu_arch_isa_flags to check if we SHOULD
optimize for Cpu686. */
- if (cpu_arch_isa_flags.bitfield.cpui686)
+ if (fragP->tc_frag_data.isa_flags.bitfield.cpui686)
patt = alt_long_patt;
else
patt = f32_patt;
@@ -1030,7 +1011,7 @@ i386_align_code (fragS *fragP, int count)
}
else
{
- switch (cpu_arch_tune)
+ switch (fragP->tc_frag_data.tune)
{
case PROCESSOR_UNKNOWN:
/* When cpu_arch_isa is set, cpu_arch_tune shouldn't be
@@ -1048,7 +1029,7 @@ i386_align_code (fragS *fragP, int count)
case PROCESSOR_GENERIC32:
/* We use cpu_arch_isa_flags to check if we CAN optimize
for Cpu686. */
- if (cpu_arch_isa_flags.bitfield.cpui686)
+ if (fragP->tc_frag_data.isa_flags.bitfield.cpui686)
patt = alt_short_patt;
else
patt = f32_patt;
@@ -1058,7 +1039,7 @@ i386_align_code (fragS *fragP, int count)
case PROCESSOR_NOCONA:
case PROCESSOR_CORE:
case PROCESSOR_CORE2:
- if (cpu_arch_isa_flags.bitfield.cpui686)
+ if (fragP->tc_frag_data.isa_flags.bitfield.cpui686)
patt = alt_long_patt;
else
patt = f32_patt;
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index fd8c8ecf73d..f7f829c48d6 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -187,6 +187,50 @@ void i386_print_statistics (FILE *);
#define md_number_to_chars number_to_chars_littleendian
+enum processor_type
+{
+ PROCESSOR_UNKNOWN,
+ PROCESSOR_I386,
+ PROCESSOR_I486,
+ PROCESSOR_PENTIUM,
+ PROCESSOR_PENTIUMPRO,
+ PROCESSOR_PENTIUM4,
+ PROCESSOR_NOCONA,
+ PROCESSOR_CORE,
+ PROCESSOR_CORE2,
+ PROCESSOR_K6,
+ PROCESSOR_ATHLON,
+ PROCESSOR_K8,
+ PROCESSOR_GENERIC32,
+ PROCESSOR_GENERIC64,
+ PROCESSOR_AMDFAM10
+};
+
+extern enum processor_type cpu_arch_tune;
+extern enum processor_type cpu_arch_isa;
+extern i386_cpu_flags cpu_arch_isa_flags;
+
+struct i386_tc_frag_data
+{
+ enum processor_type isa;
+ i386_cpu_flags isa_flags;
+ enum processor_type tune;
+};
+
+/* We need to emit the right NOP pattern in .align frags. This is
+ done after the text-to-bits assembly pass, so we need to mark it with
+ the isa/tune settings at the time the .align was assembled. */
+#define TC_FRAG_TYPE struct i386_tc_frag_data
+
+#define TC_FRAG_INIT(FRAGP) \
+ do \
+ { \
+ (FRAGP)->tc_frag_data.isa = cpu_arch_isa; \
+ (FRAGP)->tc_frag_data.isa_flags = cpu_arch_isa_flags; \
+ (FRAGP)->tc_frag_data.tune = cpu_arch_tune; \
+ } \
+ while (0)
+
#ifdef SCO_ELF
#define tc_init_after_args() sco_id ()
extern void sco_id (void);