1999-05-03 07:29:11 +00:00
|
|
|
/* tc-d10v.c -- Assembler code for the Mitsubishi D10V
|
PR gas/3797
* config/tc-d10v.c (do_assemble): Do not generate error messages, just return -1 whenever a problem is encoun$
(md_assemble): If do_assemble returns -1 generate a non-fatal error message and return.
* gas/lns/lns.exp: Do not run the lns-common test for the d10v port.
* gas/d10v/address-002.l: Update expected assembler output.
* gas/d10v/address-003.l, gas/d10v/address-004.l,
gas/d10v/address-005.l, gas/d10v/address-006.l,
gas/d10v/address-007.l, gas/d10v/address-008.l,
gas/d10v/address-009.l, gas/d10v/address-010.l,
gas/d10v/address-011.l, gas/d10v/address-012.l,
gas/d10v/address-013.l, gas/d10v/address-014.l,
gas/d10v/address-015.l, gas/d10v/address-016.l,
gas/d10v/address-017.l, gas/d10v/address-018.l,
gas/d10v/address-019.l, gas/d10v/address-020.l,
gas/d10v/address-021.l, gas/d10v/address-022.l,
gas/d10v/address-023.l, gas/d10v/address-024.l,
gas/d10v/address-025.l, gas/d10v/address-026.l,
gas/d10v/address-027.l, gas/d10v/address-030.l,
gas/d10v/address-031.l, gas/d10v/address-032.l,
gas/d10v/address-033.l, gas/d10v/address-034.l,
gas/d10v/address-035.l, gas/d10v/address-036.l,
gas/d10v/address-037.l, gas/d10v/address-038.l,
gas/d10v/address-039.l, gas/d10v/address-040.l,
gas/d10v/address-041.l: Likewise.
2007-02-28 18:38:51 +00:00
|
|
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007
|
2001-03-08 23:24:26 +00:00
|
|
|
Free Software Foundation, Inc.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
This file is part of GAS, the GNU Assembler.
|
|
|
|
|
|
|
|
GAS is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-03 11:01:12 +00:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1999-05-03 07:29:11 +00:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
GAS is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GAS; see the file COPYING. If not, write to
|
2005-05-05 09:13:19 +00:00
|
|
|
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
#include "as.h"
|
2001-09-19 05:33:36 +00:00
|
|
|
#include "safe-ctype.h"
|
2000-07-27 04:05:05 +00:00
|
|
|
#include "subsegs.h"
|
1999-05-03 07:29:11 +00:00
|
|
|
#include "opcode/d10v.h"
|
|
|
|
#include "elf/ppc.h"
|
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
const char comment_chars[] = ";";
|
|
|
|
const char line_comment_chars[] = "#";
|
1999-05-03 07:29:11 +00:00
|
|
|
const char line_separator_chars[] = "";
|
2005-03-24 20:40:28 +00:00
|
|
|
const char *md_shortopts = "O";
|
|
|
|
const char EXP_CHARS[] = "eE";
|
|
|
|
const char FLT_CHARS[] = "dD";
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
int Optimizing = 0;
|
|
|
|
|
|
|
|
#define AT_WORD_P(X) ((X)->X_op == O_right_shift \
|
|
|
|
&& (X)->X_op_symbol != NULL \
|
1999-06-22 14:35:19 +00:00
|
|
|
&& symbol_constant_p ((X)->X_op_symbol) \
|
|
|
|
&& S_GET_VALUE ((X)->X_op_symbol) == AT_WORD_RIGHT_SHIFT)
|
1999-05-03 07:29:11 +00:00
|
|
|
#define AT_WORD_RIGHT_SHIFT 2
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Fixups. */
|
2005-03-24 20:40:28 +00:00
|
|
|
#define MAX_INSN_FIXUPS 5
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
struct d10v_fixup
|
|
|
|
{
|
|
|
|
expressionS exp;
|
|
|
|
int operand;
|
|
|
|
int pcrel;
|
|
|
|
int size;
|
|
|
|
bfd_reloc_code_real_type reloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _fixups
|
|
|
|
{
|
|
|
|
int fc;
|
|
|
|
struct d10v_fixup fix[MAX_INSN_FIXUPS];
|
|
|
|
struct _fixups *next;
|
|
|
|
} Fixups;
|
|
|
|
|
|
|
|
static Fixups FixUps[2];
|
|
|
|
static Fixups *fixups;
|
|
|
|
|
1999-06-17 02:13:18 +00:00
|
|
|
static int do_not_ignore_hash = 0;
|
|
|
|
|
2000-05-25 22:35:05 +00:00
|
|
|
typedef int packing_type;
|
2000-07-27 04:05:05 +00:00
|
|
|
#define PACK_UNSPEC (0) /* Packing order not specified. */
|
|
|
|
#define PACK_PARALLEL (1) /* "||" */
|
|
|
|
#define PACK_LEFT_RIGHT (2) /* "->" */
|
|
|
|
#define PACK_RIGHT_LEFT (3) /* "<-" */
|
|
|
|
static packing_type etype = PACK_UNSPEC; /* Used by d10v_cleanup. */
|
2000-05-25 22:35:05 +00:00
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
/* TRUE if instruction swapping warnings should be inhibited.
|
2001-01-14 18:54:06 +00:00
|
|
|
--nowarnswap. */
|
2002-11-30 08:39:46 +00:00
|
|
|
static bfd_boolean flag_warn_suppress_instructionswap;
|
2000-12-05 00:56:09 +00:00
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
/* TRUE if instruction packing should be performed when --gstabs is specified.
|
2000-12-05 00:56:09 +00:00
|
|
|
--gstabs-packing, --no-gstabs-packing. */
|
2002-11-30 08:39:46 +00:00
|
|
|
static bfd_boolean flag_allow_gstabs_packing = 1;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Local functions. */
|
2005-03-24 20:40:28 +00:00
|
|
|
|
|
|
|
enum options
|
|
|
|
{
|
|
|
|
OPTION_NOWARNSWAP = OPTION_MD_BASE,
|
|
|
|
OPTION_GSTABSPACKING,
|
|
|
|
OPTION_NOGSTABSPACKING
|
|
|
|
};
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
struct option md_longopts[] =
|
|
|
|
{
|
|
|
|
{"nowarnswap", no_argument, NULL, OPTION_NOWARNSWAP},
|
2000-12-05 00:56:09 +00:00
|
|
|
{"gstabspacking", no_argument, NULL, OPTION_GSTABSPACKING},
|
|
|
|
{"gstabs-packing", no_argument, NULL, OPTION_GSTABSPACKING},
|
|
|
|
{"nogstabspacking", no_argument, NULL, OPTION_NOGSTABSPACKING},
|
|
|
|
{"no-gstabs-packing", no_argument, NULL, OPTION_NOGSTABSPACKING},
|
1999-05-03 07:29:11 +00:00
|
|
|
{NULL, no_argument, NULL, 0}
|
|
|
|
};
|
2000-08-04 01:01:32 +00:00
|
|
|
|
|
|
|
size_t md_longopts_size = sizeof (md_longopts);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
/* Opcode hash table. */
|
|
|
|
static struct hash_control *d10v_hash;
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Do a binary search of the d10v_predefined_registers array to see if
|
|
|
|
NAME is a valid regiter name. Return the register number from the
|
|
|
|
array on success, or -1 on failure. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
static int
|
2005-03-24 20:40:28 +00:00
|
|
|
reg_name_search (char *name)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int middle, low, high;
|
|
|
|
int cmp;
|
|
|
|
|
|
|
|
low = 0;
|
2000-07-27 04:05:05 +00:00
|
|
|
high = d10v_reg_name_cnt () - 1;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
middle = (low + high) / 2;
|
|
|
|
cmp = strcasecmp (name, d10v_predefined_registers[middle].name);
|
|
|
|
if (cmp < 0)
|
|
|
|
high = middle - 1;
|
|
|
|
else if (cmp > 0)
|
|
|
|
low = middle + 1;
|
2000-07-27 04:05:05 +00:00
|
|
|
else
|
|
|
|
return d10v_predefined_registers[middle].value;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
while (low <= high);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Check the string at input_line_pointer
|
|
|
|
to see if it is a valid register name. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
static int
|
2005-03-24 20:40:28 +00:00
|
|
|
register_name (expressionS *expressionP)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int reg_number;
|
|
|
|
char c, *p = input_line_pointer;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
|
|
|
while (*p
|
|
|
|
&& *p != '\n' && *p != '\r' && *p != ',' && *p != ' ' && *p != ')')
|
1999-05-03 07:29:11 +00:00
|
|
|
p++;
|
|
|
|
|
|
|
|
c = *p;
|
|
|
|
if (c)
|
|
|
|
*p++ = 0;
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Look to see if it's in the register table. */
|
1999-05-03 07:29:11 +00:00
|
|
|
reg_number = reg_name_search (input_line_pointer);
|
2000-07-27 04:05:05 +00:00
|
|
|
if (reg_number >= 0)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
expressionP->X_op = O_register;
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Temporarily store a pointer to the string here. */
|
|
|
|
expressionP->X_op_symbol = (symbolS *) input_line_pointer;
|
1999-05-03 07:29:11 +00:00
|
|
|
expressionP->X_add_number = reg_number;
|
|
|
|
input_line_pointer = p;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (c)
|
2000-07-27 04:05:05 +00:00
|
|
|
*(p - 1) = c;
|
1999-05-03 07:29:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2005-03-24 20:40:28 +00:00
|
|
|
check_range (unsigned long num, int bits, int flags)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-12-05 00:56:09 +00:00
|
|
|
long min, max;
|
2000-07-27 04:05:05 +00:00
|
|
|
int retval = 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Don't bother checking 16-bit values. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (bits == 16)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (flags & OPERAND_SHIFT)
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
/* All special shift operands are unsigned and <= 16.
|
|
|
|
We allow 0 for now. */
|
|
|
|
if (num > 16)
|
1999-05-03 07:29:11 +00:00
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & OPERAND_SIGNED)
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Signed 3-bit integers are restricted to the (-2, 3) range. */
|
1999-10-07 06:17:04 +00:00
|
|
|
if (flags & RESTRICTED_NUM3)
|
|
|
|
{
|
|
|
|
if ((long) num < -2 || (long) num > 3)
|
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
max = (1 << (bits - 1)) - 1;
|
|
|
|
min = - (1 << (bits - 1));
|
1999-10-07 06:17:04 +00:00
|
|
|
if (((long) num > max) || ((long) num < min))
|
|
|
|
retval = 1;
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
max = (1 << bits) - 1;
|
|
|
|
min = 0;
|
2000-12-05 00:56:09 +00:00
|
|
|
if (((long) num > max) || ((long) num < min))
|
1999-05-03 07:29:11 +00:00
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-03-24 20:40:28 +00:00
|
|
|
md_show_usage (FILE *stream)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
fprintf (stream, _("D10V options:\n\
|
2000-12-05 00:56:09 +00:00
|
|
|
-O Optimize. Will do some operations in parallel.\n\
|
|
|
|
--gstabs-packing Pack adjacent short instructions together even\n\
|
|
|
|
when --gstabs is specified. On by default.\n\
|
|
|
|
--no-gstabs-packing If --gstabs is specified, do not pack adjacent\n\
|
|
|
|
instructions together.\n"));
|
2000-07-27 04:05:05 +00:00
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
int
|
2005-03-24 20:40:28 +00:00
|
|
|
md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case 'O':
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Optimize. Will attempt to parallelize operations. */
|
1999-05-03 07:29:11 +00:00
|
|
|
Optimizing = 1;
|
|
|
|
break;
|
|
|
|
case OPTION_NOWARNSWAP:
|
|
|
|
flag_warn_suppress_instructionswap = 1;
|
|
|
|
break;
|
2000-12-05 00:56:09 +00:00
|
|
|
case OPTION_GSTABSPACKING:
|
|
|
|
flag_allow_gstabs_packing = 1;
|
|
|
|
break;
|
|
|
|
case OPTION_NOGSTABSPACKING:
|
|
|
|
flag_allow_gstabs_packing = 0;
|
|
|
|
break;
|
1999-05-03 07:29:11 +00:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
symbolS *
|
2005-03-24 20:40:28 +00:00
|
|
|
md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
2005-03-24 20:40:28 +00:00
|
|
|
md_atof (int type, char *litP, int *sizeP)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2007-10-17 16:45:56 +00:00
|
|
|
return ieee_md_atof (type, litP, sizeP, TRUE);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-03-24 20:40:28 +00:00
|
|
|
md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
asection *sec ATTRIBUTE_UNUSED,
|
|
|
|
fragS *fragP ATTRIBUTE_UNUSED)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
valueT
|
2005-03-24 20:40:28 +00:00
|
|
|
md_section_align (asection *seg, valueT addr)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int align = bfd_get_section_alignment (stdoutput, seg);
|
|
|
|
return ((addr + (1 << align) - 1) & (-1 << align));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-03-24 20:40:28 +00:00
|
|
|
md_begin (void)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
char *prev_name = "";
|
|
|
|
struct d10v_opcode *opcode;
|
2000-07-27 04:05:05 +00:00
|
|
|
d10v_hash = hash_new ();
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
/* Insert unique names into hash table. The D10v instruction set
|
|
|
|
has many identical opcode names that have different opcodes based
|
|
|
|
on the operands. This hash table then provides a quick index to
|
|
|
|
the first opcode with a particular name in the opcode table. */
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
for (opcode = (struct d10v_opcode *) d10v_opcodes; opcode->name; opcode++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
if (strcmp (prev_name, opcode->name))
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
prev_name = (char *) opcode->name;
|
1999-05-03 07:29:11 +00:00
|
|
|
hash_insert (d10v_hash, opcode->name, (char *) opcode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fixups = &FixUps[0];
|
|
|
|
FixUps[0].next = &FixUps[1];
|
|
|
|
FixUps[1].next = &FixUps[0];
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Remove the postincrement or postdecrement operator ( '+' or '-' )
|
|
|
|
from an expression. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
static int
|
2005-03-24 20:40:28 +00:00
|
|
|
postfix (char *p)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
while (*p != '-' && *p != '+')
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
if (*p == 0 || *p == '\n' || *p == '\r')
|
1999-05-03 07:29:11 +00:00
|
|
|
break;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
if (*p == '-')
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
*p = ' ';
|
2005-03-24 20:40:28 +00:00
|
|
|
return -1;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2000-07-27 04:05:05 +00:00
|
|
|
if (*p == '+')
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
*p = ' ';
|
2005-03-24 20:40:28 +00:00
|
|
|
return 1;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
return 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
static bfd_reloc_code_real_type
|
2005-03-24 20:40:28 +00:00
|
|
|
get_reloc (struct d10v_operand *op)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int bits = op->bits;
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
if (bits <= 4)
|
2005-03-24 20:40:28 +00:00
|
|
|
return 0;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
|
|
|
if (op->flags & OPERAND_ADDR)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
if (bits == 8)
|
2005-03-24 20:40:28 +00:00
|
|
|
return BFD_RELOC_D10V_10_PCREL_R;
|
1999-05-03 07:29:11 +00:00
|
|
|
else
|
2005-03-24 20:40:28 +00:00
|
|
|
return BFD_RELOC_D10V_18_PCREL;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
return BFD_RELOC_16;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Parse a string of operands. Return an array of expressions. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
static int
|
2005-03-24 20:40:28 +00:00
|
|
|
get_operands (expressionS exp[])
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
char *p = input_line_pointer;
|
|
|
|
int numops = 0;
|
|
|
|
int post = 0;
|
1999-06-17 02:13:18 +00:00
|
|
|
int uses_at = 0;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
|
|
|
while (*p)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
while (*p == ' ' || *p == '\t' || *p == ',')
|
1999-05-03 07:29:11 +00:00
|
|
|
p++;
|
2000-07-27 04:05:05 +00:00
|
|
|
if (*p == 0 || *p == '\n' || *p == '\r')
|
1999-05-03 07:29:11 +00:00
|
|
|
break;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
|
|
|
if (*p == '@')
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
1999-06-17 02:13:18 +00:00
|
|
|
uses_at = 1;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
p++;
|
|
|
|
exp[numops].X_op = O_absent;
|
2000-07-27 04:05:05 +00:00
|
|
|
if (*p == '(')
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
p++;
|
|
|
|
exp[numops].X_add_number = OPERAND_ATPAR;
|
|
|
|
}
|
2000-07-27 04:05:05 +00:00
|
|
|
else if (*p == '-')
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
p++;
|
|
|
|
exp[numops].X_add_number = OPERAND_ATMINUS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
exp[numops].X_add_number = OPERAND_ATSIGN;
|
2001-11-29 18:23:11 +00:00
|
|
|
if (*p == '+')
|
|
|
|
{
|
2001-12-12 07:32:47 +00:00
|
|
|
numops++;
|
|
|
|
exp[numops].X_op = O_absent;
|
|
|
|
exp[numops].X_add_number = OPERAND_PLUS;
|
|
|
|
p++;
|
2001-11-29 18:23:11 +00:00
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
post = postfix (p);
|
|
|
|
}
|
|
|
|
numops++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
if (*p == ')')
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Just skip the trailing paren. */
|
1999-05-03 07:29:11 +00:00
|
|
|
p++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
input_line_pointer = p;
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Check to see if it might be a register name. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (!register_name (&exp[numops]))
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Parse as an expression. */
|
1999-06-17 02:13:18 +00:00
|
|
|
if (uses_at)
|
|
|
|
{
|
|
|
|
/* Any expression that involves the indirect addressing
|
|
|
|
cannot also involve immediate addressing. Therefore
|
|
|
|
the use of the hash character is illegal. */
|
|
|
|
int save = do_not_ignore_hash;
|
|
|
|
do_not_ignore_hash = 1;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-06-17 02:13:18 +00:00
|
|
|
expression (&exp[numops]);
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-06-17 02:13:18 +00:00
|
|
|
do_not_ignore_hash = save;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
expression (&exp[numops]);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (strncasecmp (input_line_pointer, "@word", 5) == 0)
|
|
|
|
{
|
|
|
|
input_line_pointer += 5;
|
|
|
|
if (exp[numops].X_op == O_register)
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
/* If it looked like a register name but was followed by
|
1999-05-03 07:29:11 +00:00
|
|
|
"@word" then it was really a symbol, so change it to
|
2000-07-27 04:05:05 +00:00
|
|
|
one. */
|
1999-05-03 07:29:11 +00:00
|
|
|
exp[numops].X_op = O_symbol;
|
2000-07-27 04:05:05 +00:00
|
|
|
exp[numops].X_add_symbol =
|
|
|
|
symbol_find_or_make ((char *) exp[numops].X_op_symbol);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Check for identifier@word+constant. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (*input_line_pointer == '-' || *input_line_pointer == '+')
|
2000-07-27 04:05:05 +00:00
|
|
|
{
|
|
|
|
expressionS new_exp;
|
|
|
|
expression (&new_exp);
|
|
|
|
exp[numops].X_add_number = new_exp.X_add_number;
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Convert expr into a right shift by AT_WORD_RIGHT_SHIFT. */
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
expressionS new_exp;
|
|
|
|
memset (&new_exp, 0, sizeof new_exp);
|
|
|
|
new_exp.X_add_number = AT_WORD_RIGHT_SHIFT;
|
|
|
|
new_exp.X_op = O_constant;
|
|
|
|
new_exp.X_unsigned = 1;
|
|
|
|
exp[numops].X_op_symbol = make_expr_symbol (&new_exp);
|
|
|
|
exp[numops].X_op = O_right_shift;
|
|
|
|
}
|
|
|
|
|
|
|
|
know (AT_WORD_P (&exp[numops]));
|
|
|
|
}
|
2000-07-27 04:05:05 +00:00
|
|
|
|
|
|
|
if (exp[numops].X_op == O_illegal)
|
1999-05-03 07:29:11 +00:00
|
|
|
as_bad (_("illegal operand"));
|
2000-07-27 04:05:05 +00:00
|
|
|
else if (exp[numops].X_op == O_absent)
|
1999-05-03 07:29:11 +00:00
|
|
|
as_bad (_("missing operand"));
|
|
|
|
|
|
|
|
numops++;
|
|
|
|
p = input_line_pointer;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
switch (post)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
case -1: /* Postdecrement mode. */
|
1999-05-03 07:29:11 +00:00
|
|
|
exp[numops].X_op = O_absent;
|
|
|
|
exp[numops++].X_add_number = OPERAND_MINUS;
|
|
|
|
break;
|
2000-07-27 04:05:05 +00:00
|
|
|
case 1: /* Postincrement mode. */
|
1999-05-03 07:29:11 +00:00
|
|
|
exp[numops].X_op = O_absent;
|
|
|
|
exp[numops++].X_add_number = OPERAND_PLUS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
exp[numops].X_op = 0;
|
2005-03-24 20:40:28 +00:00
|
|
|
return numops;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned long
|
2005-03-24 20:40:28 +00:00
|
|
|
d10v_insert_operand (unsigned long insn,
|
|
|
|
int op_type,
|
|
|
|
offsetT value,
|
|
|
|
int left,
|
|
|
|
fixS *fix)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int shift, bits;
|
|
|
|
|
|
|
|
shift = d10v_operands[op_type].shift;
|
|
|
|
if (left)
|
|
|
|
shift += 15;
|
|
|
|
|
|
|
|
bits = d10v_operands[op_type].bits;
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Truncate to the proper number of bits. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (check_range (value, bits, d10v_operands[op_type].flags))
|
2000-08-04 01:01:32 +00:00
|
|
|
as_bad_where (fix->fx_file, fix->fx_line,
|
2002-04-03 19:44:05 +00:00
|
|
|
_("operand out of range: %ld"), (long) value);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
value &= 0x7FFFFFFF >> (31 - bits);
|
|
|
|
insn |= (value << shift);
|
|
|
|
|
|
|
|
return insn;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Take a pointer to the opcode entry in the opcode table and the
|
|
|
|
array of operand expressions. Return the instruction. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
static unsigned long
|
2005-03-24 20:40:28 +00:00
|
|
|
build_insn (struct d10v_opcode *opcode,
|
|
|
|
expressionS *opers,
|
|
|
|
unsigned long insn)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int i, bits, shift, flags, format;
|
|
|
|
unsigned long number;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
|
|
|
/* The insn argument is only used for the DIVS kludge. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (insn)
|
|
|
|
format = LONG_R;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
insn = opcode->opcode;
|
|
|
|
format = opcode->format;
|
|
|
|
}
|
2000-07-27 04:05:05 +00:00
|
|
|
|
|
|
|
for (i = 0; opcode->operands[i]; i++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
flags = d10v_operands[opcode->operands[i]].flags;
|
|
|
|
bits = d10v_operands[opcode->operands[i]].bits;
|
|
|
|
shift = d10v_operands[opcode->operands[i]].shift;
|
|
|
|
number = opers[i].X_add_number;
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
if (flags & OPERAND_REG)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
number &= REGISTER_MASK;
|
|
|
|
if (format == LONG_L)
|
|
|
|
shift += 15;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
if (opers[i].X_op != O_register && opers[i].X_op != O_constant)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Now create a fixup. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
if (fixups->fc >= MAX_INSN_FIXUPS)
|
|
|
|
as_fatal (_("too many fixups"));
|
|
|
|
|
|
|
|
if (AT_WORD_P (&opers[i]))
|
|
|
|
{
|
2003-11-21 00:24:40 +00:00
|
|
|
/* Recognize XXX>>1+N aka XXX@word+N as special (AT_WORD). */
|
1999-05-03 07:29:11 +00:00
|
|
|
fixups->fix[fixups->fc].reloc = BFD_RELOC_D10V_18;
|
|
|
|
opers[i].X_op = O_symbol;
|
2000-07-27 04:05:05 +00:00
|
|
|
opers[i].X_op_symbol = NULL; /* Should free it. */
|
1999-05-03 07:29:11 +00:00
|
|
|
/* number is left shifted by AT_WORD_RIGHT_SHIFT so
|
|
|
|
that, it is aligned with the symbol's value. Later,
|
|
|
|
BFD_RELOC_D10V_18 will right shift (symbol_value +
|
2000-07-27 04:05:05 +00:00
|
|
|
X_add_number). */
|
1999-05-03 07:29:11 +00:00
|
|
|
number <<= AT_WORD_RIGHT_SHIFT;
|
|
|
|
opers[i].X_add_number = number;
|
|
|
|
}
|
|
|
|
else
|
2002-05-30 16:16:30 +00:00
|
|
|
{
|
|
|
|
fixups->fix[fixups->fc].reloc =
|
|
|
|
get_reloc ((struct d10v_operand *) &d10v_operands[opcode->operands[i]]);
|
|
|
|
|
2002-12-17 01:13:56 +00:00
|
|
|
/* Check that an immediate was passed to ops that expect one. */
|
2002-11-30 08:39:46 +00:00
|
|
|
if ((flags & OPERAND_NUM)
|
2002-05-30 16:16:30 +00:00
|
|
|
&& (fixups->fix[fixups->fc].reloc == 0))
|
|
|
|
as_bad (_("operand is not an immediate"));
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
if (fixups->fix[fixups->fc].reloc == BFD_RELOC_16 ||
|
1999-05-03 07:29:11 +00:00
|
|
|
fixups->fix[fixups->fc].reloc == BFD_RELOC_D10V_18)
|
2000-07-27 04:05:05 +00:00
|
|
|
fixups->fix[fixups->fc].size = 2;
|
1999-05-03 07:29:11 +00:00
|
|
|
else
|
|
|
|
fixups->fix[fixups->fc].size = 4;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
fixups->fix[fixups->fc].exp = opers[i];
|
|
|
|
fixups->fix[fixups->fc].operand = opcode->operands[i];
|
2000-07-27 04:05:05 +00:00
|
|
|
fixups->fix[fixups->fc].pcrel =
|
2002-11-30 08:39:46 +00:00
|
|
|
(flags & OPERAND_ADDR) ? TRUE : FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
(fixups->fc)++;
|
|
|
|
}
|
2002-11-30 08:39:46 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Truncate to the proper number of bits. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if ((opers[i].X_op == O_constant) && check_range (number, bits, flags))
|
2002-04-03 19:44:05 +00:00
|
|
|
as_bad (_("operand out of range: %lu"), number);
|
1999-05-03 07:29:11 +00:00
|
|
|
number &= 0x7FFFFFFF >> (31 - bits);
|
|
|
|
insn = insn | (number << shift);
|
|
|
|
}
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
/* kludge: for DIVS, we need to put the operands in twice on the second
|
|
|
|
pass, format is changed to LONG_R to force the second set of operands
|
2002-04-03 19:44:05 +00:00
|
|
|
to not be shifted over 15. */
|
2000-07-27 04:05:05 +00:00
|
|
|
if ((opcode->opcode == OPCODE_DIVS) && (format == LONG_L))
|
1999-05-03 07:29:11 +00:00
|
|
|
insn = build_insn (opcode, opers, insn);
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
return insn;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Write out a long form instruction. */
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
static void
|
2005-03-24 20:40:28 +00:00
|
|
|
write_long (unsigned long insn, Fixups *fx)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int i, where;
|
2000-07-27 04:05:05 +00:00
|
|
|
char *f = frag_more (4);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
insn |= FM11;
|
|
|
|
number_to_chars_bigendian (f, insn, 4);
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
for (i = 0; i < fx->fc; i++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
if (fx->fix[i].reloc)
|
2000-07-27 04:05:05 +00:00
|
|
|
{
|
|
|
|
where = f - frag_now->fr_literal;
|
1999-05-03 07:29:11 +00:00
|
|
|
if (fx->fix[i].size == 2)
|
|
|
|
where += 2;
|
|
|
|
|
|
|
|
if (fx->fix[i].reloc == BFD_RELOC_D10V_18)
|
2000-07-27 04:05:05 +00:00
|
|
|
fx->fix[i].operand |= 4096;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
fix_new_exp (frag_now,
|
|
|
|
where,
|
|
|
|
fx->fix[i].size,
|
|
|
|
&(fx->fix[i].exp),
|
|
|
|
fx->fix[i].pcrel,
|
|
|
|
fx->fix[i].operand|2048);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fx->fc = 0;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Write out a short form instruction by itself. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
static void
|
2005-03-24 20:40:28 +00:00
|
|
|
write_1_short (struct d10v_opcode *opcode,
|
|
|
|
unsigned long insn,
|
|
|
|
Fixups *fx)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
char *f = frag_more (4);
|
1999-05-03 07:29:11 +00:00
|
|
|
int i, where;
|
|
|
|
|
|
|
|
if (opcode->exec_type & PARONLY)
|
|
|
|
as_fatal (_("Instruction must be executed in parallel with another instruction."));
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
/* The other container needs to be NOP.
|
|
|
|
According to 4.3.1: for FM=00, sub-instructions performed only by IU
|
2002-04-03 19:44:05 +00:00
|
|
|
cannot be encoded in L-container. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (opcode->unit == IU)
|
2000-07-27 04:05:05 +00:00
|
|
|
insn |= FM00 | (NOP << 15); /* Right container. */
|
1999-05-03 07:29:11 +00:00
|
|
|
else
|
2000-07-27 04:05:05 +00:00
|
|
|
insn = FM00 | (insn << 15) | NOP; /* Left container. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
number_to_chars_bigendian (f, insn, 4);
|
2000-07-27 04:05:05 +00:00
|
|
|
for (i = 0; i < fx->fc; i++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
if (fx->fix[i].reloc)
|
2000-07-27 04:05:05 +00:00
|
|
|
{
|
|
|
|
where = f - frag_now->fr_literal;
|
1999-05-03 07:29:11 +00:00
|
|
|
if (fx->fix[i].size == 2)
|
|
|
|
where += 2;
|
|
|
|
|
|
|
|
if (fx->fix[i].reloc == BFD_RELOC_D10V_18)
|
2000-07-27 04:05:05 +00:00
|
|
|
fx->fix[i].operand |= 4096;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* If it's an R reloc, we may have to switch it to L. */
|
|
|
|
if ((fx->fix[i].reloc == BFD_RELOC_D10V_10_PCREL_R)
|
|
|
|
&& (opcode->unit != IU))
|
1999-05-03 07:29:11 +00:00
|
|
|
fx->fix[i].operand |= 1024;
|
|
|
|
|
|
|
|
fix_new_exp (frag_now,
|
2000-07-27 04:05:05 +00:00
|
|
|
where,
|
1999-05-03 07:29:11 +00:00
|
|
|
fx->fix[i].size,
|
|
|
|
&(fx->fix[i].exp),
|
|
|
|
fx->fix[i].pcrel,
|
|
|
|
fx->fix[i].operand|2048);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fx->fc = 0;
|
|
|
|
}
|
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
/* Determine if there are any resource conflicts among two manually
|
|
|
|
parallelized instructions. Some of this was lifted from parallel_ok. */
|
2000-05-25 22:35:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
static void
|
|
|
|
check_resource_conflict (struct d10v_opcode *op1,
|
|
|
|
unsigned long insn1,
|
|
|
|
struct d10v_opcode *op2,
|
|
|
|
unsigned long insn2)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
int i, j, flags, mask, shift, regno;
|
|
|
|
unsigned long ins, mod[2];
|
|
|
|
struct d10v_opcode *op;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if ((op1->exec_type & SEQ)
|
|
|
|
|| ! ((op1->exec_type & PAR) || (op1->exec_type & PARONLY)))
|
|
|
|
{
|
|
|
|
as_warn (_("packing conflict: %s must dispatch sequentially"),
|
|
|
|
op1->name);
|
|
|
|
return;
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if ((op2->exec_type & SEQ)
|
|
|
|
|| ! ((op2->exec_type & PAR) || (op2->exec_type & PARONLY)))
|
|
|
|
{
|
|
|
|
as_warn (_("packing conflict: %s must dispatch sequentially"),
|
|
|
|
op2->name);
|
|
|
|
return;
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
/* See if both instructions write to the same resource.
|
|
|
|
|
|
|
|
The idea here is to create two sets of bitmasks (mod and used) which
|
|
|
|
indicate which registers are modified or used by each instruction.
|
|
|
|
The operation can only be done in parallel if neither instruction
|
|
|
|
modifies the same register. Accesses to control registers and memory
|
|
|
|
are treated as accesses to a single register. So if both instructions
|
|
|
|
write memory or if the first instruction writes memory and the second
|
|
|
|
reads, then they cannot be done in parallel. We treat reads to the PSW
|
|
|
|
(which includes C, F0, and F1) in isolation. So simultaneously writing
|
|
|
|
C and F0 in two different sub-instructions is permitted. */
|
|
|
|
|
|
|
|
/* The bitmasks (mod and used) look like this (bit 31 = MSB).
|
|
|
|
r0-r15 0-15
|
|
|
|
a0-a1 16-17
|
|
|
|
cr (not psw) 18
|
|
|
|
psw(other) 19
|
|
|
|
mem 20
|
|
|
|
psw(C flag) 21
|
|
|
|
psw(F0 flag) 22 */
|
|
|
|
|
|
|
|
for (j = 0; j < 2; j++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
if (j == 0)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
op = op1;
|
|
|
|
ins = insn1;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
op = op2;
|
|
|
|
ins = insn2;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2005-03-24 20:40:28 +00:00
|
|
|
mod[j] = 0;
|
|
|
|
if (op->exec_type & BRANCH_LINK)
|
|
|
|
mod[j] |= 1 << 13;
|
2000-05-25 22:35:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
for (i = 0; op->operands[i]; i++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
flags = d10v_operands[op->operands[i]].flags;
|
|
|
|
shift = d10v_operands[op->operands[i]].shift;
|
|
|
|
mask = 0x7FFFFFFF >> (31 - d10v_operands[op->operands[i]].bits);
|
|
|
|
if (flags & OPERAND_REG)
|
|
|
|
{
|
|
|
|
regno = (ins >> shift) & mask;
|
|
|
|
if (flags & (OPERAND_ACC0 | OPERAND_ACC1))
|
|
|
|
regno += 16;
|
|
|
|
else if (flags & OPERAND_CONTROL) /* mvtc or mvfc */
|
|
|
|
{
|
|
|
|
if (regno == 0)
|
|
|
|
regno = 19;
|
|
|
|
else
|
|
|
|
regno = 18;
|
|
|
|
}
|
|
|
|
else if (flags & OPERAND_FFLAG)
|
|
|
|
regno = 22;
|
|
|
|
else if (flags & OPERAND_CFLAG)
|
|
|
|
regno = 21;
|
2000-05-25 22:35:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if (flags & OPERAND_DEST
|
|
|
|
/* Auto inc/dec also modifies the register. */
|
|
|
|
|| (op->operands[i + 1] != 0
|
|
|
|
&& (d10v_operands[op->operands[i + 1]].flags
|
|
|
|
& (OPERAND_PLUS | OPERAND_MINUS)) != 0))
|
|
|
|
{
|
|
|
|
mod[j] |= 1 << regno;
|
|
|
|
if (flags & OPERAND_EVEN)
|
|
|
|
mod[j] |= 1 << (regno + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (flags & OPERAND_ATMINUS)
|
|
|
|
{
|
|
|
|
/* SP implicitly used/modified. */
|
|
|
|
mod[j] |= 1 << 15;
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2000-05-25 22:35:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if (op->exec_type & WMEM)
|
|
|
|
mod[j] |= 1 << 20;
|
|
|
|
else if (op->exec_type & WF0)
|
|
|
|
mod[j] |= 1 << 22;
|
|
|
|
else if (op->exec_type & WCAR)
|
|
|
|
mod[j] |= 1 << 21;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if ((mod[0] & mod[1]) == 0)
|
|
|
|
return;
|
|
|
|
else
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
unsigned long x;
|
|
|
|
x = mod[0] & mod[1];
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
for (j = 0; j <= 15; j++)
|
|
|
|
if (x & (1 << j))
|
|
|
|
as_warn (_("resource conflict (R%d)"), j);
|
|
|
|
for (j = 16; j <= 17; j++)
|
|
|
|
if (x & (1 << j))
|
|
|
|
as_warn (_("resource conflict (A%d)"), j - 16);
|
|
|
|
if (x & (1 << 19))
|
|
|
|
as_warn (_("resource conflict (PSW)"));
|
|
|
|
if (x & (1 << 21))
|
|
|
|
as_warn (_("resource conflict (C flag)"));
|
|
|
|
if (x & (1 << 22))
|
|
|
|
as_warn (_("resource conflict (F flag)"));
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Check 2 instructions and determine if they can be safely
|
|
|
|
executed in parallel. Return 1 if they can be. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
static int
|
2005-03-24 20:40:28 +00:00
|
|
|
parallel_ok (struct d10v_opcode *op1,
|
|
|
|
unsigned long insn1,
|
|
|
|
struct d10v_opcode *op2,
|
|
|
|
unsigned long insn2,
|
|
|
|
packing_type exec_type)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int i, j, flags, mask, shift, regno;
|
|
|
|
unsigned long ins, mod[2], used[2];
|
|
|
|
struct d10v_opcode *op;
|
|
|
|
|
|
|
|
if ((op1->exec_type & SEQ) != 0 || (op2->exec_type & SEQ) != 0
|
|
|
|
|| (op1->exec_type & PAR) == 0 || (op2->exec_type & PAR) == 0
|
|
|
|
|| (op1->unit == BOTH) || (op2->unit == BOTH)
|
|
|
|
|| (op1->unit == IU && op2->unit == IU)
|
|
|
|
|| (op1->unit == MU && op2->unit == MU))
|
|
|
|
return 0;
|
|
|
|
|
2002-05-30 16:16:30 +00:00
|
|
|
/* If this is auto parallelization, and the first instruction is a
|
|
|
|
branch or should not be packed, then don't parallelize. */
|
2000-05-25 22:35:05 +00:00
|
|
|
if (exec_type == PACK_UNSPEC
|
2002-05-30 16:16:30 +00:00
|
|
|
&& (op1->exec_type & (ALONE | BRANCH)))
|
1999-05-03 07:29:11 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* The idea here is to create two sets of bitmasks (mod and used)
|
|
|
|
which indicate which registers are modified or used by each
|
|
|
|
instruction. The operation can only be done in parallel if
|
|
|
|
instruction 1 and instruction 2 modify different registers, and
|
|
|
|
the first instruction does not modify registers that the second
|
|
|
|
is using (The second instruction can modify registers that the
|
|
|
|
first is using as they are only written back after the first
|
|
|
|
instruction has completed). Accesses to control registers, PSW,
|
|
|
|
and memory are treated as accesses to a single register. So if
|
|
|
|
both instructions write memory or if the first instruction writes
|
|
|
|
memory and the second reads, then they cannot be done in
|
|
|
|
parallel. Likewise, if the first instruction mucks with the psw
|
|
|
|
and the second reads the PSW (which includes C, F0, and F1), then
|
2000-07-27 04:05:05 +00:00
|
|
|
they cannot operate safely in parallel. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
/* The bitmasks (mod and used) look like this (bit 31 = MSB).
|
|
|
|
r0-r15 0-15
|
2002-04-03 19:44:05 +00:00
|
|
|
a0-a1 16-17
|
|
|
|
cr (not psw) 18
|
|
|
|
psw 19
|
|
|
|
mem 20 */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
for (j = 0; j < 2; j++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
if (j == 0)
|
|
|
|
{
|
|
|
|
op = op1;
|
|
|
|
ins = insn1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
op = op2;
|
|
|
|
ins = insn2;
|
|
|
|
}
|
|
|
|
mod[j] = used[j] = 0;
|
|
|
|
if (op->exec_type & BRANCH_LINK)
|
|
|
|
mod[j] |= 1 << 13;
|
|
|
|
|
|
|
|
for (i = 0; op->operands[i]; i++)
|
|
|
|
{
|
|
|
|
flags = d10v_operands[op->operands[i]].flags;
|
|
|
|
shift = d10v_operands[op->operands[i]].shift;
|
|
|
|
mask = 0x7FFFFFFF >> (31 - d10v_operands[op->operands[i]].bits);
|
|
|
|
if (flags & OPERAND_REG)
|
|
|
|
{
|
|
|
|
regno = (ins >> shift) & mask;
|
2000-07-27 04:05:05 +00:00
|
|
|
if (flags & (OPERAND_ACC0 | OPERAND_ACC1))
|
1999-05-03 07:29:11 +00:00
|
|
|
regno += 16;
|
2000-07-27 04:05:05 +00:00
|
|
|
else if (flags & OPERAND_CONTROL) /* mvtc or mvfc. */
|
|
|
|
{
|
1999-05-03 07:29:11 +00:00
|
|
|
if (regno == 0)
|
|
|
|
regno = 19;
|
|
|
|
else
|
2000-07-27 04:05:05 +00:00
|
|
|
regno = 18;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2000-07-27 04:05:05 +00:00
|
|
|
else if (flags & (OPERAND_FFLAG | OPERAND_CFLAG))
|
1999-05-03 07:29:11 +00:00
|
|
|
regno = 19;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
|
|
|
if (flags & OPERAND_DEST)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
mod[j] |= 1 << regno;
|
|
|
|
if (flags & OPERAND_EVEN)
|
|
|
|
mod[j] |= 1 << (regno + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
used[j] |= 1 << regno;
|
1999-05-03 07:29:11 +00:00
|
|
|
if (flags & OPERAND_EVEN)
|
|
|
|
used[j] |= 1 << (regno + 1);
|
|
|
|
|
|
|
|
/* Auto inc/dec also modifies the register. */
|
2000-07-27 04:05:05 +00:00
|
|
|
if (op->operands[i + 1] != 0
|
|
|
|
&& (d10v_operands[op->operands[i + 1]].flags
|
1999-05-03 07:29:11 +00:00
|
|
|
& (OPERAND_PLUS | OPERAND_MINUS)) != 0)
|
|
|
|
mod[j] |= 1 << regno;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (flags & OPERAND_ATMINUS)
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
/* SP implicitly used/modified. */
|
1999-05-03 07:29:11 +00:00
|
|
|
mod[j] |= 1 << 15;
|
|
|
|
used[j] |= 1 << 15;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (op->exec_type & RMEM)
|
|
|
|
used[j] |= 1 << 20;
|
|
|
|
else if (op->exec_type & WMEM)
|
|
|
|
mod[j] |= 1 << 20;
|
|
|
|
else if (op->exec_type & RF0)
|
|
|
|
used[j] |= 1 << 19;
|
|
|
|
else if (op->exec_type & WF0)
|
|
|
|
mod[j] |= 1 << 19;
|
|
|
|
else if (op->exec_type & WCAR)
|
|
|
|
mod[j] |= 1 << 19;
|
|
|
|
}
|
|
|
|
if ((mod[0] & mod[1]) == 0 && (mod[0] & used[1]) == 0)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
/* Expects two short instructions.
|
|
|
|
If possible, writes out both as a single packed instruction.
|
|
|
|
Otherwise, writes out the first one, packed with a NOP.
|
|
|
|
Returns number of instructions not written out. */
|
2002-04-03 19:44:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
static int
|
|
|
|
write_2_short (struct d10v_opcode *opcode1,
|
|
|
|
unsigned long insn1,
|
|
|
|
struct d10v_opcode *opcode2,
|
|
|
|
unsigned long insn2,
|
|
|
|
packing_type exec_type,
|
|
|
|
Fixups *fx)
|
|
|
|
{
|
|
|
|
unsigned long insn;
|
|
|
|
char *f;
|
|
|
|
int i, j, where;
|
2002-05-30 16:16:30 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if ((exec_type != PACK_PARALLEL)
|
|
|
|
&& ((opcode1->exec_type & PARONLY) || (opcode2->exec_type & PARONLY)))
|
|
|
|
as_fatal (_("Instruction must be executed in parallel"));
|
2002-04-03 19:44:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if ((opcode1->format & LONG_OPCODE) || (opcode2->format & LONG_OPCODE))
|
|
|
|
as_fatal (_("Long instructions may not be combined."));
|
2002-04-03 19:44:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
switch (exec_type)
|
2002-04-03 19:44:05 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
case PACK_UNSPEC: /* Order not specified. */
|
|
|
|
if (opcode1->exec_type & ALONE)
|
2002-04-03 19:44:05 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
/* Case of a short branch on a separate GAS line. Pack with NOP. */
|
|
|
|
write_1_short (opcode1, insn1, fx->next);
|
|
|
|
return 1;
|
2002-04-03 19:44:05 +00:00
|
|
|
}
|
2005-03-24 20:40:28 +00:00
|
|
|
if (Optimizing
|
|
|
|
&& parallel_ok (opcode1, insn1, opcode2, insn2, exec_type))
|
2002-04-03 19:44:05 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
/* Parallel. */
|
|
|
|
if (opcode1->unit == IU)
|
|
|
|
insn = FM00 | (insn2 << 15) | insn1;
|
|
|
|
else if (opcode2->unit == MU)
|
|
|
|
insn = FM00 | (insn2 << 15) | insn1;
|
|
|
|
else
|
|
|
|
insn = FM00 | (insn1 << 15) | insn2;
|
2002-04-03 19:44:05 +00:00
|
|
|
}
|
2005-03-24 20:40:28 +00:00
|
|
|
else if (opcode1->unit == IU)
|
|
|
|
/* Reverse sequential with IU opcode1 on right and done first. */
|
|
|
|
insn = FM10 | (insn2 << 15) | insn1;
|
1999-05-03 07:29:11 +00:00
|
|
|
else
|
2005-03-24 20:40:28 +00:00
|
|
|
/* Sequential with non-IU opcode1 on left and done first. */
|
|
|
|
insn = FM01 | (insn1 << 15) | insn2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PACK_PARALLEL:
|
|
|
|
if (opcode1->exec_type & SEQ || opcode2->exec_type & SEQ)
|
|
|
|
as_fatal
|
|
|
|
(_("One of these instructions may not be executed in parallel."));
|
|
|
|
if (opcode1->unit == IU)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
if (opcode2->unit == IU)
|
|
|
|
as_fatal (_("Two IU instructions may not be executed in parallel"));
|
|
|
|
if (!flag_warn_suppress_instructionswap)
|
|
|
|
as_warn (_("Swapping instruction order"));
|
|
|
|
insn = FM00 | (insn2 << 15) | insn1;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2005-03-24 20:40:28 +00:00
|
|
|
else if (opcode2->unit == MU)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
if (opcode1->unit == MU)
|
|
|
|
as_fatal (_("Two MU instructions may not be executed in parallel"));
|
|
|
|
if (!flag_warn_suppress_instructionswap)
|
|
|
|
as_warn (_("Swapping instruction order"));
|
|
|
|
insn = FM00 | (insn2 << 15) | insn1;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2005-03-24 20:40:28 +00:00
|
|
|
else
|
|
|
|
insn = FM00 | (insn1 << 15) | insn2;
|
|
|
|
check_resource_conflict (opcode1, insn1, opcode2, insn2);
|
|
|
|
break;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
case PACK_LEFT_RIGHT:
|
|
|
|
if (opcode1->unit != IU)
|
|
|
|
insn = FM01 | (insn1 << 15) | insn2;
|
|
|
|
else if (opcode2->unit == MU || opcode2->unit == EITHER)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
if (!flag_warn_suppress_instructionswap)
|
|
|
|
as_warn (_("Swapping instruction order"));
|
|
|
|
insn = FM10 | (insn2 << 15) | insn1;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2005-03-24 20:40:28 +00:00
|
|
|
else
|
|
|
|
as_fatal (_("IU instruction may not be in the left container"));
|
|
|
|
if (opcode1->exec_type & ALONE)
|
|
|
|
as_warn (_("Instruction in R container is squashed by flow control instruction in L container."));
|
|
|
|
break;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
case PACK_RIGHT_LEFT:
|
|
|
|
if (opcode2->unit != MU)
|
|
|
|
insn = FM10 | (insn1 << 15) | insn2;
|
|
|
|
else if (opcode1->unit == IU || opcode1->unit == EITHER)
|
|
|
|
{
|
|
|
|
if (!flag_warn_suppress_instructionswap)
|
|
|
|
as_warn (_("Swapping instruction order"));
|
|
|
|
insn = FM01 | (insn2 << 15) | insn1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
as_fatal (_("MU instruction may not be in the right container"));
|
|
|
|
if (opcode2->exec_type & ALONE)
|
|
|
|
as_warn (_("Instruction in R container is squashed by flow control instruction in L container."));
|
|
|
|
break;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
default:
|
|
|
|
as_fatal (_("unknown execution type passed to write_2_short()"));
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
f = frag_more (4);
|
|
|
|
number_to_chars_bigendian (f, insn, 4);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
/* Process fixup chains. fx refers to insn2 when j == 0, and to
|
|
|
|
insn1 when j == 1. Yes, it's reversed. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
for (j = 0; j < 2; j++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2005-03-24 20:40:28 +00:00
|
|
|
for (i = 0; i < fx->fc; i++)
|
|
|
|
{
|
|
|
|
if (fx->fix[i].reloc)
|
|
|
|
{
|
|
|
|
where = f - frag_now->fr_literal;
|
|
|
|
if (fx->fix[i].size == 2)
|
|
|
|
where += 2;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if (fx->fix[i].reloc == BFD_RELOC_D10V_10_PCREL_R
|
|
|
|
/* A BFD_RELOC_D10V_10_PCREL_R relocation applied to
|
|
|
|
the instruction in the L container has to be
|
|
|
|
adjusted to BDF_RELOC_D10V_10_PCREL_L. When
|
|
|
|
j==0, we're processing insn2's operands, so we
|
|
|
|
want to mark the operand if insn2 is *not* in the
|
|
|
|
R container. When j==1, we're processing insn1's
|
|
|
|
operands, so we want to mark the operand if insn2
|
|
|
|
*is* in the R container. Note that, if two
|
|
|
|
instructions are identical, we're never going to
|
|
|
|
swap them, so the test is safe. */
|
|
|
|
&& j == ((insn & 0x7fff) == insn2))
|
|
|
|
fx->fix[i].operand |= 1024;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
if (fx->fix[i].reloc == BFD_RELOC_D10V_18)
|
|
|
|
fx->fix[i].operand |= 4096;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
fix_new_exp (frag_now,
|
|
|
|
where,
|
|
|
|
fx->fix[i].size,
|
|
|
|
&(fx->fix[i].exp),
|
|
|
|
fx->fix[i].pcrel,
|
|
|
|
fx->fix[i].operand|2048);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fx->fc = 0;
|
|
|
|
fx = fx->next;
|
|
|
|
}
|
|
|
|
return 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
/* This is the main entry point for the machine-dependent assembler.
|
|
|
|
str points to a machine-dependent instruction. This function is
|
|
|
|
supposed to emit the frags/bytes it assembles to. For the D10V, it
|
|
|
|
mostly handles the special VLIW parsing and packing and leaves the
|
|
|
|
difficult stuff to do_assemble(). */
|
|
|
|
|
|
|
|
static unsigned long prev_insn;
|
|
|
|
static struct d10v_opcode *prev_opcode = 0;
|
|
|
|
static subsegT prev_subseg;
|
|
|
|
static segT prev_seg = 0;;
|
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
/* Find the symbol which has the same name as the register in exp. */
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
static symbolS *
|
2005-03-24 20:40:28 +00:00
|
|
|
find_symbol_matching_register (expressionS *exp)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int i;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (exp->X_op != O_register)
|
|
|
|
return NULL;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/* Find the name of the register. */
|
|
|
|
for (i = d10v_reg_name_cnt (); i--;)
|
2000-07-27 04:05:05 +00:00
|
|
|
if (d10v_predefined_registers[i].value == exp->X_add_number)
|
1999-05-03 07:29:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
/* Now see if a symbol has been defined with the same name. */
|
2000-07-27 04:05:05 +00:00
|
|
|
return symbol_find (d10v_predefined_registers[i].name);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Get a pointer to an entry in the opcode table.
|
|
|
|
The function must look at all opcodes with the same name and use
|
|
|
|
the operands to choose the correct opcode. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
static struct d10v_opcode *
|
2005-03-24 20:40:28 +00:00
|
|
|
find_opcode (struct d10v_opcode *opcode, expressionS myops[])
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-12-05 00:56:09 +00:00
|
|
|
int i, match;
|
1999-05-03 07:29:11 +00:00
|
|
|
struct d10v_opcode *next_opcode;
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Get all the operands and save them as expressions. */
|
1999-05-03 07:29:11 +00:00
|
|
|
get_operands (myops);
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Now see if the operand is a fake. If so, find the correct size
|
|
|
|
instruction, if possible. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (opcode->format == OPCODE_FAKE)
|
|
|
|
{
|
|
|
|
int opnum = opcode->operands[0];
|
|
|
|
int flags;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (myops[opnum].X_op == O_register)
|
|
|
|
{
|
|
|
|
myops[opnum].X_op = O_symbol;
|
2000-07-27 04:05:05 +00:00
|
|
|
myops[opnum].X_add_symbol =
|
|
|
|
symbol_find_or_make ((char *) myops[opnum].X_op_symbol);
|
1999-05-03 07:29:11 +00:00
|
|
|
myops[opnum].X_add_number = 0;
|
|
|
|
myops[opnum].X_op_symbol = NULL;
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
next_opcode = opcode + 1;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
|| (num & ~flags
|
|
|
|
& (OPERAND_GPR | OPERAND_ACC0 | OPERAND_ACC1
|
2001-11-29 18:04:12 +00:00
|
|
|
| OPERAND_FFLAG | OPERAND_CFLAG | OPERAND_CONTROL))
|
|
|
|
|| ((flags & OPERAND_SP) && ! (num & OPERAND_SP)))
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
as_bad (_("bad opcode or operands"));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
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)))
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
for (i = 0; opcode->operands[i + 1]; i++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
int bits = d10v_operands[next_opcode->operands[opnum]].bits;
|
|
|
|
int flags = d10v_operands[next_opcode->operands[opnum]].flags;
|
|
|
|
if (flags & OPERAND_ADDR)
|
|
|
|
bits += 2;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (myops[opnum].X_op == O_constant)
|
|
|
|
{
|
|
|
|
if (!check_range (myops[opnum].X_add_number, bits, flags))
|
2002-04-03 19:44:05 +00:00
|
|
|
break;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
fragS *sym_frag;
|
|
|
|
fragS *f;
|
2000-04-12 18:03:58 +00:00
|
|
|
unsigned long current_position;
|
|
|
|
unsigned long symbol_position;
|
|
|
|
unsigned long value;
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean found_symbol;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2000-04-12 18:03:58 +00:00
|
|
|
/* Calculate the address of the current instruction
|
|
|
|
and the address of the symbol. Do this by summing
|
|
|
|
the offsets of previous frags until we reach the
|
|
|
|
frag containing the symbol, and the current frag. */
|
|
|
|
sym_frag = symbol_get_frag (myops[opnum].X_add_symbol);
|
2002-11-30 08:39:46 +00:00
|
|
|
found_symbol = FALSE;
|
2000-04-12 18:03:58 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
current_position =
|
|
|
|
obstack_next_free (&frchain_now->frch_obstack)
|
|
|
|
- frag_now->fr_literal;
|
2000-04-12 18:03:58 +00:00
|
|
|
symbol_position = S_GET_VALUE (myops[opnum].X_add_symbol);
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2000-04-12 18:03:58 +00:00
|
|
|
for (f = frchain_now->frch_root; f; f = f->fr_next)
|
|
|
|
{
|
|
|
|
current_position += f->fr_fix + f->fr_offset;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2000-04-12 18:03:58 +00:00
|
|
|
if (f == sym_frag)
|
2002-11-30 08:39:46 +00:00
|
|
|
found_symbol = TRUE;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2000-04-12 18:03:58 +00:00
|
|
|
if (! found_symbol)
|
|
|
|
symbol_position += f->fr_fix + f->fr_offset;
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-04-12 18:03:58 +00:00
|
|
|
value = symbol_position;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (flags & OPERAND_ADDR)
|
2000-04-12 18:03:58 +00:00
|
|
|
value -= current_position;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (AT_WORD_P (&myops[opnum]))
|
|
|
|
{
|
|
|
|
if (bits > 4)
|
|
|
|
{
|
|
|
|
bits += 2;
|
|
|
|
if (!check_range (value, bits, flags))
|
2002-04-03 19:44:05 +00:00
|
|
|
break;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!check_range (value, bits, flags))
|
2002-04-03 19:44:05 +00:00
|
|
|
break;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
next_opcode++;
|
|
|
|
}
|
2002-04-03 19:44:05 +00:00
|
|
|
|
|
|
|
if (opcode->operands [i + 1] == 0)
|
|
|
|
as_fatal (_("value out of range"));
|
|
|
|
else
|
|
|
|
opcode = next_opcode;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
else
|
2005-03-24 20:40:28 +00:00
|
|
|
/* Not a constant, so use a long instruction. */
|
|
|
|
opcode += 2;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2002-04-03 19:44:05 +00:00
|
|
|
|
|
|
|
match = 0;
|
2002-11-30 08:39:46 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
/* Now search the opcode table table for one with operands
|
|
|
|
that matches what we've got. */
|
|
|
|
while (!match)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2002-04-03 19:44:05 +00:00
|
|
|
match = 1;
|
|
|
|
for (i = 0; opcode->operands[i]; i++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2002-04-03 19:44:05 +00:00
|
|
|
int flags = d10v_operands[opcode->operands[i]].flags;
|
|
|
|
int X_op = myops[i].X_op;
|
|
|
|
int num = myops[i].X_add_number;
|
|
|
|
|
|
|
|
if (X_op == 0)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2002-04-03 19:44:05 +00:00
|
|
|
match = 0;
|
|
|
|
break;
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
if (flags & OPERAND_REG)
|
|
|
|
{
|
|
|
|
if ((X_op != O_register)
|
|
|
|
|| (num & ~flags
|
|
|
|
& (OPERAND_GPR | OPERAND_ACC0 | OPERAND_ACC1
|
|
|
|
| OPERAND_FFLAG | OPERAND_CFLAG
|
|
|
|
| OPERAND_CONTROL))
|
|
|
|
|| ((flags & OPERAND_SP) && ! (num & OPERAND_SP)))
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
match = 0;
|
|
|
|
break;
|
|
|
|
}
|
2002-04-03 19:44:05 +00:00
|
|
|
}
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
if (((flags & OPERAND_MINUS) && ((X_op != O_absent) || (num != OPERAND_MINUS))) ||
|
|
|
|
((flags & OPERAND_PLUS) && ((X_op != O_absent) || (num != OPERAND_PLUS))) ||
|
|
|
|
((flags & OPERAND_ATMINUS) && ((X_op != O_absent) || (num != OPERAND_ATMINUS))) ||
|
|
|
|
((flags & OPERAND_ATPAR) && ((X_op != O_absent) || (num != OPERAND_ATPAR))) ||
|
|
|
|
((flags & OPERAND_ATSIGN) && ((X_op != O_absent) || ((num != OPERAND_ATSIGN) && (num != OPERAND_ATPAR)))))
|
|
|
|
{
|
|
|
|
match = 0;
|
|
|
|
break;
|
|
|
|
}
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2003-11-21 00:24:40 +00:00
|
|
|
/* Unfortunately, for the indirect operand in instructions such
|
2002-11-30 08:39:46 +00:00
|
|
|
as ``ldb r1, @(c,r14)'' this function can be passed
|
|
|
|
X_op == O_register (because 'c' is a valid register name).
|
|
|
|
However we cannot just ignore the case when X_op == O_register
|
|
|
|
but flags & OPERAND_REG is null, so we check to see if a symbol
|
|
|
|
of the same name as the register exists. If the symbol does
|
|
|
|
exist, then the parser was unable to distinguish the two cases
|
2002-04-03 19:44:05 +00:00
|
|
|
and we fix things here. (Ref: PR14826) */
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
if (!(flags & OPERAND_REG) && (X_op == O_register))
|
|
|
|
{
|
|
|
|
symbolS * sym;
|
2002-11-30 08:39:46 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
sym = find_symbol_matching_register (& myops[i]);
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
if (sym != NULL)
|
|
|
|
{
|
|
|
|
myops[i].X_op = X_op = O_symbol;
|
|
|
|
myops[i].X_add_symbol = sym;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2002-04-03 19:44:05 +00:00
|
|
|
else
|
|
|
|
as_bad
|
|
|
|
(_("illegal operand - register name found where none expected"));
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2002-04-03 19:44:05 +00:00
|
|
|
}
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
/* We're only done if the operands matched so far AND there
|
1999-05-03 07:29:11 +00:00
|
|
|
are no more to check. */
|
2002-04-03 19:44:05 +00:00
|
|
|
if (match && myops[i].X_op == 0)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
match = 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
next_opcode = opcode + 1;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
if (next_opcode->opcode == 0)
|
|
|
|
break;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
if (strcmp (next_opcode->name, opcode->name))
|
|
|
|
break;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
opcode = next_opcode;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
if (!match)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
as_bad (_("bad opcode or operands"));
|
2005-03-24 20:40:28 +00:00
|
|
|
return 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Check that all registers that are required to be even are.
|
|
|
|
Also, if any operands were marked as registers, but were really symbols,
|
|
|
|
fix that here. */
|
|
|
|
for (i = 0; opcode->operands[i]; i++)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
if ((d10v_operands[opcode->operands[i]].flags & OPERAND_EVEN) &&
|
2000-07-27 04:05:05 +00:00
|
|
|
(myops[i].X_add_number & 1))
|
1999-05-03 07:29:11 +00:00
|
|
|
as_fatal (_("Register number must be EVEN"));
|
2001-12-04 10:07:03 +00:00
|
|
|
if ((d10v_operands[opcode->operands[i]].flags & OPERAND_NOSP)
|
|
|
|
&& (myops[i].X_add_number & OPERAND_SP))
|
|
|
|
as_bad (_("Unsupported use of sp"));
|
1999-05-03 07:29:11 +00:00
|
|
|
if (myops[i].X_op == O_register)
|
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
if (!(d10v_operands[opcode->operands[i]].flags & OPERAND_REG))
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
myops[i].X_op = O_symbol;
|
2000-07-27 04:05:05 +00:00
|
|
|
myops[i].X_add_symbol =
|
|
|
|
symbol_find_or_make ((char *) myops[i].X_op_symbol);
|
1999-05-03 07:29:11 +00:00
|
|
|
myops[i].X_add_number = 0;
|
|
|
|
myops[i].X_op_symbol = NULL;
|
|
|
|
}
|
|
|
|
}
|
2002-04-03 19:44:05 +00:00
|
|
|
if ((d10v_operands[opcode->operands[i]].flags & OPERAND_CONTROL)
|
|
|
|
&& (myops[i].X_add_number == OPERAND_CONTROL + 4
|
|
|
|
|| myops[i].X_add_number == OPERAND_CONTROL + 5
|
|
|
|
|| myops[i].X_add_number == OPERAND_CONTROL + 6
|
|
|
|
|| myops[i].X_add_number == OPERAND_CONTROL + 12
|
|
|
|
|| myops[i].X_add_number == OPERAND_CONTROL + 13
|
|
|
|
|| myops[i].X_add_number == OPERAND_CONTROL + 15))
|
|
|
|
as_warn (_("cr%ld is a reserved control register"),
|
|
|
|
myops[i].X_add_number - OPERAND_CONTROL);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
return opcode;
|
|
|
|
}
|
|
|
|
|
2005-03-24 20:40:28 +00:00
|
|
|
/* Assemble a single instruction.
|
|
|
|
Return an opcode, or -1 (an invalid opcode) on error. */
|
|
|
|
|
|
|
|
static unsigned long
|
|
|
|
do_assemble (char *str, struct d10v_opcode **opcode)
|
|
|
|
{
|
|
|
|
unsigned char *op_start, *op_end;
|
|
|
|
char *save;
|
|
|
|
char name[20];
|
|
|
|
int nlen = 0;
|
|
|
|
expressionS myops[6];
|
|
|
|
|
|
|
|
/* Drop leading whitespace. */
|
|
|
|
while (*str == ' ')
|
|
|
|
str++;
|
|
|
|
|
|
|
|
/* Find the opcode end. */
|
|
|
|
for (op_start = op_end = (unsigned char *) str;
|
|
|
|
*op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' ';
|
|
|
|
op_end++)
|
|
|
|
{
|
|
|
|
name[nlen] = TOLOWER (op_start[nlen]);
|
|
|
|
nlen++;
|
|
|
|
}
|
|
|
|
name[nlen] = 0;
|
|
|
|
|
|
|
|
if (nlen == 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
/* Find the first opcode with the proper name. */
|
|
|
|
*opcode = (struct d10v_opcode *) hash_find (d10v_hash, name);
|
|
|
|
if (*opcode == NULL)
|
PR gas/3797
* config/tc-d10v.c (do_assemble): Do not generate error messages, just return -1 whenever a problem is encoun$
(md_assemble): If do_assemble returns -1 generate a non-fatal error message and return.
* gas/lns/lns.exp: Do not run the lns-common test for the d10v port.
* gas/d10v/address-002.l: Update expected assembler output.
* gas/d10v/address-003.l, gas/d10v/address-004.l,
gas/d10v/address-005.l, gas/d10v/address-006.l,
gas/d10v/address-007.l, gas/d10v/address-008.l,
gas/d10v/address-009.l, gas/d10v/address-010.l,
gas/d10v/address-011.l, gas/d10v/address-012.l,
gas/d10v/address-013.l, gas/d10v/address-014.l,
gas/d10v/address-015.l, gas/d10v/address-016.l,
gas/d10v/address-017.l, gas/d10v/address-018.l,
gas/d10v/address-019.l, gas/d10v/address-020.l,
gas/d10v/address-021.l, gas/d10v/address-022.l,
gas/d10v/address-023.l, gas/d10v/address-024.l,
gas/d10v/address-025.l, gas/d10v/address-026.l,
gas/d10v/address-027.l, gas/d10v/address-030.l,
gas/d10v/address-031.l, gas/d10v/address-032.l,
gas/d10v/address-033.l, gas/d10v/address-034.l,
gas/d10v/address-035.l, gas/d10v/address-036.l,
gas/d10v/address-037.l, gas/d10v/address-038.l,
gas/d10v/address-039.l, gas/d10v/address-040.l,
gas/d10v/address-041.l: Likewise.
2007-02-28 18:38:51 +00:00
|
|
|
return -1;
|
2005-03-24 20:40:28 +00:00
|
|
|
|
|
|
|
save = input_line_pointer;
|
|
|
|
input_line_pointer = (char *) op_end;
|
|
|
|
*opcode = find_opcode (*opcode, myops);
|
|
|
|
if (*opcode == 0)
|
|
|
|
return -1;
|
|
|
|
input_line_pointer = save;
|
|
|
|
|
PR gas/3797
* config/tc-d10v.c (do_assemble): Do not generate error messages, just return -1 whenever a problem is encoun$
(md_assemble): If do_assemble returns -1 generate a non-fatal error message and return.
* gas/lns/lns.exp: Do not run the lns-common test for the d10v port.
* gas/d10v/address-002.l: Update expected assembler output.
* gas/d10v/address-003.l, gas/d10v/address-004.l,
gas/d10v/address-005.l, gas/d10v/address-006.l,
gas/d10v/address-007.l, gas/d10v/address-008.l,
gas/d10v/address-009.l, gas/d10v/address-010.l,
gas/d10v/address-011.l, gas/d10v/address-012.l,
gas/d10v/address-013.l, gas/d10v/address-014.l,
gas/d10v/address-015.l, gas/d10v/address-016.l,
gas/d10v/address-017.l, gas/d10v/address-018.l,
gas/d10v/address-019.l, gas/d10v/address-020.l,
gas/d10v/address-021.l, gas/d10v/address-022.l,
gas/d10v/address-023.l, gas/d10v/address-024.l,
gas/d10v/address-025.l, gas/d10v/address-026.l,
gas/d10v/address-027.l, gas/d10v/address-030.l,
gas/d10v/address-031.l, gas/d10v/address-032.l,
gas/d10v/address-033.l, gas/d10v/address-034.l,
gas/d10v/address-035.l, gas/d10v/address-036.l,
gas/d10v/address-037.l, gas/d10v/address-038.l,
gas/d10v/address-039.l, gas/d10v/address-040.l,
gas/d10v/address-041.l: Likewise.
2007-02-28 18:38:51 +00:00
|
|
|
return build_insn ((*opcode), myops, 0);
|
2005-03-24 20:40:28 +00:00
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* If while processing a fixup, a reloc really needs to be created.
|
|
|
|
Then it is done here. */
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
arelent *
|
2005-03-24 20:40:28 +00:00
|
|
|
tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
arelent *reloc;
|
2005-03-24 20:40:28 +00:00
|
|
|
reloc = xmalloc (sizeof (arelent));
|
|
|
|
reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
|
1999-06-22 14:07:40 +00:00
|
|
|
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
|
1999-05-03 07:29:11 +00:00
|
|
|
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
|
|
|
|
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
|
|
|
|
if (reloc->howto == (reloc_howto_type *) NULL)
|
|
|
|
{
|
|
|
|
as_bad_where (fixp->fx_file, fixp->fx_line,
|
2000-07-27 04:05:05 +00:00
|
|
|
_("reloc %d not supported by object file format"),
|
|
|
|
(int) fixp->fx_r_type);
|
1999-05-03 07:29:11 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-09-05 00:01:18 +00:00
|
|
|
if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
|
1999-05-03 07:29:11 +00:00
|
|
|
reloc->address = fixp->fx_offset;
|
2002-05-09 13:12:57 +00:00
|
|
|
|
2002-09-05 00:01:18 +00:00
|
|
|
reloc->addend = 0;
|
2002-05-09 13:12:57 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
return reloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2005-03-24 20:40:28 +00:00
|
|
|
md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED,
|
|
|
|
asection *seg ATTRIBUTE_UNUSED)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
abort ();
|
|
|
|
return 0;
|
2000-07-27 04:05:05 +00:00
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
long
|
2005-03-24 20:40:28 +00:00
|
|
|
md_pcrel_from_section (fixS *fixp, segT sec)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
if (fixp->fx_addsy != (symbolS *) NULL
|
|
|
|
&& (!S_IS_DEFINED (fixp->fx_addsy)
|
|
|
|
|| (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
|
1999-05-03 07:29:11 +00:00
|
|
|
return 0;
|
|
|
|
return fixp->fx_frag->fr_address + fixp->fx_where;
|
|
|
|
}
|
|
|
|
|
2001-11-15 21:29:00 +00:00
|
|
|
void
|
gas:
* cgen.c, cgen.h, tc.h, write.c, config/obj-coff.c
* config/tc-a29k.c, config/tc-alpha.c, config/tc-alpha.h
* config/tc-arc.c, config/tc-arc.h, config/tc-arm.c
* config/tc-arm.h, config/tc-avr.c, config/tc-avr.h
* config/tc-cris.c, config/tc-crx.c, config/tc-d10v.c
* config/tc-d10v.h, config/tc-d30v.c, config/tc-d30v.h
* config/tc-dlx.c, config/tc-dlx.h, config/tc-fr30.h
* config/tc-frv.c, config/tc-frv.h, config/tc-h8300.c
* config/tc-h8500.c, config/tc-hppa.c, config/tc-hppa.h
* config/tc-i370.c, config/tc-i370.h, config/tc-i386.c
* config/tc-i386.h, config/tc-i860.c, config/tc-i860.h
* config/tc-i960.c, config/tc-i960.h, config/tc-ia64.c
* config/tc-ip2k.c, config/tc-ip2k.h, config/tc-iq2000.c
* config/tc-iq2000.h, config/tc-m32r.c, config/tc-m32r.h
* config/tc-m68hc11.c, config/tc-m68hc11.h, config/tc-m68k.c
* config/tc-m68k.h, config/tc-m88k.c, config/tc-maxq.c
* config/tc-mcore.c, config/tc-mcore.h, config/tc-mips.c
* config/tc-mips.h, config/tc-mmix.c, config/tc-mn10200.c
* config/tc-mn10300.c, config/tc-msp430.c, config/tc-ns32k.c
* config/tc-openrisc.h, config/tc-or32.c, config/tc-or32.h
* config/tc-pdp11.c, config/tc-pj.c, config/tc-pj.h
* config/tc-ppc.c, config/tc-ppc.h, config/tc-s390.c
* config/tc-s390.h, config/tc-sh64.c, config/tc-sh.c
* config/tc-sh.h, config/tc-sparc.c, config/tc-sparc.h
* config/tc-tahoe.c, config/tc-tic30.c, config/tc-tic4x.c
* config/tc-tic54x.c, config/tc-tic80.c, config/tc-v850.c
* config/tc-v850.h, config/tc-vax.c, config/tc-vax.h
* config/tc-w65.c, config/tc-xstormy16.c, config/tc-xstormy16.h
* config/tc-xtensa.c, config/tc-z8k.c:
Replace all instances of the string "_apply_fix3" with
"_apply_fix".
* po/POTFILES.in, po/gas.pot: Regenerate.
bfd:
* coff-i386.c: Change md_apply_fix3 to md_apply_fix in comment.
cgen:
* doc/porting.texi: Change all mention of md_apply_fix3 and
gas_cgen_md_apply_fix3 to md_apply_fix and gas_cgen_md_apply_fix
respectively.
2005-06-07 17:54:22 +00:00
|
|
|
md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
char *where;
|
|
|
|
unsigned long insn;
|
2002-09-05 00:01:18 +00:00
|
|
|
long value = *valP;
|
1999-05-03 07:29:11 +00:00
|
|
|
int op_type;
|
2000-07-27 04:05:05 +00:00
|
|
|
int left = 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2001-11-15 21:29:00 +00:00
|
|
|
if (fixP->fx_addsy == (symbolS *) NULL)
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
2002-09-05 00:01:18 +00:00
|
|
|
/* We don't actually support subtracting a symbol. */
|
|
|
|
if (fixP->fx_subsy != (symbolS *) NULL)
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2001-11-15 21:29:00 +00:00
|
|
|
op_type = fixP->fx_r_type;
|
1999-05-03 07:29:11 +00:00
|
|
|
if (op_type & 2048)
|
|
|
|
{
|
|
|
|
op_type -= 2048;
|
|
|
|
if (op_type & 1024)
|
|
|
|
{
|
|
|
|
op_type -= 1024;
|
2001-11-15 21:29:00 +00:00
|
|
|
fixP->fx_r_type = BFD_RELOC_D10V_10_PCREL_L;
|
1999-05-03 07:29:11 +00:00
|
|
|
left = 1;
|
|
|
|
}
|
|
|
|
else if (op_type & 4096)
|
|
|
|
{
|
|
|
|
op_type -= 4096;
|
2001-11-15 21:29:00 +00:00
|
|
|
fixP->fx_r_type = BFD_RELOC_D10V_18;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
else
|
2001-11-15 21:29:00 +00:00
|
|
|
fixP->fx_r_type =
|
2000-07-27 04:05:05 +00:00
|
|
|
get_reloc ((struct d10v_operand *) &d10v_operands[op_type]);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Fetch the instruction, insert the fully resolved operand
|
|
|
|
value, and stuff the instruction back again. */
|
2001-11-15 21:29:00 +00:00
|
|
|
where = fixP->fx_frag->fr_literal + fixP->fx_where;
|
1999-05-03 07:29:11 +00:00
|
|
|
insn = bfd_getb32 ((unsigned char *) where);
|
|
|
|
|
2001-11-15 21:29:00 +00:00
|
|
|
switch (fixP->fx_r_type)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
case BFD_RELOC_D10V_10_PCREL_L:
|
|
|
|
case BFD_RELOC_D10V_10_PCREL_R:
|
|
|
|
case BFD_RELOC_D10V_18_PCREL:
|
2002-04-03 19:44:05 +00:00
|
|
|
/* If the fix is relative to a global symbol, not a section
|
|
|
|
symbol, then ignore the offset.
|
|
|
|
XXX - Do we have to worry about branches to a symbol + offset ? */
|
|
|
|
if (fixP->fx_addsy != NULL
|
2005-04-20 17:40:01 +00:00
|
|
|
&& S_IS_EXTERNAL (fixP->fx_addsy) )
|
2002-05-30 16:16:30 +00:00
|
|
|
{
|
|
|
|
segT fseg = S_GET_SEGMENT (fixP->fx_addsy);
|
|
|
|
segment_info_type *segf = seg_info(fseg);
|
2002-04-03 19:44:05 +00:00
|
|
|
|
|
|
|
if ( segf && segf->sym != fixP->fx_addsy)
|
|
|
|
value = 0;
|
2002-05-30 16:16:30 +00:00
|
|
|
}
|
2002-04-03 19:44:05 +00:00
|
|
|
/* Drop through. */
|
1999-05-03 07:29:11 +00:00
|
|
|
case BFD_RELOC_D10V_18:
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Instruction addresses are always right-shifted by 2. */
|
1999-05-03 07:29:11 +00:00
|
|
|
value >>= AT_WORD_RIGHT_SHIFT;
|
2001-11-15 21:29:00 +00:00
|
|
|
if (fixP->fx_size == 2)
|
1999-05-03 07:29:11 +00:00
|
|
|
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct d10v_opcode *rep, *repi;
|
|
|
|
|
|
|
|
rep = (struct d10v_opcode *) hash_find (d10v_hash, "rep");
|
|
|
|
repi = (struct d10v_opcode *) hash_find (d10v_hash, "repi");
|
|
|
|
if ((insn & FM11) == FM11
|
2002-11-30 08:39:46 +00:00
|
|
|
&& ((repi != NULL
|
2002-04-03 19:44:05 +00:00
|
|
|
&& (insn & repi->mask) == (unsigned) repi->opcode)
|
2002-11-30 08:39:46 +00:00
|
|
|
|| (rep != NULL
|
2002-04-03 19:44:05 +00:00
|
|
|
&& (insn & rep->mask) == (unsigned) rep->opcode))
|
1999-05-03 07:29:11 +00:00
|
|
|
&& value < 4)
|
|
|
|
as_fatal
|
|
|
|
(_("line %d: rep or repi must include at least 4 instructions"),
|
2001-11-15 21:29:00 +00:00
|
|
|
fixP->fx_line);
|
2000-07-27 04:05:05 +00:00
|
|
|
insn =
|
2001-11-15 21:29:00 +00:00
|
|
|
d10v_insert_operand (insn, op_type, (offsetT) value, left, fixP);
|
2000-07-27 04:05:05 +00:00
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_32:
|
|
|
|
bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_16:
|
|
|
|
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BFD_RELOC_VTABLE_INHERIT:
|
|
|
|
case BFD_RELOC_VTABLE_ENTRY:
|
2001-11-15 21:29:00 +00:00
|
|
|
fixP->fx_done = 0;
|
|
|
|
return;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
default:
|
2000-07-27 04:05:05 +00:00
|
|
|
as_fatal (_("line %d: unknown relocation type: 0x%x"),
|
2001-11-15 21:29:00 +00:00
|
|
|
fixP->fx_line, fixP->fx_r_type);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-12-05 00:56:09 +00:00
|
|
|
/* d10v_cleanup() is called after the assembler has finished parsing
|
|
|
|
the input file, when a label is read from the input file, or when a
|
|
|
|
stab directive is output. Because the D10V assembler sometimes
|
2000-07-27 04:05:05 +00:00
|
|
|
saves short instructions to see if it can package them with the
|
|
|
|
next instruction, there may be a short instruction that still needs
|
|
|
|
to be written.
|
|
|
|
|
2000-05-25 22:35:05 +00:00
|
|
|
NOTE: accesses a global, etype.
|
|
|
|
NOTE: invoked by various macros such as md_cleanup: see. */
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
int
|
2005-03-24 20:40:28 +00:00
|
|
|
d10v_cleanup (void)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
segT seg;
|
|
|
|
subsegT subseg;
|
|
|
|
|
2000-12-05 00:56:09 +00:00
|
|
|
/* If cleanup was invoked because the assembler encountered, e.g., a
|
|
|
|
user label, we write out the pending instruction, if any. If it
|
|
|
|
was invoked because the assembler is outputting a piece of line
|
|
|
|
debugging information, though, we write out the pending
|
|
|
|
instruction only if the --no-gstabs-packing command line switch
|
|
|
|
has been specified. */
|
|
|
|
if (prev_opcode
|
|
|
|
&& etype == PACK_UNSPEC
|
|
|
|
&& (! outputting_stabs_line_debug || ! flag_allow_gstabs_packing))
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
seg = now_seg;
|
|
|
|
subseg = now_subseg;
|
2000-12-05 00:56:09 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (prev_seg)
|
|
|
|
subseg_set (prev_seg, prev_subseg);
|
2000-12-05 00:56:09 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
write_1_short (prev_opcode, prev_insn, fixups->next);
|
|
|
|
subseg_set (seg, subseg);
|
|
|
|
prev_opcode = NULL;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
/* Like normal .word, except support @word.
|
|
|
|
Clobbers input_line_pointer, checks end-of-line. */
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
static void
|
2005-03-24 20:40:28 +00:00
|
|
|
d10v_dot_word (int dummy ATTRIBUTE_UNUSED)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
expressionS exp;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if (is_it_end_of_statement ())
|
|
|
|
{
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
expression (&exp);
|
|
|
|
if (!strncasecmp (input_line_pointer, "@word", 5))
|
|
|
|
{
|
|
|
|
exp.X_add_number = 0;
|
|
|
|
input_line_pointer += 5;
|
2000-07-27 04:05:05 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
p = frag_more (2);
|
2000-07-27 04:05:05 +00:00
|
|
|
fix_new_exp (frag_now, p - frag_now->fr_literal, 2,
|
1999-05-03 07:29:11 +00:00
|
|
|
&exp, 0, BFD_RELOC_D10V_18);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
emit_expr (&exp, 2);
|
|
|
|
}
|
|
|
|
while (*input_line_pointer++ == ',');
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
input_line_pointer--; /* Put terminator back into stream. */
|
1999-05-03 07:29:11 +00:00
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
/* Mitsubishi asked that we support some old syntax that apparently
|
|
|
|
had immediate operands starting with '#'. This is in some of their
|
|
|
|
sample code but is not documented (although it appears in some
|
|
|
|
examples in their assembler manual). For now, we'll solve this
|
|
|
|
compatibility problem by simply ignoring any '#' at the beginning
|
|
|
|
of an operand. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2002-04-03 19:44:05 +00:00
|
|
|
/* Operands that begin with '#' should fall through to here.
|
|
|
|
From expr.c. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-07-27 04:05:05 +00:00
|
|
|
void
|
2005-03-24 20:40:28 +00:00
|
|
|
md_operand (expressionS *expressionP)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
1999-06-17 02:13:18 +00:00
|
|
|
if (*input_line_pointer == '#' && ! do_not_ignore_hash)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
input_line_pointer++;
|
|
|
|
expression (expressionP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2005-03-24 20:40:28 +00:00
|
|
|
d10v_fix_adjustable (fixS *fixP)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2000-07-27 04:05:05 +00:00
|
|
|
/* We need the symbol name for the VTABLE entries. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|
|
|
|
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2005-03-24 20:40:28 +00:00
|
|
|
|
|
|
|
/* The target specific pseudo-ops which we support. */
|
|
|
|
const pseudo_typeS md_pseudo_table[] =
|
|
|
|
{
|
|
|
|
{ "word", d10v_dot_word, 2 },
|
|
|
|
{ NULL, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
md_assemble (char *str)
|
|
|
|
{
|
|
|
|
/* etype is saved extype. For multi-line instructions. */
|
|
|
|
packing_type extype = PACK_UNSPEC; /* Parallel, etc. */
|
|
|
|
struct d10v_opcode *opcode;
|
|
|
|
unsigned long insn;
|
|
|
|
char *str2;
|
|
|
|
|
|
|
|
if (etype == PACK_UNSPEC)
|
|
|
|
{
|
|
|
|
/* Look for the special multiple instruction separators. */
|
|
|
|
str2 = strstr (str, "||");
|
|
|
|
if (str2)
|
|
|
|
extype = PACK_PARALLEL;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str2 = strstr (str, "->");
|
|
|
|
if (str2)
|
|
|
|
extype = PACK_LEFT_RIGHT;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str2 = strstr (str, "<-");
|
|
|
|
if (str2)
|
|
|
|
extype = PACK_RIGHT_LEFT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* str2 points to the separator, if there is one. */
|
|
|
|
if (str2)
|
|
|
|
{
|
|
|
|
*str2 = 0;
|
|
|
|
|
|
|
|
/* If two instructions are present and we already have one saved,
|
|
|
|
then first write out the saved one. */
|
|
|
|
d10v_cleanup ();
|
|
|
|
|
|
|
|
/* Assemble first instruction and save it. */
|
|
|
|
prev_insn = do_assemble (str, &prev_opcode);
|
|
|
|
prev_seg = now_seg;
|
|
|
|
prev_subseg = now_subseg;
|
|
|
|
if (prev_insn == (unsigned long) -1)
|
PR gas/3797
* config/tc-d10v.c (do_assemble): Do not generate error messages, just return -1 whenever a problem is encoun$
(md_assemble): If do_assemble returns -1 generate a non-fatal error message and return.
* gas/lns/lns.exp: Do not run the lns-common test for the d10v port.
* gas/d10v/address-002.l: Update expected assembler output.
* gas/d10v/address-003.l, gas/d10v/address-004.l,
gas/d10v/address-005.l, gas/d10v/address-006.l,
gas/d10v/address-007.l, gas/d10v/address-008.l,
gas/d10v/address-009.l, gas/d10v/address-010.l,
gas/d10v/address-011.l, gas/d10v/address-012.l,
gas/d10v/address-013.l, gas/d10v/address-014.l,
gas/d10v/address-015.l, gas/d10v/address-016.l,
gas/d10v/address-017.l, gas/d10v/address-018.l,
gas/d10v/address-019.l, gas/d10v/address-020.l,
gas/d10v/address-021.l, gas/d10v/address-022.l,
gas/d10v/address-023.l, gas/d10v/address-024.l,
gas/d10v/address-025.l, gas/d10v/address-026.l,
gas/d10v/address-027.l, gas/d10v/address-030.l,
gas/d10v/address-031.l, gas/d10v/address-032.l,
gas/d10v/address-033.l, gas/d10v/address-034.l,
gas/d10v/address-035.l, gas/d10v/address-036.l,
gas/d10v/address-037.l, gas/d10v/address-038.l,
gas/d10v/address-039.l, gas/d10v/address-040.l,
gas/d10v/address-041.l: Likewise.
2007-02-28 18:38:51 +00:00
|
|
|
as_fatal (_("can't find previous opcode "));
|
2005-03-24 20:40:28 +00:00
|
|
|
fixups = fixups->next;
|
|
|
|
str = str2 + 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
insn = do_assemble (str, &opcode);
|
|
|
|
if (insn == (unsigned long) -1)
|
|
|
|
{
|
|
|
|
if (extype != PACK_UNSPEC)
|
PR gas/3797
* config/tc-d10v.c (do_assemble): Do not generate error messages, just return -1 whenever a problem is encoun$
(md_assemble): If do_assemble returns -1 generate a non-fatal error message and return.
* gas/lns/lns.exp: Do not run the lns-common test for the d10v port.
* gas/d10v/address-002.l: Update expected assembler output.
* gas/d10v/address-003.l, gas/d10v/address-004.l,
gas/d10v/address-005.l, gas/d10v/address-006.l,
gas/d10v/address-007.l, gas/d10v/address-008.l,
gas/d10v/address-009.l, gas/d10v/address-010.l,
gas/d10v/address-011.l, gas/d10v/address-012.l,
gas/d10v/address-013.l, gas/d10v/address-014.l,
gas/d10v/address-015.l, gas/d10v/address-016.l,
gas/d10v/address-017.l, gas/d10v/address-018.l,
gas/d10v/address-019.l, gas/d10v/address-020.l,
gas/d10v/address-021.l, gas/d10v/address-022.l,
gas/d10v/address-023.l, gas/d10v/address-024.l,
gas/d10v/address-025.l, gas/d10v/address-026.l,
gas/d10v/address-027.l, gas/d10v/address-030.l,
gas/d10v/address-031.l, gas/d10v/address-032.l,
gas/d10v/address-033.l, gas/d10v/address-034.l,
gas/d10v/address-035.l, gas/d10v/address-036.l,
gas/d10v/address-037.l, gas/d10v/address-038.l,
gas/d10v/address-039.l, gas/d10v/address-040.l,
gas/d10v/address-041.l: Likewise.
2007-02-28 18:38:51 +00:00
|
|
|
etype = extype;
|
|
|
|
else
|
|
|
|
as_bad (_("could not assemble: %s"), str);
|
|
|
|
return;
|
2005-03-24 20:40:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (etype != PACK_UNSPEC)
|
|
|
|
{
|
|
|
|
extype = etype;
|
|
|
|
etype = PACK_UNSPEC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If this is a long instruction, write it and any previous short
|
|
|
|
instruction. */
|
|
|
|
if (opcode->format & LONG_OPCODE)
|
|
|
|
{
|
|
|
|
if (extype != PACK_UNSPEC)
|
|
|
|
as_fatal (_("Unable to mix instructions as specified"));
|
|
|
|
d10v_cleanup ();
|
|
|
|
write_long (insn, fixups);
|
|
|
|
prev_opcode = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prev_opcode
|
|
|
|
&& prev_seg
|
|
|
|
&& ((prev_seg != now_seg) || (prev_subseg != now_subseg)))
|
|
|
|
d10v_cleanup ();
|
|
|
|
|
|
|
|
if (prev_opcode
|
|
|
|
&& (0 == write_2_short (prev_opcode, prev_insn, opcode, insn, extype,
|
|
|
|
fixups)))
|
|
|
|
{
|
|
|
|
/* No instructions saved. */
|
|
|
|
prev_opcode = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (extype != PACK_UNSPEC)
|
|
|
|
as_fatal (_("Unable to mix instructions as specified"));
|
|
|
|
/* Save last instruction so it may be packed on next pass. */
|
|
|
|
prev_opcode = opcode;
|
|
|
|
prev_insn = insn;
|
|
|
|
prev_seg = now_seg;
|
|
|
|
prev_subseg = now_subseg;
|
|
|
|
fixups = fixups->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|