1997-02-19 02:47:03 +00:00
|
|
|
/* tc-d30v.c -- Assembler code for the Mitsubishi D30V
|
|
|
|
|
1998-02-20 05:47:40 +00:00
|
|
|
Copyright (C) 1997, 1998 Free Software Foundation.
|
1997-02-19 02:47:03 +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
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
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
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include "as.h"
|
|
|
|
#include "subsegs.h"
|
|
|
|
#include "opcode/d30v.h"
|
|
|
|
|
|
|
|
const char comment_chars[] = ";";
|
|
|
|
const char line_comment_chars[] = "#";
|
|
|
|
const char line_separator_chars[] = "";
|
1997-12-17 12:43:15 +00:00
|
|
|
const char *md_shortopts = "OnN";
|
1997-02-19 02:47:03 +00:00
|
|
|
const char EXP_CHARS[] = "eE";
|
|
|
|
const char FLT_CHARS[] = "dD";
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
#define NOP_MULTIPLY 1
|
|
|
|
#define NOP_ALL 2
|
|
|
|
static int warn_nops = 0;
|
|
|
|
static int Optimizing = 0;
|
1997-02-19 02:47:03 +00:00
|
|
|
|
1997-12-16 13:25:59 +00:00
|
|
|
#define FORCE_SHORT 1
|
|
|
|
#define FORCE_LONG 2
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
/* EXEC types. */
|
|
|
|
typedef enum _exec_type
|
|
|
|
{
|
|
|
|
EXEC_UNKNOWN, /* no order specified */
|
1998-02-20 05:47:40 +00:00
|
|
|
EXEC_PARALLEL, /* done in parallel (FM=00) */
|
|
|
|
EXEC_SEQ, /* sequential (FM=01) */
|
|
|
|
EXEC_REVSEQ /* reverse sequential (FM=10) */
|
1997-12-17 12:43:15 +00:00
|
|
|
} exec_type_enum;
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
/* fixups */
|
|
|
|
#define MAX_INSN_FIXUPS (5)
|
|
|
|
struct d30v_fixup
|
|
|
|
{
|
|
|
|
expressionS exp;
|
|
|
|
int operand;
|
|
|
|
int pcrel;
|
|
|
|
int size;
|
|
|
|
bfd_reloc_code_real_type reloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _fixups
|
|
|
|
{
|
|
|
|
int fc;
|
|
|
|
struct d30v_fixup fix[MAX_INSN_FIXUPS];
|
|
|
|
struct _fixups *next;
|
|
|
|
} Fixups;
|
|
|
|
|
|
|
|
static Fixups FixUps[2];
|
|
|
|
static Fixups *fixups;
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
/* Whether current and previous instruction is a word multiply. */
|
1998-05-12 19:04:29 +00:00
|
|
|
static int cur_mul32_p = 0;
|
|
|
|
static int prev_mul32_p = 0;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1998-02-20 05:47:40 +00:00
|
|
|
/* The flag_explicitly_parallel is true iff the instruction being assembled
|
|
|
|
has been explicitly written as a parallel short-instruction pair by the
|
|
|
|
human programmer. It is used in parallel_ok() to distinguish between
|
|
|
|
those dangerous parallelizations attempted by the human, which are to be
|
|
|
|
allowed, and those attempted by the assembler, which are not. It is set
|
|
|
|
from md_assemble(). */
|
|
|
|
static int flag_explicitly_parallel = 0;
|
|
|
|
static int flag_xp_state = 0;
|
|
|
|
|
1998-07-30 19:41:18 +00:00
|
|
|
/* Whether current and previous left sub-instruction disables
|
|
|
|
execution of right sub-instruction. */
|
|
|
|
static int cur_left_kills_right_p = 0;
|
|
|
|
static int prev_left_kills_right_p = 0;
|
|
|
|
|
1998-05-12 19:04:29 +00:00
|
|
|
/* The known current alignment of the current section. */
|
|
|
|
static int d30v_current_align;
|
|
|
|
static segT d30v_current_align_seg;
|
|
|
|
|
|
|
|
/* The last seen label in the current section. This is used to auto-align
|
|
|
|
labels preceeding instructions. */
|
|
|
|
static symbolS *d30v_last_label;
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
/* Two nops */
|
|
|
|
#define NOP_LEFT ((long long)NOP << 32)
|
|
|
|
#define NOP_RIGHT ((long long)NOP)
|
|
|
|
#define NOP2 (FM00 | NOP_LEFT | NOP_RIGHT)
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
/* local functions */
|
|
|
|
static int reg_name_search PARAMS ((char *name));
|
|
|
|
static int register_name PARAMS ((expressionS *expressionP));
|
|
|
|
static int check_range PARAMS ((unsigned long num, int bits, int flags));
|
|
|
|
static int postfix PARAMS ((char *p));
|
|
|
|
static bfd_reloc_code_real_type get_reloc PARAMS ((struct d30v_operand *op, int rel_flag));
|
|
|
|
static int get_operands PARAMS ((expressionS exp[], int cmp_hack));
|
1997-12-16 13:25:59 +00:00
|
|
|
static struct d30v_format *find_format PARAMS ((struct d30v_opcode *opcode,
|
|
|
|
expressionS ops[],int fsize, int cmp_hack));
|
1997-02-19 02:47:03 +00:00
|
|
|
static long long build_insn PARAMS ((struct d30v_insn *opcode, expressionS *opers));
|
|
|
|
static void write_long PARAMS ((struct d30v_insn *opcode, long long insn, Fixups *fx));
|
|
|
|
static void write_1_short PARAMS ((struct d30v_insn *opcode, long long insn, Fixups *fx));
|
|
|
|
static int write_2_short PARAMS ((struct d30v_insn *opcode1, long long insn1,
|
1997-12-17 12:43:15 +00:00
|
|
|
struct d30v_insn *opcode2, long long insn2, exec_type_enum exec_type, Fixups *fx));
|
1998-05-06 18:56:08 +00:00
|
|
|
static long long do_assemble PARAMS ((char *str, struct d30v_insn *opcode,
|
1998-06-09 01:33:23 +00:00
|
|
|
int shortp, int is_parallel));
|
1997-02-19 02:47:03 +00:00
|
|
|
static int parallel_ok PARAMS ((struct d30v_insn *opcode1, unsigned long insn1,
|
|
|
|
struct d30v_insn *opcode2, unsigned long insn2,
|
1997-12-17 12:43:15 +00:00
|
|
|
exec_type_enum exec_type));
|
1997-02-19 02:47:03 +00:00
|
|
|
static void d30v_number_to_chars PARAMS ((char *buf, long long value, int nbytes));
|
1997-12-16 13:25:59 +00:00
|
|
|
static void check_size PARAMS ((long value, int bits, char *file, int line));
|
1998-05-12 19:04:29 +00:00
|
|
|
static void d30v_align PARAMS ((int, char *, symbolS *));
|
|
|
|
static void s_d30v_align PARAMS ((int));
|
|
|
|
static void s_d30v_text PARAMS ((int));
|
|
|
|
static void s_d30v_data PARAMS ((int));
|
|
|
|
static void s_d30v_section PARAMS ((int));
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
struct option md_longopts[] = {
|
|
|
|
{NULL, no_argument, NULL, 0}
|
|
|
|
};
|
|
|
|
size_t md_longopts_size = sizeof(md_longopts);
|
|
|
|
|
|
|
|
|
|
|
|
/* The target specific pseudo-ops which we support. */
|
|
|
|
const pseudo_typeS md_pseudo_table[] =
|
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
{ "word", cons, 4 },
|
|
|
|
{ "hword", cons, 2 },
|
1998-05-12 19:04:29 +00:00
|
|
|
{ "align", s_d30v_align, 0 },
|
|
|
|
{ "text", s_d30v_text, 0 },
|
|
|
|
{ "data", s_d30v_data, 0 },
|
|
|
|
{ "section", s_d30v_section, 0 },
|
|
|
|
{ "section.s", s_d30v_section, 0 },
|
|
|
|
{ "sect", s_d30v_section, 0 },
|
|
|
|
{ "sect.s", s_d30v_section, 0 },
|
1997-12-16 13:25:59 +00:00
|
|
|
{ NULL, NULL, 0 }
|
1997-02-19 02:47:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Opcode hash table. */
|
|
|
|
static struct hash_control *d30v_hash;
|
|
|
|
|
|
|
|
/* reg_name_search does a binary search of the pre_defined_registers
|
|
|
|
array to see if "name" is a valid regiter name. Returns the register
|
|
|
|
number from the array on success, or -1 on failure. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
reg_name_search (name)
|
|
|
|
char *name;
|
|
|
|
{
|
|
|
|
int middle, low, high;
|
|
|
|
int cmp;
|
|
|
|
|
|
|
|
low = 0;
|
1998-06-09 01:33:23 +00:00
|
|
|
high = reg_name_cnt () - 1;
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
middle = (low + high) / 2;
|
|
|
|
cmp = strcasecmp (name, pre_defined_registers[middle].name);
|
|
|
|
if (cmp < 0)
|
|
|
|
high = middle - 1;
|
|
|
|
else if (cmp > 0)
|
|
|
|
low = middle + 1;
|
|
|
|
else
|
|
|
|
return pre_defined_registers[middle].value;
|
|
|
|
}
|
|
|
|
while (low <= high);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* register_name() checks the string at input_line_pointer
|
|
|
|
to see if it is a valid register name */
|
|
|
|
|
|
|
|
static int
|
|
|
|
register_name (expressionP)
|
|
|
|
expressionS *expressionP;
|
|
|
|
{
|
|
|
|
int reg_number;
|
|
|
|
char c, *p = input_line_pointer;
|
|
|
|
|
|
|
|
while (*p && *p!='\n' && *p!='\r' && *p !=',' && *p!=' ' && *p!=')')
|
|
|
|
p++;
|
|
|
|
|
|
|
|
c = *p;
|
|
|
|
if (c)
|
|
|
|
*p++ = 0;
|
|
|
|
|
|
|
|
/* look to see if it's in the register table */
|
|
|
|
reg_number = reg_name_search (input_line_pointer);
|
|
|
|
if (reg_number >= 0)
|
|
|
|
{
|
|
|
|
expressionP->X_op = O_register;
|
|
|
|
/* temporarily store a pointer to the string here */
|
|
|
|
expressionP->X_op_symbol = (struct symbol *)input_line_pointer;
|
|
|
|
expressionP->X_add_number = reg_number;
|
|
|
|
input_line_pointer = p;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (c)
|
|
|
|
*(p-1) = c;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
check_range (num, bits, flags)
|
|
|
|
unsigned long num;
|
|
|
|
int bits;
|
|
|
|
int flags;
|
|
|
|
{
|
1997-12-17 12:43:15 +00:00
|
|
|
long min, max;
|
1997-02-19 02:47:03 +00:00
|
|
|
int retval=0;
|
|
|
|
|
|
|
|
/* don't bother checking 32-bit values */
|
|
|
|
if (bits == 32)
|
|
|
|
return 0;
|
|
|
|
|
1998-07-30 19:41:18 +00:00
|
|
|
if (flags & OPERAND_SHIFT)
|
|
|
|
{
|
|
|
|
/* We know that all shifts are right by three bits.... */
|
|
|
|
|
|
|
|
if (flags & OPERAND_SIGNED)
|
|
|
|
num = (unsigned long) (((/*signed*/ long) num) >> 3);
|
|
|
|
else
|
|
|
|
num >>= 3;
|
|
|
|
}
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
if (flags & OPERAND_SIGNED)
|
|
|
|
{
|
|
|
|
max = (1 << (bits - 1))-1;
|
1997-12-16 13:25:59 +00:00
|
|
|
min = - (1 << (bits - 1));
|
1997-02-19 02:47:03 +00:00
|
|
|
if (((long)num > max) || ((long)num < min))
|
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
max = (1 << bits) - 1;
|
|
|
|
min = 0;
|
|
|
|
if ((num > max) || (num < min))
|
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
md_show_usage (stream)
|
|
|
|
FILE *stream;
|
|
|
|
{
|
1998-06-09 01:33:23 +00:00
|
|
|
fprintf (stream, _("\nD30V options:\n\
|
1997-12-17 12:43:15 +00:00
|
|
|
-O Make adjacent short instructions parallel if possible.\n\
|
|
|
|
-n Warn about all NOPs inserted by the assembler.\n\
|
1998-05-12 19:04:29 +00:00
|
|
|
-N Warn about NOPs inserted after word multiplies.\n"));
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
md_parse_option (c, arg)
|
|
|
|
int c;
|
|
|
|
char *arg;
|
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
/* Optimize. Will attempt to parallelize operations */
|
1997-12-17 12:43:15 +00:00
|
|
|
case 'O':
|
1997-02-19 02:47:03 +00:00
|
|
|
Optimizing = 1;
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
|
|
|
/* Warn about all NOPS that the assembler inserts. */
|
|
|
|
case 'n':
|
|
|
|
warn_nops = NOP_ALL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Warn about the NOPS that the assembler inserts because of the
|
|
|
|
multiply hazard. */
|
|
|
|
case 'N':
|
|
|
|
warn_nops = NOP_MULTIPLY;
|
|
|
|
break;
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
symbolS *
|
|
|
|
md_undefined_symbol (name)
|
|
|
|
char *name;
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Turn a string in input_line_pointer into a floating point constant of type
|
|
|
|
type, and store the appropriate bytes in *litP. The number of LITTLENUMS
|
|
|
|
emitted is stored in *sizeP . An error message is returned, or NULL on OK.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
md_atof (type, litP, sizeP)
|
|
|
|
int type;
|
|
|
|
char *litP;
|
|
|
|
int *sizeP;
|
|
|
|
{
|
|
|
|
int prec;
|
|
|
|
LITTLENUM_TYPE words[4];
|
|
|
|
char *t;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case 'f':
|
|
|
|
prec = 2;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
prec = 4;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*sizeP = 0;
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
return _("bad call to md_atof");
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
t = atof_ieee (input_line_pointer, type, words);
|
|
|
|
if (t)
|
|
|
|
input_line_pointer = t;
|
|
|
|
|
|
|
|
*sizeP = prec * 2;
|
|
|
|
|
|
|
|
for (i = 0; i < prec; i++)
|
|
|
|
{
|
|
|
|
md_number_to_chars (litP, (valueT) words[i], 2);
|
|
|
|
litP += 2;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
md_convert_frag (abfd, sec, fragP)
|
|
|
|
bfd *abfd;
|
|
|
|
asection *sec;
|
|
|
|
fragS *fragP;
|
|
|
|
{
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
valueT
|
|
|
|
md_section_align (seg, addr)
|
|
|
|
asection *seg;
|
|
|
|
valueT addr;
|
|
|
|
{
|
|
|
|
int align = bfd_get_section_alignment (stdoutput, seg);
|
|
|
|
return ((addr + (1 << align) - 1) & (-1 << align));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
md_begin ()
|
|
|
|
{
|
|
|
|
struct d30v_opcode *opcode;
|
1998-06-09 01:33:23 +00:00
|
|
|
d30v_hash = hash_new ();
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
/* Insert opcode names into a hash table. */
|
|
|
|
for (opcode = (struct d30v_opcode *)d30v_opcode_table; opcode->name; opcode++)
|
|
|
|
hash_insert (d30v_hash, opcode->name, (char *) opcode);
|
|
|
|
|
|
|
|
fixups = &FixUps[0];
|
|
|
|
FixUps[0].next = &FixUps[1];
|
|
|
|
FixUps[1].next = &FixUps[0];
|
1998-05-12 19:04:29 +00:00
|
|
|
|
|
|
|
d30v_current_align_seg = now_seg;
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* this function removes the postincrement or postdecrement
|
|
|
|
operator ( '+' or '-' ) from an expression */
|
|
|
|
|
|
|
|
static int postfix (p)
|
|
|
|
char *p;
|
|
|
|
{
|
|
|
|
while (*p != '-' && *p != '+')
|
|
|
|
{
|
1997-03-24 02:27:09 +00:00
|
|
|
if (*p==0 || *p=='\n' || *p=='\r' || *p==' ' || *p==',')
|
1997-02-19 02:47:03 +00:00
|
|
|
break;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*p == '-')
|
|
|
|
{
|
|
|
|
*p = ' ';
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
if (*p == '+')
|
|
|
|
{
|
|
|
|
*p = ' ';
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bfd_reloc_code_real_type
|
|
|
|
get_reloc (op, rel_flag)
|
|
|
|
struct d30v_operand *op;
|
|
|
|
int rel_flag;
|
|
|
|
{
|
|
|
|
switch (op->bits)
|
|
|
|
{
|
|
|
|
case 6:
|
1997-12-16 13:25:59 +00:00
|
|
|
if (op->flags & OPERAND_SHIFT)
|
|
|
|
return BFD_RELOC_D30V_9_PCREL;
|
|
|
|
else
|
|
|
|
return BFD_RELOC_D30V_6;
|
|
|
|
break;
|
1997-02-19 02:47:03 +00:00
|
|
|
case 12:
|
|
|
|
if (!(op->flags & OPERAND_SHIFT))
|
1998-06-09 01:33:23 +00:00
|
|
|
as_warn (_("unexpected 12-bit reloc type"));
|
1997-02-19 02:47:03 +00:00
|
|
|
if (rel_flag == RELOC_PCREL)
|
|
|
|
return BFD_RELOC_D30V_15_PCREL;
|
|
|
|
else
|
|
|
|
return BFD_RELOC_D30V_15;
|
|
|
|
case 18:
|
|
|
|
if (!(op->flags & OPERAND_SHIFT))
|
1998-06-09 01:33:23 +00:00
|
|
|
as_warn (_("unexpected 18-bit reloc type"));
|
1997-02-19 02:47:03 +00:00
|
|
|
if (rel_flag == RELOC_PCREL)
|
|
|
|
return BFD_RELOC_D30V_21_PCREL;
|
|
|
|
else
|
|
|
|
return BFD_RELOC_D30V_21;
|
|
|
|
case 32:
|
|
|
|
if (rel_flag == RELOC_PCREL)
|
|
|
|
return BFD_RELOC_D30V_32_PCREL;
|
|
|
|
else
|
|
|
|
return BFD_RELOC_D30V_32;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get_operands parses a string of operands and returns
|
|
|
|
an array of expressions */
|
|
|
|
|
|
|
|
static int
|
|
|
|
get_operands (exp, cmp_hack)
|
|
|
|
expressionS exp[];
|
|
|
|
int cmp_hack;
|
|
|
|
{
|
|
|
|
char *p = input_line_pointer;
|
|
|
|
int numops = 0;
|
|
|
|
int post = 0;
|
|
|
|
|
|
|
|
if (cmp_hack)
|
|
|
|
{
|
|
|
|
exp[numops].X_op = O_absent;
|
|
|
|
exp[numops++].X_add_number = cmp_hack - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
while (*p == ' ' || *p == '\t' || *p == ',')
|
|
|
|
p++;
|
|
|
|
if (*p==0 || *p=='\n' || *p=='\r')
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (*p == '@')
|
|
|
|
{
|
|
|
|
p++;
|
|
|
|
exp[numops].X_op = O_absent;
|
|
|
|
if (*p == '(')
|
|
|
|
{
|
|
|
|
p++;
|
|
|
|
exp[numops].X_add_number = OPERAND_ATPAR;
|
|
|
|
post = postfix (p);
|
|
|
|
}
|
|
|
|
else if (*p == '-')
|
|
|
|
{
|
|
|
|
p++;
|
|
|
|
exp[numops].X_add_number = OPERAND_ATMINUS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
exp[numops].X_add_number = OPERAND_ATSIGN;
|
|
|
|
post = postfix (p);
|
|
|
|
}
|
|
|
|
numops++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*p == ')')
|
|
|
|
{
|
|
|
|
/* just skip the trailing paren */
|
|
|
|
p++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
input_line_pointer = p;
|
|
|
|
|
|
|
|
/* check to see if it might be a register name */
|
|
|
|
if (!register_name (&exp[numops]))
|
|
|
|
{
|
|
|
|
/* parse as an expression */
|
|
|
|
expression (&exp[numops]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (exp[numops].X_op == O_illegal)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_bad (_("illegal operand"));
|
1997-02-19 02:47:03 +00:00
|
|
|
else if (exp[numops].X_op == O_absent)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_bad (_("missing operand"));
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
numops++;
|
|
|
|
p = input_line_pointer;
|
|
|
|
|
|
|
|
switch (post)
|
|
|
|
{
|
|
|
|
case -1: /* postdecrement mode */
|
|
|
|
exp[numops].X_op = O_absent;
|
|
|
|
exp[numops++].X_add_number = OPERAND_MINUS;
|
|
|
|
break;
|
|
|
|
case 1: /* postincrement mode */
|
|
|
|
exp[numops].X_op = O_absent;
|
|
|
|
exp[numops++].X_add_number = OPERAND_PLUS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
post = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
exp[numops].X_op = 0;
|
|
|
|
return (numops);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* build_insn generates the instruction. It does everything */
|
|
|
|
/* but write the FM bits. */
|
|
|
|
|
|
|
|
static long long
|
|
|
|
build_insn (opcode, opers)
|
|
|
|
struct d30v_insn *opcode;
|
|
|
|
expressionS *opers;
|
|
|
|
{
|
1997-12-17 12:43:15 +00:00
|
|
|
int i, length, bits, shift, flags;
|
1997-02-19 02:47:03 +00:00
|
|
|
unsigned int number, id=0;
|
|
|
|
long long insn;
|
|
|
|
struct d30v_opcode *op = opcode->op;
|
|
|
|
struct d30v_format *form = opcode->form;
|
|
|
|
|
|
|
|
insn = opcode->ecc << 28 | op->op1 << 25 | op->op2 << 20 | form->modifier << 18;
|
1997-12-16 13:25:59 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
for (i=0; form->operands[i]; i++)
|
|
|
|
{
|
|
|
|
flags = d30v_operand_table[form->operands[i]].flags;
|
|
|
|
|
|
|
|
/* must be a register or number */
|
|
|
|
if (!(flags & OPERAND_REG) && !(flags & OPERAND_NUM) &&
|
|
|
|
!(flags & OPERAND_NAME) && !(flags & OPERAND_SPECIAL))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bits = d30v_operand_table[form->operands[i]].bits;
|
1997-12-16 13:25:59 +00:00
|
|
|
if (flags & OPERAND_SHIFT)
|
|
|
|
bits += 3;
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
length = d30v_operand_table[form->operands[i]].length;
|
|
|
|
shift = 12 - d30v_operand_table[form->operands[i]].position;
|
1997-12-16 13:25:59 +00:00
|
|
|
if (opers[i].X_op != O_symbol)
|
|
|
|
number = opers[i].X_add_number;
|
|
|
|
else
|
|
|
|
number = 0;
|
1997-02-19 02:47:03 +00:00
|
|
|
if (flags & OPERAND_REG)
|
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
/* check for mvfsys or mvtsys control registers */
|
|
|
|
if (flags & OPERAND_CONTROL && (number & 0x7f) > MAX_CONTROL_REG)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
/* PSWL or PSWH */
|
1997-12-16 13:25:59 +00:00
|
|
|
id = (number & 0x7f) - MAX_CONTROL_REG;
|
|
|
|
number = 0;
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
else if (number & OPERAND_FLAG)
|
|
|
|
{
|
|
|
|
id = 3; /* number is a flag register */
|
|
|
|
}
|
1997-12-16 13:25:59 +00:00
|
|
|
number &= 0x7F;
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
else if (flags & OPERAND_SPECIAL)
|
|
|
|
{
|
|
|
|
number = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opers[i].X_op != O_register && opers[i].X_op != O_constant && !(flags & OPERAND_NAME))
|
|
|
|
{
|
|
|
|
/* now create a fixup */
|
|
|
|
|
|
|
|
if (fixups->fc >= MAX_INSN_FIXUPS)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("too many fixups"));
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
fixups->fix[fixups->fc].reloc =
|
1998-06-09 01:33:23 +00:00
|
|
|
get_reloc ((struct d30v_operand *)&d30v_operand_table[form->operands[i]], op->reloc_flag);
|
1997-02-19 02:47:03 +00:00
|
|
|
fixups->fix[fixups->fc].size = 4;
|
|
|
|
fixups->fix[fixups->fc].exp = opers[i];
|
|
|
|
fixups->fix[fixups->fc].operand = form->operands[i];
|
1997-12-16 13:25:59 +00:00
|
|
|
if (fixups->fix[fixups->fc].reloc == BFD_RELOC_D30V_9_PCREL)
|
|
|
|
fixups->fix[fixups->fc].pcrel = RELOC_PCREL;
|
|
|
|
else
|
|
|
|
fixups->fix[fixups->fc].pcrel = op->reloc_flag;
|
1997-02-19 02:47:03 +00:00
|
|
|
(fixups->fc)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* truncate to the proper number of bits */
|
1997-03-24 02:27:09 +00:00
|
|
|
if ((opers[i].X_op == O_constant) && check_range (number, bits, flags))
|
1998-06-09 01:33:23 +00:00
|
|
|
as_bad (_("operand out of range: %d"),number);
|
1997-03-24 02:27:09 +00:00
|
|
|
if (bits < 31)
|
1997-02-19 02:47:03 +00:00
|
|
|
number &= 0x7FFFFFFF >> (31 - bits);
|
1997-12-16 13:25:59 +00:00
|
|
|
if (flags & OPERAND_SHIFT)
|
|
|
|
number >>= 3;
|
1997-02-19 02:47:03 +00:00
|
|
|
if (bits == 32)
|
|
|
|
{
|
|
|
|
/* it's a LONG instruction */
|
|
|
|
insn |= (number >> 26); /* top 6 bits */
|
|
|
|
insn <<= 32; /* shift the first word over */
|
|
|
|
insn |= ((number & 0x03FC0000) << 2); /* next 8 bits */
|
|
|
|
insn |= number & 0x0003FFFF; /* bottom 18 bits */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
insn |= number << shift;
|
|
|
|
}
|
|
|
|
return insn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* write out a long form instruction */
|
|
|
|
static void
|
|
|
|
write_long (opcode, insn, fx)
|
|
|
|
struct d30v_insn *opcode;
|
|
|
|
long long insn;
|
|
|
|
Fixups *fx;
|
|
|
|
{
|
|
|
|
int i, where;
|
1998-06-09 01:33:23 +00:00
|
|
|
char *f = frag_more (8);
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
insn |= FM11;
|
|
|
|
d30v_number_to_chars (f, insn, 8);
|
|
|
|
|
|
|
|
for (i=0; i < fx->fc; i++)
|
|
|
|
{
|
|
|
|
if (fx->fix[i].reloc)
|
|
|
|
{
|
|
|
|
where = f - frag_now->fr_literal;
|
|
|
|
fix_new_exp (frag_now,
|
|
|
|
where,
|
|
|
|
fx->fix[i].size,
|
|
|
|
&(fx->fix[i].exp),
|
|
|
|
fx->fix[i].pcrel,
|
|
|
|
fx->fix[i].reloc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fx->fc = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* write out a short form instruction by itself */
|
|
|
|
static void
|
|
|
|
write_1_short (opcode, insn, fx)
|
|
|
|
struct d30v_insn *opcode;
|
|
|
|
long long insn;
|
|
|
|
Fixups *fx;
|
|
|
|
{
|
1998-06-09 01:33:23 +00:00
|
|
|
char *f = frag_more (8);
|
1997-02-19 02:47:03 +00:00
|
|
|
int i, where;
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
if (warn_nops == NOP_ALL)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_warn (_("NOP inserted"));
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
/* the other container needs to be NOP */
|
|
|
|
/* according to 4.3.1: for FM=00, sub-instructions performed only
|
|
|
|
by IU cannot be encoded in L-container. */
|
|
|
|
if (opcode->op->unit == IU)
|
1997-12-17 12:43:15 +00:00
|
|
|
insn |= FM00 | NOP_LEFT; /* right container */
|
1997-02-19 02:47:03 +00:00
|
|
|
else
|
1997-12-17 12:43:15 +00:00
|
|
|
insn = FM00 | (insn << 32) | NOP_RIGHT; /* left container */
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
d30v_number_to_chars (f, insn, 8);
|
|
|
|
|
|
|
|
for (i=0; i < fx->fc; i++)
|
|
|
|
{
|
|
|
|
if (fx->fix[i].reloc)
|
|
|
|
{
|
|
|
|
where = f - frag_now->fr_literal;
|
|
|
|
fix_new_exp (frag_now,
|
|
|
|
where,
|
|
|
|
fx->fix[i].size,
|
|
|
|
&(fx->fix[i].exp),
|
|
|
|
fx->fix[i].pcrel,
|
|
|
|
fx->fix[i].reloc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fx->fc = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write out a short form instruction if possible */
|
|
|
|
/* return number of instructions not written out */
|
|
|
|
static int
|
|
|
|
write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx)
|
|
|
|
struct d30v_insn *opcode1, *opcode2;
|
|
|
|
long long insn1, insn2;
|
1997-12-17 12:43:15 +00:00
|
|
|
exec_type_enum exec_type;
|
1997-02-19 02:47:03 +00:00
|
|
|
Fixups *fx;
|
|
|
|
{
|
1997-12-17 12:43:15 +00:00
|
|
|
long long insn = NOP2;
|
1997-02-19 02:47:03 +00:00
|
|
|
char *f;
|
|
|
|
int i,j, where;
|
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
if (exec_type != EXEC_PARALLEL &&
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
((opcode1->op->flags_used & (FLAG_JSR | FLAG_DELAY)) == FLAG_JSR))
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
/* subroutines must be called from 32-bit boundaries */
|
|
|
|
/* so the return address will be correct */
|
|
|
|
write_1_short (opcode1, insn1, fx->next);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (exec_type)
|
|
|
|
{
|
1997-12-17 12:43:15 +00:00
|
|
|
case EXEC_UNKNOWN: /* order not specified */
|
|
|
|
if (Optimizing && parallel_ok (opcode1, insn1, opcode2, insn2, exec_type))
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
/* parallel */
|
1997-12-17 12:43:15 +00:00
|
|
|
exec_type = EXEC_PARALLEL;
|
1997-02-19 02:47:03 +00:00
|
|
|
if (opcode1->op->unit == IU)
|
|
|
|
insn = FM00 | (insn2 << 32) | insn1;
|
|
|
|
else if (opcode2->op->unit == MU)
|
|
|
|
insn = FM00 | (insn2 << 32) | insn1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
insn = FM00 | (insn1 << 32) | insn2;
|
|
|
|
fx = fx->next;
|
|
|
|
}
|
|
|
|
}
|
1997-12-17 12:43:15 +00:00
|
|
|
else if (opcode1->op->unit == IU)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
/* reverse sequential */
|
|
|
|
insn = FM10 | (insn2 << 32) | insn1;
|
1997-12-17 12:43:15 +00:00
|
|
|
exec_type = EXEC_REVSEQ;
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* sequential */
|
|
|
|
insn = FM01 | (insn1 << 32) | insn2;
|
1997-12-17 12:43:15 +00:00
|
|
|
fx = fx->next;
|
|
|
|
exec_type = EXEC_SEQ;
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
|
|
|
case EXEC_PARALLEL: /* parallel */
|
1998-02-20 05:47:40 +00:00
|
|
|
flag_explicitly_parallel = flag_xp_state;
|
1997-12-17 12:43:15 +00:00
|
|
|
if (! parallel_ok (opcode1, insn1, opcode2, insn2, exec_type))
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("Instructions may not be executed in parallel"));
|
1997-12-17 12:43:15 +00:00
|
|
|
else if (opcode1->op->unit == IU)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
if (opcode2->op->unit == IU)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("Two IU instructions may not be executed in parallel"));
|
|
|
|
as_warn (_("Swapping instruction order"));
|
1997-02-19 02:47:03 +00:00
|
|
|
insn = FM00 | (insn2 << 32) | insn1;
|
|
|
|
}
|
|
|
|
else if (opcode2->op->unit == MU)
|
|
|
|
{
|
|
|
|
if (opcode1->op->unit == MU)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("Two MU instructions may not be executed in parallel"));
|
|
|
|
as_warn (_("Swapping instruction order"));
|
1997-02-19 02:47:03 +00:00
|
|
|
insn = FM00 | (insn2 << 32) | insn1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
insn = FM00 | (insn1 << 32) | insn2;
|
|
|
|
fx = fx->next;
|
|
|
|
}
|
1998-02-20 05:47:40 +00:00
|
|
|
flag_explicitly_parallel = 0;
|
1997-02-19 02:47:03 +00:00
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
|
|
|
case EXEC_SEQ: /* sequential */
|
1997-02-19 02:47:03 +00:00
|
|
|
if (opcode1->op->unit == IU)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("IU instruction may not be in the left container"));
|
1998-07-30 19:41:18 +00:00
|
|
|
if (prev_left_kills_right_p)
|
|
|
|
as_warn (_("special left instruction `%s' kills instruction "
|
|
|
|
"`%s' in right container"),
|
|
|
|
opcode1->op->name, opcode2->op->name);
|
1997-02-19 02:47:03 +00:00
|
|
|
insn = FM01 | (insn1 << 32) | insn2;
|
|
|
|
fx = fx->next;
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
|
|
|
case EXEC_REVSEQ: /* reverse sequential */
|
1997-02-19 02:47:03 +00:00
|
|
|
if (opcode2->op->unit == MU)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("MU instruction may not be in the right container"));
|
1997-02-19 02:47:03 +00:00
|
|
|
insn = FM10 | (insn1 << 32) | insn2;
|
|
|
|
fx = fx->next;
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
default:
|
1998-06-09 01:33:23 +00:00
|
|
|
as_fatal (_("unknown execution type passed to write_2_short()"));
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* printf("writing out %llx\n",insn); */
|
1998-06-09 01:33:23 +00:00
|
|
|
f = frag_more (8);
|
1997-02-19 02:47:03 +00:00
|
|
|
d30v_number_to_chars (f, insn, 8);
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
/* If the previous instruction was a 32-bit multiply but it is put into a
|
|
|
|
parallel container, mark the current instruction as being a 32-bit
|
|
|
|
multiply. */
|
|
|
|
if (prev_mul32_p && exec_type == EXEC_PARALLEL)
|
|
|
|
cur_mul32_p = 1;
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
for (j=0; j<2; j++)
|
|
|
|
{
|
|
|
|
for (i=0; i < fx->fc; i++)
|
|
|
|
{
|
|
|
|
if (fx->fix[i].reloc)
|
|
|
|
{
|
|
|
|
where = (f - frag_now->fr_literal) + 4*j;
|
|
|
|
|
|
|
|
fix_new_exp (frag_now,
|
|
|
|
where,
|
|
|
|
fx->fix[i].size,
|
|
|
|
&(fx->fix[i].exp),
|
|
|
|
fx->fix[i].pcrel,
|
|
|
|
fx->fix[i].reloc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fx->fc = 0;
|
|
|
|
fx = fx->next;
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Check 2 instructions and determine if they can be safely */
|
|
|
|
/* executed in parallel. Returns 1 if they can be. */
|
|
|
|
static int
|
|
|
|
parallel_ok (op1, insn1, op2, insn2, exec_type)
|
|
|
|
struct d30v_insn *op1, *op2;
|
|
|
|
unsigned long insn1, insn2;
|
1997-12-17 12:43:15 +00:00
|
|
|
exec_type_enum exec_type;
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
int i, j, shift, regno, bits, ecc;
|
|
|
|
unsigned long flags, mask, flags_set1, flags_set2, flags_used1, flags_used2;
|
1997-12-17 12:43:15 +00:00
|
|
|
unsigned long ins, mod_reg[2][3], used_reg[2][3], flag_reg[2];
|
1997-02-22 00:29:55 +00:00
|
|
|
struct d30v_format *f;
|
|
|
|
struct d30v_opcode *op;
|
|
|
|
|
|
|
|
/* section 4.3: both instructions must not be IU or MU only */
|
|
|
|
if ((op1->op->unit == IU && op2->op->unit == IU)
|
|
|
|
|| (op1->op->unit == MU && op2->op->unit == MU))
|
1997-02-19 02:47:03 +00:00
|
|
|
return 0;
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
/* first instruction must not be a jump to safely optimize, unless this
|
|
|
|
is an explicit parallel operation. */
|
|
|
|
if (exec_type != EXEC_PARALLEL
|
|
|
|
&& (op1->op->flags_used & (FLAG_JMP | FLAG_JSR)))
|
1997-12-16 13:25:59 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* If one instruction is /TX or /XT and the other is /FX or /XF respectively,
|
|
|
|
then it is safe to allow the two to be done as parallel ops, since only
|
|
|
|
one will ever be executed at a time. */
|
|
|
|
if ((op1->ecc == ECC_TX && op2->ecc == ECC_FX)
|
|
|
|
|| (op1->ecc == ECC_FX && op2->ecc == ECC_TX)
|
|
|
|
|| (op1->ecc == ECC_XT && op2->ecc == ECC_XF)
|
|
|
|
|| (op1->ecc == ECC_XF && op2->ecc == ECC_XT))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* [0] r0-r31
|
|
|
|
[1] r32-r63
|
|
|
|
[2] a0, a1, flag registers */
|
1997-02-19 02:47:03 +00:00
|
|
|
|
1997-02-22 00:29:55 +00:00
|
|
|
for (j = 0; j < 2; j++)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
if (j == 0)
|
|
|
|
{
|
1997-02-22 00:29:55 +00:00
|
|
|
f = op1->form;
|
|
|
|
op = op1->op;
|
1997-12-16 13:25:59 +00:00
|
|
|
ecc = op1->ecc;
|
1997-02-19 02:47:03 +00:00
|
|
|
ins = insn1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1997-02-22 00:29:55 +00:00
|
|
|
f = op2->form;
|
|
|
|
op = op2->op;
|
1997-12-16 13:25:59 +00:00
|
|
|
ecc = op2->ecc;
|
1997-02-19 02:47:03 +00:00
|
|
|
ins = insn2;
|
|
|
|
}
|
1997-12-17 12:43:15 +00:00
|
|
|
flag_reg[j] = 0;
|
1997-02-22 00:29:55 +00:00
|
|
|
mod_reg[j][0] = mod_reg[j][1] = 0;
|
1997-12-16 13:25:59 +00:00
|
|
|
mod_reg[j][2] = (op->flags_set & FLAG_ALL);
|
1997-02-22 00:29:55 +00:00
|
|
|
used_reg[j][0] = used_reg[j][1] = 0;
|
1997-12-16 13:25:59 +00:00
|
|
|
used_reg[j][2] = (op->flags_used & FLAG_ALL);
|
|
|
|
|
|
|
|
/* BSR/JSR always sets R62 */
|
|
|
|
if (op->flags_used & FLAG_JSR)
|
|
|
|
mod_reg[j][1] = (1L << (62-32));
|
|
|
|
|
|
|
|
/* conditional execution affects the flags_used */
|
|
|
|
switch (ecc)
|
|
|
|
{
|
|
|
|
case ECC_TX:
|
|
|
|
case ECC_FX:
|
1997-12-17 12:43:15 +00:00
|
|
|
used_reg[j][2] |= flag_reg[j] = FLAG_0;
|
1997-12-16 13:25:59 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ECC_XT:
|
|
|
|
case ECC_XF:
|
1997-12-17 12:43:15 +00:00
|
|
|
used_reg[j][2] |= flag_reg[j] = FLAG_1;
|
1997-12-16 13:25:59 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ECC_TT:
|
|
|
|
case ECC_TF:
|
1997-12-17 12:43:15 +00:00
|
|
|
used_reg[j][2] |= flag_reg[j] = (FLAG_0 | FLAG_1);
|
1997-12-16 13:25:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1997-02-22 00:29:55 +00:00
|
|
|
for (i = 0; f->operands[i]; i++)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
1997-02-22 00:29:55 +00:00
|
|
|
flags = d30v_operand_table[f->operands[i]].flags;
|
|
|
|
shift = 12 - d30v_operand_table[f->operands[i]].position;
|
|
|
|
bits = d30v_operand_table[f->operands[i]].bits;
|
|
|
|
if (bits == 32)
|
|
|
|
mask = 0xffffffff;
|
|
|
|
else
|
|
|
|
mask = 0x7FFFFFFF >> (31 - bits);
|
1997-12-16 13:25:59 +00:00
|
|
|
|
|
|
|
if ((flags & OPERAND_PLUS) || (flags & OPERAND_MINUS))
|
|
|
|
{
|
|
|
|
/* this is a post-increment or post-decrement */
|
|
|
|
/* the previous register needs to be marked as modified */
|
|
|
|
|
|
|
|
shift = 12 - d30v_operand_table[f->operands[i-1]].position;
|
|
|
|
regno = (ins >> shift) & 0x3f;
|
|
|
|
if (regno >= 32)
|
|
|
|
mod_reg[j][1] |= 1L << (regno - 32);
|
|
|
|
else
|
|
|
|
mod_reg[j][0] |= 1L << regno;
|
|
|
|
}
|
|
|
|
else if (flags & OPERAND_REG)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
regno = (ins >> shift) & mask;
|
1997-12-16 13:25:59 +00:00
|
|
|
/* the memory write functions don't have a destination register */
|
|
|
|
if ((flags & OPERAND_DEST) && !(op->flags_set & FLAG_MEM))
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
/* MODIFIED registers and flags */
|
1997-02-22 00:29:55 +00:00
|
|
|
if (flags & OPERAND_ACC)
|
1997-12-16 13:25:59 +00:00
|
|
|
{
|
|
|
|
if (regno == 0)
|
|
|
|
mod_reg[j][2] |= FLAG_A0;
|
|
|
|
else if (regno == 1)
|
|
|
|
mod_reg[j][2] |= FLAG_A1;
|
|
|
|
else
|
|
|
|
abort ();
|
|
|
|
}
|
1997-02-22 00:29:55 +00:00
|
|
|
else if (flags & OPERAND_FLAG)
|
1997-12-16 13:25:59 +00:00
|
|
|
mod_reg[j][2] |= 1L << regno;
|
1997-02-22 00:29:55 +00:00
|
|
|
else if (!(flags & OPERAND_CONTROL))
|
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
int r, z;
|
|
|
|
|
|
|
|
/* need to check if there are two destination */
|
|
|
|
/* registers, for example ld2w */
|
|
|
|
if (flags & OPERAND_2REG)
|
|
|
|
z = 1;
|
1997-02-22 00:29:55 +00:00
|
|
|
else
|
1997-12-16 13:25:59 +00:00
|
|
|
z = 0;
|
|
|
|
|
|
|
|
for (r = regno; r <= regno + z; r++)
|
|
|
|
{
|
|
|
|
if (r >= 32)
|
|
|
|
mod_reg[j][1] |= 1L << (r - 32);
|
|
|
|
else
|
|
|
|
mod_reg[j][0] |= 1L << r;
|
|
|
|
}
|
1997-02-22 00:29:55 +00:00
|
|
|
}
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
/* USED, but not modified registers and flags */
|
1997-02-22 00:29:55 +00:00
|
|
|
if (flags & OPERAND_ACC)
|
1997-12-16 13:25:59 +00:00
|
|
|
{
|
|
|
|
if (regno == 0)
|
|
|
|
used_reg[j][2] |= FLAG_A0;
|
|
|
|
else if (regno == 1)
|
|
|
|
used_reg[j][2] |= FLAG_A1;
|
|
|
|
else
|
|
|
|
abort ();
|
|
|
|
}
|
1997-02-22 00:29:55 +00:00
|
|
|
else if (flags & OPERAND_FLAG)
|
1997-12-16 13:25:59 +00:00
|
|
|
used_reg[j][2] |= 1L << regno;
|
1997-02-22 00:29:55 +00:00
|
|
|
else if (!(flags & OPERAND_CONTROL))
|
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
int r, z;
|
|
|
|
|
|
|
|
/* need to check if there are two source */
|
|
|
|
/* registers, for example st2w */
|
|
|
|
if (flags & OPERAND_2REG)
|
|
|
|
z = 1;
|
1997-02-22 00:29:55 +00:00
|
|
|
else
|
1997-12-16 13:25:59 +00:00
|
|
|
z = 0;
|
|
|
|
|
|
|
|
for (r = regno; r <= regno + z; r++)
|
|
|
|
{
|
|
|
|
if (r >= 32)
|
|
|
|
used_reg[j][1] |= 1L << (r - 32);
|
|
|
|
else
|
|
|
|
used_reg[j][0] |= 1L << r;
|
|
|
|
}
|
1997-02-22 00:29:55 +00:00
|
|
|
}
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1997-02-22 00:29:55 +00:00
|
|
|
|
1997-12-16 13:25:59 +00:00
|
|
|
flags_set1 = op1->op->flags_set;
|
|
|
|
flags_set2 = op2->op->flags_set;
|
|
|
|
flags_used1 = op1->op->flags_used;
|
|
|
|
flags_used2 = op2->op->flags_used;
|
|
|
|
|
|
|
|
/* ST2W/ST4HB combined with ADDppp/SUBppp is illegal. */
|
|
|
|
if (((flags_set1 & (FLAG_MEM | FLAG_2WORD)) == (FLAG_MEM | FLAG_2WORD)
|
|
|
|
&& (flags_used2 & FLAG_ADDSUBppp) != 0)
|
|
|
|
|| ((flags_set2 & (FLAG_MEM | FLAG_2WORD)) == (FLAG_MEM | FLAG_2WORD)
|
|
|
|
&& (flags_used1 & FLAG_ADDSUBppp) != 0))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Load instruction combined with half-word multiply is illegal. */
|
|
|
|
if (((flags_used1 & FLAG_MEM) != 0 && (flags_used2 & FLAG_MUL16))
|
|
|
|
|| ((flags_used2 & FLAG_MEM) != 0 && (flags_used1 & FLAG_MUL16)))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Specifically allow add || add by removing carry, overflow bits dependency.
|
|
|
|
This is safe, even if an addc follows since the IU takes the argument in
|
|
|
|
the right container, and it writes its results last.
|
|
|
|
However, don't paralellize add followed by addc or sub followed by
|
|
|
|
subb. */
|
|
|
|
|
|
|
|
if (mod_reg[0][2] == FLAG_CVVA && mod_reg[1][2] == FLAG_CVVA
|
1997-12-17 12:43:15 +00:00
|
|
|
&& (used_reg[0][2] & ~flag_reg[0]) == 0
|
|
|
|
&& (used_reg[1][2] & ~flag_reg[1]) == 0
|
1997-12-16 13:25:59 +00:00
|
|
|
&& op1->op->unit == EITHER && op2->op->unit == EITHER)
|
|
|
|
{
|
|
|
|
mod_reg[0][2] = mod_reg[1][2] = 0;
|
|
|
|
}
|
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
1997-12-16 13:25:59 +00:00
|
|
|
{
|
|
|
|
/* If the second instruction depends on the first, we obviously
|
|
|
|
cannot parallelize. Note, the mod flag implies use, so
|
|
|
|
check that as well. */
|
1998-02-20 05:47:40 +00:00
|
|
|
/* If flag_explicitly_parallel is set, then the case of the
|
|
|
|
second instruction using a register the first instruction
|
|
|
|
modifies is assumed to be okay; we trust the human. We
|
|
|
|
don't trust the human if both instructions modify the same
|
|
|
|
register but we do trust the human if they modify the same
|
|
|
|
flags. */
|
|
|
|
if (flag_explicitly_parallel)
|
|
|
|
{
|
|
|
|
if ((j < 2) && (mod_reg[0][j] & mod_reg[1][j]) != 0)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((mod_reg[0][j] & (mod_reg[1][j] | used_reg[1][j])) != 0)
|
|
|
|
return 0;
|
1997-12-16 13:25:59 +00:00
|
|
|
}
|
|
|
|
|
1997-02-22 00:29:55 +00:00
|
|
|
return 1;
|
1997-02-19 02:47:03 +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 D30V, it mostly handles the special VLIW parsing and packing
|
1997-12-17 12:43:15 +00:00
|
|
|
and leaves the difficult stuff to do_assemble(). */
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
static long long prev_insn = -1;
|
|
|
|
static struct d30v_insn prev_opcode;
|
|
|
|
static subsegT prev_subseg;
|
|
|
|
static segT prev_seg = 0;
|
|
|
|
|
|
|
|
void
|
|
|
|
md_assemble (str)
|
|
|
|
char *str;
|
|
|
|
{
|
|
|
|
struct d30v_insn opcode;
|
|
|
|
long long insn;
|
1997-12-17 12:43:15 +00:00
|
|
|
exec_type_enum extype = EXEC_UNKNOWN; /* execution type; parallel, etc */
|
|
|
|
static exec_type_enum etype = EXEC_UNKNOWN; /* saved extype. used for multiline instructions */
|
1997-02-19 02:47:03 +00:00
|
|
|
char *str2;
|
|
|
|
|
1998-05-12 19:04:29 +00:00
|
|
|
if ((prev_insn != -1) && prev_seg
|
|
|
|
&& ((prev_seg != now_seg) || (prev_subseg != now_subseg)))
|
1998-06-09 01:33:23 +00:00
|
|
|
d30v_cleanup ();
|
1997-12-16 13:25:59 +00:00
|
|
|
|
1998-05-12 19:04:29 +00:00
|
|
|
if (d30v_current_align < 3)
|
|
|
|
d30v_align (3, NULL, d30v_last_label);
|
|
|
|
else if (d30v_current_align > 3)
|
|
|
|
d30v_current_align = 3;
|
|
|
|
d30v_last_label = NULL;
|
|
|
|
|
1998-02-20 05:47:40 +00:00
|
|
|
flag_explicitly_parallel = 0;
|
|
|
|
flag_xp_state = 0;
|
1997-12-17 12:43:15 +00:00
|
|
|
if (etype == EXEC_UNKNOWN)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
/* look for the special multiple instruction separators */
|
|
|
|
str2 = strstr (str, "||");
|
|
|
|
if (str2)
|
1998-02-20 05:47:40 +00:00
|
|
|
{
|
|
|
|
extype = EXEC_PARALLEL;
|
|
|
|
flag_xp_state = 1;
|
|
|
|
}
|
1997-02-19 02:47:03 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
str2 = strstr (str, "->");
|
|
|
|
if (str2)
|
1997-12-17 12:43:15 +00:00
|
|
|
extype = EXEC_SEQ;
|
1997-02-19 02:47:03 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
str2 = strstr (str, "<-");
|
|
|
|
if (str2)
|
1997-12-17 12:43:15 +00:00
|
|
|
extype = EXEC_REVSEQ;
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* str2 points to the separator, if one */
|
|
|
|
if (str2)
|
|
|
|
{
|
|
|
|
*str2 = 0;
|
|
|
|
|
|
|
|
/* if two instructions are present and we already have one saved
|
|
|
|
then first write it out */
|
1998-06-09 01:33:23 +00:00
|
|
|
d30v_cleanup ();
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
/* assemble first instruction and save it */
|
1998-06-09 01:33:23 +00:00
|
|
|
prev_insn = do_assemble (str, &prev_opcode, 1, 0);
|
1997-02-19 02:47:03 +00:00
|
|
|
if (prev_insn == -1)
|
1998-05-12 19:04:29 +00:00
|
|
|
as_fatal (_("Cannot assemble instruction"));
|
1997-12-16 13:25:59 +00:00
|
|
|
if (prev_opcode.form->form >= LONG)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("First opcode is long. Unable to mix instructions as specified."));
|
1997-02-19 02:47:03 +00:00
|
|
|
fixups = fixups->next;
|
|
|
|
str = str2 + 2;
|
1998-06-05 17:51:58 +00:00
|
|
|
prev_seg = now_seg;
|
|
|
|
prev_subseg = now_subseg;
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-05-06 18:56:08 +00:00
|
|
|
insn = do_assemble (str, &opcode,
|
1998-06-09 01:33:23 +00:00
|
|
|
(extype != EXEC_UNKNOWN || etype != EXEC_UNKNOWN),
|
|
|
|
extype == EXEC_PARALLEL);
|
1997-02-19 02:47:03 +00:00
|
|
|
if (insn == -1)
|
|
|
|
{
|
1998-05-06 18:56:08 +00:00
|
|
|
if (extype != EXEC_UNKNOWN)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
etype = extype;
|
|
|
|
return;
|
|
|
|
}
|
1998-05-12 19:04:29 +00:00
|
|
|
as_fatal (_("Cannot assemble instruction"));
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
|
1998-05-06 18:56:08 +00:00
|
|
|
if (etype != EXEC_UNKNOWN)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
extype = etype;
|
1998-05-06 18:56:08 +00:00
|
|
|
etype = EXEC_UNKNOWN;
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
/* Word multiply instructions must not be followed by either a load or a
|
|
|
|
16-bit multiply instruction in the next cycle. */
|
1998-06-09 01:33:23 +00:00
|
|
|
if ( (extype != EXEC_REVSEQ)
|
|
|
|
&& prev_mul32_p
|
|
|
|
&& (opcode.op->flags_used & (FLAG_MEM | FLAG_MUL16)))
|
1997-12-17 12:43:15 +00:00
|
|
|
{
|
|
|
|
/* However, load and multiply should able to be combined in a parallel
|
|
|
|
operation, so check for that first. */
|
|
|
|
if (prev_insn != -1
|
|
|
|
&& (opcode.op->flags_used & FLAG_MEM)
|
|
|
|
&& opcode.form->form < LONG
|
|
|
|
&& (extype == EXEC_PARALLEL || (Optimizing && extype == EXEC_UNKNOWN))
|
|
|
|
&& parallel_ok (&prev_opcode, (long)prev_insn,
|
|
|
|
&opcode, (long)insn, extype)
|
|
|
|
&& write_2_short (&prev_opcode, (long)prev_insn,
|
|
|
|
&opcode, (long)insn, extype, fixups) == 0)
|
|
|
|
{
|
|
|
|
/* no instructions saved */
|
|
|
|
prev_insn = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-06-09 01:33:23 +00:00
|
|
|
/* Can't parallelize, flush previous instruction and emit a word of NOPS,
|
|
|
|
unless the previous instruction is a NOP, in whcih case just flush it,
|
|
|
|
as this will generate a word of NOPs for us. */
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
if (prev_insn != -1 && (strcmp (prev_opcode.op->name, "nop") == 0))
|
|
|
|
{
|
|
|
|
d30v_cleanup ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char * f;
|
|
|
|
|
|
|
|
d30v_cleanup ();
|
|
|
|
|
|
|
|
f = frag_more (8);
|
|
|
|
d30v_number_to_chars (f, NOP2, 8);
|
|
|
|
if (warn_nops == NOP_ALL || warn_nops == NOP_MULTIPLY)
|
|
|
|
{
|
|
|
|
if (opcode.op->flags_used & FLAG_MEM)
|
|
|
|
as_warn (_("word of NOPs added between word multiply and load"));
|
|
|
|
else
|
|
|
|
as_warn (_("word of NOPs added between word multiply and 16-bit multiply"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
extype = EXEC_UNKNOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( (extype == EXEC_REVSEQ)
|
|
|
|
&& cur_mul32_p
|
|
|
|
&& (prev_opcode.op->flags_used & (FLAG_MEM | FLAG_MUL16)))
|
|
|
|
{
|
|
|
|
/* Can't parallelize, flush current instruction and emit a word of NOPS */
|
|
|
|
write_1_short (& opcode, (long) insn, fixups->next->next);
|
|
|
|
|
|
|
|
if (strcmp (opcode.op->name, "nop") != 0)
|
|
|
|
{
|
|
|
|
char * f;
|
|
|
|
|
|
|
|
f = frag_more (8);
|
1997-12-17 12:43:15 +00:00
|
|
|
d30v_number_to_chars (f, NOP2, 8);
|
|
|
|
if (warn_nops == NOP_ALL || warn_nops == NOP_MULTIPLY)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
{
|
1998-05-12 19:04:29 +00:00
|
|
|
if (opcode.op->flags_used & FLAG_MEM)
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_warn (_("word of NOPs added between word multiply and load"));
|
|
|
|
else
|
|
|
|
as_warn (_("word of NOPs added between word multiply and 16-bit multiply"));
|
|
|
|
}
|
1997-12-17 12:43:15 +00:00
|
|
|
}
|
1998-06-09 01:33:23 +00:00
|
|
|
|
|
|
|
/* Make the previous instruction the current one. */
|
|
|
|
extype = EXEC_UNKNOWN;
|
|
|
|
insn = prev_insn;
|
|
|
|
now_seg = prev_seg;
|
|
|
|
now_subseg = prev_subseg;
|
|
|
|
prev_insn = -1;
|
|
|
|
cur_mul32_p = prev_mul32_p;
|
|
|
|
prev_mul32_p = 0;
|
1997-12-17 12:43:15 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
/* If this is a long instruction, write it and any previous short instruction. */
|
1997-02-19 02:47:03 +00:00
|
|
|
if (opcode.form->form >= LONG)
|
|
|
|
{
|
1998-06-09 01:33:23 +00:00
|
|
|
if (extype != EXEC_UNKNOWN)
|
|
|
|
as_fatal (_("Unable to mix instructions as specified"));
|
|
|
|
d30v_cleanup ();
|
1997-02-19 02:47:03 +00:00
|
|
|
write_long (&opcode, insn, fixups);
|
|
|
|
prev_insn = -1;
|
|
|
|
}
|
1998-06-09 01:33:23 +00:00
|
|
|
else if ((prev_insn != -1) &&
|
1997-12-17 12:43:15 +00:00
|
|
|
(write_2_short (&prev_opcode, (long)prev_insn, &opcode, (long)insn, extype, fixups) == 0))
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
1998-06-09 01:33:23 +00:00
|
|
|
/* No instructions saved. */
|
1997-02-19 02:47:03 +00:00
|
|
|
prev_insn = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-06-09 01:33:23 +00:00
|
|
|
if (extype != EXEC_UNKNOWN)
|
|
|
|
as_fatal (_("Unable to mix instructions as specified"));
|
|
|
|
|
|
|
|
/* Save off last instruction so it may be packed on next pass. */
|
|
|
|
memcpy (&prev_opcode, &opcode, sizeof (prev_opcode));
|
1997-02-19 02:47:03 +00:00
|
|
|
prev_insn = insn;
|
|
|
|
prev_seg = now_seg;
|
|
|
|
prev_subseg = now_subseg;
|
|
|
|
fixups = fixups->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* do_assemble assembles a single instruction and returns an opcode */
|
|
|
|
/* it returns -1 (an invalid opcode) on error */
|
|
|
|
|
|
|
|
static long long
|
1998-06-09 01:33:23 +00:00
|
|
|
do_assemble (str, opcode, shortp, is_parallel)
|
1997-02-19 02:47:03 +00:00
|
|
|
char *str;
|
|
|
|
struct d30v_insn *opcode;
|
1998-05-06 18:56:08 +00:00
|
|
|
int shortp;
|
1998-06-09 01:33:23 +00:00
|
|
|
int is_parallel;
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
unsigned char *op_start, *save;
|
|
|
|
unsigned char *op_end;
|
|
|
|
char name[20];
|
1998-05-06 18:56:08 +00:00
|
|
|
int cmp_hack, nlen = 0, fsize = (shortp ? FORCE_SHORT : 0);
|
1997-02-19 02:47:03 +00:00
|
|
|
expressionS myops[6];
|
|
|
|
long long insn;
|
|
|
|
|
|
|
|
/* Drop leading whitespace */
|
|
|
|
while (*str == ' ')
|
|
|
|
str++;
|
|
|
|
|
|
|
|
/* find the opcode end */
|
|
|
|
for (op_start = op_end = (unsigned char *) (str);
|
|
|
|
*op_end
|
|
|
|
&& nlen < 20
|
|
|
|
&& *op_end != '/'
|
|
|
|
&& !is_end_of_line[*op_end] && *op_end != ' ';
|
|
|
|
op_end++)
|
|
|
|
{
|
1998-06-09 01:33:23 +00:00
|
|
|
name[nlen] = tolower (op_start[nlen]);
|
1997-02-19 02:47:03 +00:00
|
|
|
nlen++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nlen == 0)
|
|
|
|
return (-1);
|
|
|
|
|
|
|
|
name[nlen] = 0;
|
|
|
|
|
|
|
|
/* if there is an execution condition code, handle it */
|
|
|
|
if (*op_end == '/')
|
|
|
|
{
|
|
|
|
int i = 0;
|
1998-06-09 01:33:23 +00:00
|
|
|
while ( (i < ECC_MAX) && strncasecmp (d30v_ecc_names[i],op_end+1,2))
|
1997-02-19 02:47:03 +00:00
|
|
|
i++;
|
|
|
|
|
|
|
|
if (i == ECC_MAX)
|
|
|
|
{
|
|
|
|
char tmp[4];
|
1998-06-09 01:33:23 +00:00
|
|
|
strncpy (tmp,op_end+1,2);
|
1997-02-19 02:47:03 +00:00
|
|
|
tmp[2] = 0;
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("unknown condition code: %s"),tmp);
|
1997-02-19 02:47:03 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
/* printf("condition code=%d\n",i); */
|
|
|
|
opcode->ecc = i;
|
|
|
|
op_end += 3;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
opcode->ecc = ECC_AL;
|
|
|
|
|
|
|
|
|
|
|
|
/* CMP and CMPU change their name based on condition codes */
|
1998-06-09 01:33:23 +00:00
|
|
|
if (!strncmp (name,"cmp",3))
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
int p,i;
|
|
|
|
char **str = (char **)d30v_cc_names;
|
|
|
|
if (name[3] == 'u')
|
|
|
|
p = 4;
|
|
|
|
else
|
|
|
|
p = 3;
|
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
for (i=1; *str && strncmp (*str,&name[p],2); i++, str++)
|
1997-02-19 02:47:03 +00:00
|
|
|
;
|
|
|
|
|
1997-12-16 13:25:59 +00:00
|
|
|
/* cmpu only supports some condition codes */
|
|
|
|
if (p == 4)
|
|
|
|
{
|
|
|
|
if (i < 3 || i > 6)
|
|
|
|
{
|
|
|
|
name[p+2]=0;
|
1998-05-12 19:04:29 +00:00
|
|
|
as_fatal (_("cmpu doesn't support condition code %s"),&name[p]);
|
1997-12-16 13:25:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
if (!*str)
|
|
|
|
{
|
|
|
|
name[p+2]=0;
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("unknown condition code: %s"),&name[p]);
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cmp_hack = i;
|
|
|
|
name[p] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cmp_hack = 0;
|
|
|
|
|
|
|
|
/* printf("cmp_hack=%d\n",cmp_hack); */
|
|
|
|
|
1997-12-16 13:25:59 +00:00
|
|
|
/* need to look for .s or .l */
|
|
|
|
if (name[nlen-2] == '.')
|
|
|
|
{
|
|
|
|
switch (name[nlen-1])
|
|
|
|
{
|
|
|
|
case 's':
|
|
|
|
fsize = FORCE_SHORT;
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
fsize = FORCE_LONG;
|
1998-02-20 05:47:40 +00:00
|
|
|
break;
|
1997-12-16 13:25:59 +00:00
|
|
|
}
|
|
|
|
name[nlen-2] = 0;
|
|
|
|
}
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
/* find the first opcode with the proper name */
|
|
|
|
opcode->op = (struct d30v_opcode *)hash_find (d30v_hash, name);
|
|
|
|
if (opcode->op == NULL)
|
1998-06-09 01:33:23 +00:00
|
|
|
as_fatal (_("unknown opcode: %s"),name);
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
save = input_line_pointer;
|
|
|
|
input_line_pointer = op_end;
|
1997-12-16 13:25:59 +00:00
|
|
|
while (!(opcode->form = find_format (opcode->op, myops, fsize, cmp_hack)))
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
opcode->op++;
|
1998-06-09 01:33:23 +00:00
|
|
|
if (strcmp (opcode->op->name,name))
|
1998-05-12 19:04:29 +00:00
|
|
|
as_fatal (_("operands for opcode `%s' do not match any valid format"), name);
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
input_line_pointer = save;
|
|
|
|
|
|
|
|
insn = build_insn (opcode, myops);
|
1997-12-17 12:43:15 +00:00
|
|
|
|
|
|
|
/* Propigate multiply status */
|
|
|
|
if (insn != -1)
|
|
|
|
{
|
1998-06-09 01:33:23 +00:00
|
|
|
if (is_parallel && prev_mul32_p)
|
|
|
|
cur_mul32_p = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prev_mul32_p = cur_mul32_p;
|
|
|
|
cur_mul32_p = (opcode->op->flags_used & FLAG_MUL32) != 0;
|
|
|
|
}
|
1997-12-17 12:43:15 +00:00
|
|
|
}
|
|
|
|
|
1998-07-30 19:41:18 +00:00
|
|
|
/* Propagate left_kills_right status */
|
|
|
|
if (insn != -1)
|
|
|
|
{
|
|
|
|
prev_left_kills_right_p = cur_left_kills_right_p;
|
|
|
|
|
|
|
|
if (opcode->op->flags_set & FLAG_LKR)
|
|
|
|
{
|
|
|
|
cur_left_kills_right_p = 1;
|
|
|
|
|
|
|
|
if (strcmp (opcode->op->name, "mvtsys") == 0)
|
|
|
|
{
|
|
|
|
/* Left kills right for only mvtsys only for PSW/PSWH/PSWL/flags target. */
|
|
|
|
if ((myops[0].X_op == O_register) &&
|
|
|
|
((myops[0].X_add_number == OPERAND_CONTROL) || /* psw */
|
|
|
|
(myops[0].X_add_number == OPERAND_CONTROL+MAX_CONTROL_REG+2) || /* pswh */
|
|
|
|
(myops[0].X_add_number == OPERAND_CONTROL+MAX_CONTROL_REG+1) || /* pswl */
|
|
|
|
(myops[0].X_add_number == OPERAND_FLAG+0) || /* f0 */
|
|
|
|
(myops[0].X_add_number == OPERAND_FLAG+1) || /* f1 */
|
|
|
|
(myops[0].X_add_number == OPERAND_FLAG+2) || /* f2 */
|
|
|
|
(myops[0].X_add_number == OPERAND_FLAG+3) || /* f3 */
|
|
|
|
(myops[0].X_add_number == OPERAND_FLAG+4) || /* f4 */
|
|
|
|
(myops[0].X_add_number == OPERAND_FLAG+5) || /* f5 */
|
|
|
|
(myops[0].X_add_number == OPERAND_FLAG+6) || /* f6 */
|
|
|
|
(myops[0].X_add_number == OPERAND_FLAG+7))) /* f7 */
|
|
|
|
{
|
|
|
|
cur_left_kills_right_p = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Other mvtsys target registers don't kill right instruction. */
|
|
|
|
cur_left_kills_right_p = 0;
|
|
|
|
}
|
|
|
|
} /* mvtsys */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cur_left_kills_right_p = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
return (insn);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-05-12 19:04:29 +00:00
|
|
|
/* find_format() gets a pointer to an entry in the format table.
|
|
|
|
It must look at all formats for an opcode and use the operands
|
|
|
|
to choose the correct one. Returns NULL on error. */
|
1997-02-19 02:47:03 +00:00
|
|
|
|
|
|
|
static struct d30v_format *
|
1997-12-16 13:25:59 +00:00
|
|
|
find_format (opcode, myops, fsize, cmp_hack)
|
1997-02-19 02:47:03 +00:00
|
|
|
struct d30v_opcode *opcode;
|
|
|
|
expressionS myops[];
|
1997-12-16 13:25:59 +00:00
|
|
|
int fsize;
|
1997-02-19 02:47:03 +00:00
|
|
|
int cmp_hack;
|
|
|
|
{
|
|
|
|
int numops, match, index, i=0, j, k;
|
|
|
|
struct d30v_format *fm;
|
|
|
|
|
1998-05-12 19:04:29 +00:00
|
|
|
/* Get all the operands and save them as expressions. */
|
1997-02-19 02:47:03 +00:00
|
|
|
numops = get_operands (myops, cmp_hack);
|
|
|
|
|
1997-12-17 12:43:15 +00:00
|
|
|
while ((index = opcode->format[i++]) != 0)
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
1998-05-12 19:04:29 +00:00
|
|
|
if (fsize == FORCE_SHORT && index >= LONG)
|
1997-12-16 13:25:59 +00:00
|
|
|
continue;
|
|
|
|
|
1998-05-12 19:04:29 +00:00
|
|
|
if (fsize == FORCE_LONG && index < LONG)
|
1997-12-16 13:25:59 +00:00
|
|
|
continue;
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
fm = (struct d30v_format *)&d30v_format_table[index];
|
|
|
|
k = index;
|
|
|
|
while (fm->form == index)
|
|
|
|
{
|
|
|
|
match = 1;
|
1998-05-12 19:04:29 +00:00
|
|
|
/* Now check the operands for compatibility. */
|
1997-02-19 02:47:03 +00:00
|
|
|
for (j = 0; match && fm->operands[j]; j++)
|
|
|
|
{
|
|
|
|
int flags = d30v_operand_table[fm->operands[j]].flags;
|
1998-05-12 19:04:29 +00:00
|
|
|
int bits = d30v_operand_table[fm->operands[j]].bits;
|
1997-02-19 02:47:03 +00:00
|
|
|
int X_op = myops[j].X_op;
|
|
|
|
int num = myops[j].X_add_number;
|
|
|
|
|
1998-05-12 19:04:29 +00:00
|
|
|
if (flags & OPERAND_SPECIAL)
|
1997-02-19 02:47:03 +00:00
|
|
|
break;
|
1998-05-12 19:04:29 +00:00
|
|
|
else if (X_op == O_illegal)
|
1997-02-19 02:47:03 +00:00
|
|
|
match = 0;
|
|
|
|
else if (flags & OPERAND_REG)
|
|
|
|
{
|
1998-05-12 19:04:29 +00:00
|
|
|
if (X_op != O_register
|
1997-12-17 12:43:15 +00:00
|
|
|
|| ((flags & OPERAND_ACC) && !(num & OPERAND_ACC))
|
|
|
|
|| ((flags & OPERAND_FLAG) && !(num & OPERAND_FLAG))
|
|
|
|
|| ((flags & OPERAND_CONTROL)
|
|
|
|
&& !(num & (OPERAND_CONTROL | OPERAND_FLAG))))
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
match = 0;
|
|
|
|
}
|
|
|
|
}
|
1998-05-12 19:04:29 +00:00
|
|
|
else 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)))
|
|
|
|
{
|
|
|
|
match=0;
|
|
|
|
}
|
|
|
|
else if (flags & OPERAND_NUM)
|
|
|
|
{
|
|
|
|
/* A number can be a constant or symbol expression. */
|
|
|
|
|
|
|
|
/* Turn an expression into a symbol for later resolution. */
|
|
|
|
if (X_op != O_absent && X_op != O_constant
|
|
|
|
&& X_op != O_symbol && X_op != O_register
|
|
|
|
&& X_op != O_big)
|
|
|
|
{
|
|
|
|
symbolS *sym = make_expr_symbol (&myops[j]);
|
|
|
|
myops[j].X_op = X_op = O_symbol;
|
|
|
|
myops[j].X_add_symbol = sym;
|
|
|
|
myops[j].X_add_number = num = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fm->form >= LONG)
|
|
|
|
{
|
|
|
|
/* If we're testing for a LONG format, either fits. */
|
|
|
|
if (X_op != O_constant && X_op != O_symbol)
|
|
|
|
match = 0;
|
|
|
|
}
|
|
|
|
else if (fm->form < LONG
|
|
|
|
&& ((fsize == FORCE_SHORT && X_op == O_symbol)
|
|
|
|
|| (fm->form == SHORT_D2 && j == 0)))
|
|
|
|
match = 1;
|
|
|
|
/* This is the tricky part. Will the constant or symbol
|
|
|
|
fit into the space in the current format? */
|
|
|
|
else if (X_op == O_constant)
|
|
|
|
{
|
|
|
|
if (check_range (num, bits, flags))
|
|
|
|
match = 0;
|
|
|
|
}
|
|
|
|
else if (X_op == O_symbol
|
1998-06-09 01:33:23 +00:00
|
|
|
&& S_IS_DEFINED (myops[j].X_add_symbol)
|
|
|
|
&& S_GET_SEGMENT (myops[j].X_add_symbol) == now_seg
|
1998-05-12 19:04:29 +00:00
|
|
|
&& opcode->reloc_flag == RELOC_PCREL)
|
|
|
|
{
|
|
|
|
/* If the symbol is defined, see if the value will fit
|
|
|
|
into the form we're considering. */
|
|
|
|
fragS *f;
|
|
|
|
long value;
|
|
|
|
|
|
|
|
/* Calculate the current address by running through the
|
|
|
|
previous frags and adding our current offset. */
|
|
|
|
value = 0;
|
|
|
|
for (f = frchain_now->frch_root; f; f = f->fr_next)
|
|
|
|
value += f->fr_fix + f->fr_offset;
|
1998-06-09 01:33:23 +00:00
|
|
|
value = (S_GET_VALUE (myops[j].X_add_symbol) - value
|
|
|
|
- (obstack_next_free (&frchain_now->frch_obstack)
|
1998-05-12 19:04:29 +00:00
|
|
|
- frag_now->fr_literal));
|
|
|
|
if (check_range (value, bits, flags))
|
|
|
|
match = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
match = 0;
|
|
|
|
}
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
/* printf("through the loop: match=%d\n",match); */
|
1998-05-12 19:04:29 +00:00
|
|
|
/* We're only done if the operands matched so far AND there
|
|
|
|
are no more to check. */
|
|
|
|
if (match && myops[j].X_op == 0)
|
1997-02-19 02:47:03 +00:00
|
|
|
return fm;
|
|
|
|
fm = (struct d30v_format *)&d30v_format_table[++k];
|
|
|
|
}
|
|
|
|
/* printf("trying another format: i=%d\n",i); */
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if while processing a fixup, a reloc really needs to be created */
|
|
|
|
/* then it is done here */
|
|
|
|
|
|
|
|
arelent *
|
|
|
|
tc_gen_reloc (seg, fixp)
|
|
|
|
asection *seg;
|
|
|
|
fixS *fixp;
|
|
|
|
{
|
|
|
|
arelent *reloc;
|
1997-03-24 02:27:09 +00:00
|
|
|
reloc = (arelent *) xmalloc (sizeof (arelent));
|
1997-02-19 02:47:03 +00:00
|
|
|
reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
|
|
|
|
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,
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
_("reloc %d not supported by object file format"), (int)fixp->fx_r_type);
|
1997-02-19 02:47:03 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
reloc->addend = fixp->fx_addnumber;
|
|
|
|
return reloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
md_estimate_size_before_relax (fragp, seg)
|
|
|
|
fragS *fragp;
|
|
|
|
asection *seg;
|
|
|
|
{
|
|
|
|
abort ();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
long
|
|
|
|
md_pcrel_from_section (fixp, sec)
|
|
|
|
fixS *fixp;
|
|
|
|
segT sec;
|
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
if (fixp->fx_addsy != (symbolS *)NULL && (!S_IS_DEFINED (fixp->fx_addsy) ||
|
|
|
|
(S_GET_SEGMENT (fixp->fx_addsy) != sec)))
|
1997-02-19 02:47:03 +00:00
|
|
|
return 0;
|
|
|
|
return fixp->fx_frag->fr_address + fixp->fx_where;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
md_apply_fix3 (fixp, valuep, seg)
|
|
|
|
fixS *fixp;
|
|
|
|
valueT *valuep;
|
|
|
|
segT seg;
|
|
|
|
{
|
|
|
|
char *where;
|
|
|
|
unsigned long insn, insn2;
|
|
|
|
long value;
|
|
|
|
|
|
|
|
if (fixp->fx_addsy == (symbolS *) NULL)
|
|
|
|
{
|
|
|
|
value = *valuep;
|
|
|
|
fixp->fx_done = 1;
|
|
|
|
}
|
|
|
|
else if (fixp->fx_pcrel)
|
|
|
|
{
|
|
|
|
value = *valuep;
|
1997-12-16 13:25:59 +00:00
|
|
|
}
|
1997-02-22 00:29:55 +00:00
|
|
|
else
|
1997-02-19 02:47:03 +00:00
|
|
|
{
|
|
|
|
value = fixp->fx_offset;
|
|
|
|
if (fixp->fx_subsy != (symbolS *) NULL)
|
|
|
|
{
|
1997-12-16 13:25:59 +00:00
|
|
|
if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
|
1997-02-19 02:47:03 +00:00
|
|
|
value -= S_GET_VALUE (fixp->fx_subsy);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We don't actually support subtracting a symbol. */
|
1997-02-22 00:29:55 +00:00
|
|
|
as_bad_where (fixp->fx_file, fixp->fx_line,
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
_("expression too complex"));
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fetch the instruction, insert the fully resolved operand
|
|
|
|
value, and stuff the instruction back again. */
|
|
|
|
where = fixp->fx_frag->fr_literal + fixp->fx_where;
|
|
|
|
insn = bfd_getb32 ((unsigned char *) where);
|
1997-02-22 00:29:55 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
switch (fixp->fx_r_type)
|
|
|
|
{
|
1998-06-11 22:58:05 +00:00
|
|
|
case BFD_RELOC_8:
|
|
|
|
/* Caused by a bad .byte directive. */
|
|
|
|
as_fatal (_("line %d: unable to place address of symbol '%s' into a byte"),
|
|
|
|
fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BFD_RELOC_16:
|
|
|
|
/* Caused by a bad .short directive. */
|
|
|
|
as_fatal (_("line %d: unable to place address of symbol '%s' into a short"),
|
|
|
|
fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BFD_RELOC_64:
|
|
|
|
/* Caused by a bad .quad directive. */
|
|
|
|
as_fatal (_("line %d: unable to place address of symbol '%s' into a .quad"),
|
|
|
|
fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
|
|
|
|
break;
|
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
case BFD_RELOC_D30V_6:
|
1997-12-16 13:25:59 +00:00
|
|
|
check_size (value, 6, fixp->fx_file, fixp->fx_line);
|
1997-02-19 02:47:03 +00:00
|
|
|
insn |= value & 0x3F;
|
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-12-16 13:25:59 +00:00
|
|
|
case BFD_RELOC_D30V_9_PCREL:
|
|
|
|
if (fixp->fx_where & 0x7)
|
|
|
|
{
|
|
|
|
if (fixp->fx_done)
|
|
|
|
value += 4;
|
|
|
|
else
|
|
|
|
fixp->fx_r_type = BFD_RELOC_D30V_9_PCREL_R;
|
|
|
|
}
|
|
|
|
check_size (value, 9, fixp->fx_file, fixp->fx_line);
|
|
|
|
insn |= ((value >> 3) & 0x3F) << 12;
|
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
case BFD_RELOC_D30V_15:
|
1997-12-16 13:25:59 +00:00
|
|
|
check_size (value, 15, fixp->fx_file, fixp->fx_line);
|
1997-02-19 02:47:03 +00:00
|
|
|
insn |= (value >> 3) & 0xFFF;
|
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
case BFD_RELOC_D30V_15_PCREL:
|
1997-12-16 13:25:59 +00:00
|
|
|
if (fixp->fx_where & 0x7)
|
|
|
|
{
|
|
|
|
if (fixp->fx_done)
|
|
|
|
value += 4;
|
|
|
|
else
|
|
|
|
fixp->fx_r_type = BFD_RELOC_D30V_15_PCREL_R;
|
|
|
|
}
|
|
|
|
check_size (value, 15, fixp->fx_file, fixp->fx_line);
|
1997-02-19 02:47:03 +00:00
|
|
|
insn |= (value >> 3) & 0xFFF;
|
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
case BFD_RELOC_D30V_21:
|
1997-12-16 13:25:59 +00:00
|
|
|
check_size (value, 21, fixp->fx_file, fixp->fx_line);
|
1997-02-19 02:47:03 +00:00
|
|
|
insn |= (value >> 3) & 0x3FFFF;
|
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
case BFD_RELOC_D30V_21_PCREL:
|
1997-12-16 13:25:59 +00:00
|
|
|
if (fixp->fx_where & 0x7)
|
|
|
|
{
|
|
|
|
if (fixp->fx_done)
|
|
|
|
value += 4;
|
|
|
|
else
|
|
|
|
fixp->fx_r_type = BFD_RELOC_D30V_21_PCREL_R;
|
|
|
|
}
|
|
|
|
check_size (value, 21, fixp->fx_file, fixp->fx_line);
|
1997-02-19 02:47:03 +00:00
|
|
|
insn |= (value >> 3) & 0x3FFFF;
|
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
case BFD_RELOC_D30V_32:
|
|
|
|
insn2 = bfd_getb32 ((unsigned char *) where + 4);
|
1997-12-17 12:43:15 +00:00
|
|
|
insn |= (value >> 26) & 0x3F; /* top 6 bits */
|
|
|
|
insn2 |= ((value & 0x03FC0000) << 2); /* next 8 bits */
|
1997-02-19 02:47:03 +00:00
|
|
|
insn2 |= value & 0x0003FFFF; /* bottom 18 bits */
|
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
bfd_putb32 ((bfd_vma) insn2, (unsigned char *) where + 4);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
case BFD_RELOC_D30V_32_PCREL:
|
|
|
|
insn2 = bfd_getb32 ((unsigned char *) where + 4);
|
1997-12-17 12:43:15 +00:00
|
|
|
insn |= (value >> 26) & 0x3F; /* top 6 bits */
|
|
|
|
insn2 |= ((value & 0x03FC0000) << 2); /* next 8 bits */
|
1997-02-19 02:47:03 +00:00
|
|
|
insn2 |= value & 0x0003FFFF; /* bottom 18 bits */
|
|
|
|
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
bfd_putb32 ((bfd_vma) insn2, (unsigned char *) where + 4);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
case BFD_RELOC_32:
|
|
|
|
bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
|
|
|
|
break;
|
1997-12-17 12:43:15 +00:00
|
|
|
|
1997-02-19 02:47:03 +00:00
|
|
|
default:
|
* Many files: Added gettext invocations around user-visible
strings.
* acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
HAVE_LC_MESSAGES): Define.
* dep-in.sed: Added asintl.h.
* po/Make-in: New file.
* gasp.c (main): Call setlocale, bindtextdomain, and textdomain.
Include "asintl.h".
* read.c (Z_): Renamed from `_'.
* Makefile.am (SUBDIRS): Added po.
(POTFILES): new macro.
(po/POTFILES.in): New target.
($(OBJS)): Added asintl.h.
(HFILES): Likewise.
(INCLUDES): Added -DLOCALEDIR, -I$(top_srcdir)/../intl.
(as_new_LDADD): Added $(INTLLIBS).
(as_new_DEPENDENCIES): Added $(INTLDEPS).
(gasp_new_LDADD): Added $(INTLLIBS).
(gasp_new_DEPENDENCIES): New macro.
* configure, aclocal.m4: Rebuilt.
* configure.in: Call CY_GNU_GETTEXT. Generate po/Makefile.in and
po/Makefile.
(ALL_LINGUAS): Define.
* macro.c: Include "asintl.h".
* as.c (main): Call setlocale, bindtextdomain, and textdomain.
* as.h: Include "asintl.h".
* config/tc-i386.c (ordinal_names): Removed.
(md_assemble): Changed error text to avoid ordinal_names.
(i386_operand): Likewise.
(reloc): Added as_bad to avoid i18n problems.
(tc_gen_reloc): Likewise.
* config/tc-arm.c (bad_args): Now a #define.
(bad_pc): Likewise.
* config/obj-vms.c (VMS_stab_parse): Changed type of
`long_const_msg'.
(global_symbol_directory): Unified strings to avoid i18n
problems.
* config/tc-m68k.c (get_reloc_code): Added some as_bad calls to
avoid i18n problems.
* config/tc-ns32k.c (reloc): Added as_bad to avoid i18n problems.
* config/tc-ppc.c (md_apply_fix3): Added as_bad_where to avoid
i18n problems.
* config/tc-sh.c (md_convert_frag): Added as_bad to avoid i18n
problems.
start-sanitize-v850
* config/tc-v850.c (md_assemble): Changed C++ comment into C
comment.
end-sanitize-v850
* config/tc-vax.c (md_assemble): Added as_warn to avoid i18n
problems.
* as.c (print_version_id): Added an fprintf to avoid i18n
problems.
* cond.c (cond_finish_check): Added as_bad call to avoid i18n
problems.
* expr.c (expr): Added as_warn call to avoid i18n problems.
* messages.c (as_assert): Changed code to avoid i18n problems.
(as_abort): Likewise.
* read.c (pseudo_set): Added as_bad call to avoid i18n problems.
(s_space): Likewise.
* po/Make-in, po/POTFILES.in, po/gas.pot: New files.
1998-04-22 06:10:03 +00:00
|
|
|
as_fatal (_("line %d: unknown relocation type: 0x%x"),fixp->fx_line,fixp->fx_r_type);
|
1997-02-19 02:47:03 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* d30v_cleanup() is called after the assembler has finished parsing the input
|
|
|
|
file or after a label is defined. Because the D30V assembler sometimes saves short
|
|
|
|
instructions to see if it can package them with the next instruction, there may
|
|
|
|
be a short instruction that still needs written. */
|
|
|
|
int
|
|
|
|
d30v_cleanup ()
|
|
|
|
{
|
|
|
|
segT seg;
|
|
|
|
subsegT subseg;
|
|
|
|
|
|
|
|
if (prev_insn != -1)
|
|
|
|
{
|
|
|
|
seg = now_seg;
|
|
|
|
subseg = now_subseg;
|
|
|
|
subseg_set (prev_seg, prev_subseg);
|
|
|
|
write_1_short (&prev_opcode, (long)prev_insn, fixups->next);
|
|
|
|
subseg_set (seg, subseg);
|
|
|
|
prev_insn = -1;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
d30v_number_to_chars (buf, value, n)
|
|
|
|
char *buf; /* Return 'nbytes' of chars here. */
|
|
|
|
long long value; /* The value of the bits. */
|
|
|
|
int n; /* Number of bytes in the output. */
|
|
|
|
{
|
|
|
|
while (n--)
|
|
|
|
{
|
|
|
|
buf[n] = value & 0xff;
|
|
|
|
value >>= 8;
|
|
|
|
}
|
|
|
|
}
|
1997-12-16 13:25:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* This function is called at the start of every line. */
|
|
|
|
/* it checks to see if the first character is a '.' */
|
|
|
|
/* which indicates the start of a pseudo-op. If it is, */
|
|
|
|
/* then write out any unwritten instructions */
|
|
|
|
|
|
|
|
void
|
1998-06-09 01:33:23 +00:00
|
|
|
d30v_start_line ()
|
1997-12-16 13:25:59 +00:00
|
|
|
{
|
|
|
|
char *c = input_line_pointer;
|
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
while (isspace (*c))
|
1997-12-16 13:25:59 +00:00
|
|
|
c++;
|
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
if (*c == '.')
|
|
|
|
d30v_cleanup ();
|
1997-12-16 13:25:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
check_size (value, bits, file, line)
|
|
|
|
long value;
|
|
|
|
int bits;
|
|
|
|
char *file;
|
|
|
|
int line;
|
|
|
|
{
|
|
|
|
int tmp, max;
|
|
|
|
|
|
|
|
if (value < 0)
|
|
|
|
tmp = ~value;
|
|
|
|
else
|
|
|
|
tmp = value;
|
|
|
|
|
|
|
|
max = (1 << (bits - 1)) - 1;
|
|
|
|
|
|
|
|
if (tmp > max)
|
1998-05-12 19:04:29 +00:00
|
|
|
as_bad_where (file, line, _("value too large to fit in %d bits"), bits);
|
1997-12-16 13:25:59 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
1998-05-12 19:04:29 +00:00
|
|
|
|
|
|
|
/* d30v_frob_label() is called when after a label is recognized. */
|
|
|
|
|
|
|
|
void
|
|
|
|
d30v_frob_label (lab)
|
|
|
|
symbolS *lab;
|
|
|
|
{
|
|
|
|
/* Emit any pending instructions. */
|
1998-06-09 01:33:23 +00:00
|
|
|
d30v_cleanup ();
|
1998-05-12 19:04:29 +00:00
|
|
|
|
|
|
|
/* Update the label's address with the current output pointer. */
|
|
|
|
lab->sy_frag = frag_now;
|
|
|
|
S_SET_VALUE (lab, (valueT) frag_now_fix ());
|
|
|
|
|
|
|
|
/* Record this label for future adjustment after we find out what
|
|
|
|
kind of data it references, and the required alignment therewith. */
|
|
|
|
d30v_last_label = lab;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Hook into cons for capturing alignment changes. */
|
|
|
|
|
|
|
|
void
|
|
|
|
d30v_cons_align (size)
|
|
|
|
int size;
|
|
|
|
{
|
|
|
|
int log_size;
|
|
|
|
|
|
|
|
log_size = 0;
|
|
|
|
while ((size >>= 1) != 0)
|
|
|
|
++log_size;
|
|
|
|
|
|
|
|
if (d30v_current_align < log_size)
|
|
|
|
d30v_align (log_size, (char *) NULL, NULL);
|
|
|
|
else if (d30v_current_align > log_size)
|
|
|
|
d30v_current_align = log_size;
|
|
|
|
d30v_last_label = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called internally to handle all alignment needs. This takes care
|
|
|
|
of eliding calls to frag_align if'n the cached current alignment
|
|
|
|
says we've already got it, as well as taking care of the auto-aligning
|
|
|
|
labels wrt code. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
d30v_align (n, pfill, label)
|
|
|
|
int n;
|
|
|
|
char *pfill;
|
|
|
|
symbolS *label;
|
|
|
|
{
|
|
|
|
/* The front end is prone to changing segments out from under us
|
|
|
|
temporarily when -g is in effect. */
|
|
|
|
int switched_seg_p = (d30v_current_align_seg != now_seg);
|
|
|
|
|
1998-07-30 19:41:18 +00:00
|
|
|
/* Do not assume that if 'd30v_current_align >= n' and
|
|
|
|
'! switched_seg_p' that it is safe to avoid performing
|
|
|
|
this alignement request. The alignment of the current frag
|
|
|
|
can be changed under our feet, for example by a .ascii
|
|
|
|
directive in the source code. cf testsuite/gas/d30v/reloc.s */
|
1998-05-12 19:04:29 +00:00
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
d30v_cleanup ();
|
1998-05-12 19:04:29 +00:00
|
|
|
|
|
|
|
if (pfill == NULL)
|
|
|
|
{
|
|
|
|
if (n > 2
|
|
|
|
&& (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
|
|
|
|
{
|
|
|
|
static char const nop[4] = { 0x00, 0xf0, 0x00, 0x00 };
|
|
|
|
|
|
|
|
/* First, make sure we're on a four-byte boundary, in case
|
|
|
|
someone has been putting .byte values the text section. */
|
|
|
|
if (d30v_current_align < 2 || switched_seg_p)
|
|
|
|
frag_align (2, 0, 0);
|
|
|
|
frag_align_pattern (n, nop, sizeof nop, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
frag_align (n, 0, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
frag_align (n, *pfill, 0);
|
|
|
|
|
|
|
|
if (!switched_seg_p)
|
|
|
|
d30v_current_align = n;
|
|
|
|
|
|
|
|
if (label != NULL)
|
|
|
|
{
|
1998-06-05 17:51:58 +00:00
|
|
|
symbolS * sym;
|
|
|
|
int label_seen = false;
|
|
|
|
struct frag * old_frag;
|
|
|
|
valueT old_value;
|
|
|
|
valueT new_value;
|
|
|
|
|
1998-05-12 19:04:29 +00:00
|
|
|
assert (S_GET_SEGMENT (label) == now_seg);
|
1998-06-05 17:51:58 +00:00
|
|
|
|
|
|
|
old_frag = label->sy_frag;
|
|
|
|
old_value = S_GET_VALUE (label);
|
1998-06-09 01:33:23 +00:00
|
|
|
new_value = (valueT) frag_now_fix ();
|
1998-06-05 17:51:58 +00:00
|
|
|
|
|
|
|
/* It is possible to have more than one label at a particular
|
|
|
|
address, especially if debugging is enabled, so we must
|
|
|
|
take care to adjust all the labels at this address in this
|
|
|
|
fragment. To save time we search from the end of the symbol
|
|
|
|
list, backwards, since the symbols we are interested in are
|
|
|
|
almost certainly the ones that were most recently added.
|
|
|
|
Also to save time we stop searching once we have seen at least
|
|
|
|
one matching label, and we encounter a label that is no longer
|
|
|
|
in the target fragment. Note, this search is guaranteed to
|
|
|
|
find at least one match when sym == label, so no special case
|
|
|
|
code is necessary. */
|
|
|
|
for (sym = symbol_lastP; sym != NULL; sym = sym->sy_previous)
|
|
|
|
{
|
|
|
|
if (sym->sy_frag == old_frag && S_GET_VALUE (sym) == old_value)
|
|
|
|
{
|
|
|
|
label_seen = true;
|
|
|
|
sym->sy_frag = frag_now;
|
|
|
|
S_SET_VALUE (sym, new_value);
|
|
|
|
}
|
|
|
|
else if (label_seen && sym->sy_frag != old_frag)
|
|
|
|
break;
|
|
|
|
}
|
1998-05-12 19:04:29 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 01:33:23 +00:00
|
|
|
record_alignment (now_seg, n);
|
1998-05-12 19:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .align pseudo-op. This aligns to a power of two. We
|
|
|
|
hook here to latch the current alignment. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_d30v_align (ignore)
|
|
|
|
int ignore;
|
|
|
|
{
|
|
|
|
int align;
|
|
|
|
char fill, *pfill = NULL;
|
|
|
|
long max_alignment = 15;
|
|
|
|
|
|
|
|
align = get_absolute_expression ();
|
|
|
|
if (align > max_alignment)
|
|
|
|
{
|
|
|
|
align = max_alignment;
|
|
|
|
as_warn (_("Alignment too large: %d assumed"), align);
|
|
|
|
}
|
|
|
|
else if (align < 0)
|
|
|
|
{
|
|
|
|
as_warn (_("Alignment negative: 0 assumed"));
|
|
|
|
align = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
{
|
|
|
|
input_line_pointer++;
|
|
|
|
fill = get_absolute_expression ();
|
|
|
|
pfill = &fill;
|
|
|
|
}
|
|
|
|
|
|
|
|
d30v_last_label = NULL;
|
|
|
|
d30v_align (align, pfill, NULL);
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .text pseudo-op. This is like the usual one, but it
|
|
|
|
clears the saved last label and resets known alignment. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_d30v_text (i)
|
|
|
|
int i;
|
|
|
|
|
|
|
|
{
|
|
|
|
s_text (i);
|
|
|
|
d30v_last_label = NULL;
|
|
|
|
d30v_current_align = 0;
|
|
|
|
d30v_current_align_seg = now_seg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .data pseudo-op. This is like the usual one, but it
|
|
|
|
clears the saved last label and resets known alignment. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_d30v_data (i)
|
|
|
|
int i;
|
|
|
|
{
|
|
|
|
s_data (i);
|
|
|
|
d30v_last_label = NULL;
|
|
|
|
d30v_current_align = 0;
|
|
|
|
d30v_current_align_seg = now_seg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .section pseudo-op. This is like the usual one, but it
|
|
|
|
clears the saved last label and resets known alignment. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_d30v_section (ignore)
|
|
|
|
int ignore;
|
|
|
|
{
|
|
|
|
obj_elf_section (ignore);
|
|
|
|
d30v_last_label = NULL;
|
|
|
|
d30v_current_align = 0;
|
|
|
|
d30v_current_align_seg = now_seg;
|
|
|
|
}
|