From d30a2be45d6518c9de3aba98b75b5552880cb524 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 16 Sep 1997 01:34:03 +0000 Subject: [PATCH] Added checking of instructions against target cpu. --- gas/ChangeLog | 15 +++++++++++++++ gas/config/tc-v850.c | 28 ++++++++++++++++++++++++++-- gas/config/tc-v850.h | 14 ++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 474654b10fe..c1783b3cd2e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,18 @@ +Mon Sep 15 18:33:06 1997 Nick Clifton + + * config/tc-v850.c (processor_mask): New variable. + (set_machine, md_parse_option): Set processor_mask. + (md_assemble): Check that instruction is available to target + processor. + + * config/tc-v850.h (TARGET_PROCESSOR): New constant. +start-sanitize-v850e + (TARGET_PROCESSOR): New constant. +end-sanitize-v850e +start-sanitize-v850eq + (TARGET_PROCESSOR): New constant. +end-sanitize-v850eq + start-sanitize-tx19 Mon Sep 15 17:26:46 1997 Gavin Koch diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 727c2efad73..39f1c72cfcf 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -34,9 +34,12 @@ static bfd_reloc_code_real_type hold_cons_reloc; static boolean warn_signed_overflows = FALSE; static boolean warn_unsigned_overflows = FALSE; -/* Indicates the target processor type. */ +/* Indicates the target BFD machine number. */ static int machine = TARGET_MACHINE; +/* Indicates the target processor(s) for the assemble. */ +static unsigned int processor_mask = TARGET_PROCESSOR; + /* Structure to hold information about predefined registers. */ struct reg_name @@ -211,6 +214,17 @@ set_machine (int number) { machine = number; bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine); + + switch (machine) + { + case 0: processor_mask = PROCESSOR_V850; break; +/* start-sanitize-v850e */ + case bfd_mach_v850e: processor_mask = PROCESSOR_V850E; break; +/* end-sanitize-v850e */ +/* start-sanitize-v850eq */ + case bfd_mach_v850eq: processor_mask = PROCESSOR_V850EQ; break; +/* end-sanitize-v850eq */ + } } /* The target specific pseudo-ops which we support. */ @@ -821,6 +835,8 @@ md_parse_option (c, arg) else if (strcmp (arg, "v850e") == 0) { machine = bfd_mach_v850e; + processor_mask = PROCESSOR_V850 | PROCESSOR_V850E; + return 1; } /* end-sanitize-v850e */ @@ -828,6 +844,7 @@ md_parse_option (c, arg) else if (strcmp (arg, "v850eq") == 0) { machine = bfd_mach_v850eq; + processor_mask = PROCESSOR_V850EQ; return 1; } /* end-sanitize-v850eq */ @@ -1133,9 +1150,16 @@ md_assemble (str) { const char * errmsg = NULL; + match = 0; + + if ((opcode->processors & processor_mask) == 0) + { + errmsg = "Target processor doe snot support this instruction."; + goto error; + } + relaxable = 0; fc = 0; - match = 0; next_opindex = 0; insn = opcode->opcode; extra_data_after_insn = false; diff --git a/gas/config/tc-v850.h b/gas/config/tc-v850.h index 31baf0be6e6..449777a595e 100644 --- a/gas/config/tc-v850.h +++ b/gas/config/tc-v850.h @@ -29,8 +29,10 @@ /* The target BFD architecture. */ #define TARGET_ARCH bfd_arch_v850 +/* The target BFD format. */ #define TARGET_FORMAT "elf32-v850" +/* The target BFD machine number. */ #define TARGET_MACHINE 0 /* start-sanitize-v850e */ #undef TARGET_MACHINE @@ -41,6 +43,18 @@ #define TARGET_MACHINE bfd_mach_v850eq /* end-sanitize-v850eq */ +/* The target processor mask. */ +#define TARGET_PROCESSOR PROCESSOR_V850 +/* start-sanitize-v850e */ +#undef TARGET_PROCESSOR +#define TARGET_PROCESSOR PROCESSOR_V850E +/* end-sanitize-v850e */ +/* start-sanitize-v850eq */ +#undef TARGET_PROCESSOR +#define TARGET_PROCESSOR PROCESSOR_V850EQ +/* end-sanitize-v850eq */ + + #define MD_APPLY_FIX3 #define md_operand(x)