From 7012071819b65c5794ef09c1b0e7627ebe36cfc1 Mon Sep 17 00:00:00 2001 From: Bill Moyer Date: Wed, 28 Jan 1998 18:20:46 +0000 Subject: [PATCH] Added --nowarnswap arg to suppress "Swapping instructions" warning. --- gas/ChangeLog | 7 +++++++ gas/as.c | 9 ++++++++- gas/as.h | 3 +++ gas/config/tc-d10v.c | 36 ++++++++++++++++++++++++++++++------ 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 7f4e06cfea7..67ed5c5409f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +Fri Jan 28 10:18:06 1998 Bill Moyer + + * as.h (flag_warn_instructionswap): added new flag variable. + * as.c (parse_args): added "--nowarnswap" command line arg. + * tc-d10v.c (write_2_short): emit "Swapping instructions" + warning only if flag_warn_instructionswap is set. + start-sanitize-sky Wed Jan 28 10:00:40 1998 Doug Evans diff --git a/gas/as.c b/gas/as.c index 42613087ca6..93959668dd3 100644 --- a/gas/as.c +++ b/gas/as.c @@ -356,7 +356,9 @@ parse_args (pargc, pargv) #define OPTION_GSTABS (OPTION_STD_BASE + 14) {"gstabs", no_argument, NULL, OPTION_GSTABS}, #define OPTION_STRIP_LOCAL_ABSOLUTE (OPTION_STD_BASE + 15) - {"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE} + {"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE}, +#define OPTION_NOWARNSWAP (OPTION_STD_BASE + 16) + {"nowarnswap", no_argument, NULL, OPTION_NOWARNSWAP} }; /* Construct the option lists from the standard list and the @@ -532,6 +534,10 @@ the GNU General Public License. This program has absolutely no warranty.\n"); case OPTION_GSTABS: debug_type = DEBUG_STABS; break; + + case OPTION_NOWARNSWAP: + flag_warn_instructionswap = 0; + break; case 'J': flag_signed_overflow_ok = 1; @@ -702,6 +708,7 @@ main (argc, argv) #endif out_file_name = OBJ_DEFAULT_OUTPUT_FILE_NAME; + flag_warn_instructionswap = 1; hex_init (); #ifdef BFD_ASSEMBLER diff --git a/gas/as.h b/gas/as.h index e5991908cb7..2d7052c6693 100644 --- a/gas/as.h +++ b/gas/as.h @@ -423,6 +423,9 @@ COMMON int flag_no_warnings; /* -W */ are detected. */ COMMON unsigned char flag_always_generate_output; /* -Z */ +/* True if instruction swapping warnings should be inhibited. */ +COMMON unsigned char flag_warn_instructionswap; /* --nowarnswap */ + /* This is true if the assembler should output time and space usage. */ COMMON unsigned char flag_print_statistics; diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index c8324b4585b..195e2666594 100644 --- a/gas/config/tc-d10v.c +++ b/gas/config/tc-d10v.c @@ -501,7 +501,7 @@ build_insn (opcode, opers, insn) unsigned long insn; { int i, bits, shift, flags, format; - unsigned int number; + unsigned long number; /* the insn argument is only used for the DIVS kludge */ if (insn) @@ -718,14 +718,16 @@ write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx) { if (opcode2->unit == IU) as_fatal ("Two IU instructions may not be executed in parallel"); - as_warn ("Swapping instruction order"); + if (flag_warn_instructionswap) + as_warn ("Swapping instruction order"); insn = FM00 | (insn2 << 15) | insn1; } else if (opcode2->unit == MU) { if (opcode1->unit == MU) as_fatal ("Two MU instructions may not be executed in parallel"); - as_warn ("Swapping instruction order"); + if (flag_warn_instructionswap) + as_warn ("Swapping instruction order"); insn = FM00 | (insn2 << 15) | insn1; } else @@ -863,7 +865,7 @@ parallel_ok (op1, insn1, op2, insn2, exec_type) else regno = 18; } - else if (flags & OPERAND_FLAG) + else if (flags & (OPERAND_FFLAG|OPERAND_CFLAG)) regno = 19; if ( flags & OPERAND_DEST ) @@ -1086,6 +1088,7 @@ find_opcode (opcode, myops) if (opcode->format == OPCODE_FAKE) { int opnum = opcode->operands[0]; + int flags; if (myops[opnum].X_op == O_register) { @@ -1095,11 +1098,31 @@ find_opcode (opcode, myops) myops[opnum].X_op_symbol = NULL; } + next_opcode=opcode+1; + + /* If the first operand is supposed to be a register, make sure + we got a valid one. */ + flags = d10v_operands[next_opcode->operands[0]].flags; + if (flags & OPERAND_REG) + { + int X_op = myops[0].X_op; + int num = myops[0].X_add_number; + + if (X_op != O_register + || (flags & OPERAND_ACC) != (num & OPERAND_ACC) + || (flags & OPERAND_FFLAG) != (num & OPERAND_FFLAG) + || (flags & OPERAND_CFLAG) != (num & OPERAND_CFLAG) + || (flags & OPERAND_CONTROL) != (num & OPERAND_CONTROL)) + { + as_bad ("bad opcode or operands"); + return 0; + } + } + if (myops[opnum].X_op == O_constant || (myops[opnum].X_op == O_symbol && S_IS_DEFINED(myops[opnum].X_add_symbol) && (S_GET_SEGMENT(myops[opnum].X_add_symbol) == now_seg))) { - next_opcode=opcode+1; for (i=0; opcode->operands[i+1]; i++) { int bits = d10v_operands[next_opcode->operands[opnum]].bits; @@ -1173,7 +1196,8 @@ find_opcode (opcode, myops) { if ((X_op != O_register) || ((flags & OPERAND_ACC) != (num & OPERAND_ACC)) || - ((flags & OPERAND_FLAG) != (num & OPERAND_FLAG)) || + ((flags & OPERAND_FFLAG) != (num & OPERAND_FFLAG)) || + ((flags & OPERAND_CFLAG) != (num & OPERAND_CFLAG)) || ((flags & OPERAND_CONTROL) != (num & OPERAND_CONTROL))) { match=0; -- 2.30.2