1998-01-28 10:15:09 +00:00
|
|
|
|
/* tc-dvp.c -- Assembler for the DVP
|
1998-01-27 00:32:01 +00:00
|
|
|
|
Copyright (C) 1997, 1998 Free Software Foundation.
|
1997-12-22 17:55:19 +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>
|
1998-02-19 10:24:15 +00:00
|
|
|
|
|
1997-12-22 17:55:19 +00:00
|
|
|
|
#include "as.h"
|
1998-01-05 14:56:04 +00:00
|
|
|
|
#include "subsegs.h"
|
1998-01-28 10:15:09 +00:00
|
|
|
|
/* Needed by opcode/dvp.h. */
|
1998-01-05 14:56:04 +00:00
|
|
|
|
#include "dis-asm.h"
|
1998-01-28 10:15:09 +00:00
|
|
|
|
#include "opcode/dvp.h"
|
1998-01-28 14:05:49 +00:00
|
|
|
|
#include "elf/mips.h"
|
1998-01-27 22:17:11 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
#ifdef USE_STDARG
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <varargs.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Value of VIF `nop' instruction. */
|
|
|
|
|
#define VIFNOP 0
|
|
|
|
|
|
1998-03-07 03:22:18 +00:00
|
|
|
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Compute DMA operand index number of OP. */
|
|
|
|
|
#define DMA_OPERAND_INDEX(op) ((op) - dma_operands)
|
1998-02-18 23:56:15 +00:00
|
|
|
|
|
1998-02-19 22:51:08 +00:00
|
|
|
|
/* Our local label prefix. */
|
|
|
|
|
#define LOCAL_LABEL_PREFIX ".L"
|
|
|
|
|
/* Label prefix for end markers used in autocounts. */
|
|
|
|
|
#define END_LABEL_PREFIX ".L.end."
|
1998-02-24 22:08:40 +00:00
|
|
|
|
/* Label to use for unique labels. */
|
|
|
|
|
#define UNIQUE_LABEL_PREFIX ".L.dvptmp."
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* Prefix for mips version of labels defined in vu code.
|
|
|
|
|
Note that symbols that begin with '$' are local symbols
|
|
|
|
|
on mips targets, so we can't begin it with '$'. */
|
1998-05-11 19:49:29 +00:00
|
|
|
|
#define VU_LABEL_PREFIX "_$"
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* Prefix for symbols at start of vu overlays, in r5900 space. */
|
|
|
|
|
#define VUOVERLAY_START_PREFIX "__start_"
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
static long parse_float PARAMS ((char **, const char **));
|
1998-02-21 06:28:18 +00:00
|
|
|
|
static symbolS * create_label PARAMS ((const char *, const char *));
|
1998-02-24 20:40:41 +00:00
|
|
|
|
static symbolS * create_colon_label PARAMS ((int, const char *, const char *));
|
1998-02-21 06:28:18 +00:00
|
|
|
|
static char * unique_name PARAMS ((const char *));
|
1998-05-29 01:08:08 +00:00
|
|
|
|
static char * vuoverlay_section_name PARAMS ((symbolS *));
|
|
|
|
|
static void create_vuoverlay_section PARAMS ((const char *, symbolS *,
|
1998-05-28 23:29:19 +00:00
|
|
|
|
symbolS *, symbolS *));
|
1998-04-10 01:37:00 +00:00
|
|
|
|
static symbolS * compute_mpgloc PARAMS ((symbolS *, symbolS *, symbolS *));
|
1998-03-16 18:22:18 +00:00
|
|
|
|
static int compute_nloop PARAMS ((gif_type, int, int));
|
|
|
|
|
static void check_nloop PARAMS ((gif_type, int, int, int,
|
|
|
|
|
char *, unsigned int));
|
1998-04-10 01:37:00 +00:00
|
|
|
|
static long eval_expr PARAMS ((dvp_cpu, int, int, const char *, ...));
|
1998-02-19 10:24:15 +00:00
|
|
|
|
static long parse_dma_addr_autocount ();
|
1998-02-21 02:12:15 +00:00
|
|
|
|
static void inline_dma_data PARAMS ((int, DVP_INSN *));
|
1998-02-24 00:00:18 +00:00
|
|
|
|
static void setup_dma_autocount PARAMS ((const char *, DVP_INSN *, int));
|
1998-01-29 13:22:46 +00:00
|
|
|
|
|
1998-01-28 19:35:31 +00:00
|
|
|
|
static void insert_operand
|
|
|
|
|
PARAMS ((dvp_cpu, const dvp_opcode *, const dvp_operand *, int,
|
|
|
|
|
DVP_INSN *, offsetT, const char **));
|
|
|
|
|
static void insert_operand_final
|
|
|
|
|
PARAMS ((dvp_cpu, const dvp_operand *, int,
|
|
|
|
|
DVP_INSN *, offsetT, char *, unsigned int));
|
1998-01-21 00:30:46 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
static void insert_mpg_marker PARAMS ((unsigned long));
|
|
|
|
|
static void insert_unpack_marker PARAMS ((unsigned long));
|
|
|
|
|
static int insert_file PARAMS ((const char *,
|
|
|
|
|
void (*) PARAMS ((unsigned long)),
|
|
|
|
|
unsigned long, int));
|
1998-01-29 12:37:45 +00:00
|
|
|
|
|
1998-04-16 22:07:02 +00:00
|
|
|
|
static int vif_insn_type PARAMS ((char));
|
|
|
|
|
static int vif_length_value PARAMS ((char, int, int, int));
|
1998-02-11 23:40:43 +00:00
|
|
|
|
static void install_vif_length PARAMS ((char *, int));
|
1998-01-29 12:37:45 +00:00
|
|
|
|
|
1997-12-22 17:55:19 +00:00
|
|
|
|
const char comment_chars[] = ";";
|
|
|
|
|
const char line_comment_chars[] = "#";
|
|
|
|
|
const char line_separator_chars[] = "!";
|
|
|
|
|
const char EXP_CHARS[] = "eE";
|
|
|
|
|
const char FLT_CHARS[] = "dD";
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
1998-01-29 12:37:45 +00:00
|
|
|
|
/* Current assembler state.
|
|
|
|
|
Instructions like mpg and direct are followed by a restricted set of
|
1998-01-30 12:01:27 +00:00
|
|
|
|
instructions. In the case of a '*' length argument an end marker must
|
|
|
|
|
be provided. (e.g. mpg is followed by vu insns until a .EndMpg is
|
1998-02-21 03:26:47 +00:00
|
|
|
|
seen).
|
|
|
|
|
|
|
|
|
|
Allowed state transitions:
|
1998-04-10 18:34:49 +00:00
|
|
|
|
ASM_INIT <--> ASM_MPG
|
|
|
|
|
ASM_DIRECT <--> ASM_GIF
|
|
|
|
|
ASM_UNPACK
|
|
|
|
|
ASM_VU
|
|
|
|
|
|
|
|
|
|
FIXME: Make the ASM_INIT -> ASM_VU a one way transition.
|
|
|
|
|
".vu" must be seen at the top of the file,
|
|
|
|
|
and cannot be switched out of.
|
1998-02-21 03:26:47 +00:00
|
|
|
|
*/
|
|
|
|
|
|
1998-01-29 17:06:52 +00:00
|
|
|
|
typedef enum {
|
1998-02-21 03:26:47 +00:00
|
|
|
|
ASM_INIT, ASM_DIRECT, ASM_MPG, ASM_UNPACK, ASM_VU, ASM_GIF
|
1998-01-29 17:06:52 +00:00
|
|
|
|
} asm_state;
|
1998-02-21 03:26:47 +00:00
|
|
|
|
|
|
|
|
|
/* We need to maintain a stack of the current and previous status to handle
|
|
|
|
|
such things as "direct ...; gifpacked ... ; .endgif ; .enddirect". */
|
|
|
|
|
#define MAX_STATE_DEPTH 2
|
|
|
|
|
static asm_state asm_state_stack[MAX_STATE_DEPTH];
|
|
|
|
|
/* Current state's index in the stack. */
|
|
|
|
|
static int cur_state_index;
|
|
|
|
|
/* Macro to fetch the current state. */
|
|
|
|
|
#define CUR_ASM_STATE (asm_state_stack[cur_state_index])
|
|
|
|
|
|
|
|
|
|
/* Functions to push/pop the state stack. */
|
|
|
|
|
static void push_asm_state PARAMS ((asm_state));
|
|
|
|
|
static void pop_asm_state PARAMS ((int));
|
|
|
|
|
static void set_asm_state PARAMS ((asm_state));
|
1998-04-10 01:37:00 +00:00
|
|
|
|
|
|
|
|
|
/* Set to non-zero if any non-vu insn seen.
|
|
|
|
|
Used to control type of relocations emitted. */
|
|
|
|
|
static int non_vu_insn_seen_p = 0;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
/* Current cpu (machine variant) type state.
|
1998-02-21 06:28:18 +00:00
|
|
|
|
We copy the mips16 way of recording what the current machine type is in
|
|
|
|
|
the code. A label is created whenever necessary and has an "other" value
|
|
|
|
|
the denotes the machine type. */
|
1998-02-24 20:40:41 +00:00
|
|
|
|
static dvp_cpu cur_cpu;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
/* Record the current mach type. */
|
1998-02-24 20:40:41 +00:00
|
|
|
|
static void record_mach PARAMS ((dvp_cpu, int));
|
1998-03-17 22:10:10 +00:00
|
|
|
|
/* Force emission of mach type label at next insn.
|
|
|
|
|
This isn't static as TC_START_LABEL uses it. */
|
|
|
|
|
int force_mach_label PARAMS ((void));
|
1998-02-24 20:40:41 +00:00
|
|
|
|
/* Given a dvp_cpu value, return the STO_DVP value to use. */
|
|
|
|
|
static int cpu_sto PARAMS ((dvp_cpu, const char **));
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
1998-02-19 22:51:08 +00:00
|
|
|
|
/* Nonzero if inside .DmaData. */
|
1998-02-21 02:12:15 +00:00
|
|
|
|
static int dma_data_state = 0;
|
1998-02-19 22:51:08 +00:00
|
|
|
|
/* Label of .DmaData (internally generated for inline data). */
|
1998-02-21 02:12:15 +00:00
|
|
|
|
static const char *dma_data_name;
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Variable length VIF insn support. */
|
|
|
|
|
/* Label at start of insn's data. */
|
|
|
|
|
static symbolS *vif_data_start;
|
|
|
|
|
/* Label at end of insn's data. */
|
|
|
|
|
static symbolS *vif_data_end;
|
|
|
|
|
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* Special symbol $.mpgloc. The value is in bytes.
|
|
|
|
|
This value is kept absolute, for simplicity. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
static symbolS *mpgloc_sym;
|
|
|
|
|
|
1998-05-31 22:46:56 +00:00
|
|
|
|
/* Handle of the current vu overlay section. */
|
1998-05-28 23:29:19 +00:00
|
|
|
|
static segT vuoverlay_section;
|
|
|
|
|
|
1998-05-31 22:46:56 +00:00
|
|
|
|
/* The overlay table section is a table mapping lma's to vma's. */
|
1998-05-28 23:29:19 +00:00
|
|
|
|
static segT vuoverlay_table_section;
|
1998-05-31 22:46:56 +00:00
|
|
|
|
/* String table to record section names in the overlay table. */
|
|
|
|
|
static segT vuoverlay_string_section;
|
1998-05-28 23:29:19 +00:00
|
|
|
|
|
|
|
|
|
/* Table to map vu space labels to their overlay sections.
|
|
|
|
|
Labels in vu space are first put in the ABS section to simplify
|
|
|
|
|
PC relative branch calculations (s1 - s2 isn't supported if they're
|
|
|
|
|
in different sections). Before the file is written out the labels
|
|
|
|
|
are moved to their overlay section. */
|
|
|
|
|
typedef struct ovlysym {
|
|
|
|
|
struct ovlysym *next;
|
|
|
|
|
segT sec;
|
|
|
|
|
symbolS *sym;
|
|
|
|
|
} ovlysymS;
|
|
|
|
|
static ovlysymS *ovlysym_table;
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* GIF insn support. */
|
|
|
|
|
/* Type of insn. */
|
|
|
|
|
static int gif_insn_type;
|
|
|
|
|
/* Name of label of insn's data. */
|
1998-02-21 02:12:15 +00:00
|
|
|
|
static const char *gif_data_name;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Pointer to frag of insn. */
|
1998-03-16 18:22:18 +00:00
|
|
|
|
static fragS *gif_insn_frag;
|
|
|
|
|
/* Pointer to current gif insn in gif_insn_frag. */
|
|
|
|
|
static char *gif_insn_frag_loc;
|
1998-01-30 12:01:27 +00:00
|
|
|
|
/* The length value specified in the insn, or -1 if '*'. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
static int gif_user_value;
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
1998-02-21 07:44:25 +00:00
|
|
|
|
/* Count of vu insns seen since the last mpg.
|
|
|
|
|
Set to -1 to disable automatic mpg insertion. */
|
|
|
|
|
static int vu_count;
|
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
/* Non-zero if packing vif instructions in dma tags. */
|
|
|
|
|
static int dma_pack_vif_p;
|
1998-01-30 12:01:27 +00:00
|
|
|
|
|
|
|
|
|
/* Non-zero if dma insns are to be included in the output.
|
|
|
|
|
This is the default, but writing "if (! no_dma)" is klunky. */
|
1998-01-30 12:10:00 +00:00
|
|
|
|
static int output_dma = 1;
|
1998-02-11 23:40:43 +00:00
|
|
|
|
/* Non-zero if vif insns are to be included in the output. */
|
|
|
|
|
static int output_vif = 1;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
|
|
|
|
/* Current opcode/operand for use by md_operand. */
|
|
|
|
|
static const dvp_opcode *cur_opcode;
|
|
|
|
|
static const dvp_operand *cur_operand;
|
|
|
|
|
|
|
|
|
|
/* Options for the `caller' argument to s_endmpg. */
|
|
|
|
|
typedef enum { ENDMPG_USER, ENDMPG_INTERNAL, ENDMPG_MIDDLE } endmpg_caller;
|
1998-04-10 01:37:00 +00:00
|
|
|
|
|
|
|
|
|
/* Relaxation support. */
|
|
|
|
|
#define RELAX_MPG 1
|
|
|
|
|
#define RELAX_DIRECT 2
|
|
|
|
|
/* vu insns aren't relaxed, but they use machine dependent frags so we
|
|
|
|
|
must handle them during relaxation */
|
|
|
|
|
#define RELAX_VU 3
|
|
|
|
|
#define RELAX_ENCODE(type, growth) (10 + (growth))
|
|
|
|
|
#define RELAX_GROWTH(state) ((state) - 10)
|
|
|
|
|
/* Return non-zero if STATE represents a relaxed state. */
|
|
|
|
|
#define RELAX_DONE_P(state) ((state) >= 10)
|
1997-12-22 17:55:19 +00:00
|
|
|
|
|
|
|
|
|
const char *md_shortopts = "";
|
|
|
|
|
|
|
|
|
|
struct option md_longopts[] =
|
|
|
|
|
{
|
1998-01-30 12:01:27 +00:00
|
|
|
|
#define OPTION_NO_DMA (OPTION_MD_BASE + 1)
|
|
|
|
|
{ "no-dma", no_argument, NULL, OPTION_NO_DMA },
|
1998-02-11 23:40:43 +00:00
|
|
|
|
#define OPTION_NO_DMA_VIF (OPTION_NO_DMA + 1)
|
|
|
|
|
{ "no-dma-vif", no_argument, NULL, OPTION_NO_DMA_VIF },
|
1997-12-22 17:55:19 +00:00
|
|
|
|
|
|
|
|
|
{NULL, no_argument, NULL, 0}
|
|
|
|
|
};
|
1998-01-30 12:01:27 +00:00
|
|
|
|
size_t md_longopts_size = sizeof(md_longopts);
|
1997-12-22 17:55:19 +00:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
md_parse_option (c, arg)
|
|
|
|
|
int c;
|
|
|
|
|
char *arg;
|
|
|
|
|
{
|
1998-01-30 12:01:27 +00:00
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case OPTION_NO_DMA :
|
|
|
|
|
output_dma = 0;
|
|
|
|
|
break;
|
1998-02-11 23:40:43 +00:00
|
|
|
|
case OPTION_NO_DMA_VIF :
|
1998-01-30 12:01:27 +00:00
|
|
|
|
output_dma = 0;
|
1998-02-11 23:40:43 +00:00
|
|
|
|
output_vif = 0;
|
1998-01-30 12:01:27 +00:00
|
|
|
|
break;
|
|
|
|
|
default :
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
md_show_usage (stream)
|
|
|
|
|
FILE *stream;
|
|
|
|
|
{
|
1998-01-30 12:01:27 +00:00
|
|
|
|
fprintf (stream, "\
|
|
|
|
|
DVP options:\n\
|
|
|
|
|
-no-dma do not include DMA instructions in the output\n\
|
1998-02-11 23:40:43 +00:00
|
|
|
|
-no-dma-vif do not include DMA or VIF instructions in the output\n\
|
1998-01-30 12:01:27 +00:00
|
|
|
|
");
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-01-26 06:24:59 +00:00
|
|
|
|
static void s_dmadata PARAMS ((int));
|
1998-01-31 00:04:26 +00:00
|
|
|
|
static void s_enddmadata PARAMS ((int));
|
1998-02-11 23:40:43 +00:00
|
|
|
|
static void s_dmapackvif PARAMS ((int));
|
1998-01-26 06:24:59 +00:00
|
|
|
|
static void s_enddirect PARAMS ((int));
|
|
|
|
|
static void s_endmpg PARAMS ((int));
|
|
|
|
|
static void s_endunpack PARAMS ((int));
|
1998-02-21 03:26:47 +00:00
|
|
|
|
static void s_endgif PARAMS ((int));
|
1998-01-29 12:37:45 +00:00
|
|
|
|
static void s_state PARAMS ((int));
|
1998-06-02 16:54:20 +00:00
|
|
|
|
static void s_dvp_func PARAMS ((int));
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
1997-12-22 17:55:19 +00:00
|
|
|
|
/* The target specific pseudo-ops which we support. */
|
|
|
|
|
const pseudo_typeS md_pseudo_table[] =
|
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
{ "word", cons, 4 },
|
1998-03-16 18:22:18 +00:00
|
|
|
|
{ "quad", cons, 16 },
|
1998-02-19 10:24:15 +00:00
|
|
|
|
{ "dmadata", s_dmadata, 0 },
|
|
|
|
|
{ "dmapackvif", s_dmapackvif, 0 },
|
|
|
|
|
{ "enddirect", s_enddirect, 0 },
|
|
|
|
|
{ "enddmadata", s_enddmadata, 0 },
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
{ "endmpg", s_endmpg, ENDMPG_USER },
|
1998-02-19 10:24:15 +00:00
|
|
|
|
{ "endunpack", s_endunpack, 0 },
|
1998-02-21 03:26:47 +00:00
|
|
|
|
{ "endgif", s_endgif, 0 },
|
1998-02-19 10:24:15 +00:00
|
|
|
|
{ "vu", s_state, ASM_VU },
|
1998-06-02 16:54:20 +00:00
|
|
|
|
/* We need to intercept .func/.endfunc so that we can prepend _$.
|
|
|
|
|
??? Not sure this is right though as _$foo is the lma version. */
|
|
|
|
|
{ "func", s_dvp_func, 0 },
|
|
|
|
|
{ "endfunc", s_dvp_func, 1 },
|
1998-02-19 10:24:15 +00:00
|
|
|
|
{ NULL, NULL, 0 }
|
1997-12-22 17:55:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
md_begin ()
|
|
|
|
|
{
|
1998-01-05 14:56:04 +00:00
|
|
|
|
/* Initialize the opcode tables.
|
|
|
|
|
This involves computing the hash chains. */
|
1998-01-28 10:15:09 +00:00
|
|
|
|
dvp_opcode_init_tables (0);
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
1998-03-17 22:10:10 +00:00
|
|
|
|
/* Force a mach type label for the first insn. */
|
|
|
|
|
force_mach_label ();
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
|
|
|
|
/* Initialize the parsing state. */
|
1998-02-21 03:26:47 +00:00
|
|
|
|
cur_state_index = 0;
|
|
|
|
|
set_asm_state (ASM_INIT);
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
1998-03-17 18:51:57 +00:00
|
|
|
|
/* Pack vif insns in dma tags by default. */
|
|
|
|
|
dma_pack_vif_p = 1;
|
1998-02-21 07:44:25 +00:00
|
|
|
|
|
|
|
|
|
/* Disable automatic mpg insertion. */
|
|
|
|
|
vu_count = -1;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* Initialize $.mpgloc. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
mpgloc_sym = expr_build_uconstant (0);
|
1998-05-11 19:49:29 +00:00
|
|
|
|
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* Create the vu overlay table section. */
|
|
|
|
|
{
|
|
|
|
|
/* Must preserve the current seg/subseg. It is the initial one. */
|
|
|
|
|
segT orig_seg = now_seg;
|
|
|
|
|
subsegT orig_subseg = now_subseg;
|
1998-05-31 22:46:56 +00:00
|
|
|
|
|
|
|
|
|
vuoverlay_table_section = subseg_new (SHNAME_DVP_OVERLAY_TABLE, 0);
|
1998-06-03 17:27:56 +00:00
|
|
|
|
record_alignment (now_seg, 2);
|
1998-05-31 22:46:56 +00:00
|
|
|
|
vuoverlay_string_section = subseg_new (SHNAME_DVP_OVERLAY_STRTAB, 0);
|
|
|
|
|
/* Ensure first byte in executable is zero. So what if we waste
|
|
|
|
|
a few bytes. */
|
|
|
|
|
FRAG_APPEND_1_CHAR (0);
|
|
|
|
|
|
1998-05-28 23:29:19 +00:00
|
|
|
|
subseg_set (orig_seg, orig_subseg);
|
|
|
|
|
}
|
|
|
|
|
|
1998-05-11 19:49:29 +00:00
|
|
|
|
/* Set the type of the output file to r5900. */
|
|
|
|
|
bfd_set_arch_mach (stdoutput, bfd_arch_mips, 5900);
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
1998-01-27 00:32:01 +00:00
|
|
|
|
|
1998-01-05 14:56:04 +00:00
|
|
|
|
/* We need to keep a list of fixups. We can't simply generate them as
|
|
|
|
|
we go, because that would require us to first create the frag, and
|
|
|
|
|
that would screw up references to ``.''. */
|
|
|
|
|
|
1998-01-28 10:15:09 +00:00
|
|
|
|
struct dvp_fixup
|
1998-01-05 14:56:04 +00:00
|
|
|
|
{
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* the cpu this fixup is associated with */
|
|
|
|
|
dvp_cpu cpu;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
/* index into `dvp_operands' */
|
1998-01-05 14:56:04 +00:00
|
|
|
|
int opindex;
|
1998-01-29 12:37:45 +00:00
|
|
|
|
/* byte offset from beginning of instruction */
|
|
|
|
|
int offset;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* user specified value [when there is one] */
|
|
|
|
|
int user_value;
|
|
|
|
|
/* wl,cl values, only used with unpack insn */
|
|
|
|
|
short wl,cl;
|
|
|
|
|
/* the expression */
|
1998-01-05 14:56:04 +00:00
|
|
|
|
expressionS exp;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define MAX_FIXUPS 5
|
|
|
|
|
|
1998-01-27 00:32:01 +00:00
|
|
|
|
static int fixup_count;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
static struct dvp_fixup fixups[MAX_FIXUPS];
|
1998-01-27 00:32:01 +00:00
|
|
|
|
|
1998-01-27 22:17:11 +00:00
|
|
|
|
/* Given a cpu type and operand number, return a temporary reloc type
|
|
|
|
|
for use in generating the fixup that encodes the cpu type and operand. */
|
1998-01-28 14:05:49 +00:00
|
|
|
|
static int encode_fixup_reloc_type PARAMS ((dvp_cpu, int));
|
1998-01-27 22:17:11 +00:00
|
|
|
|
/* Given an encoded fixup reloc type, decode it into cpu and operand. */
|
1998-01-28 14:05:49 +00:00
|
|
|
|
static void decode_fixup_reloc_type PARAMS ((int, dvp_cpu *,
|
1998-01-28 10:15:09 +00:00
|
|
|
|
const dvp_operand **));
|
1998-01-27 22:17:11 +00:00
|
|
|
|
|
1998-01-26 06:24:59 +00:00
|
|
|
|
static void assemble_dma PARAMS ((char *));
|
1998-02-11 23:40:43 +00:00
|
|
|
|
static void assemble_gif PARAMS ((char *));
|
|
|
|
|
static void assemble_vif PARAMS ((char *));
|
1998-01-26 06:24:59 +00:00
|
|
|
|
static void assemble_vu PARAMS ((char *));
|
1998-01-28 14:05:49 +00:00
|
|
|
|
static const dvp_opcode * assemble_vu_insn PARAMS ((dvp_cpu,
|
|
|
|
|
const dvp_opcode *,
|
|
|
|
|
const dvp_operand *,
|
|
|
|
|
char **, char *));
|
|
|
|
|
static const dvp_opcode * assemble_one_insn PARAMS ((dvp_cpu,
|
|
|
|
|
const dvp_opcode *,
|
|
|
|
|
const dvp_operand *,
|
1998-04-10 01:37:00 +00:00
|
|
|
|
int, int,
|
1998-01-28 14:05:49 +00:00
|
|
|
|
char **, DVP_INSN *));
|
|
|
|
|
|
|
|
|
|
/* Main entry point for assembling an instruction. */
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
1997-12-22 17:55:19 +00:00
|
|
|
|
void
|
|
|
|
|
md_assemble (str)
|
|
|
|
|
char *str;
|
1998-01-26 06:24:59 +00:00
|
|
|
|
{
|
1998-01-27 00:32:01 +00:00
|
|
|
|
/* Skip leading white space. */
|
|
|
|
|
while (isspace (*str))
|
|
|
|
|
str++;
|
|
|
|
|
|
1998-02-21 02:12:15 +00:00
|
|
|
|
/* After a gif tag, no insns can appear until a .endgif is seen. */
|
1998-02-21 03:26:47 +00:00
|
|
|
|
if (CUR_ASM_STATE == ASM_GIF)
|
1998-02-21 02:12:15 +00:00
|
|
|
|
{
|
|
|
|
|
as_bad ("missing .endgif");
|
1998-02-21 03:26:47 +00:00
|
|
|
|
pop_asm_state (1);
|
|
|
|
|
}
|
|
|
|
|
/* Ditto for unpack. */
|
|
|
|
|
if (CUR_ASM_STATE == ASM_UNPACK)
|
|
|
|
|
{
|
|
|
|
|
as_bad ("missing .endunpack");
|
|
|
|
|
pop_asm_state (1);
|
|
|
|
|
}
|
|
|
|
|
#if 0 /* this doesn't work of course as gif insns may follow */
|
|
|
|
|
/* Ditto for direct. */
|
|
|
|
|
if (CUR_ASM_STATE == ASM_DIRECT)
|
|
|
|
|
{
|
|
|
|
|
as_bad ("missing .enddirect");
|
|
|
|
|
pop_asm_state (1);
|
1998-02-21 02:12:15 +00:00
|
|
|
|
}
|
1998-02-21 03:26:47 +00:00
|
|
|
|
#endif
|
1998-02-21 02:12:15 +00:00
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
if (CUR_ASM_STATE == ASM_INIT)
|
1998-01-26 06:24:59 +00:00
|
|
|
|
{
|
|
|
|
|
if (strncasecmp (str, "dma", 3) == 0)
|
|
|
|
|
assemble_dma (str);
|
1998-02-19 10:24:15 +00:00
|
|
|
|
else if (strncasecmp (str, "gif", 3) == 0)
|
1998-02-18 23:56:15 +00:00
|
|
|
|
assemble_gif (str);
|
1998-01-26 06:24:59 +00:00
|
|
|
|
else
|
1998-02-11 23:40:43 +00:00
|
|
|
|
assemble_vif (str);
|
1998-04-10 01:37:00 +00:00
|
|
|
|
non_vu_insn_seen_p = 1;
|
1998-01-26 06:24:59 +00:00
|
|
|
|
}
|
1998-02-21 03:26:47 +00:00
|
|
|
|
else if (CUR_ASM_STATE == ASM_DIRECT)
|
1998-04-10 01:37:00 +00:00
|
|
|
|
{
|
|
|
|
|
assemble_gif (str);
|
|
|
|
|
non_vu_insn_seen_p = 1;
|
|
|
|
|
}
|
1998-02-21 03:26:47 +00:00
|
|
|
|
else if (CUR_ASM_STATE == ASM_VU
|
|
|
|
|
|| CUR_ASM_STATE == ASM_MPG)
|
1998-01-26 06:24:59 +00:00
|
|
|
|
assemble_vu (str);
|
1998-01-29 12:37:45 +00:00
|
|
|
|
else
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: unknown parse state");
|
1998-01-26 06:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-01-27 00:32:01 +00:00
|
|
|
|
/* Subroutine of md_assemble to assemble DMA instructions. */
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
assemble_dma (str)
|
|
|
|
|
char *str;
|
|
|
|
|
{
|
1998-03-17 18:51:57 +00:00
|
|
|
|
DVP_INSN insn_buf[2];
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Insn's length, in 32 bit words. */
|
|
|
|
|
int len;
|
|
|
|
|
/* Pointer to allocated frag. */
|
|
|
|
|
char *f;
|
|
|
|
|
int i;
|
|
|
|
|
const dvp_opcode *opcode;
|
|
|
|
|
|
1998-02-24 00:00:18 +00:00
|
|
|
|
if (output_dma)
|
|
|
|
|
{
|
|
|
|
|
/* Do an implicit alignment to a 16 byte boundary.
|
|
|
|
|
Do it now so that inline dma data labels are at the right place. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* ??? One can certainly argue all this implicit alignment is
|
|
|
|
|
questionable. The thing is assembler programming is all that will
|
|
|
|
|
mostly likely ever be done and not doing so forces an extra [and
|
|
|
|
|
arguably unnecessary] burden on the programmer. */
|
1998-02-24 00:00:18 +00:00
|
|
|
|
frag_align (4, 0, 0);
|
|
|
|
|
record_alignment (now_seg, 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This is the DMA tag. */
|
1998-02-19 10:24:15 +00:00
|
|
|
|
insn_buf[0] = 0;
|
|
|
|
|
insn_buf[1] = 0;
|
|
|
|
|
|
|
|
|
|
opcode = assemble_one_insn (DVP_DMA,
|
|
|
|
|
dma_opcode_lookup_asm (str), dma_operands,
|
1998-04-10 01:37:00 +00:00
|
|
|
|
0, 0, &str, insn_buf);
|
1998-02-19 10:24:15 +00:00
|
|
|
|
if (opcode == NULL)
|
|
|
|
|
return;
|
|
|
|
|
if (!output_dma)
|
|
|
|
|
return;
|
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
record_mach (DVP_DMA, 0);
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
1998-03-17 18:51:57 +00:00
|
|
|
|
f = frag_more (8);
|
1998-02-19 10:24:15 +00:00
|
|
|
|
|
|
|
|
|
/* Write out the DMA instruction. */
|
1998-03-17 18:51:57 +00:00
|
|
|
|
for (i = 0; i < 2; ++i)
|
1998-02-19 10:24:15 +00:00
|
|
|
|
md_number_to_chars (f + i * 4, insn_buf[i], 4);
|
1998-01-27 00:32:01 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Create any fixups. */
|
|
|
|
|
/* FIXME: It might eventually be possible to combine all the various
|
|
|
|
|
copies of this bit of code. */
|
|
|
|
|
for (i = 0; i < fixup_count; ++i)
|
1998-01-31 00:04:26 +00:00
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
int op_type, reloc_type, offset;
|
|
|
|
|
const dvp_operand *operand;
|
1998-01-31 00:04:26 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Create a fixup for this operand.
|
|
|
|
|
At this point we do not use a bfd_reloc_code_real_type for
|
|
|
|
|
operands residing in the insn, but instead just use the
|
|
|
|
|
operand index. This lets us easily handle fixups for any
|
|
|
|
|
operand type, although that is admittedly not a very exciting
|
|
|
|
|
feature. We pick a BFD reloc type in md_apply_fix. */
|
|
|
|
|
|
|
|
|
|
op_type = fixups[i].opindex;
|
|
|
|
|
offset = fixups[i].offset;
|
|
|
|
|
reloc_type = encode_fixup_reloc_type (DVP_DMA, op_type);
|
|
|
|
|
operand = &dma_operands[op_type];
|
|
|
|
|
fix_new_exp (frag_now, f + offset - frag_now->fr_literal, 4,
|
|
|
|
|
&fixups[i].exp,
|
|
|
|
|
(operand->flags & DVP_OPERAND_RELATIVE_BRANCH) != 0,
|
|
|
|
|
(bfd_reloc_code_real_type) reloc_type);
|
1998-01-31 00:04:26 +00:00
|
|
|
|
}
|
1998-03-17 18:51:57 +00:00
|
|
|
|
|
|
|
|
|
/* The upper two words are vif insns. */
|
|
|
|
|
record_mach (DVP_VIF, 0);
|
|
|
|
|
|
|
|
|
|
/* If not doing dma/vif packing, fill out the insn with vif nops.
|
|
|
|
|
??? We take advantage of the fact that the default fill value of zero
|
|
|
|
|
is the vifnop insn. This occurs for example when handling mpg
|
|
|
|
|
alignment. It also occurs when one dma tag immediately follows the
|
|
|
|
|
previous one. */
|
|
|
|
|
if (! dma_pack_vif_p)
|
|
|
|
|
{
|
|
|
|
|
f = frag_more (8);
|
|
|
|
|
md_number_to_chars (f + 0, VIFNOP, 4);
|
|
|
|
|
md_number_to_chars (f + 4, VIFNOP, 4);
|
|
|
|
|
}
|
1998-01-26 06:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
/* Subroutine of md_assemble to assemble VIF instructions. */
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
|
|
|
|
static void
|
1998-02-11 23:40:43 +00:00
|
|
|
|
assemble_vif (str)
|
1998-01-26 06:24:59 +00:00
|
|
|
|
char *str;
|
|
|
|
|
{
|
1998-01-27 22:17:11 +00:00
|
|
|
|
/* Space for the instruction.
|
|
|
|
|
The variable length insns can require much more space than this.
|
|
|
|
|
It is allocated later, when we know we have such an insn. */
|
1998-01-28 10:15:09 +00:00
|
|
|
|
DVP_INSN insn_buf[5];
|
1998-01-27 22:17:11 +00:00
|
|
|
|
/* Insn's length, in 32 bit words. */
|
|
|
|
|
int len;
|
|
|
|
|
/* Pointer to allocated frag. */
|
|
|
|
|
char *f;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
int i,wl,cl;
|
1998-01-28 14:05:49 +00:00
|
|
|
|
const dvp_opcode *opcode;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
fragS * insn_frag;
|
|
|
|
|
/* Name of file to read data from. */
|
|
|
|
|
const char *file;
|
|
|
|
|
/* Length in 32 bit words. */
|
|
|
|
|
int data_len;
|
1998-04-07 00:12:27 +00:00
|
|
|
|
/* Macro expansion, if there is one. */
|
|
|
|
|
char * macstr;
|
|
|
|
|
|
|
|
|
|
/* First check for macros. */
|
|
|
|
|
macstr = dvp_expand_macro (vif_macros, vif_macro_count, str);
|
|
|
|
|
if (macstr)
|
|
|
|
|
{
|
|
|
|
|
/* The macro may expand into several insns (delimited with '\n'),
|
|
|
|
|
so loop. */
|
|
|
|
|
char * next = macstr;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
char *p = strchr (next, '\n');
|
|
|
|
|
if (p)
|
|
|
|
|
*p = 0;
|
|
|
|
|
assemble_vif (next);
|
|
|
|
|
next = p ? p + 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
while (next);
|
|
|
|
|
free (macstr);
|
|
|
|
|
return;
|
|
|
|
|
}
|
1998-01-27 22:17:11 +00:00
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
opcode = assemble_one_insn (DVP_VIF,
|
|
|
|
|
vif_opcode_lookup_asm (str), vif_operands,
|
1998-04-10 01:37:00 +00:00
|
|
|
|
0, 0, &str, insn_buf);
|
1998-01-28 14:05:49 +00:00
|
|
|
|
if (opcode == NULL)
|
1998-01-27 22:17:11 +00:00
|
|
|
|
return;
|
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
if (opcode->flags & VIF_OPCODE_LENVAR)
|
1998-01-29 12:37:45 +00:00
|
|
|
|
len = 1; /* actual data follows later */
|
1998-02-11 23:40:43 +00:00
|
|
|
|
else if (opcode->flags & VIF_OPCODE_LEN2)
|
1998-01-28 14:05:49 +00:00
|
|
|
|
len = 2;
|
1998-02-11 23:40:43 +00:00
|
|
|
|
else if (opcode->flags & VIF_OPCODE_LEN5)
|
1998-01-28 14:05:49 +00:00
|
|
|
|
len = 5;
|
1998-01-27 22:17:11 +00:00
|
|
|
|
else
|
1998-01-28 14:05:49 +00:00
|
|
|
|
len = 1;
|
|
|
|
|
|
1998-01-30 12:01:27 +00:00
|
|
|
|
/* We still have to switch modes (if mpg for example) so we can't exit
|
1998-02-11 23:40:43 +00:00
|
|
|
|
early if -no-vif. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
if (output_vif)
|
1998-01-27 22:17:11 +00:00
|
|
|
|
{
|
1998-02-21 07:44:25 +00:00
|
|
|
|
/* Record the mach before doing the alignment so that we properly
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
disassemble any inserted vifnop's. For mpg and direct insns
|
|
|
|
|
force the recording of the mach type for the next insn. The data
|
|
|
|
|
will switch the mach type and we want to ensure it's switched
|
|
|
|
|
back. */
|
1998-02-21 07:44:25 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
if (opcode->flags & (VIF_OPCODE_MPG | VIF_OPCODE_DIRECT))
|
1998-02-24 20:40:41 +00:00
|
|
|
|
record_mach (DVP_VIF, 1);
|
|
|
|
|
else
|
|
|
|
|
record_mach (DVP_VIF, 0);
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* For variable length instructions record a fixup that is the symbol
|
|
|
|
|
marking the end of the data. eval_expr will queue the fixup
|
|
|
|
|
which will then be emitted later. */
|
|
|
|
|
if (opcode->flags & VIF_OPCODE_LENVAR)
|
|
|
|
|
{
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
|
|
asprintf (&name, "%s%s", LOCAL_LABEL_PREFIX,
|
|
|
|
|
unique_name ("varlen"));
|
|
|
|
|
vif_data_end = symbol_new (name, now_seg, 0, 0);
|
|
|
|
|
symbol_table_insert (vif_data_end);
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fixups[fixup_count].cpu = DVP_VIF;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
fixups[fixup_count].exp.X_op = O_symbol;
|
|
|
|
|
fixups[fixup_count].exp.X_add_symbol = vif_data_end;
|
|
|
|
|
fixups[fixup_count].exp.X_add_number = 0;
|
|
|
|
|
fixups[fixup_count].opindex = vif_operand_datalen_special;
|
|
|
|
|
fixups[fixup_count].offset = 0;
|
|
|
|
|
|
|
|
|
|
/* See what the user specified. */
|
|
|
|
|
vif_get_var_data (&file, &data_len);
|
|
|
|
|
if (file)
|
|
|
|
|
data_len = -1;
|
|
|
|
|
fixups[fixup_count].user_value = data_len;
|
|
|
|
|
/* Get the wl,cl values. Only useful for the unpack insn but
|
|
|
|
|
it doesn't hurt to always record them. */
|
|
|
|
|
vif_get_wl_cl (&wl, &cl);
|
|
|
|
|
fixups[fixup_count].wl = wl;
|
|
|
|
|
fixups[fixup_count].cl = cl;
|
|
|
|
|
++fixup_count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Obtain space in which to store the instruction. */
|
|
|
|
|
|
1998-02-21 07:44:25 +00:00
|
|
|
|
if (opcode->flags & VIF_OPCODE_MPG)
|
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* The data must be aligned on a 64 bit boundary (so the mpg insn
|
|
|
|
|
comes just before that 64 bit boundary).
|
|
|
|
|
Do this by putting the mpg insn in a relaxable fragment
|
|
|
|
|
with a symbol that marks the beginning of the aligned data. */
|
|
|
|
|
|
1998-04-03 20:15:57 +00:00
|
|
|
|
/* Ensure relaxable fragments are in their own fragment.
|
1998-04-03 20:37:32 +00:00
|
|
|
|
Otherwise md_apply_fix3 mishandles fixups to insns earlier
|
1998-04-07 03:22:22 +00:00
|
|
|
|
in the fragment (because we set fr_opcode for the `mpg' insn
|
1998-04-03 20:37:32 +00:00
|
|
|
|
because it can move in the fragment). */
|
1998-04-03 20:15:57 +00:00
|
|
|
|
frag_wane (frag_now);
|
|
|
|
|
frag_new (0);
|
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* One could combine the previous two lines with the following.
|
|
|
|
|
They're not for clarity: keep separate the actions being
|
|
|
|
|
performed. */
|
|
|
|
|
|
|
|
|
|
/* This dance with frag_grow is so we can record frag_now in
|
|
|
|
|
insn_frag. frag_var always changes frag_now. We must allocate
|
|
|
|
|
the maximal amount of space we need so there's room to move
|
|
|
|
|
the insn in the frag during relaxation. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
frag_grow (8);
|
|
|
|
|
/* Allocate space for the fixed part. */
|
|
|
|
|
f = frag_more (4);
|
|
|
|
|
insn_frag = frag_now;
|
|
|
|
|
|
|
|
|
|
frag_var (rs_machine_dependent,
|
|
|
|
|
4, /* max chars */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
0, /* variable part is empty at present */
|
|
|
|
|
RELAX_MPG, /* subtype */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
NULL, /* no symbol */
|
|
|
|
|
0, /* offset */
|
|
|
|
|
f); /* opcode */
|
|
|
|
|
|
1998-02-21 07:44:25 +00:00
|
|
|
|
frag_align (3, 0, 0);
|
|
|
|
|
record_alignment (now_seg, 3);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
|
|
|
|
/* Put a symbol at the start of data. The relaxation code uses
|
|
|
|
|
this to figure out how many bytes to insert. $.mpgloc
|
1998-05-28 23:29:19 +00:00
|
|
|
|
calculations use it. The disassembler uses it. The overlay
|
1998-05-29 00:39:03 +00:00
|
|
|
|
tracking table uses it.
|
|
|
|
|
Update $.mpgloc.
|
|
|
|
|
Create an overlay section. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
{
|
|
|
|
|
int mpgloc = vif_get_mpgloc ();
|
1998-05-29 00:39:03 +00:00
|
|
|
|
const char * section_name;
|
|
|
|
|
|
1998-05-29 01:08:08 +00:00
|
|
|
|
/* Update $.mpgloc if explicitly set.
|
|
|
|
|
Otherwise just use the current value. */
|
1998-05-29 00:39:03 +00:00
|
|
|
|
if (mpgloc != -1)
|
|
|
|
|
{
|
|
|
|
|
/* The value is recorded in bytes, mpgloc is in dwords. */
|
|
|
|
|
mpgloc_sym = expr_build_uconstant (mpgloc * 8);
|
|
|
|
|
}
|
|
|
|
|
|
1998-05-29 01:08:08 +00:00
|
|
|
|
section_name = vuoverlay_section_name (mpgloc_sym);
|
1998-05-28 23:29:19 +00:00
|
|
|
|
vif_data_start = create_colon_label (STO_DVP_VU,
|
|
|
|
|
VUOVERLAY_START_PREFIX,
|
|
|
|
|
section_name);
|
|
|
|
|
insn_frag->fr_symbol = vif_data_start;
|
|
|
|
|
|
1998-05-29 01:08:08 +00:00
|
|
|
|
create_vuoverlay_section (section_name, mpgloc_sym,
|
1998-05-29 00:39:03 +00:00
|
|
|
|
vif_data_start, vif_data_end);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
}
|
1998-02-21 07:44:25 +00:00
|
|
|
|
}
|
|
|
|
|
else if (opcode->flags & VIF_OPCODE_DIRECT)
|
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* The data must be aligned on a 128 bit boundary (so the direct insn
|
|
|
|
|
comes just before that 128 bit boundary).
|
|
|
|
|
Do this by putting the direct insn in a relaxable fragment.
|
|
|
|
|
with a symbol that marks the beginning of the aligned data. */
|
|
|
|
|
|
1998-04-03 20:15:57 +00:00
|
|
|
|
/* Ensure relaxable fragments are in their own fragment.
|
1998-04-03 20:37:32 +00:00
|
|
|
|
Otherwise md_apply_fix3 mishandles fixups to insns earlier
|
|
|
|
|
in the fragment (because we set fr_opcode for the `direct' insn
|
|
|
|
|
because it can move in the fragment). */
|
1998-04-03 20:15:57 +00:00
|
|
|
|
frag_wane (frag_now);
|
|
|
|
|
frag_new (0);
|
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* One could combine the previous two lines with the following.
|
|
|
|
|
They're not for clarity: keep separate the actions being
|
|
|
|
|
performed. */
|
|
|
|
|
|
|
|
|
|
/* This dance with frag_grow is so we can record frag_now in
|
|
|
|
|
insn_frag. frag_var always changes frag_now. We must allocate
|
|
|
|
|
the maximal amount of space we need so there's room to move
|
|
|
|
|
the insn in the frag during relaxation. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
frag_grow (16);
|
|
|
|
|
/* Allocate space for the fixed part. */
|
|
|
|
|
f = frag_more (4);
|
|
|
|
|
insn_frag = frag_now;
|
|
|
|
|
|
|
|
|
|
frag_var (rs_machine_dependent,
|
|
|
|
|
12, /* max chars */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
0, /* variable part is empty at present */
|
|
|
|
|
RELAX_DIRECT, /* subtype */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
NULL, /* no symbol */
|
|
|
|
|
0, /* offset */
|
|
|
|
|
f); /* opcode */
|
|
|
|
|
|
1998-02-21 07:44:25 +00:00
|
|
|
|
frag_align (4, 0, 0);
|
|
|
|
|
record_alignment (now_seg, 4);
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Put a symbol at the start of data. The relaxation code uses
|
|
|
|
|
this to figure out how many bytes to insert. */
|
|
|
|
|
vif_data_start = create_colon_label (0, LOCAL_LABEL_PREFIX,
|
|
|
|
|
unique_name ("direct"));
|
|
|
|
|
insn_frag->fr_symbol = vif_data_start;
|
|
|
|
|
}
|
|
|
|
|
else if (opcode->flags & VIF_OPCODE_UNPACK)
|
|
|
|
|
{
|
|
|
|
|
f = frag_more (len * 4);
|
|
|
|
|
insn_frag = frag_now;
|
|
|
|
|
/* Put a symbol at the start of data. $.unpackloc calculations
|
|
|
|
|
use it. */
|
1998-04-16 18:51:58 +00:00
|
|
|
|
/* ??? $.unpackloc is gone. Is this also used for data length
|
|
|
|
|
verification? */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
vif_data_start = create_colon_label (STO_DVP_VIF, LOCAL_LABEL_PREFIX,
|
|
|
|
|
unique_name ("unpack"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Reminder: it is important to fetch enough space in one call to
|
|
|
|
|
`frag_more'. We use (f - frag_now->fr_literal) to compute where
|
|
|
|
|
we are and we don't want frag_now to change between calls. */
|
|
|
|
|
f = frag_more (len * 4);
|
|
|
|
|
insn_frag = frag_now;
|
|
|
|
|
}
|
1998-01-30 12:01:27 +00:00
|
|
|
|
|
|
|
|
|
/* Write out the instruction. */
|
|
|
|
|
for (i = 0; i < len; ++i)
|
|
|
|
|
md_number_to_chars (f + i * 4, insn_buf[i], 4);
|
|
|
|
|
|
|
|
|
|
/* Create any fixups. */
|
|
|
|
|
/* FIXME: It might eventually be possible to combine all the various
|
|
|
|
|
copies of this bit of code. */
|
|
|
|
|
for (i = 0; i < fixup_count; ++i)
|
|
|
|
|
{
|
|
|
|
|
int op_type, reloc_type, offset;
|
|
|
|
|
const dvp_operand *operand;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
fixS *fixP;
|
1998-01-27 00:32:01 +00:00
|
|
|
|
|
1998-01-30 12:01:27 +00:00
|
|
|
|
/* Create a fixup for this operand.
|
|
|
|
|
At this point we do not use a bfd_reloc_code_real_type for
|
|
|
|
|
operands residing in the insn, but instead just use the
|
|
|
|
|
operand index. This lets us easily handle fixups for any
|
|
|
|
|
operand type, although that is admittedly not a very exciting
|
|
|
|
|
feature. We pick a BFD reloc type in md_apply_fix. */
|
|
|
|
|
|
|
|
|
|
op_type = fixups[i].opindex;
|
|
|
|
|
offset = fixups[i].offset;
|
1998-02-11 23:40:43 +00:00
|
|
|
|
reloc_type = encode_fixup_reloc_type (DVP_VIF, op_type);
|
|
|
|
|
operand = &vif_operands[op_type];
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
fixP = fix_new_exp (insn_frag, f + offset - insn_frag->fr_literal, 4,
|
|
|
|
|
&fixups[i].exp,
|
|
|
|
|
(operand->flags & DVP_OPERAND_RELATIVE_BRANCH) != 0,
|
|
|
|
|
(bfd_reloc_code_real_type) reloc_type);
|
|
|
|
|
fixP->tc_fix_data.user_value = fixups[i].user_value;
|
|
|
|
|
fixP->tc_fix_data.wl = fixups[i].wl;
|
|
|
|
|
fixP->tc_fix_data.cl = fixups[i].cl;
|
|
|
|
|
|
|
|
|
|
/* Set fx_tcbit so other parts of the code know this fixup is for
|
|
|
|
|
a vif insn. */
|
|
|
|
|
fixP->fx_tcbit = 1;
|
1998-01-30 12:01:27 +00:00
|
|
|
|
}
|
1998-01-27 22:17:11 +00:00
|
|
|
|
}
|
1998-01-29 12:37:45 +00:00
|
|
|
|
|
1998-01-29 17:06:52 +00:00
|
|
|
|
/* Handle variable length insns. */
|
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
if (opcode->flags & VIF_OPCODE_LENVAR)
|
1998-01-29 12:37:45 +00:00
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* See what the user specified. */
|
1998-02-11 23:40:43 +00:00
|
|
|
|
vif_get_var_data (&file, &data_len);
|
1998-03-07 03:22:18 +00:00
|
|
|
|
|
1998-01-29 12:37:45 +00:00
|
|
|
|
if (file)
|
|
|
|
|
{
|
1998-02-27 18:10:03 +00:00
|
|
|
|
int byte_len;
|
|
|
|
|
|
1998-03-07 03:22:18 +00:00
|
|
|
|
/* The handling for each of mpg,direct,unpack is basically the same:
|
|
|
|
|
- emit a label to set the mach type for the data we're inserting
|
|
|
|
|
- switch to the new assembler state
|
|
|
|
|
- insert the file
|
|
|
|
|
- call the `end' handler */
|
|
|
|
|
|
1998-02-27 18:10:03 +00:00
|
|
|
|
if (opcode->flags & VIF_OPCODE_MPG)
|
1998-03-07 03:22:18 +00:00
|
|
|
|
{
|
|
|
|
|
record_mach (DVP_VUUP, 1);
|
|
|
|
|
set_asm_state (ASM_MPG);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
byte_len = insert_file (file, insert_mpg_marker, 0, 256 * 8);
|
|
|
|
|
s_endmpg (ENDMPG_INTERNAL);
|
1998-03-07 03:22:18 +00:00
|
|
|
|
}
|
1998-02-27 18:10:03 +00:00
|
|
|
|
else if (opcode->flags & VIF_OPCODE_DIRECT)
|
1998-03-07 03:22:18 +00:00
|
|
|
|
{
|
|
|
|
|
record_mach (DVP_GIF, 1);
|
|
|
|
|
set_asm_state (ASM_DIRECT);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
byte_len = insert_file (file, NULL, 0, 0);
|
1998-03-07 03:22:18 +00:00
|
|
|
|
s_enddirect (1);
|
|
|
|
|
}
|
1998-02-27 18:10:03 +00:00
|
|
|
|
else if (opcode->flags & VIF_OPCODE_UNPACK)
|
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
int max_len = 0; /*unpack_max_byte_len (insn_buf[0]);*/
|
1998-03-07 03:22:18 +00:00
|
|
|
|
set_asm_state (ASM_UNPACK);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
byte_len = insert_file (file, NULL /*insert_unpack_marker*/,
|
|
|
|
|
insn_buf[0], max_len);
|
1998-03-07 03:22:18 +00:00
|
|
|
|
s_endunpack (1);
|
1998-02-27 18:10:03 +00:00
|
|
|
|
}
|
1998-03-07 03:22:18 +00:00
|
|
|
|
else
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: unknown cpu type for variable length vif insn");
|
1998-01-29 12:37:45 +00:00
|
|
|
|
}
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
else /* file == NULL */
|
1998-01-29 12:37:45 +00:00
|
|
|
|
{
|
|
|
|
|
/* data_len == -1 means the value must be computed from
|
|
|
|
|
the data. */
|
1998-04-07 03:22:22 +00:00
|
|
|
|
if (data_len <= -2)
|
1998-01-29 12:37:45 +00:00
|
|
|
|
as_bad ("invalid data length");
|
1998-03-07 03:22:18 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
if (output_vif && data_len != -1)
|
|
|
|
|
install_vif_length (f, data_len);
|
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
if (opcode->flags & VIF_OPCODE_MPG)
|
1998-02-21 07:44:25 +00:00
|
|
|
|
{
|
|
|
|
|
set_asm_state (ASM_MPG);
|
|
|
|
|
/* Enable automatic mpg insertion every 256 insns. */
|
|
|
|
|
vu_count = 0;
|
|
|
|
|
}
|
1998-02-11 23:40:43 +00:00
|
|
|
|
else if (opcode->flags & VIF_OPCODE_DIRECT)
|
1998-02-21 03:26:47 +00:00
|
|
|
|
set_asm_state (ASM_DIRECT);
|
1998-02-11 23:40:43 +00:00
|
|
|
|
else if (opcode->flags & VIF_OPCODE_UNPACK)
|
1998-02-21 03:26:47 +00:00
|
|
|
|
set_asm_state (ASM_UNPACK);
|
1998-01-29 12:37:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-26 06:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
/* Subroutine of md_assemble to assemble GIF instructions. */
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
|
|
|
|
static void
|
1998-02-11 23:40:43 +00:00
|
|
|
|
assemble_gif (str)
|
1998-01-26 06:24:59 +00:00
|
|
|
|
char *str;
|
|
|
|
|
{
|
1998-01-28 10:15:09 +00:00
|
|
|
|
DVP_INSN insn_buf[4];
|
1998-01-28 14:05:49 +00:00
|
|
|
|
const dvp_opcode *opcode;
|
1998-02-21 02:12:15 +00:00
|
|
|
|
char *f;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
insn_buf[0] = insn_buf[1] = insn_buf[2] = insn_buf[3] = 0;
|
1998-01-27 00:32:01 +00:00
|
|
|
|
|
1998-02-11 23:40:43 +00:00
|
|
|
|
opcode = assemble_one_insn (DVP_GIF,
|
|
|
|
|
gif_opcode_lookup_asm (str), gif_operands,
|
1998-04-10 01:37:00 +00:00
|
|
|
|
0, 0, &str, insn_buf);
|
1998-01-28 14:05:49 +00:00
|
|
|
|
if (opcode == NULL)
|
1998-01-27 22:17:11 +00:00
|
|
|
|
return;
|
1998-02-21 02:12:15 +00:00
|
|
|
|
|
|
|
|
|
/* Do an implicit alignment to a 16 byte boundary. */
|
|
|
|
|
frag_align (4, 0, 0);
|
|
|
|
|
record_alignment (now_seg, 4);
|
|
|
|
|
|
1998-02-24 22:08:40 +00:00
|
|
|
|
/* Insert a label so we can compute the number of quadwords when the
|
|
|
|
|
.endgif is seen. This is put before the mach type label because gif
|
|
|
|
|
insns are followed by data and we don't want the disassembler to try
|
|
|
|
|
to disassemble them as mips insns (since it uses the st_other field)
|
|
|
|
|
of the closest label to choose the mach type and since we don't have
|
|
|
|
|
a special st_other value for "data". */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
gif_data_name = S_GET_NAME (create_colon_label (0, LOCAL_LABEL_PREFIX,
|
|
|
|
|
unique_name ("gifdata")));
|
1998-02-24 22:08:40 +00:00
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
record_mach (DVP_GIF, 1);
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
1998-03-16 18:22:18 +00:00
|
|
|
|
gif_insn_frag_loc = f = frag_more (16);
|
|
|
|
|
gif_insn_frag = frag_now;
|
1998-02-21 02:12:15 +00:00
|
|
|
|
for (i = 0; i < 4; ++i)
|
|
|
|
|
md_number_to_chars (f + i * 4, insn_buf[i], 4);
|
|
|
|
|
|
|
|
|
|
/* Record the type of the gif tag so we know how to compute nloop
|
|
|
|
|
in s_endgif. */
|
|
|
|
|
if (strcmp (opcode->mnemonic, "gifpacked") == 0)
|
|
|
|
|
gif_insn_type = GIF_PACKED;
|
|
|
|
|
else if (strcmp (opcode->mnemonic, "gifreglist") == 0)
|
|
|
|
|
gif_insn_type = GIF_REGLIST;
|
|
|
|
|
else if (strcmp (opcode->mnemonic, "gifimage") == 0)
|
|
|
|
|
gif_insn_type = GIF_IMAGE;
|
|
|
|
|
else
|
|
|
|
|
abort ();
|
1998-02-21 03:26:47 +00:00
|
|
|
|
push_asm_state (ASM_GIF);
|
1998-01-26 06:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Subroutine of md_assemble to assemble VU instructions. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
assemble_vu (str)
|
|
|
|
|
char *str;
|
1997-12-22 17:55:19 +00:00
|
|
|
|
{
|
1998-04-10 01:37:00 +00:00
|
|
|
|
int i;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
char *f;
|
|
|
|
|
const dvp_opcode *opcode;
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* The lower instruction has the lower address so insns[0] = lower insn,
|
|
|
|
|
insns[1] = upper insn. */
|
|
|
|
|
DVP_INSN insns[2];
|
|
|
|
|
fragS * insn_frag;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
1998-02-21 07:44:25 +00:00
|
|
|
|
/* Handle automatic mpg insertion if enabled. */
|
|
|
|
|
if (CUR_ASM_STATE == ASM_MPG
|
|
|
|
|
&& vu_count == 256)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
insert_mpg_marker (0);
|
1998-02-21 07:44:25 +00:00
|
|
|
|
|
|
|
|
|
/* Do an implicit alignment to a 8 byte boundary. */
|
|
|
|
|
frag_align (3, 0, 0);
|
|
|
|
|
record_alignment (now_seg, 3);
|
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
record_mach (DVP_VUUP, 0);
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
1998-01-06 13:12:16 +00:00
|
|
|
|
#ifdef VERTICAL_BAR_SEPARATOR
|
1998-01-05 14:56:04 +00:00
|
|
|
|
char *p = strchr (str, '|');
|
|
|
|
|
|
|
|
|
|
if (p == NULL)
|
|
|
|
|
{
|
|
|
|
|
as_bad ("lower slot missing in `%s'", str);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*p = 0;
|
1998-04-10 01:37:00 +00:00
|
|
|
|
opcode = assemble_one_insn (DVP_VUUP,
|
|
|
|
|
vu_upper_opcode_lookup_asm (str), vu_operands,
|
|
|
|
|
0, 4, &str, &insns[1]);
|
1998-01-05 14:56:04 +00:00
|
|
|
|
*p = '|';
|
1998-01-28 14:05:49 +00:00
|
|
|
|
str = p + 1;
|
1998-01-06 13:12:16 +00:00
|
|
|
|
#else
|
1998-04-10 01:37:00 +00:00
|
|
|
|
opcode = assemble_one_insn (DVP_VUUP,
|
1998-01-28 14:05:49 +00:00
|
|
|
|
vu_upper_opcode_lookup_asm (str), vu_operands,
|
1998-04-10 01:37:00 +00:00
|
|
|
|
0, 4, &str, &insns[1]);
|
1998-01-06 13:12:16 +00:00
|
|
|
|
#endif
|
1998-02-18 23:56:15 +00:00
|
|
|
|
|
|
|
|
|
/* Don't assemble next one if we couldn't assemble the first. */
|
|
|
|
|
if (opcode == NULL)
|
|
|
|
|
return;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* Assemble the lower insn.
|
|
|
|
|
Pass `fixup_count' for `init_fixup_count' so that we don't clobber
|
|
|
|
|
any fixups the upper insn had. */
|
|
|
|
|
opcode = assemble_one_insn (DVP_VULO,
|
|
|
|
|
vu_lower_opcode_lookup_asm (str), vu_operands,
|
|
|
|
|
fixup_count, 0, &str, &insns[0]);
|
1998-01-28 14:05:49 +00:00
|
|
|
|
if (opcode == NULL)
|
1998-04-10 01:37:00 +00:00
|
|
|
|
return;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* If there were fixups and we're inside mpg, create a machine dependent
|
|
|
|
|
fragment so that we can record the current value of $.mpgloc in fr_symbol.
|
1998-01-27 00:32:01 +00:00
|
|
|
|
Reminder: it is important to fetch enough space in one call to
|
|
|
|
|
`frag_more'. We use (f - frag_now->fr_literal) to compute where
|
|
|
|
|
we are and we don't want frag_now to change between calls. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
if (fixup_count != 0
|
|
|
|
|
&& CUR_ASM_STATE == ASM_MPG)
|
|
|
|
|
{
|
|
|
|
|
symbolS * cur_mpgloc;
|
|
|
|
|
|
|
|
|
|
/* Ensure we get a new frag. */
|
|
|
|
|
frag_wane (frag_now);
|
|
|
|
|
frag_new (0);
|
|
|
|
|
|
|
|
|
|
/* Compute the current $.mpgloc. */
|
|
|
|
|
cur_mpgloc = compute_mpgloc (mpgloc_sym, vif_data_start,
|
|
|
|
|
expr_build_dot ());
|
|
|
|
|
|
|
|
|
|
/* We need to use frag_now afterwards, so we can't just call frag_var.
|
|
|
|
|
Instead we use frag_more and save the value of frag_now in
|
|
|
|
|
insn_frag. */
|
|
|
|
|
f = frag_more (8);
|
|
|
|
|
insn_frag = frag_now;
|
|
|
|
|
/* Turn the frag into a machine dependent frag. */
|
|
|
|
|
frag_variant (rs_machine_dependent,
|
|
|
|
|
0, /* max chars */
|
|
|
|
|
0, /* no variable part */
|
|
|
|
|
RELAX_VU, /* subtype */
|
|
|
|
|
cur_mpgloc, /* $.mpgloc */
|
|
|
|
|
0, /* offset */
|
|
|
|
|
NULL); /* opcode */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
f = frag_more (8);
|
|
|
|
|
insn_frag = frag_now;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write out the instructions. */
|
|
|
|
|
md_number_to_chars (f, insns[0], 4);
|
|
|
|
|
md_number_to_chars (f + 4, insns[1], 4);
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
1998-01-27 00:32:01 +00:00
|
|
|
|
/* Create any fixups. */
|
|
|
|
|
for (i = 0; i < fixup_count; ++i)
|
|
|
|
|
{
|
|
|
|
|
int op_type, reloc_type;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
const dvp_operand *operand;
|
1998-04-10 01:37:00 +00:00
|
|
|
|
dvp_cpu cpu;
|
1998-01-27 00:32:01 +00:00
|
|
|
|
|
|
|
|
|
/* Create a fixup for this operand.
|
|
|
|
|
At this point we do not use a bfd_reloc_code_real_type for
|
|
|
|
|
operands residing in the insn, but instead just use the
|
|
|
|
|
operand index. This lets us easily handle fixups for any
|
|
|
|
|
operand type, although that is admittedly not a very exciting
|
|
|
|
|
feature. We pick a BFD reloc type in md_apply_fix. */
|
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
cpu = fixups[i].cpu;
|
1998-01-27 00:32:01 +00:00
|
|
|
|
op_type = fixups[i].opindex;
|
1998-01-27 22:17:11 +00:00
|
|
|
|
reloc_type = encode_fixup_reloc_type (cpu, op_type);
|
1998-01-28 10:15:09 +00:00
|
|
|
|
operand = &vu_operands[op_type];
|
1998-04-10 01:37:00 +00:00
|
|
|
|
|
|
|
|
|
/* Branch operands inside mpg have to be handled specially.
|
|
|
|
|
We want a pc relative relocation in a section different from our own.
|
|
|
|
|
See the br-2.s dejagnu testcase for a good example. */
|
|
|
|
|
if (CUR_ASM_STATE == ASM_MPG
|
|
|
|
|
&& (operand->flags & DVP_OPERAND_RELATIVE_BRANCH) != 0)
|
|
|
|
|
{
|
|
|
|
|
symbolS *e1,*e2,*diff_expr;
|
|
|
|
|
|
|
|
|
|
/* For "br foo" we want "foo - (. + 8)". */
|
|
|
|
|
e1 = expr_build_binary (O_add, insn_frag->fr_symbol,
|
|
|
|
|
expr_build_uconstant (8));
|
|
|
|
|
e2 = make_expr_symbol (&fixups[i].exp);
|
|
|
|
|
diff_expr = expr_build_binary (O_subtract, e2, e1);
|
|
|
|
|
fixups[i].exp.X_op = O_symbol;
|
|
|
|
|
fixups[i].exp.X_add_symbol = diff_expr;
|
|
|
|
|
fixups[i].exp.X_add_number = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fix_new_exp (insn_frag, f + fixups[i].offset - insn_frag->fr_literal, 4,
|
1998-01-27 00:32:01 +00:00
|
|
|
|
&fixups[i].exp,
|
1998-04-10 01:37:00 +00:00
|
|
|
|
CUR_ASM_STATE == ASM_MPG /* pcrel */
|
|
|
|
|
? 0
|
|
|
|
|
: (operand->flags & DVP_OPERAND_RELATIVE_BRANCH) != 0,
|
1998-01-27 00:32:01 +00:00
|
|
|
|
(bfd_reloc_code_real_type) reloc_type);
|
|
|
|
|
}
|
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* If this was the "loi" pseudo-insn, we need to set the `i' bit. */
|
|
|
|
|
if (strcmp (opcode->mnemonic, "loi") == 0)
|
|
|
|
|
f[7] |= 0x80;
|
|
|
|
|
|
|
|
|
|
/* Increment the vu insn counter.
|
|
|
|
|
If get reach 256 we need to insert an `mpg'. */
|
|
|
|
|
++vu_count;
|
1998-01-27 00:32:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-01-28 14:05:49 +00:00
|
|
|
|
/* Assemble one instruction at *PSTR.
|
1998-01-27 00:32:01 +00:00
|
|
|
|
CPU indicates what component we're assembling for.
|
|
|
|
|
The assembled instruction is stored in INSN_BUF.
|
1998-01-28 14:05:49 +00:00
|
|
|
|
OPCODE is a pointer to the head of the hash chain.
|
1998-04-10 01:37:00 +00:00
|
|
|
|
INIT_FIXUP_COUNT is the initial value for `fixup_count'.
|
|
|
|
|
It exists to allow the fixups for multiple calls to this insn to be
|
|
|
|
|
queued up before actually emitting them.
|
1998-01-28 14:05:49 +00:00
|
|
|
|
*PSTR is updated to point passed the parsed instruction.
|
1998-01-27 00:32:01 +00:00
|
|
|
|
|
1998-01-28 14:05:49 +00:00
|
|
|
|
If the insn is successfully parsed the result is a pointer to the opcode
|
|
|
|
|
entry that successfully matched and *PSTR is updated to point passed
|
|
|
|
|
the parsed insn. If an error occurs the result is NULL and *PSTR is left
|
|
|
|
|
at some random point in the string (??? may wish to leave it pointing where
|
|
|
|
|
the error occured). */
|
|
|
|
|
|
|
|
|
|
static const dvp_opcode *
|
1998-04-10 01:37:00 +00:00
|
|
|
|
assemble_one_insn (cpu, opcode, operand_table, init_fixup_count, fixup_offset,
|
|
|
|
|
pstr, insn_buf)
|
1998-01-28 14:05:49 +00:00
|
|
|
|
dvp_cpu cpu;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
const dvp_opcode *opcode;
|
|
|
|
|
const dvp_operand *operand_table;
|
1998-04-10 01:37:00 +00:00
|
|
|
|
int init_fixup_count;
|
|
|
|
|
int fixup_offset;
|
1998-01-28 14:05:49 +00:00
|
|
|
|
char **pstr;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
DVP_INSN *insn_buf;
|
1998-01-27 00:32:01 +00:00
|
|
|
|
{
|
1998-01-28 14:05:49 +00:00
|
|
|
|
char *start, *str;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
|
|
|
|
/* Keep looking until we find a match. */
|
|
|
|
|
|
1998-01-28 14:05:49 +00:00
|
|
|
|
start = str = *pstr;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
for ( ; opcode != NULL; opcode = DVP_OPCODE_NEXT_ASM (opcode))
|
1998-01-05 14:56:04 +00:00
|
|
|
|
{
|
1998-02-19 22:51:08 +00:00
|
|
|
|
int past_opcode_p, num_suffixes;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
const unsigned char *syn;
|
|
|
|
|
|
|
|
|
|
/* Ensure the mnemonic part matches. */
|
|
|
|
|
for (str = start, syn = opcode->mnemonic; *syn != '\0'; ++str, ++syn)
|
|
|
|
|
if (tolower (*str) != tolower (*syn))
|
|
|
|
|
break;
|
|
|
|
|
if (*syn != '\0')
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Scan the syntax string. If it doesn't match, try the next one. */
|
|
|
|
|
|
1998-01-28 10:15:09 +00:00
|
|
|
|
dvp_opcode_init_parse ();
|
1998-02-19 22:51:08 +00:00
|
|
|
|
insn_buf[opcode->opcode_word] = opcode->value;
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fixup_count = init_fixup_count;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
past_opcode_p = 0;
|
|
|
|
|
num_suffixes = 0;
|
|
|
|
|
|
|
|
|
|
/* We don't check for (*str != '\0') here because we want to parse
|
|
|
|
|
any trailing fake arguments in the syntax string. */
|
|
|
|
|
for (/*str = start, */ syn = opcode->syntax; *syn != '\0'; )
|
|
|
|
|
{
|
|
|
|
|
int mods,index;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
const dvp_operand *operand;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
const char *errmsg;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
long value;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
1998-01-24 00:44:52 +00:00
|
|
|
|
/* Non operand chars must match exactly.
|
|
|
|
|
Operand chars that are letters are not part of symbols
|
|
|
|
|
and are case insensitive. */
|
1998-01-05 14:56:04 +00:00
|
|
|
|
if (*syn < 128)
|
|
|
|
|
{
|
1998-01-24 00:44:52 +00:00
|
|
|
|
if (tolower (*str) == tolower (*syn))
|
1998-01-05 14:56:04 +00:00
|
|
|
|
{
|
|
|
|
|
if (*syn == ' ')
|
|
|
|
|
past_opcode_p = 1;
|
|
|
|
|
++syn;
|
|
|
|
|
++str;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We have a suffix or an operand. Pick out any modifiers. */
|
|
|
|
|
mods = 0;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
index = DVP_OPERAND_INDEX (*syn);
|
|
|
|
|
while (DVP_MOD_P (operand_table[index].flags))
|
1998-01-05 14:56:04 +00:00
|
|
|
|
{
|
1998-01-28 10:15:09 +00:00
|
|
|
|
mods |= operand_table[index].flags & DVP_MOD_BITS;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
++syn;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
index = DVP_OPERAND_INDEX (*syn);
|
1998-01-05 14:56:04 +00:00
|
|
|
|
}
|
1998-01-27 00:32:01 +00:00
|
|
|
|
operand = operand_table + index;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
1998-01-28 10:15:09 +00:00
|
|
|
|
if (operand->flags & DVP_OPERAND_FAKE)
|
1998-01-05 14:56:04 +00:00
|
|
|
|
{
|
1998-02-19 00:39:38 +00:00
|
|
|
|
long value = 0;
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
|
|
|
|
if (operand->flags & DVP_OPERAND_DMA_INLINE)
|
|
|
|
|
{
|
1998-02-21 02:12:15 +00:00
|
|
|
|
inline_dma_data ((mods & DVP_OPERAND_AUTOCOUNT) != 0,
|
1998-02-19 22:51:08 +00:00
|
|
|
|
insn_buf);
|
|
|
|
|
++syn;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
1998-02-19 00:39:38 +00:00
|
|
|
|
if (operand->parse)
|
|
|
|
|
{
|
|
|
|
|
errmsg = NULL;
|
|
|
|
|
value = (*operand->parse) (opcode, operand, mods,
|
|
|
|
|
&str, &errmsg);
|
|
|
|
|
if (errmsg)
|
|
|
|
|
break;
|
|
|
|
|
}
|
1998-01-05 14:56:04 +00:00
|
|
|
|
if (operand->insert)
|
|
|
|
|
{
|
1998-01-24 00:44:53 +00:00
|
|
|
|
errmsg = NULL;
|
1998-02-19 00:39:38 +00:00
|
|
|
|
(*operand->insert) (opcode, operand, mods, insn_buf,
|
|
|
|
|
(offsetT) value, &errmsg);
|
1998-01-05 14:56:04 +00:00
|
|
|
|
/* If we get an error, go on to try the next insn. */
|
|
|
|
|
if (errmsg)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
++syn;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
continue;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
}
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
1998-01-05 14:56:04 +00:00
|
|
|
|
/* Are we finished with suffixes? */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
if (!past_opcode_p)
|
1998-01-05 14:56:04 +00:00
|
|
|
|
{
|
|
|
|
|
long suf_value;
|
|
|
|
|
|
1998-01-28 10:15:09 +00:00
|
|
|
|
if (!(operand->flags & DVP_OPERAND_SUFFIX))
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: bad opcode table, missing suffix flag");
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* Parse the suffix. If we're at a space in the input string
|
|
|
|
|
there are no more suffixes. Suffix parse routines must be
|
|
|
|
|
prepared to deal with this. */
|
1998-01-27 00:32:01 +00:00
|
|
|
|
errmsg = NULL;
|
1998-02-18 23:56:15 +00:00
|
|
|
|
suf_value = (*operand->parse) (opcode, operand, mods, &str,
|
1998-01-27 22:17:11 +00:00
|
|
|
|
&errmsg);
|
1998-01-05 14:56:04 +00:00
|
|
|
|
if (errmsg)
|
|
|
|
|
{
|
1998-01-24 00:44:52 +00:00
|
|
|
|
/* This can happen, for example, in ARC's in "blle foo" and
|
|
|
|
|
we're currently using the template "b%q%.n %j". The "bl"
|
|
|
|
|
insn occurs later in the table so "lle" isn't an illegal
|
|
|
|
|
suffix. */
|
1998-01-05 14:56:04 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
1998-01-28 19:35:31 +00:00
|
|
|
|
|
1998-01-05 14:56:04 +00:00
|
|
|
|
/* Insert the suffix's value into the insn. */
|
1998-01-28 19:35:31 +00:00
|
|
|
|
insert_operand (cpu, opcode, operand, mods, insn_buf,
|
|
|
|
|
(offsetT) suf_value, &errmsg);
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
|
|
|
|
++syn;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
continue;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* This is an operand, either a register or an expression of
|
|
|
|
|
some kind. */
|
|
|
|
|
|
|
|
|
|
value = 0;
|
|
|
|
|
|
|
|
|
|
if (operand->flags & DVP_OPERAND_SUFFIX)
|
|
|
|
|
as_fatal ("internal error: bad opcode table, suffix wrong");
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Is there anything left to parse?
|
|
|
|
|
We don't check for this at the top because we want to parse
|
|
|
|
|
any trailing fake arguments in the syntax string. */
|
|
|
|
|
/* ??? This doesn't allow operands with a legal value of "". */
|
|
|
|
|
if (*str == '\0')
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Parse the operand. */
|
|
|
|
|
if (operand->flags & DVP_OPERAND_FLOAT)
|
|
|
|
|
{
|
|
|
|
|
errmsg = 0;
|
|
|
|
|
value = parse_float (&str, &errmsg);
|
|
|
|
|
if (errmsg)
|
1998-01-05 14:56:04 +00:00
|
|
|
|
break;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
}
|
|
|
|
|
else if ((operand->flags & DVP_OPERAND_DMA_ADDR)
|
|
|
|
|
&& (mods & DVP_OPERAND_AUTOCOUNT))
|
|
|
|
|
{
|
|
|
|
|
errmsg = 0;
|
|
|
|
|
value = parse_dma_addr_autocount (opcode, operand, mods,
|
|
|
|
|
insn_buf, &str, &errmsg);
|
|
|
|
|
if (errmsg)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char *origstr,*hold;
|
|
|
|
|
expressionS exp;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* First see if there is a special parser. */
|
|
|
|
|
origstr = str;
|
|
|
|
|
if (operand->parse)
|
1998-01-05 14:56:04 +00:00
|
|
|
|
{
|
1998-01-27 00:32:01 +00:00
|
|
|
|
errmsg = NULL;
|
1998-01-27 22:17:11 +00:00
|
|
|
|
value = (*operand->parse) (opcode, operand, mods,
|
|
|
|
|
&str, &errmsg);
|
1998-01-05 15:53:49 +00:00
|
|
|
|
if (errmsg)
|
|
|
|
|
break;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
}
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
|
|
|
|
/* If there wasn't a special parser, or there was and it
|
|
|
|
|
left the input stream unchanged, use the general
|
|
|
|
|
expression parser. */
|
|
|
|
|
if (str == origstr)
|
1998-01-05 14:56:04 +00:00
|
|
|
|
{
|
|
|
|
|
hold = input_line_pointer;
|
|
|
|
|
input_line_pointer = str;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Set cur_{opcode,operand} for md_operand. */
|
|
|
|
|
cur_opcode = opcode;
|
|
|
|
|
cur_operand = operand;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
expression (&exp);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
cur_opcode = NULL;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
str = input_line_pointer;
|
|
|
|
|
input_line_pointer = hold;
|
|
|
|
|
|
1998-01-05 15:53:49 +00:00
|
|
|
|
if (exp.X_op == O_illegal
|
|
|
|
|
|| exp.X_op == O_absent)
|
|
|
|
|
break;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
else if (exp.X_op == O_constant)
|
1998-01-05 15:53:49 +00:00
|
|
|
|
value = exp.X_add_number;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
else if (exp.X_op == O_register)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: got O_register");
|
1998-01-05 14:56:04 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* We need to generate a fixup for this expression. */
|
1998-01-27 00:32:01 +00:00
|
|
|
|
if (fixup_count >= MAX_FIXUPS)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: too many fixups");
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fixups[fixup_count].cpu = cpu;
|
1998-01-27 00:32:01 +00:00
|
|
|
|
fixups[fixup_count].exp = exp;
|
|
|
|
|
fixups[fixup_count].opindex = index;
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* FIXME: Revisit. Do we really need operand->word?
|
|
|
|
|
The endianness of a 128 bit DMAtag is rather
|
|
|
|
|
twisted. How about defining word 0 as the word with
|
|
|
|
|
the lowest address and basing operand-shift off that.
|
|
|
|
|
operand->word could then be deleted. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fixups[fixup_count].offset = fixup_offset;
|
1998-02-19 10:24:15 +00:00
|
|
|
|
if (operand->word != 0)
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fixups[fixup_count].offset += operand->word * 4;
|
1998-02-19 10:24:15 +00:00
|
|
|
|
else
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fixups[fixup_count].offset += (operand->shift / 32) * 4;
|
1998-01-27 00:32:01 +00:00
|
|
|
|
++fixup_count;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
value = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
}
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Insert the register or expression into the instruction. */
|
|
|
|
|
errmsg = NULL;
|
|
|
|
|
insert_operand (cpu, opcode, operand, mods, insn_buf,
|
|
|
|
|
(offsetT) value, &errmsg);
|
|
|
|
|
if (errmsg != (const char *) NULL)
|
|
|
|
|
break;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
++syn;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we're at the end of the syntax string, we're done. */
|
|
|
|
|
if (*syn == '\0')
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* For the moment we assume a valid `str' can only contain blanks
|
|
|
|
|
now. IE: We needn't try again with a longer version of the
|
|
|
|
|
insn and it is assumed that longer versions of insns appear
|
|
|
|
|
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
|
|
|
|
|
|
|
|
|
|
while (isspace (*str))
|
|
|
|
|
++str;
|
|
|
|
|
|
1998-01-06 13:12:16 +00:00
|
|
|
|
if (*str != '\0'
|
|
|
|
|
#ifndef VERTICAL_BAR_SEPARATOR
|
1998-01-28 14:05:49 +00:00
|
|
|
|
&& cpu != DVP_VUUP
|
1998-01-06 13:12:16 +00:00
|
|
|
|
#endif
|
|
|
|
|
)
|
1998-01-05 14:56:04 +00:00
|
|
|
|
as_bad ("junk at end of line: `%s'", str);
|
|
|
|
|
|
1998-01-27 00:32:01 +00:00
|
|
|
|
/* It's now up to the caller to emit the instruction and any
|
|
|
|
|
relocations. */
|
1998-01-28 14:05:49 +00:00
|
|
|
|
*pstr = str;
|
|
|
|
|
return opcode;
|
1998-01-05 14:56:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Try the next entry. */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
as_bad ("bad instruction `%s'", start);
|
1998-01-06 13:12:16 +00:00
|
|
|
|
return 0;
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
1998-02-21 03:26:47 +00:00
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
/* Given a dvp cpu type, return it's STO_DVP value.
|
1998-03-17 18:51:57 +00:00
|
|
|
|
The label prefix to use is stored in *PNAME. */
|
1998-02-24 20:40:41 +00:00
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
cpu_sto (cpu, pname)
|
|
|
|
|
dvp_cpu cpu;
|
|
|
|
|
const char **pname;
|
|
|
|
|
{
|
|
|
|
|
switch (cpu)
|
|
|
|
|
{
|
|
|
|
|
case DVP_DMA : *pname = ".dma."; return STO_DVP_DMA;
|
|
|
|
|
case DVP_VIF : *pname = ".vif."; return STO_DVP_VIF;
|
|
|
|
|
case DVP_GIF : *pname = ".gif."; return STO_DVP_GIF;
|
|
|
|
|
case DVP_VUUP : *pname = ".vu."; return STO_DVP_VU;
|
|
|
|
|
}
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record the current mach type in the object file.
|
|
|
|
|
If FORCE_NEXT_P is non-zero, force a label to be emitted the next time
|
|
|
|
|
we're called. This is useful for variable length instructions that can
|
|
|
|
|
have labels embedded within them. */
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
|
|
|
|
static void
|
1998-02-24 20:40:41 +00:00
|
|
|
|
record_mach (cpu, force_next_p)
|
|
|
|
|
dvp_cpu cpu;
|
|
|
|
|
int force_next_p;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
{
|
|
|
|
|
symbolS *label;
|
1998-02-24 20:40:41 +00:00
|
|
|
|
const char *name;
|
|
|
|
|
int sto;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
if (cpu == cur_cpu)
|
1998-02-21 06:28:18 +00:00
|
|
|
|
return;
|
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
sto = cpu_sto (cpu, &name);
|
|
|
|
|
|
|
|
|
|
label = create_colon_label (sto, "", unique_name (name));
|
1998-02-21 06:28:18 +00:00
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
if (force_next_p)
|
|
|
|
|
cur_cpu = DVP_UNKNOWN;
|
|
|
|
|
else
|
|
|
|
|
cur_cpu = cpu;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-03-17 22:10:10 +00:00
|
|
|
|
/* Force emission of mach type label at next insn.
|
|
|
|
|
This isn't static as TC_START_LABEL uses it.
|
|
|
|
|
The result is the value of TC_START_LABEL. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
force_mach_label ()
|
|
|
|
|
{
|
|
|
|
|
cur_cpu = DVP_UNKNOWN;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
/* Push/pop the current parsing state. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
push_asm_state (new_state)
|
|
|
|
|
asm_state new_state;
|
|
|
|
|
{
|
|
|
|
|
++cur_state_index;
|
|
|
|
|
if (cur_state_index == MAX_STATE_DEPTH)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: unexpected state push");
|
1998-02-21 03:26:47 +00:00
|
|
|
|
asm_state_stack[cur_state_index] = new_state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* TOP_OK_P is non-zero if it's ok that we're at the top of the stack.
|
|
|
|
|
This happens if there are errors in the assembler code.
|
|
|
|
|
We just reset the stack to its "init" state. */
|
1997-12-22 17:55:19 +00:00
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
static void
|
|
|
|
|
pop_asm_state (top_ok_p)
|
|
|
|
|
int top_ok_p;
|
|
|
|
|
{
|
|
|
|
|
if (cur_state_index == 0)
|
|
|
|
|
{
|
|
|
|
|
if (top_ok_p)
|
|
|
|
|
asm_state_stack[cur_state_index] = ASM_INIT;
|
|
|
|
|
else
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: unexpected state pop");
|
1998-02-21 03:26:47 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
--cur_state_index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_asm_state (state)
|
|
|
|
|
asm_state state;
|
|
|
|
|
{
|
|
|
|
|
CUR_ASM_STATE = state;
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-22 17:55:19 +00:00
|
|
|
|
void
|
|
|
|
|
md_operand (expressionP)
|
|
|
|
|
expressionS *expressionP;
|
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Check if this is a '*' for mpgloc. */
|
|
|
|
|
if (cur_opcode
|
|
|
|
|
&& (cur_opcode->flags & VIF_OPCODE_MPG) != 0
|
|
|
|
|
&& (cur_operand->flags & DVP_OPERAND_VU_ADDRESS) != 0
|
|
|
|
|
&& *input_line_pointer == '*')
|
|
|
|
|
{
|
|
|
|
|
expressionP->X_op = O_symbol;
|
|
|
|
|
expressionP->X_add_symbol = mpgloc_sym;
|
|
|
|
|
expressionP->X_add_number = 0;
|
|
|
|
|
|
|
|
|
|
/* Advance over the '*'. */
|
|
|
|
|
++input_line_pointer;
|
|
|
|
|
}
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
valueT
|
|
|
|
|
md_section_align (segment, size)
|
|
|
|
|
segT segment;
|
|
|
|
|
valueT size;
|
|
|
|
|
{
|
|
|
|
|
int align = bfd_get_section_alignment (stdoutput, segment);
|
|
|
|
|
return ((size + (1 << align) - 1) & (-1 << align));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
symbolS *
|
|
|
|
|
md_undefined_symbol (name)
|
|
|
|
|
char *name;
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1998-01-29 17:06:52 +00:00
|
|
|
|
|
|
|
|
|
/* Called after parsing the file via md_after_pass_hook. */
|
|
|
|
|
|
|
|
|
|
void
|
1998-02-24 19:04:22 +00:00
|
|
|
|
dvp_after_pass_hook ()
|
1998-01-29 17:06:52 +00:00
|
|
|
|
{
|
1998-03-17 18:51:57 +00:00
|
|
|
|
/* If doing dma packing, ensure the last dma tag is filled out. */
|
|
|
|
|
if (dma_pack_vif_p)
|
|
|
|
|
{
|
|
|
|
|
/* Nothing to do as vifnops are zero and frag_align at beginning
|
|
|
|
|
of dmatag is all we need. */
|
|
|
|
|
}
|
|
|
|
|
|
1998-02-20 20:48:39 +00:00
|
|
|
|
#if 0 /* ??? Doesn't work unless we keep track of the nested include file
|
|
|
|
|
level. */
|
1998-01-29 17:06:52 +00:00
|
|
|
|
/* Check for missing .EndMpg, and supply one if necessary. */
|
1998-02-21 03:26:47 +00:00
|
|
|
|
if (CUR_ASM_STATE == ASM_MPG)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
s_endmpg (ENDMPG_INTERNAL);
|
1998-02-21 03:26:47 +00:00
|
|
|
|
else if (CUR_ASM_STATE == ASM_DIRECT)
|
1998-01-29 17:06:52 +00:00
|
|
|
|
s_enddirect (0);
|
1998-02-21 03:26:47 +00:00
|
|
|
|
else if (CUR_ASM_STATE == ASM_UNPACK)
|
1998-01-29 17:06:52 +00:00
|
|
|
|
s_endunpack (0);
|
1998-02-20 20:48:39 +00:00
|
|
|
|
#endif
|
1998-01-29 17:06:52 +00:00
|
|
|
|
}
|
1998-02-24 19:04:22 +00:00
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* Called via tc_frob_label when a label is defined. */
|
1998-02-24 19:04:22 +00:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
dvp_frob_label (sym)
|
|
|
|
|
symbolS *sym;
|
|
|
|
|
{
|
1998-04-10 01:37:00 +00:00
|
|
|
|
const char * name = S_GET_NAME (sym);
|
|
|
|
|
|
1998-02-24 20:40:41 +00:00
|
|
|
|
/* All labels in vu code must be specially marked for the disassembler.
|
|
|
|
|
The disassembler ignores all previous information at each new label
|
|
|
|
|
(that has a higher address than the last one). */
|
1998-02-24 19:04:22 +00:00
|
|
|
|
if (CUR_ASM_STATE == ASM_MPG
|
|
|
|
|
|| CUR_ASM_STATE == ASM_VU)
|
|
|
|
|
S_SET_OTHER (sym, STO_DVP_VU);
|
1998-04-10 01:37:00 +00:00
|
|
|
|
|
|
|
|
|
/* If inside an mpg, move vu space labels to their own section and create
|
1998-05-11 19:49:29 +00:00
|
|
|
|
the corresponding _$ version in normal space. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
|
|
|
|
|
if (CUR_ASM_STATE == ASM_MPG
|
|
|
|
|
/* Only do this special processing for user specified symbols.
|
|
|
|
|
Not sure how we can distinguish them other than by some prefix. */
|
1998-05-11 19:49:29 +00:00
|
|
|
|
&& *name != '.' && *name != '$'
|
|
|
|
|
/* Check for recursive invocation creating the _$name. */
|
1998-05-29 00:39:03 +00:00
|
|
|
|
&& strncmp (name, VU_LABEL_PREFIX, sizeof (VU_LABEL_PREFIX) - 1) != 0
|
|
|
|
|
/* -gstabs creates FAKE_LABEL_NAME labels. There's probably a better
|
|
|
|
|
test than this. */
|
|
|
|
|
&& ! S_IS_LOCAL (sym))
|
1998-04-10 01:37:00 +00:00
|
|
|
|
{
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* Move this symbol to the vu overlay. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
symbolS * cur_mpgloc = compute_mpgloc (mpgloc_sym, vif_data_start,
|
|
|
|
|
expr_build_dot ());
|
1998-05-28 23:29:19 +00:00
|
|
|
|
#if 0 /* Don't do this now, leave in ABS and then move to overlay
|
|
|
|
|
section before file is written. */
|
|
|
|
|
S_SET_SEGMENT (sym, vuoverlay_section);
|
|
|
|
|
#else
|
|
|
|
|
/* Record the overlay section this symbol is in. */
|
|
|
|
|
{
|
|
|
|
|
ovlysymS *p = (ovlysymS *) xmalloc (sizeof (ovlysymS));
|
|
|
|
|
p->next = ovlysym_table;
|
|
|
|
|
p->sec = vuoverlay_section;
|
|
|
|
|
p->sym = sym;
|
|
|
|
|
ovlysym_table = p;
|
|
|
|
|
}
|
1998-04-10 01:37:00 +00:00
|
|
|
|
S_SET_SEGMENT (sym, expr_section);
|
1998-05-28 23:29:19 +00:00
|
|
|
|
#endif
|
1998-04-10 01:37:00 +00:00
|
|
|
|
sym->sy_value = cur_mpgloc->sy_value;
|
|
|
|
|
sym->sy_frag = &zero_address_frag;
|
|
|
|
|
|
1998-05-11 19:49:29 +00:00
|
|
|
|
/* Create the _$ symbol in normal space. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
create_colon_label (STO_DVP_VU, VU_LABEL_PREFIX, name);
|
|
|
|
|
}
|
1998-02-24 19:04:22 +00:00
|
|
|
|
}
|
1998-05-28 23:29:19 +00:00
|
|
|
|
|
|
|
|
|
/* Move vu space symbols into their overlay sections.
|
|
|
|
|
Called via tc_frob_file. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
dvp_frob_file ()
|
|
|
|
|
{
|
|
|
|
|
ovlysymS *p;
|
|
|
|
|
|
|
|
|
|
for (p = ovlysym_table; p; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
/* See the comment near tc_frob_file in write.c.
|
|
|
|
|
We are responsible for updating sym->bsym->value. */
|
|
|
|
|
S_SET_SEGMENT (p->sym, p->sec);
|
|
|
|
|
/* Adjust for the section's vma. */
|
|
|
|
|
p->sym->bsym->value -= bfd_get_section_vma (stdoutput, p->sec);
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-12-22 17:55:19 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* mpg/direct alignment is handled via relaxation */
|
|
|
|
|
|
|
|
|
|
/* Return an initial guess of the length by which a fragment must grow to
|
|
|
|
|
hold a branch to reach its destination.
|
|
|
|
|
Also updates fr_type/fr_subtype as necessary.
|
|
|
|
|
|
|
|
|
|
Called just before doing relaxation.
|
|
|
|
|
Any symbol that is now undefined will not become defined.
|
|
|
|
|
The guess for fr_var is ACTUALLY the growth beyond fr_fix.
|
|
|
|
|
Whatever we do to grow fr_fix or fr_var contributes to our returned value.
|
|
|
|
|
Although it may not be explicit in the frag, pretend fr_var starts with a
|
|
|
|
|
0 value. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
md_estimate_size_before_relax (fragP, segment)
|
|
|
|
|
fragS * fragP;
|
|
|
|
|
segT segment;
|
|
|
|
|
{
|
|
|
|
|
/* Our initial estimate is always 0. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Perform the relaxation.
|
|
|
|
|
All we have to do is figure out how many bytes we need to insert to
|
1998-04-10 01:37:00 +00:00
|
|
|
|
get to the recorded symbol (which is at the required alignment).
|
|
|
|
|
This function is also called for machine dependent vu insn frags.
|
|
|
|
|
In this case the growth is always 0. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
|
|
|
|
long
|
|
|
|
|
dvp_relax_frag (fragP, stretch)
|
|
|
|
|
fragS * fragP;
|
|
|
|
|
long stretch;
|
|
|
|
|
{
|
|
|
|
|
/* Address of variable part. */
|
|
|
|
|
long address = fragP->fr_address + fragP->fr_fix;
|
|
|
|
|
/* Symbol marking start of data. */
|
|
|
|
|
symbolS * symbolP = fragP->fr_symbol;
|
|
|
|
|
/* Address of the symbol. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
long target;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
long growth;
|
|
|
|
|
|
|
|
|
|
/* subtype >= 10 means "done" */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
if (RELAX_DONE_P (fragP->fr_subtype))
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* vu insn? */
|
|
|
|
|
if (fragP->fr_subtype == RELAX_VU)
|
|
|
|
|
{
|
|
|
|
|
fragP->fr_subtype = RELAX_ENCODE (RELAX_VU, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
target = S_GET_VALUE (symbolP) + symbolP->sy_frag->fr_address;
|
|
|
|
|
|
|
|
|
|
if (fragP->fr_subtype == RELAX_MPG)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
{
|
|
|
|
|
growth = target - address;
|
|
|
|
|
if (growth < 0)
|
|
|
|
|
as_fatal ("internal error: bad mpg alignment handling");
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fragP->fr_subtype = RELAX_ENCODE (RELAX_MPG, growth);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
return growth;
|
|
|
|
|
}
|
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
if (fragP->fr_subtype == RELAX_DIRECT)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
{
|
|
|
|
|
growth = target - address;
|
|
|
|
|
if (growth < 0)
|
|
|
|
|
as_fatal ("internal error: bad direct alignment handling");
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fragP->fr_subtype = RELAX_ENCODE (RELAX_DIRECT, growth);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
return growth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
as_fatal ("internal error: unknown fr_subtype");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* *fragP has been relaxed to its final size, and now needs to have
|
|
|
|
|
the bytes inside it modified to conform to the new size.
|
|
|
|
|
|
|
|
|
|
Called after relaxation is finished.
|
|
|
|
|
fragP->fr_type == rs_machine_dependent.
|
|
|
|
|
fragP->fr_subtype is the subtype of what the address relaxed to. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
md_convert_frag (abfd, sec, fragP)
|
|
|
|
|
bfd * abfd;
|
|
|
|
|
segT sec;
|
|
|
|
|
fragS * fragP;
|
|
|
|
|
{
|
1998-04-10 01:37:00 +00:00
|
|
|
|
int growth = RELAX_GROWTH (fragP->fr_subtype);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
|
|
|
|
fragP->fr_fix += growth;
|
|
|
|
|
|
|
|
|
|
if (growth != 0)
|
|
|
|
|
{
|
|
|
|
|
/* We had to grow this fragment. Shift the mpg/direct insn to the end
|
|
|
|
|
(so it abuts the following data). */
|
|
|
|
|
DVP_INSN insn = bfd_getl32 (fragP->fr_opcode);
|
|
|
|
|
md_number_to_chars (fragP->fr_opcode, VIFNOP, 4);
|
1998-04-07 19:26:40 +00:00
|
|
|
|
if (growth > 4)
|
|
|
|
|
md_number_to_chars (fragP->fr_opcode + 4, VIFNOP, 4);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
if (growth > 8)
|
1998-04-07 19:26:40 +00:00
|
|
|
|
md_number_to_chars (fragP->fr_opcode + 8, VIFNOP, 4);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
md_number_to_chars (fragP->fr_literal + fragP->fr_fix - 4, insn, 4);
|
|
|
|
|
|
|
|
|
|
/* Adjust fr_opcode so md_apply_fix3 works with the right bytes. */
|
|
|
|
|
fragP->fr_opcode += growth;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-22 17:55:19 +00:00
|
|
|
|
/* Functions concerning relocs. */
|
|
|
|
|
|
1998-01-27 22:17:11 +00:00
|
|
|
|
/* Spacing between each cpu type's operand numbers.
|
1998-03-17 18:51:57 +00:00
|
|
|
|
Should be at least as big as any operand table. */
|
1998-01-27 22:17:11 +00:00
|
|
|
|
#define RELOC_SPACING 256
|
|
|
|
|
|
|
|
|
|
/* Given a cpu type and operand number, return a temporary reloc type
|
|
|
|
|
for use in generating the fixup that encodes the cpu type and operand
|
|
|
|
|
number. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
encode_fixup_reloc_type (cpu, opnum)
|
1998-01-28 14:05:49 +00:00
|
|
|
|
dvp_cpu cpu;
|
1998-01-27 22:17:11 +00:00
|
|
|
|
int opnum;
|
|
|
|
|
{
|
|
|
|
|
return (int) BFD_RELOC_UNUSED + ((int) cpu * RELOC_SPACING) + opnum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a fixup reloc type, decode it into cpu type and operand. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
decode_fixup_reloc_type (fixup_reloc, cpuP, operandP)
|
|
|
|
|
int fixup_reloc;
|
1998-01-28 14:05:49 +00:00
|
|
|
|
dvp_cpu *cpuP;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
const dvp_operand **operandP;
|
1998-01-27 22:17:11 +00:00
|
|
|
|
{
|
1998-01-28 14:05:49 +00:00
|
|
|
|
dvp_cpu cpu = (fixup_reloc - (int) BFD_RELOC_UNUSED) / RELOC_SPACING;
|
1998-01-27 22:17:11 +00:00
|
|
|
|
int opnum = (fixup_reloc - (int) BFD_RELOC_UNUSED) % RELOC_SPACING;
|
|
|
|
|
|
|
|
|
|
*cpuP = cpu;
|
|
|
|
|
switch (cpu)
|
|
|
|
|
{
|
1998-01-28 14:05:49 +00:00
|
|
|
|
case DVP_VUUP : *operandP = &vu_operands[opnum]; break;
|
|
|
|
|
case DVP_VULO : *operandP = &vu_operands[opnum]; break;
|
|
|
|
|
case DVP_DMA : *operandP = &dma_operands[opnum]; break;
|
1998-02-11 23:40:43 +00:00
|
|
|
|
case DVP_VIF : *operandP = &vif_operands[opnum]; break;
|
|
|
|
|
case DVP_GIF : *operandP = &gif_operands[opnum]; break;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
default : as_fatal ("internal error: bad fixup encoding");
|
1998-01-27 22:17:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-22 17:55:19 +00:00
|
|
|
|
/* The location from which a PC relative jump should be calculated,
|
|
|
|
|
given a PC relative reloc. */
|
|
|
|
|
|
|
|
|
|
long
|
|
|
|
|
md_pcrel_from_section (fixP, sec)
|
|
|
|
|
fixS *fixP;
|
|
|
|
|
segT sec;
|
|
|
|
|
{
|
|
|
|
|
if (fixP->fx_addsy != (symbolS *) NULL
|
|
|
|
|
&& (! S_IS_DEFINED (fixP->fx_addsy)
|
|
|
|
|
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
|
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* If fx_tcbit is set this is for a vif insn and thus should never
|
|
|
|
|
happen in correct code. */
|
|
|
|
|
/* ??? The error message could be a bit more descriptive. */
|
|
|
|
|
if (fixP->fx_tcbit)
|
|
|
|
|
as_bad ("unable to compute length of vif insn");
|
1997-12-22 17:55:19 +00:00
|
|
|
|
/* The symbol is undefined (or is defined but not in this section).
|
1998-01-31 00:04:27 +00:00
|
|
|
|
Let the linker figure it out. +8: branch offsets are relative to the
|
|
|
|
|
delay slot. */
|
|
|
|
|
return 8;
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* If fx_tcbit is set, this is a vif end-of-variable-length-insn marker.
|
|
|
|
|
In this case the offset is relative to the start of data.
|
|
|
|
|
Otherwise we assume this is a vu branch. In this case
|
|
|
|
|
offsets are calculated based on the address of the next insn. */
|
|
|
|
|
if (fixP->fx_tcbit)
|
|
|
|
|
{
|
|
|
|
|
/* As a further refinement, if fr_opcode is NULL this is `unpack'
|
|
|
|
|
which doesn't involve any relaxing. */
|
|
|
|
|
if (fixP->fx_frag->fr_opcode == NULL)
|
|
|
|
|
return fixP->fx_frag->fr_address + fixP->fx_where + 4;
|
|
|
|
|
else
|
|
|
|
|
return fixP->fx_frag->fr_address + fixP->fx_frag->fr_fix;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return ((fixP->fx_frag->fr_address + fixP->fx_where) & -8L) + 8;
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Apply a fixup to the object code. This is called for all the
|
|
|
|
|
fixups we generated by calls to fix_new_exp. At this point all symbol
|
|
|
|
|
values should be fully resolved, and we attempt to completely resolve the
|
|
|
|
|
reloc. If we can not do that, we determine the correct reloc code and put
|
|
|
|
|
it back in the fixup. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
md_apply_fix3 (fixP, valueP, seg)
|
|
|
|
|
fixS *fixP;
|
|
|
|
|
valueT *valueP;
|
|
|
|
|
segT seg;
|
|
|
|
|
{
|
|
|
|
|
char *where = fixP->fx_frag->fr_literal + fixP->fx_where;
|
|
|
|
|
valueT value;
|
|
|
|
|
|
1998-01-21 00:30:46 +00:00
|
|
|
|
/* FIXME FIXME FIXME: The value we are passed in *valueP includes
|
|
|
|
|
the symbol values. Since we are using BFD_ASSEMBLER, if we are
|
|
|
|
|
doing this relocation the code in write.c is going to call
|
|
|
|
|
bfd_perform_relocation, which is also going to use the symbol
|
|
|
|
|
value. That means that if the reloc is fully resolved we want to
|
|
|
|
|
use *valueP since bfd_perform_relocation is not being used.
|
|
|
|
|
However, if the reloc is not fully resolved we do not want to use
|
|
|
|
|
*valueP, and must use fx_offset instead. However, if the reloc
|
|
|
|
|
is PC relative, we do want to use *valueP since it includes the
|
|
|
|
|
result of md_pcrel_from. This is confusing. */
|
|
|
|
|
|
|
|
|
|
if (fixP->fx_addsy == (symbolS *) NULL)
|
|
|
|
|
{
|
|
|
|
|
value = *valueP;
|
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (fixP->fx_pcrel)
|
|
|
|
|
{
|
|
|
|
|
value = *valueP;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
|
if (fixP->fx_subsy != (symbolS *) NULL)
|
|
|
|
|
{
|
|
|
|
|
if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
|
|
|
|
|
value -= S_GET_VALUE (fixP->fx_subsy);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* We can't actually support subtracting a symbol. */
|
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
|
|
|
|
"expression too complex");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Check for dvp operands. These are indicated with a reloc value
|
1998-01-21 00:30:46 +00:00
|
|
|
|
>= BFD_RELOC_UNUSED. */
|
|
|
|
|
|
|
|
|
|
if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
|
|
|
|
|
{
|
1998-01-28 14:05:49 +00:00
|
|
|
|
dvp_cpu cpu;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
const dvp_operand *operand;
|
|
|
|
|
DVP_INSN insn;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
fragS *fragP = fixP->fx_frag;
|
|
|
|
|
|
|
|
|
|
/* If this was a relaxable insn, the opcode may have moved. Find it. */
|
|
|
|
|
if (fragP->fr_opcode != NULL)
|
|
|
|
|
where = fragP->fr_opcode;
|
1998-01-21 00:30:46 +00:00
|
|
|
|
|
1998-01-27 22:17:11 +00:00
|
|
|
|
decode_fixup_reloc_type ((int) fixP->fx_r_type,
|
|
|
|
|
& cpu, & operand);
|
1998-01-21 00:30:46 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* For variable length vif insn data lengths, validate the user specified
|
|
|
|
|
value or install the computed value in the instruction. */
|
|
|
|
|
if (cpu == DVP_VIF
|
|
|
|
|
&& (operand - vif_operands) == vif_operand_datalen_special)
|
|
|
|
|
{
|
1998-04-16 22:07:02 +00:00
|
|
|
|
int insn_type = vif_insn_type (where[3]);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
value = vif_length_value (where[3],
|
|
|
|
|
fixP->tc_fix_data.wl, fixP->tc_fix_data.cl,
|
|
|
|
|
value);
|
|
|
|
|
if (fixP->tc_fix_data.user_value != -1)
|
|
|
|
|
{
|
1998-04-16 22:07:02 +00:00
|
|
|
|
/* We can't do this for unpack insns with wl > cl. */
|
|
|
|
|
if ((insn_type != VIF_OPCODE_UNPACK
|
|
|
|
|
|| (fixP->tc_fix_data.wl <= fixP->tc_fix_data.cl))
|
|
|
|
|
&& fixP->tc_fix_data.user_value != value)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_warn_where (fixP->fx_file, fixP->fx_line,
|
|
|
|
|
"specified length value doesn't match computed value");
|
|
|
|
|
/* Don't override the user specified value. */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (output_vif)
|
|
|
|
|
{
|
|
|
|
|
install_vif_length (where, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1998-03-16 18:22:18 +00:00
|
|
|
|
/* For the gif nloop operand, if it was specified by the user ensure
|
|
|
|
|
it matches the value we computed. */
|
|
|
|
|
if (cpu == DVP_GIF
|
|
|
|
|
&& (operand - gif_operands) == gif_operand_nloop)
|
|
|
|
|
{
|
|
|
|
|
value = compute_nloop (fixP->tc_fix_data.type,
|
|
|
|
|
fixP->tc_fix_data.nregs,
|
|
|
|
|
value);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
if (fixP->tc_fix_data.user_value != -1)
|
1998-03-16 18:22:18 +00:00
|
|
|
|
{
|
|
|
|
|
check_nloop (fixP->tc_fix_data.type,
|
|
|
|
|
fixP->tc_fix_data.nregs,
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
fixP->tc_fix_data.user_value,
|
1998-03-16 18:22:18 +00:00
|
|
|
|
value,
|
|
|
|
|
fixP->fx_file, fixP->fx_line);
|
|
|
|
|
/* Don't override the user specified value. */
|
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-01-21 00:30:46 +00:00
|
|
|
|
/* Fetch the instruction, insert the fully resolved operand
|
1998-02-19 10:24:15 +00:00
|
|
|
|
value, and stuff the instruction back again. The fixup is recorded
|
|
|
|
|
at the appropriate word so pass DVP_MOD_THIS_WORD so any offset
|
|
|
|
|
specified in the tables is ignored. */
|
1998-01-21 00:30:46 +00:00
|
|
|
|
insn = bfd_getl32 ((unsigned char *) where);
|
1998-01-28 19:35:31 +00:00
|
|
|
|
insert_operand_final (cpu, operand, DVP_MOD_THIS_WORD, &insn,
|
|
|
|
|
(offsetT) value, fixP->fx_file, fixP->fx_line);
|
1998-01-21 00:30:46 +00:00
|
|
|
|
bfd_putl32 ((bfd_vma) insn, (unsigned char *) where);
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* If this is mpgloc/unpackloc, we're done. */
|
|
|
|
|
if (operand->flags & (DVP_OPERAND_VU_ADDRESS | DVP_OPERAND_UNPACK_ADDRESS))
|
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
|
1998-01-21 00:30:46 +00:00
|
|
|
|
if (fixP->fx_done)
|
|
|
|
|
{
|
|
|
|
|
/* Nothing else to do here. */
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determine a BFD reloc value based on the operand information.
|
|
|
|
|
We are only prepared to turn a few of the operands into relocs. */
|
1998-01-28 10:15:09 +00:00
|
|
|
|
if ((operand->flags & DVP_OPERAND_RELATIVE_BRANCH) != 0)
|
1998-01-21 00:30:46 +00:00
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
assert (operand->bits == 11
|
1998-01-21 00:30:46 +00:00
|
|
|
|
&& operand->shift == 0);
|
1998-04-10 01:37:00 +00:00
|
|
|
|
|
|
|
|
|
/* The fixup isn't recorded as a pc relative branch to some label.
|
|
|
|
|
Instead a complicated expression is used to compute the desired
|
|
|
|
|
value. Well, that didn't work and we have to emit a reloc.
|
|
|
|
|
Things are tricky because the result we want is the difference
|
|
|
|
|
of two addresses in a section potentially different from the one
|
|
|
|
|
the reloc is in. Ugh.
|
|
|
|
|
The solution is to emit two relocs, one that adds the target
|
|
|
|
|
address and one that subtracts the source address + 8 (the
|
|
|
|
|
linker will perform the byte->dword conversion).
|
|
|
|
|
This is rather complicated and rather than risk breaking
|
|
|
|
|
existing code we fall back on the old way if the file only
|
|
|
|
|
contains vu code. In this case the file is intended to
|
|
|
|
|
be fully linked with other vu code and thus we have a normal
|
|
|
|
|
situation where the relocation directly corresponds to the
|
|
|
|
|
branch insn. */
|
|
|
|
|
|
|
|
|
|
if (non_vu_insn_seen_p)
|
|
|
|
|
{
|
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
|
|
|
|
"can't handle mpg loaded vu code with branch relocations");
|
1998-04-13 19:22:26 +00:00
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
return 1;
|
1998-04-10 01:37:00 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fixP->fx_r_type = BFD_RELOC_MIPS_DVP_11_PCREL;
|
|
|
|
|
}
|
1998-01-21 00:30:46 +00:00
|
|
|
|
}
|
1998-02-19 22:51:08 +00:00
|
|
|
|
else if ((operand->flags & DVP_OPERAND_DMA_ADDR) != 0
|
|
|
|
|
|| (operand->flags & DVP_OPERAND_DMA_NEXT) != 0)
|
1998-02-19 10:24:15 +00:00
|
|
|
|
{
|
|
|
|
|
assert (operand->bits == 27
|
|
|
|
|
&& operand->shift == 4);
|
|
|
|
|
fixP->fx_r_type = BFD_RELOC_MIPS_DVP_27_S4;
|
|
|
|
|
}
|
1998-01-21 00:30:46 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
|
|
|
|
"unresolved expression that must be resolved");
|
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-05-28 23:29:19 +00:00
|
|
|
|
else if (fixP->fx_done)
|
1998-01-21 00:30:46 +00:00
|
|
|
|
{
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* We're finished with this fixup. Install it because
|
|
|
|
|
bfd_install_relocation won't be called to do it. */
|
1998-01-21 00:30:46 +00:00
|
|
|
|
switch (fixP->fx_r_type)
|
|
|
|
|
{
|
|
|
|
|
case BFD_RELOC_8:
|
|
|
|
|
md_number_to_chars (where, value, 1);
|
|
|
|
|
break;
|
|
|
|
|
case BFD_RELOC_16:
|
|
|
|
|
md_number_to_chars (where, value, 2);
|
|
|
|
|
break;
|
|
|
|
|
case BFD_RELOC_32:
|
|
|
|
|
md_number_to_chars (where, value, 4);
|
|
|
|
|
break;
|
1998-05-29 01:08:08 +00:00
|
|
|
|
case BFD_RELOC_64:
|
|
|
|
|
md_number_to_chars (where, value, 8);
|
|
|
|
|
break;
|
1998-01-21 00:30:46 +00:00
|
|
|
|
default:
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: unexpected fixup");
|
1998-01-21 00:30:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
1998-05-28 23:29:19 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* bfd_install_relocation will be called to finish things up. */
|
|
|
|
|
}
|
1998-01-21 00:30:46 +00:00
|
|
|
|
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* Tuck `value' away for use by tc_gen_reloc.
|
|
|
|
|
See the comment describing fx_addnumber in write.h. */
|
1998-01-21 00:30:46 +00:00
|
|
|
|
fixP->fx_addnumber = value;
|
|
|
|
|
|
|
|
|
|
return 1;
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Translate internal representation of relocation info to BFD target
|
|
|
|
|
format. */
|
|
|
|
|
|
|
|
|
|
arelent *
|
1998-01-21 00:30:46 +00:00
|
|
|
|
tc_gen_reloc (section, fixP)
|
1997-12-22 17:55:19 +00:00
|
|
|
|
asection *section;
|
1998-01-21 00:30:46 +00:00
|
|
|
|
fixS *fixP;
|
1997-12-22 17:55:19 +00:00
|
|
|
|
{
|
1998-01-21 00:30:46 +00:00
|
|
|
|
arelent *reloc;
|
|
|
|
|
|
|
|
|
|
reloc = (arelent *) xmalloc (sizeof (arelent));
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
"internal error: can't export reloc type %d (`%s')",
|
|
|
|
|
fixP->fx_r_type, bfd_get_reloc_code_name (fixP->fx_r_type));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
|
|
|
|
|
|
|
|
|
|
reloc->addend = fixP->fx_addnumber;
|
|
|
|
|
|
|
|
|
|
return reloc;
|
1997-12-22 17:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write a value out to the object file, using the appropriate endianness. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
md_number_to_chars (buf, val, n)
|
|
|
|
|
char *buf;
|
|
|
|
|
valueT val;
|
|
|
|
|
int n;
|
|
|
|
|
{
|
|
|
|
|
if (target_big_endian)
|
|
|
|
|
number_to_chars_bigendian (buf, val, n);
|
|
|
|
|
else
|
|
|
|
|
number_to_chars_littleendian (buf, val, n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Equal to MAX_PRECISION in atof-ieee.c */
|
|
|
|
|
#define MAX_LITTLENUMS 6
|
|
|
|
|
|
|
|
|
|
char *
|
|
|
|
|
md_atof (type, litP, sizeP)
|
|
|
|
|
char type;
|
|
|
|
|
char *litP;
|
|
|
|
|
int *sizeP;
|
|
|
|
|
{
|
|
|
|
|
int i,prec;
|
|
|
|
|
LITTLENUM_TYPE words[MAX_LITTLENUMS];
|
|
|
|
|
LITTLENUM_TYPE *wordP;
|
|
|
|
|
char *t;
|
|
|
|
|
char *atof_ieee ();
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case 'f':
|
|
|
|
|
case 'F':
|
|
|
|
|
case 's':
|
|
|
|
|
case 'S':
|
|
|
|
|
prec = 2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
|
case 'D':
|
|
|
|
|
case 'r':
|
|
|
|
|
case 'R':
|
|
|
|
|
prec = 4;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* FIXME: Some targets allow other format chars for bigger sizes here. */
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
*sizeP = 0;
|
|
|
|
|
return "Bad call to md_atof()";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t = atof_ieee (input_line_pointer, type, words);
|
|
|
|
|
if (t)
|
|
|
|
|
input_line_pointer = t;
|
|
|
|
|
*sizeP = prec * sizeof (LITTLENUM_TYPE);
|
|
|
|
|
|
|
|
|
|
if (target_big_endian)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < prec; i++)
|
|
|
|
|
{
|
|
|
|
|
md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
|
|
|
|
|
litP += sizeof (LITTLENUM_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (i = prec - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
|
|
|
|
|
litP += sizeof (LITTLENUM_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1998-01-21 00:30:46 +00:00
|
|
|
|
|
1998-02-19 22:51:08 +00:00
|
|
|
|
/* Miscellaneous utilities. */
|
|
|
|
|
|
1998-02-18 23:56:15 +00:00
|
|
|
|
/* Parse a 32 bit floating point number.
|
|
|
|
|
The result is those 32 bits as an integer. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
parse_float (pstr, errmsg)
|
|
|
|
|
char **pstr;
|
|
|
|
|
const char **errmsg;
|
|
|
|
|
{
|
|
|
|
|
LITTLENUM_TYPE words[MAX_LITTLENUMS];
|
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
|
|
p = atof_ieee (*pstr, 'f', words);
|
|
|
|
|
*pstr = p;
|
|
|
|
|
return (words[0] << 16) | words[1];
|
|
|
|
|
}
|
1998-01-29 13:22:46 +00:00
|
|
|
|
|
1998-02-19 22:51:08 +00:00
|
|
|
|
/* Scan a symbol and return a pointer to one past the end. */
|
1998-01-29 13:22:46 +00:00
|
|
|
|
|
|
|
|
|
#define issymchar(ch) (isalnum(ch) || ch == '_')
|
|
|
|
|
static char *
|
1998-02-19 10:24:15 +00:00
|
|
|
|
scan_symbol (sym)
|
1998-01-29 13:22:46 +00:00
|
|
|
|
char *sym;
|
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
while (*sym && issymchar (*sym))
|
|
|
|
|
++sym;
|
|
|
|
|
return sym;
|
1998-01-29 13:22:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Evaluate an expression for an operand.
|
1998-02-19 10:24:15 +00:00
|
|
|
|
The result is the value of the expression if it can be evaluated,
|
|
|
|
|
or 0 if it cannot (say because some symbols haven't been defined yet)
|
1998-02-21 02:12:15 +00:00
|
|
|
|
in which case a fixup is queued.
|
|
|
|
|
|
|
|
|
|
If OPINDEX is 0, don't queue any fixups, just return 0. */
|
1998-02-19 10:24:15 +00:00
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
#ifdef USE_STDARG
|
1998-04-10 01:37:00 +00:00
|
|
|
|
eval_expr (dvp_cpu cpu, int opindex, int offset, const char *fmt, ...)
|
1998-02-19 10:24:15 +00:00
|
|
|
|
#else
|
1998-04-10 01:37:00 +00:00
|
|
|
|
eval_expr (cpu, opindex, offset, fmt, va_alist)
|
|
|
|
|
dvp_cpu cpu;
|
1998-02-19 10:24:15 +00:00
|
|
|
|
int opindex,offset;
|
|
|
|
|
const char *fmt;
|
|
|
|
|
va_dcl
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
long value;
|
|
|
|
|
va_list ap;
|
|
|
|
|
char *str,*save_input;
|
|
|
|
|
expressionS exp;
|
|
|
|
|
|
|
|
|
|
#ifdef USE_STDARG
|
|
|
|
|
va_start (ap, fmt);
|
|
|
|
|
#else
|
|
|
|
|
va_start (ap);
|
|
|
|
|
#endif
|
|
|
|
|
vasprintf (&str, fmt, ap);
|
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
|
|
save_input = input_line_pointer;
|
|
|
|
|
input_line_pointer = str;
|
|
|
|
|
expression (&exp);
|
|
|
|
|
input_line_pointer = save_input;
|
|
|
|
|
free (str);
|
|
|
|
|
if (exp.X_op == O_constant)
|
|
|
|
|
value = exp.X_add_number;
|
|
|
|
|
else
|
1998-01-29 13:22:46 +00:00
|
|
|
|
{
|
1998-02-21 02:12:15 +00:00
|
|
|
|
if (opindex != 0)
|
|
|
|
|
{
|
1998-04-10 01:37:00 +00:00
|
|
|
|
fixups[fixup_count].cpu = cpu;
|
1998-02-21 02:12:15 +00:00
|
|
|
|
fixups[fixup_count].exp = exp;
|
|
|
|
|
fixups[fixup_count].opindex = opindex;
|
|
|
|
|
fixups[fixup_count].offset = offset;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
fixups[fixup_count].user_value = -1;
|
|
|
|
|
fixups[fixup_count].wl = -1;
|
|
|
|
|
fixups[fixup_count].cl = -1;
|
1998-02-21 02:12:15 +00:00
|
|
|
|
++fixup_count;
|
|
|
|
|
}
|
1998-02-19 10:24:15 +00:00
|
|
|
|
value = 0;
|
1998-01-29 13:22:46 +00:00
|
|
|
|
}
|
1998-02-19 10:24:15 +00:00
|
|
|
|
return value;
|
|
|
|
|
}
|
1998-01-29 13:22:46 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Create a label named by concatenating PREFIX to NAME. */
|
1998-01-29 13:22:46 +00:00
|
|
|
|
|
1998-02-21 06:28:18 +00:00
|
|
|
|
static symbolS *
|
1998-02-19 10:24:15 +00:00
|
|
|
|
create_label (prefix, name)
|
|
|
|
|
const char *prefix, *name;
|
|
|
|
|
{
|
|
|
|
|
int namelen = strlen (name);
|
|
|
|
|
int prefixlen = strlen (prefix);
|
|
|
|
|
char *fullname;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
symbolS *result;
|
1998-02-19 10:24:15 +00:00
|
|
|
|
|
|
|
|
|
fullname = xmalloc (prefixlen + namelen + 1);
|
|
|
|
|
strcpy (fullname, prefix);
|
|
|
|
|
strcat (fullname, name);
|
|
|
|
|
result = symbol_find_or_make (fullname);
|
|
|
|
|
free (fullname);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
1998-01-29 13:22:46 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Create a label named by concatenating PREFIX to NAME,
|
1998-02-24 20:40:41 +00:00
|
|
|
|
and define it as `.'.
|
|
|
|
|
STO, if non-zero, is the st_other value to assign to this label.
|
1998-03-17 22:10:10 +00:00
|
|
|
|
If STO is zero `cur_cpu', call force_mach_label to force record_mach to
|
1998-02-24 20:40:41 +00:00
|
|
|
|
emit a cpu label. Otherwise the disassembler gets confused. */
|
1998-01-29 13:22:46 +00:00
|
|
|
|
|
1998-02-21 06:28:18 +00:00
|
|
|
|
static symbolS *
|
1998-02-24 20:40:41 +00:00
|
|
|
|
create_colon_label (sto, prefix, name)
|
|
|
|
|
int sto;
|
1998-02-19 10:24:15 +00:00
|
|
|
|
const char *prefix, *name;
|
|
|
|
|
{
|
|
|
|
|
int namelen = strlen (name);
|
|
|
|
|
int prefixlen = strlen (prefix);
|
|
|
|
|
char *fullname;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
symbolS *result;
|
1998-02-19 10:24:15 +00:00
|
|
|
|
|
|
|
|
|
fullname = xmalloc (prefixlen + namelen + 1);
|
|
|
|
|
strcpy (fullname, prefix);
|
|
|
|
|
strcat (fullname, name);
|
|
|
|
|
result = colon (fullname);
|
1998-02-24 20:40:41 +00:00
|
|
|
|
if (sto)
|
|
|
|
|
S_SET_OTHER (result, sto);
|
|
|
|
|
else
|
1998-03-17 22:10:10 +00:00
|
|
|
|
force_mach_label ();
|
1998-02-19 10:24:15 +00:00
|
|
|
|
free (fullname);
|
|
|
|
|
return result;
|
1998-01-29 13:22:46 +00:00
|
|
|
|
}
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
1998-02-21 06:28:18 +00:00
|
|
|
|
/* Return a malloc'd string useful in creating unique labels.
|
|
|
|
|
PREFIX is the prefix to use or NULL if we're to pick one. */
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
|
|
|
|
static char *
|
1998-02-21 06:28:18 +00:00
|
|
|
|
unique_name (prefix)
|
|
|
|
|
const char *prefix;
|
1998-02-19 22:51:08 +00:00
|
|
|
|
{
|
|
|
|
|
static int counter;
|
|
|
|
|
char *result;
|
|
|
|
|
|
1998-02-21 06:28:18 +00:00
|
|
|
|
if (prefix == NULL)
|
1998-02-24 22:08:40 +00:00
|
|
|
|
prefix = UNIQUE_LABEL_PREFIX;
|
1998-02-21 06:28:18 +00:00
|
|
|
|
asprintf (&result, "%s%d", prefix, counter);
|
1998-02-19 22:51:08 +00:00
|
|
|
|
++counter;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
1998-05-28 23:29:19 +00:00
|
|
|
|
|
|
|
|
|
/* VU support. */
|
|
|
|
|
|
|
|
|
|
/* Return the name of the overlay section.
|
|
|
|
|
It must be unique among all overlays in the executable. */
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
vuoverlay_section_name (addr)
|
1998-05-29 01:08:08 +00:00
|
|
|
|
symbolS *addr;
|
1998-05-28 23:29:19 +00:00
|
|
|
|
{
|
|
|
|
|
char *section_name;
|
|
|
|
|
char *file;
|
|
|
|
|
unsigned int lineno;
|
|
|
|
|
unsigned int fileno;
|
|
|
|
|
/* One mpg may actually result in several, counter keeps track of this. */
|
|
|
|
|
static int counter;
|
|
|
|
|
|
|
|
|
|
as_where (&file, &lineno);
|
|
|
|
|
for (fileno = 0; *file; ++file)
|
|
|
|
|
fileno = (fileno << 1) + *file;
|
1998-05-29 01:08:08 +00:00
|
|
|
|
if (addr->sy_value.X_op == O_constant)
|
1998-05-31 22:46:56 +00:00
|
|
|
|
asprintf (§ion_name, "%s.0x%x.%u.%u.%d", SHNAME_DVP_OVERLAY_PREFIX,
|
1998-05-29 01:08:08 +00:00
|
|
|
|
(int) S_GET_VALUE (addr), fileno, lineno, counter);
|
|
|
|
|
else
|
1998-05-31 22:46:56 +00:00
|
|
|
|
asprintf (§ion_name, "%s.unknvma.%u.%u.%d", SHNAME_DVP_OVERLAY_PREFIX,
|
1998-05-29 01:08:08 +00:00
|
|
|
|
fileno, lineno, counter);
|
1998-05-28 23:29:19 +00:00
|
|
|
|
++counter;
|
|
|
|
|
return section_name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create a shadow section for VU code that starts at ADDR in vu space.
|
|
|
|
|
START_LABEL and END_LABEL, if non-NULL, are symbols marking the start and
|
|
|
|
|
end of the section. If NULL, no overlay tracking information is output. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
create_vuoverlay_section (section_name, addr, start_label, end_label)
|
|
|
|
|
const char *section_name;
|
1998-05-29 01:08:08 +00:00
|
|
|
|
/* Remember, expressions are recorded as symbols. */
|
|
|
|
|
symbolS *addr;
|
1998-05-28 23:29:19 +00:00
|
|
|
|
symbolS *start_label, *end_label;
|
|
|
|
|
{
|
|
|
|
|
/* Must preserve the current seg/subseg. */
|
|
|
|
|
segT orig_seg = now_seg;
|
|
|
|
|
subsegT orig_subseg = now_subseg;
|
|
|
|
|
|
1998-05-31 22:46:56 +00:00
|
|
|
|
/* Create and get handle of a vu overlay section. All vu symbols go here.
|
1998-05-28 23:29:19 +00:00
|
|
|
|
The section name must be unique in the entire executable.
|
|
|
|
|
We achieve this by encoding the source file name and file number. Ick.
|
|
|
|
|
??? A cleaner way would be if mpg took a new argument that named the
|
|
|
|
|
overlay. */
|
|
|
|
|
vuoverlay_section = subseg_new (section_name, 0);
|
1998-06-01 03:53:32 +00:00
|
|
|
|
bfd_set_section_flags (stdoutput, vuoverlay_section, SEC_CODE);
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* There's no point in setting the section vma as we can't get the linker
|
|
|
|
|
to preserve it. But what the heck ... It might be useful to the
|
|
|
|
|
objdump user. */
|
1998-05-29 01:08:08 +00:00
|
|
|
|
if (addr->sy_value.X_op == O_constant)
|
|
|
|
|
bfd_set_section_vma (stdoutput, vuoverlay_section, S_GET_VALUE (addr));
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* The size of the section won't be known until we see the .endmpg,
|
|
|
|
|
but we can compute it from the start and end labels. */
|
|
|
|
|
/* FIXME: This causes the section to occupy space in the file. */
|
|
|
|
|
if (start_label)
|
|
|
|
|
frag_var (rs_space, 1, 1, (relax_substateT) 0,
|
|
|
|
|
expr_build_binary (O_subtract, end_label, start_label),
|
|
|
|
|
(offsetT) 0, (char *) 0);
|
|
|
|
|
#if 0
|
|
|
|
|
/* Create a symbol marking the start of the section. */
|
|
|
|
|
begin_label = create_colon_label (STO_DVP_VU, "__start_", section_name);
|
|
|
|
|
#endif
|
|
|
|
|
|
1998-05-29 00:39:03 +00:00
|
|
|
|
#if 0 /* already done */
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* Initialize $.mpgloc. */
|
|
|
|
|
mpgloc_sym = expr_build_uconstant (addr);
|
1998-05-29 00:39:03 +00:00
|
|
|
|
#endif
|
1998-05-28 23:29:19 +00:00
|
|
|
|
|
|
|
|
|
#if 0 /* $.mpgloc is kept in the ABS section. */
|
|
|
|
|
S_SET_SEGMENT (mpgloc_sym, vuoverlay_section);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Add an entry to the vu overlay table. */
|
|
|
|
|
if (start_label)
|
|
|
|
|
{
|
|
|
|
|
expressionS exp;
|
1998-05-31 22:46:56 +00:00
|
|
|
|
const char *p;
|
|
|
|
|
symbolS * name_label;
|
|
|
|
|
|
|
|
|
|
/* Put the section name in the overlay string table. */
|
|
|
|
|
|
|
|
|
|
subseg_set (vuoverlay_string_section, 0);
|
|
|
|
|
name_label = create_colon_label (0, LOCAL_LABEL_PREFIX,
|
|
|
|
|
unique_name ("secstr"));
|
|
|
|
|
/* FIXME: should be a utility to do this. */
|
|
|
|
|
for (p = section_name; *p; ++p)
|
|
|
|
|
FRAG_APPEND_1_CHAR (*p);
|
|
|
|
|
FRAG_APPEND_1_CHAR (0);
|
1998-05-28 23:29:19 +00:00
|
|
|
|
|
|
|
|
|
subseg_set (vuoverlay_table_section, 0);
|
|
|
|
|
|
1998-05-31 22:46:56 +00:00
|
|
|
|
/* FIXME: should be a utility to do these. */
|
|
|
|
|
/* Offset into string table. */
|
|
|
|
|
exp.X_op = O_symbol;
|
|
|
|
|
exp.X_add_symbol = name_label;
|
|
|
|
|
exp.X_add_number = 0;
|
1998-06-03 17:27:56 +00:00
|
|
|
|
emit_expr (&exp, 4);
|
1998-05-31 22:46:56 +00:00
|
|
|
|
|
1998-05-28 23:29:19 +00:00
|
|
|
|
/* The section's lma. */
|
|
|
|
|
exp.X_op = O_symbol;
|
|
|
|
|
exp.X_add_symbol = start_label;
|
|
|
|
|
exp.X_add_number = 0;
|
1998-06-03 17:27:56 +00:00
|
|
|
|
emit_expr (&exp, 4);
|
1998-05-28 23:29:19 +00:00
|
|
|
|
|
|
|
|
|
/* The section's vma. */
|
1998-05-29 01:08:08 +00:00
|
|
|
|
exp.X_op = O_symbol;
|
|
|
|
|
exp.X_add_symbol = addr;
|
|
|
|
|
exp.X_add_number = 0;
|
1998-06-03 17:27:56 +00:00
|
|
|
|
emit_expr (&exp, 4);
|
1998-05-28 23:29:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Restore the original seg/subseg. */
|
|
|
|
|
subseg_set (orig_seg, orig_subseg);
|
|
|
|
|
}
|
1998-04-10 01:37:00 +00:00
|
|
|
|
|
|
|
|
|
/* Compute a value for $.mpgloc given a symbol at the start of a chunk
|
|
|
|
|
of code, the $.mpgloc value for the start, and a symbol at the end
|
|
|
|
|
of the chunk of code. */
|
|
|
|
|
|
|
|
|
|
static symbolS *
|
|
|
|
|
compute_mpgloc (startloc, startsym, endsym)
|
|
|
|
|
symbolS * startloc;
|
|
|
|
|
symbolS * startsym;
|
|
|
|
|
symbolS * endsym;
|
|
|
|
|
{
|
|
|
|
|
symbolS *s;
|
|
|
|
|
|
|
|
|
|
s = expr_build_binary (O_subtract, endsym, startsym);
|
|
|
|
|
s = expr_build_binary (O_add, startloc, s);
|
|
|
|
|
return s;
|
|
|
|
|
}
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
|
1998-03-16 18:22:18 +00:00
|
|
|
|
/* Compute a value for nloop. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
compute_nloop (type, nregs, bytes)
|
|
|
|
|
gif_type type;
|
|
|
|
|
int nregs, bytes;
|
|
|
|
|
{
|
|
|
|
|
int computed_nloop;
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case GIF_PACKED :
|
|
|
|
|
/* We can't compute a value if no regs were specified and there is a
|
|
|
|
|
non-zero amount of data. Just set to something useful, a warning
|
|
|
|
|
will be issued later. */
|
|
|
|
|
if (nregs == 0)
|
|
|
|
|
nregs = 1;
|
|
|
|
|
computed_nloop = (bytes >> 4) / nregs;
|
|
|
|
|
break;
|
|
|
|
|
case GIF_REGLIST :
|
|
|
|
|
if (nregs == 0)
|
|
|
|
|
nregs = 1;
|
|
|
|
|
computed_nloop = (bytes >> 3) / nregs;
|
|
|
|
|
break;
|
|
|
|
|
case GIF_IMAGE :
|
|
|
|
|
computed_nloop = bytes >> 4;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return computed_nloop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Issue a warning if the user specified nloop value doesn't match the
|
|
|
|
|
computed value. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
check_nloop (type, nregs, user_nloop, computed_nloop, file, line)
|
|
|
|
|
gif_type type;
|
|
|
|
|
int nregs,user_nloop,computed_nloop;
|
|
|
|
|
char *file;
|
|
|
|
|
unsigned int line;
|
|
|
|
|
{
|
|
|
|
|
if (user_nloop != computed_nloop)
|
|
|
|
|
as_warn_where (file, line, "nloop value does not match amount of data");
|
|
|
|
|
}
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
1998-02-24 00:00:18 +00:00
|
|
|
|
/* Compute the auto-count value for a DMA tag.
|
|
|
|
|
INLINE_P is non-zero if the dma data is inline. */
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
|
|
|
|
static void
|
1998-02-24 00:00:18 +00:00
|
|
|
|
setup_dma_autocount (name, insn_buf, inline_p)
|
1998-02-19 22:51:08 +00:00
|
|
|
|
const char *name;
|
|
|
|
|
DVP_INSN *insn_buf;
|
1998-02-24 00:00:18 +00:00
|
|
|
|
int inline_p;
|
1998-02-19 22:51:08 +00:00
|
|
|
|
{
|
|
|
|
|
long count;
|
|
|
|
|
|
1998-02-24 00:00:18 +00:00
|
|
|
|
if (inline_p)
|
|
|
|
|
{
|
|
|
|
|
/* -1: The count is the number of following quadwords, so skip the one
|
|
|
|
|
containing the dma tag. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
count = eval_expr (DVP_DMA, dma_operand_count, 0,
|
1998-02-24 00:00:18 +00:00
|
|
|
|
"((%s%s - %s) >> 4) - 1", END_LABEL_PREFIX, name, name);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* We don't want to subtract 1 here as the begin and end labels
|
|
|
|
|
properly surround the data we want to compute the length of. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
count = eval_expr (DVP_DMA, dma_operand_count, 0,
|
1998-02-24 00:00:18 +00:00
|
|
|
|
"(%s%s - %s) >> 4", END_LABEL_PREFIX, name, name);
|
|
|
|
|
}
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
|
|
|
|
/* Store the count field. */
|
1998-02-24 00:00:18 +00:00
|
|
|
|
insn_buf[0] &= 0xffff0000;
|
|
|
|
|
insn_buf[0] |= count & 0x0000ffff;
|
1998-02-19 22:51:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record that inline data follows. */
|
|
|
|
|
|
|
|
|
|
static void
|
1998-02-21 02:12:15 +00:00
|
|
|
|
inline_dma_data (autocount_p, insn_buf)
|
1998-02-19 22:51:08 +00:00
|
|
|
|
int autocount_p;
|
|
|
|
|
DVP_INSN *insn_buf;
|
|
|
|
|
{
|
1998-02-21 02:12:15 +00:00
|
|
|
|
if (dma_data_state != 0 )
|
1998-02-19 22:51:08 +00:00
|
|
|
|
{
|
|
|
|
|
as_bad ("DmaData blocks cannot be nested.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1998-02-21 02:12:15 +00:00
|
|
|
|
dma_data_state = 1;
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
|
|
|
|
if (autocount_p)
|
|
|
|
|
{
|
1998-02-24 20:40:41 +00:00
|
|
|
|
dma_data_name = S_GET_NAME (create_colon_label (0, "", unique_name (NULL)));
|
1998-02-24 00:00:18 +00:00
|
|
|
|
setup_dma_autocount (dma_data_name, insn_buf, 1);
|
1998-02-19 22:51:08 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
1998-02-21 02:12:15 +00:00
|
|
|
|
dma_data_name = 0;
|
1998-02-19 22:51:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute the auto-count value for a DMA tag with out-of-line data. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
parse_dma_addr_autocount (opcode, operand, mods, insn_buf, pstr, errmsg)
|
|
|
|
|
const dvp_opcode *opcode;
|
|
|
|
|
const dvp_operand *operand;
|
|
|
|
|
int mods;
|
|
|
|
|
DVP_INSN *insn_buf;
|
|
|
|
|
char **pstr;
|
|
|
|
|
const char **errmsg;
|
|
|
|
|
{
|
|
|
|
|
char *start = *pstr;
|
|
|
|
|
char *end = start;
|
|
|
|
|
long retval;
|
|
|
|
|
/* Data reference must be a .DmaData label. */
|
1998-02-21 06:28:18 +00:00
|
|
|
|
symbolS *label, *label2, *endlabel;
|
1998-02-19 22:51:08 +00:00
|
|
|
|
const char *name;
|
|
|
|
|
char c;
|
|
|
|
|
|
|
|
|
|
label = label2 = 0;
|
|
|
|
|
if (! is_name_beginner (*start))
|
|
|
|
|
{
|
|
|
|
|
*errmsg = "invalid .DmaData label";
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name = start;
|
|
|
|
|
end = scan_symbol (name);
|
|
|
|
|
c = *end;
|
|
|
|
|
*end = 0;
|
|
|
|
|
label = symbol_find_or_make (name);
|
|
|
|
|
*end = c;
|
|
|
|
|
|
1998-06-01 03:53:32 +00:00
|
|
|
|
/* Use the same prefix as vu labels here. */
|
|
|
|
|
label2 = create_label (VU_LABEL_PREFIX, name);
|
1998-02-19 22:51:08 +00:00
|
|
|
|
endlabel = create_label (END_LABEL_PREFIX, name);
|
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
retval = eval_expr (DVP_DMA, dma_operand_addr, 4, name);
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
1998-02-24 00:00:18 +00:00
|
|
|
|
setup_dma_autocount (name, insn_buf, 0);
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
|
|
|
|
*pstr = end;
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
1998-01-29 13:22:46 +00:00
|
|
|
|
|
1998-04-16 22:07:02 +00:00
|
|
|
|
/* Compute the type of vif insn of IBYTE.
|
|
|
|
|
IBYTE is the msb of the insn.
|
|
|
|
|
This is only used for mpg,direct,unpack insns.
|
|
|
|
|
The result is one of VIF_OPCODE_{DIRECT,DIRECTHL,MPG,UNPACK}. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
vif_insn_type (ibyte)
|
|
|
|
|
char ibyte;
|
|
|
|
|
{
|
|
|
|
|
switch (ibyte & 0x70)
|
|
|
|
|
{
|
|
|
|
|
case 0x50 :
|
|
|
|
|
return (ibyte & 1) ? VIF_OPCODE_DIRECTHL : VIF_OPCODE_DIRECT;
|
|
|
|
|
case 0x40 :
|
|
|
|
|
return VIF_OPCODE_MPG;
|
|
|
|
|
case 0x60 :
|
|
|
|
|
case 0x70 :
|
|
|
|
|
return VIF_OPCODE_UNPACK;
|
|
|
|
|
default :
|
|
|
|
|
as_fatal ("internal error: bad call to vif_insn_type");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Return the length value to insert in a VIF instruction whose upper
|
1998-04-16 22:07:02 +00:00
|
|
|
|
byte is IBYTE and whose data length is BYTES.
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
WL,CL are used for unpack insns and are the stcycl values in effect.
|
|
|
|
|
This does not do the max -> 0 conversion. */
|
1998-01-29 17:06:52 +00:00
|
|
|
|
|
|
|
|
|
static int
|
1998-04-16 22:07:02 +00:00
|
|
|
|
vif_length_value (ibyte, wl, cl, bytes)
|
|
|
|
|
char ibyte;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
int wl,cl;
|
|
|
|
|
int bytes;
|
1998-01-29 17:06:52 +00:00
|
|
|
|
{
|
1998-04-16 22:07:02 +00:00
|
|
|
|
switch (ibyte & 0x70)
|
1998-01-29 17:06:52 +00:00
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
case 0x50 : /* direct */
|
|
|
|
|
/* ??? Worry about data /= 16 cuts off? */
|
|
|
|
|
return bytes / 16;
|
|
|
|
|
case 0x40 : /* mpg */
|
|
|
|
|
/* ??? Worry about data /= 8 cuts off? */
|
|
|
|
|
return bytes / 8;
|
|
|
|
|
case 0x60 : /* unpack */
|
|
|
|
|
case 0x70 :
|
1998-04-16 22:07:02 +00:00
|
|
|
|
return vif_unpack_len_value (ibyte & 15, wl, cl, bytes);
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
default :
|
|
|
|
|
as_fatal ("internal error: bad call to vif_length_value");
|
1998-01-29 17:06:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Install length LEN in the vif insn at BUF.
|
|
|
|
|
LEN is the actual value to store, except that the max->0 conversion
|
|
|
|
|
hasn't been done (we do it).
|
1998-01-29 12:37:45 +00:00
|
|
|
|
The bytes in BUF are in target order. */
|
|
|
|
|
|
|
|
|
|
static void
|
1998-02-11 23:40:43 +00:00
|
|
|
|
install_vif_length (buf, len)
|
1998-01-29 12:37:45 +00:00
|
|
|
|
char *buf;
|
|
|
|
|
int len;
|
|
|
|
|
{
|
1998-04-16 22:07:02 +00:00
|
|
|
|
unsigned char ibyte = buf[3];
|
1998-01-29 12:37:45 +00:00
|
|
|
|
|
1998-04-16 22:07:02 +00:00
|
|
|
|
if ((ibyte & 0x70) == 0x40)
|
1998-01-29 12:37:45 +00:00
|
|
|
|
{
|
|
|
|
|
/* mpg */
|
|
|
|
|
if (len > 256)
|
1998-01-29 19:37:59 +00:00
|
|
|
|
as_bad ("`mpg' data length must be between 1 and 256");
|
|
|
|
|
buf[2] = len == 256 ? 0 : len;
|
1998-01-29 12:37:45 +00:00
|
|
|
|
}
|
1998-04-16 22:07:02 +00:00
|
|
|
|
else if ((ibyte & 0x70) == 0x50)
|
1998-01-29 12:37:45 +00:00
|
|
|
|
{
|
|
|
|
|
/* direct/directhl */
|
1998-01-29 19:37:59 +00:00
|
|
|
|
if (len > 65536)
|
|
|
|
|
as_bad ("`direct' data length must be between 1 and 65536");
|
|
|
|
|
len = len == 65536 ? 0 : len;
|
|
|
|
|
buf[0] = len;
|
|
|
|
|
buf[1] = len >> 8;
|
1998-01-29 12:37:45 +00:00
|
|
|
|
}
|
1998-04-16 22:07:02 +00:00
|
|
|
|
else if ((ibyte & 0x60) == 0x60)
|
1998-01-29 12:37:45 +00:00
|
|
|
|
{
|
|
|
|
|
/* unpack */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* len == -1 means wl,cl are unknown and thus we can't compute
|
1998-03-07 01:43:32 +00:00
|
|
|
|
a useful value */
|
|
|
|
|
if (len == -1)
|
|
|
|
|
{
|
|
|
|
|
as_bad ("missing `stcycle', can't compute length of `unpack' insn");
|
|
|
|
|
len = 1;
|
|
|
|
|
}
|
1998-04-07 03:22:22 +00:00
|
|
|
|
if (len < 0 || len > 256)
|
|
|
|
|
as_bad ("`unpack' data length must be between 0 and 256");
|
|
|
|
|
/* 256 is recorded as 0 in the insn */
|
1998-02-21 06:28:18 +00:00
|
|
|
|
len = len == 256 ? 0 : len;
|
|
|
|
|
buf[2] = len;
|
1998-01-29 12:37:45 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: bad call to install_vif_length");
|
1998-01-29 12:37:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Finish off the current set of mpg insns, and start a new set.
|
|
|
|
|
The IGNORE arg exists because insert_unpack_marker uses it and both
|
|
|
|
|
of these functions are passed to insert_file. */
|
1998-03-07 03:22:18 +00:00
|
|
|
|
|
|
|
|
|
static void
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
insert_mpg_marker (ignore)
|
|
|
|
|
unsigned long ignore;
|
1998-03-07 03:22:18 +00:00
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
s_endmpg (ENDMPG_MIDDLE);
|
|
|
|
|
/* mpgloc is updated by s_endmpg. */
|
1998-03-07 03:22:18 +00:00
|
|
|
|
md_assemble ("mpg *,*");
|
|
|
|
|
/* Record the cpu type in case we're in the middle of reading binary
|
|
|
|
|
data. */
|
|
|
|
|
record_mach (DVP_VUUP, 0);
|
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Finish off the current unpack insn and start a new one.
|
|
|
|
|
INSN0 is the first word of the insn and is used to figure out what
|
|
|
|
|
kind of unpack insn it is. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
insert_unpack_marker (insn0)
|
|
|
|
|
unsigned long insn0;
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
1998-01-29 12:37:45 +00:00
|
|
|
|
/* Insert a file into the output.
|
1998-03-07 03:22:18 +00:00
|
|
|
|
The -I arg passed to GAS is used to specify where to find the file.
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
INSERT_MARKER if non-NULL is called every SIZE bytes with an argument of
|
|
|
|
|
INSERT_MARKER_ARG. This is used by the mpg insn to insert mpg's every 256
|
|
|
|
|
insns and by the unpack insn.
|
1998-01-29 12:37:45 +00:00
|
|
|
|
The result is the number of bytes inserted.
|
|
|
|
|
If an error occurs an error message is printed and zero is returned. */
|
|
|
|
|
|
|
|
|
|
static int
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
insert_file (file, insert_marker, insert_marker_arg, size)
|
1998-01-29 12:37:45 +00:00
|
|
|
|
const char *file;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
void (*insert_marker) PARAMS ((unsigned long));
|
|
|
|
|
unsigned long insert_marker_arg;
|
1998-03-07 03:22:18 +00:00
|
|
|
|
int size;
|
1998-01-29 12:37:45 +00:00
|
|
|
|
{
|
|
|
|
|
FILE *f;
|
|
|
|
|
char buf[256];
|
1998-03-07 03:22:18 +00:00
|
|
|
|
int i, n, total, left_before_marker;
|
1998-01-30 12:01:27 +00:00
|
|
|
|
char *path;
|
1998-01-29 12:37:45 +00:00
|
|
|
|
|
1998-01-30 12:01:27 +00:00
|
|
|
|
path = xmalloc (strlen (file) + include_dir_maxlen + 5 /*slop*/);
|
|
|
|
|
f = NULL;
|
|
|
|
|
for (i = 0; i < include_dir_count; i++)
|
|
|
|
|
{
|
|
|
|
|
strcpy (path, include_dirs[i]);
|
|
|
|
|
strcat (path, "/");
|
|
|
|
|
strcat (path, file);
|
|
|
|
|
if ((f = fopen (path, FOPEN_RB)) != NULL)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
free (path);
|
|
|
|
|
if (f == NULL)
|
|
|
|
|
f = fopen (file, FOPEN_RB);
|
1998-01-29 12:37:45 +00:00
|
|
|
|
if (f == NULL)
|
|
|
|
|
{
|
|
|
|
|
as_bad ("unable to read file `%s'", file);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
total = 0;
|
1998-03-07 03:22:18 +00:00
|
|
|
|
left_before_marker = 0;
|
1998-01-29 12:37:45 +00:00
|
|
|
|
do {
|
1998-03-07 03:22:18 +00:00
|
|
|
|
int bytes;
|
|
|
|
|
if (insert_marker)
|
|
|
|
|
bytes = MIN (size - left_before_marker, sizeof (buf));
|
|
|
|
|
else
|
|
|
|
|
bytes = sizeof (buf);
|
|
|
|
|
n = fread (buf, 1, bytes, f);
|
1998-01-29 12:37:45 +00:00
|
|
|
|
if (n > 0)
|
|
|
|
|
{
|
|
|
|
|
char *fr = frag_more (n);
|
|
|
|
|
memcpy (fr, buf, n);
|
|
|
|
|
total += n;
|
1998-03-07 03:22:18 +00:00
|
|
|
|
if (insert_marker)
|
|
|
|
|
{
|
|
|
|
|
left_before_marker += n;
|
|
|
|
|
if (left_before_marker > size)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
as_fatal ("internal error: file insertion sanity checky failed");
|
1998-03-07 03:22:18 +00:00
|
|
|
|
if (left_before_marker == size)
|
|
|
|
|
{
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
(*insert_marker) (insert_marker_arg);
|
1998-03-07 03:22:18 +00:00
|
|
|
|
left_before_marker = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-29 12:37:45 +00:00
|
|
|
|
}
|
|
|
|
|
} while (n > 0);
|
|
|
|
|
|
|
|
|
|
fclose (f);
|
1998-01-30 12:01:27 +00:00
|
|
|
|
/* We assume the file is smaller than 2^31 bytes.
|
1998-03-07 03:22:18 +00:00
|
|
|
|
Ok, we shouldn't make any assumptions. */
|
1998-01-29 12:37:45 +00:00
|
|
|
|
return total;
|
|
|
|
|
}
|
|
|
|
|
|
1998-01-21 00:30:46 +00:00
|
|
|
|
/* Insert an operand value into an instruction. */
|
|
|
|
|
|
1998-01-28 19:35:31 +00:00
|
|
|
|
static void
|
|
|
|
|
insert_operand (cpu, opcode, operand, mods, insn_buf, val, errmsg)
|
1998-01-28 14:05:49 +00:00
|
|
|
|
dvp_cpu cpu;
|
1998-01-28 19:35:31 +00:00
|
|
|
|
const dvp_opcode *opcode;
|
1998-01-28 10:15:09 +00:00
|
|
|
|
const dvp_operand *operand;
|
1998-01-21 00:30:46 +00:00
|
|
|
|
int mods;
|
1998-01-28 19:35:31 +00:00
|
|
|
|
DVP_INSN *insn_buf;
|
|
|
|
|
offsetT val;
|
|
|
|
|
const char **errmsg;
|
|
|
|
|
{
|
|
|
|
|
if (operand->insert)
|
|
|
|
|
{
|
|
|
|
|
(*operand->insert) (opcode, operand, mods, insn_buf, (long) val, errmsg);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1998-02-11 23:40:43 +00:00
|
|
|
|
/* We currently assume a field does not cross a word boundary. */
|
|
|
|
|
int shift = ((mods & DVP_MOD_THIS_WORD)
|
|
|
|
|
? (operand->shift & 31)
|
|
|
|
|
: operand->shift);
|
1998-02-21 02:12:15 +00:00
|
|
|
|
/* FIXME: revisit */
|
|
|
|
|
if (operand->word == 0)
|
1998-02-11 23:40:43 +00:00
|
|
|
|
{
|
1998-02-21 02:12:15 +00:00
|
|
|
|
int word = (mods & DVP_MOD_THIS_WORD) ? 0 : (shift / 32);
|
|
|
|
|
if (operand->bits == 32)
|
|
|
|
|
insn_buf[word] = val;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
shift = shift % 32;
|
|
|
|
|
insn_buf[word] |= ((long) val & ((1 << operand->bits) - 1)) << shift;
|
|
|
|
|
}
|
1998-02-11 23:40:43 +00:00
|
|
|
|
}
|
1998-01-28 19:35:31 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1998-02-21 02:12:15 +00:00
|
|
|
|
int word = (mods & DVP_MOD_THIS_WORD) ? 0 : operand->word;
|
|
|
|
|
if (operand->bits == 32)
|
|
|
|
|
insn_buf[word] = val;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
long temp = (long) val & ((1 << operand->bits) - 1);
|
|
|
|
|
insn_buf[word] |= temp << operand->shift;
|
|
|
|
|
}
|
1998-01-28 19:35:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Insert an operand's final value into an instruction.
|
|
|
|
|
Here we can give warning messages about operand values if we want to. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
insert_operand_final (cpu, operand, mods, insn_buf, val, file, line)
|
|
|
|
|
dvp_cpu cpu;
|
|
|
|
|
const dvp_operand *operand;
|
|
|
|
|
int mods;
|
|
|
|
|
DVP_INSN *insn_buf;
|
1998-01-21 00:30:46 +00:00
|
|
|
|
offsetT val;
|
|
|
|
|
char *file;
|
|
|
|
|
unsigned int line;
|
|
|
|
|
{
|
|
|
|
|
if (operand->bits != 32)
|
|
|
|
|
{
|
1998-01-31 00:04:27 +00:00
|
|
|
|
offsetT min, max, test;
|
1998-01-21 00:30:46 +00:00
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* ??? This test belongs more properly in the insert handler. */
|
1998-01-28 10:15:09 +00:00
|
|
|
|
if ((operand->flags & DVP_OPERAND_RELATIVE_BRANCH) != 0)
|
1998-01-21 00:30:46 +00:00
|
|
|
|
{
|
|
|
|
|
if ((val & 7) != 0)
|
|
|
|
|
{
|
|
|
|
|
if (file == (char *) NULL)
|
|
|
|
|
as_warn ("branch to misaligned address");
|
|
|
|
|
else
|
|
|
|
|
as_warn_where (file, line, "branch to misaligned address");
|
|
|
|
|
}
|
|
|
|
|
val >>= 3;
|
|
|
|
|
}
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* ??? This test belongs more properly in the insert handler. */
|
|
|
|
|
else if ((operand->flags & DVP_OPERAND_VU_ADDRESS) != 0)
|
|
|
|
|
{
|
|
|
|
|
if ((val & 7) != 0)
|
|
|
|
|
{
|
|
|
|
|
if (file == (char *) NULL)
|
|
|
|
|
as_warn ("misaligned vu address");
|
|
|
|
|
else
|
|
|
|
|
as_warn_where (file, line, "misaligned vu address");
|
|
|
|
|
}
|
|
|
|
|
val >>= 3;
|
|
|
|
|
}
|
1998-01-21 00:30:46 +00:00
|
|
|
|
|
1998-01-28 10:15:09 +00:00
|
|
|
|
if ((operand->flags & DVP_OPERAND_SIGNED) != 0)
|
1998-01-21 00:30:46 +00:00
|
|
|
|
{
|
1998-01-28 10:15:09 +00:00
|
|
|
|
if ((operand->flags & DVP_OPERAND_SIGNOPT) != 0)
|
1998-01-21 00:30:46 +00:00
|
|
|
|
max = (1 << operand->bits) - 1;
|
|
|
|
|
else
|
|
|
|
|
max = (1 << (operand->bits - 1)) - 1;
|
|
|
|
|
min = - (1 << (operand->bits - 1));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
max = (1 << operand->bits) - 1;
|
|
|
|
|
min = 0;
|
|
|
|
|
}
|
|
|
|
|
|
1998-01-28 10:15:09 +00:00
|
|
|
|
if ((operand->flags & DVP_OPERAND_NEGATIVE) != 0)
|
1998-01-21 00:30:46 +00:00
|
|
|
|
test = - val;
|
|
|
|
|
else
|
|
|
|
|
test = val;
|
|
|
|
|
|
|
|
|
|
if (test < (offsetT) min || test > (offsetT) max)
|
|
|
|
|
{
|
|
|
|
|
const char *err =
|
|
|
|
|
"operand out of range (%s not between %ld and %ld)";
|
|
|
|
|
char buf[100];
|
|
|
|
|
|
|
|
|
|
sprint_value (buf, test);
|
|
|
|
|
if (file == (char *) NULL)
|
|
|
|
|
as_warn (err, buf, min, max);
|
|
|
|
|
else
|
|
|
|
|
as_warn_where (file, line, err, buf, min, max);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-01-28 19:35:31 +00:00
|
|
|
|
{
|
|
|
|
|
const char *errmsg = NULL;
|
|
|
|
|
insert_operand (cpu, NULL, operand, mods, insn_buf, val, &errmsg);
|
|
|
|
|
if (errmsg != NULL)
|
|
|
|
|
as_warn_where (file, line, errmsg);
|
|
|
|
|
}
|
1998-01-21 00:30:46 +00:00
|
|
|
|
}
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
1998-02-19 22:51:08 +00:00
|
|
|
|
/* DVP pseudo ops. */
|
1998-01-31 00:04:26 +00:00
|
|
|
|
|
|
|
|
|
static void
|
1998-02-19 10:24:15 +00:00
|
|
|
|
s_dmadata (ignore)
|
1998-01-31 00:04:26 +00:00
|
|
|
|
int ignore;
|
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
char *name, c;
|
1998-01-27 02:52:04 +00:00
|
|
|
|
|
1998-02-21 02:12:15 +00:00
|
|
|
|
dma_data_name = 0;
|
1998-01-31 00:04:26 +00:00
|
|
|
|
|
1998-02-21 02:12:15 +00:00
|
|
|
|
if (dma_data_state != 0)
|
1998-01-28 02:20:20 +00:00
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
as_bad ("DmaData blocks cannot be nested.");
|
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
|
return;
|
1998-01-31 00:04:26 +00:00
|
|
|
|
}
|
1998-02-21 02:12:15 +00:00
|
|
|
|
dma_data_state = 1;
|
1998-01-28 02:20:20 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
SKIP_WHITESPACE (); /* Leading whitespace is part of operand. */
|
|
|
|
|
name = input_line_pointer;
|
1998-01-28 02:20:20 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
if (!is_name_beginner (*name))
|
1998-01-31 00:04:26 +00:00
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
as_bad ("invalid identifier for \".DmaData\"");
|
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
|
return;
|
1998-01-31 00:04:26 +00:00
|
|
|
|
}
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
1998-03-23 21:19:04 +00:00
|
|
|
|
/* Do an implicit alignment to a 16 byte boundary. */
|
|
|
|
|
frag_align (4, 0, 0);
|
|
|
|
|
record_alignment (now_seg, 4);
|
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
c = get_symbol_end ();
|
|
|
|
|
line_label = colon (name); /* user-defined label */
|
1998-02-21 02:12:15 +00:00
|
|
|
|
dma_data_name = S_GET_NAME (line_label);
|
1998-02-19 10:24:15 +00:00
|
|
|
|
*input_line_pointer = c;
|
1998-01-27 02:52:04 +00:00
|
|
|
|
|
1998-03-17 22:10:10 +00:00
|
|
|
|
/* Force emission of a machine type label for the next insn. */
|
|
|
|
|
force_mach_label ();
|
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
demand_empty_rest_of_line ();
|
1998-01-31 00:04:26 +00:00
|
|
|
|
}
|
1998-01-26 06:24:59 +00:00
|
|
|
|
|
1998-01-31 00:04:26 +00:00
|
|
|
|
static void
|
1998-02-19 10:24:15 +00:00
|
|
|
|
s_enddmadata (ignore)
|
1998-01-31 00:04:26 +00:00
|
|
|
|
int ignore;
|
|
|
|
|
{
|
1998-02-21 02:12:15 +00:00
|
|
|
|
if (dma_data_state != 1)
|
1998-01-31 00:04:26 +00:00
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
as_warn (".EndDmaData encountered outside a DmaData block -- ignored.");
|
|
|
|
|
ignore_rest_of_line ();
|
1998-02-21 02:12:15 +00:00
|
|
|
|
dma_data_name = 0;
|
1998-01-31 00:04:26 +00:00
|
|
|
|
}
|
1998-02-21 02:12:15 +00:00
|
|
|
|
dma_data_state = 0;
|
1998-02-19 10:24:15 +00:00
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
|
1998-02-24 00:00:18 +00:00
|
|
|
|
/* If count provided, verify it is correct. */
|
|
|
|
|
/* ... */
|
|
|
|
|
|
1998-03-17 22:19:12 +00:00
|
|
|
|
/* Fill the data out to a multiple of 16 bytes. */
|
|
|
|
|
/* FIXME: Are the fill contents right? */
|
|
|
|
|
frag_align (4, 0, 0);
|
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* "label" points to beginning of block.
|
|
|
|
|
Create a name for the final label like _$<name>. */
|
1998-02-21 02:12:15 +00:00
|
|
|
|
if (dma_data_name)
|
1998-03-17 22:19:12 +00:00
|
|
|
|
create_colon_label (0, END_LABEL_PREFIX, dma_data_name);
|
1998-01-26 06:24:59 +00:00
|
|
|
|
}
|
1998-02-19 22:51:08 +00:00
|
|
|
|
|
1998-01-26 06:24:59 +00:00
|
|
|
|
static void
|
1998-02-19 10:24:15 +00:00
|
|
|
|
s_dmapackvif (ignore)
|
1998-01-28 02:20:20 +00:00
|
|
|
|
int ignore;
|
1998-01-26 06:24:59 +00:00
|
|
|
|
{
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Syntax: .dmapackvif 0|1 */
|
1998-01-27 02:52:04 +00:00
|
|
|
|
|
1998-02-19 10:24:15 +00:00
|
|
|
|
/* Leading whitespace is part of operand. */
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
switch (*input_line_pointer++)
|
1998-01-27 02:52:04 +00:00
|
|
|
|
{
|
1998-01-31 00:04:26 +00:00
|
|
|
|
case '0':
|
1998-02-19 10:24:15 +00:00
|
|
|
|
dma_pack_vif_p = 0;
|
|
|
|
|
break;
|
1998-01-31 00:04:26 +00:00
|
|
|
|
case '1':
|
1998-02-19 10:24:15 +00:00
|
|
|
|
dma_pack_vif_p = 1;
|
|
|
|
|
break;
|
1998-01-27 02:52:04 +00:00
|
|
|
|
default:
|
1998-03-17 18:51:57 +00:00
|
|
|
|
as_bad ("illegal argument to `.dmapackvif'");
|
1998-01-27 02:52:04 +00:00
|
|
|
|
}
|
1998-02-19 10:24:15 +00:00
|
|
|
|
demand_empty_rest_of_line ();
|
1998-01-26 06:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-03-07 03:22:18 +00:00
|
|
|
|
/* INTERNAL_P is non-zero if invoked internally by this file rather than
|
|
|
|
|
by the user. In this case we don't touch the input stream. */
|
|
|
|
|
|
1998-01-26 06:24:59 +00:00
|
|
|
|
static void
|
1998-03-07 03:22:18 +00:00
|
|
|
|
s_enddirect (internal_p)
|
|
|
|
|
int internal_p;
|
1998-01-26 06:24:59 +00:00
|
|
|
|
{
|
1998-02-21 03:26:47 +00:00
|
|
|
|
if (CUR_ASM_STATE != ASM_DIRECT)
|
1998-01-29 17:06:52 +00:00
|
|
|
|
{
|
|
|
|
|
as_bad ("`.enddirect' has no matching `direct' instruction");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Record in the end data symbol the current location. */
|
|
|
|
|
if (now_seg != S_GET_SEGMENT (vif_data_end))
|
|
|
|
|
as_bad (".enddirect in different section");
|
|
|
|
|
vif_data_end->sy_frag = frag_now;
|
|
|
|
|
S_SET_VALUE (vif_data_end, (valueT) frag_now_fix ());
|
1998-01-29 17:06:52 +00:00
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
set_asm_state (ASM_INIT);
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Needn't be reset, but to catch bugs it is. */
|
|
|
|
|
vif_data_end = NULL;
|
1998-02-21 03:26:47 +00:00
|
|
|
|
|
1998-03-07 03:22:18 +00:00
|
|
|
|
if (! internal_p)
|
|
|
|
|
demand_empty_rest_of_line ();
|
1998-02-21 03:26:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* CALLER denotes who's calling us.
|
|
|
|
|
If ENDMPG_USER then .endmpg was found in the input stream.
|
|
|
|
|
If ENDMPG_INTERNAL then we've been invoked to finish off file insertion.
|
|
|
|
|
If ENDMPG_MIDDLE then we've been invoked in the middle of a long stretch
|
|
|
|
|
of vu code. */
|
1998-02-21 07:44:25 +00:00
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
static void
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
s_endmpg (caller)
|
|
|
|
|
int caller;
|
1998-02-21 03:26:47 +00:00
|
|
|
|
{
|
|
|
|
|
if (CUR_ASM_STATE != ASM_MPG)
|
|
|
|
|
{
|
|
|
|
|
as_bad ("`.endmpg' has no matching `mpg' instruction");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Record in the end data symbol the current location. */
|
|
|
|
|
if (now_seg != S_GET_SEGMENT (vif_data_end))
|
|
|
|
|
as_bad (".endmpg in different section");
|
|
|
|
|
vif_data_end->sy_frag = frag_now;
|
|
|
|
|
S_SET_VALUE (vif_data_end, (valueT) frag_now_fix ());
|
|
|
|
|
|
|
|
|
|
/* Update $.mpgloc.
|
|
|
|
|
We have to leave the old value alone as it may be used in fixups
|
1998-04-10 01:37:00 +00:00
|
|
|
|
already recorded. Since compute_mpgloc allocates a new symbol for the
|
|
|
|
|
result we're ok. The new value is the old value plus the number of
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
double words in this chunk. */
|
1998-04-10 01:37:00 +00:00
|
|
|
|
mpgloc_sym = compute_mpgloc (mpgloc_sym, vif_data_start, vif_data_end);
|
1998-02-21 03:26:47 +00:00
|
|
|
|
|
|
|
|
|
set_asm_state (ASM_INIT);
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Needn't be reset, but to catch bugs it is. */
|
|
|
|
|
vif_data_end = NULL;
|
1998-02-21 03:26:47 +00:00
|
|
|
|
|
1998-02-21 07:44:25 +00:00
|
|
|
|
/* Reset the vu insn counter. */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
if (caller != ENDMPG_MIDDLE)
|
|
|
|
|
vu_count = -1;
|
1998-02-21 03:26:47 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
if (caller == ENDMPG_USER)
|
1998-02-21 07:44:25 +00:00
|
|
|
|
demand_empty_rest_of_line ();
|
1998-02-21 03:26:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-03-07 03:22:18 +00:00
|
|
|
|
/* INTERNAL_P is non-zero if invoked internally by this file rather than
|
|
|
|
|
by the user. In this case we don't touch the input stream. */
|
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
static void
|
1998-03-07 03:22:18 +00:00
|
|
|
|
s_endunpack (internal_p)
|
|
|
|
|
int internal_p;
|
1998-02-21 03:26:47 +00:00
|
|
|
|
{
|
|
|
|
|
if (CUR_ASM_STATE != ASM_UNPACK)
|
|
|
|
|
{
|
|
|
|
|
as_bad ("`.endunpack' has no matching `unpack' instruction");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Record in the end data symbol the current location. */
|
1998-04-16 18:51:58 +00:00
|
|
|
|
/* ??? $.unpackloc is gone. Is this also used for data length
|
|
|
|
|
verification? */
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
if (now_seg != S_GET_SEGMENT (vif_data_end))
|
|
|
|
|
as_bad (".endunpack in different section");
|
|
|
|
|
vif_data_end->sy_frag = frag_now;
|
|
|
|
|
S_SET_VALUE (vif_data_end, (valueT) frag_now_fix ());
|
1998-03-07 01:43:32 +00:00
|
|
|
|
|
1998-04-03 20:15:57 +00:00
|
|
|
|
/* Round up to next word boundary. */
|
|
|
|
|
frag_align (2, 0, 0);
|
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
set_asm_state (ASM_INIT);
|
1998-01-30 12:01:27 +00:00
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* Needn't be reset, but to catch bugs it is. */
|
|
|
|
|
vif_data_end = NULL;
|
1998-02-21 03:26:47 +00:00
|
|
|
|
|
1998-03-07 03:22:18 +00:00
|
|
|
|
if (! internal_p)
|
|
|
|
|
demand_empty_rest_of_line ();
|
1998-01-26 06:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-02-21 02:12:15 +00:00
|
|
|
|
static void
|
|
|
|
|
s_endgif (ignore)
|
|
|
|
|
int ignore;
|
|
|
|
|
{
|
1998-03-16 18:22:18 +00:00
|
|
|
|
int bytes;
|
1998-03-06 19:40:53 +00:00
|
|
|
|
int specified_nloop = gif_nloop ();
|
|
|
|
|
int computed_nloop;
|
|
|
|
|
int nregs = gif_nregs ();
|
1998-03-16 18:22:18 +00:00
|
|
|
|
char *file;
|
|
|
|
|
unsigned int line;
|
|
|
|
|
|
|
|
|
|
as_where (&file, &line);
|
1998-02-21 02:12:15 +00:00
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
if (CUR_ASM_STATE != ASM_GIF)
|
1998-02-21 02:12:15 +00:00
|
|
|
|
{
|
|
|
|
|
as_bad (".endgif doesn't follow a gif tag");
|
|
|
|
|
return;
|
|
|
|
|
}
|
1998-02-21 03:26:47 +00:00
|
|
|
|
pop_asm_state (0);
|
1998-02-21 02:12:15 +00:00
|
|
|
|
|
1998-03-16 18:22:18 +00:00
|
|
|
|
/* Fill out to proper boundary.
|
|
|
|
|
??? This may cause eval_expr to always queue a fixup. So be it. */
|
|
|
|
|
switch (gif_insn_type)
|
1998-02-21 02:12:15 +00:00
|
|
|
|
{
|
1998-03-16 18:22:18 +00:00
|
|
|
|
case GIF_PACKED : frag_align (4, 0, 0); break;
|
|
|
|
|
case GIF_REGLIST : frag_align (3, 0, 0); break;
|
|
|
|
|
case GIF_IMAGE : frag_align (4, 0, 0); break;
|
1998-02-21 02:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* The -16 is because the `gif_data_name' label is emitted at the
|
|
|
|
|
start of the gif tag. If we're in a different frag from the one we
|
|
|
|
|
started with, this can't be computed until much later. To cope we queue
|
|
|
|
|
a fixup and deal with it then.
|
1998-03-16 18:22:18 +00:00
|
|
|
|
??? The other way to handle this is by having expr() compute "syma - symb"
|
|
|
|
|
when they're in different fragments but the difference is constant.
|
|
|
|
|
Not sure how much of a slowdown that will introduce though. */
|
|
|
|
|
fixup_count = 0;
|
1998-04-10 01:37:00 +00:00
|
|
|
|
bytes = eval_expr (DVP_GIF, gif_operand_nloop, 0, ". - %s - 16", gif_data_name);
|
1998-03-16 18:22:18 +00:00
|
|
|
|
|
|
|
|
|
/* Compute a value for nloop if we can. */
|
|
|
|
|
|
|
|
|
|
if (fixup_count == 0)
|
1998-02-21 02:12:15 +00:00
|
|
|
|
{
|
1998-03-16 18:22:18 +00:00
|
|
|
|
computed_nloop = compute_nloop (gif_insn_type, nregs, bytes);
|
1998-03-06 19:40:53 +00:00
|
|
|
|
|
1998-03-16 18:22:18 +00:00
|
|
|
|
/* If the user specified nloop, verify it. */
|
|
|
|
|
if (specified_nloop != -1)
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
check_nloop (gif_insn_type, nregs,
|
|
|
|
|
specified_nloop, computed_nloop,
|
1998-03-16 18:22:18 +00:00
|
|
|
|
file, line);
|
|
|
|
|
}
|
1998-03-06 19:40:53 +00:00
|
|
|
|
|
1998-03-16 18:22:18 +00:00
|
|
|
|
/* If computation of nloop can't be done yet, queue a fixup and do it later.
|
|
|
|
|
Otherwise validate nloop if specified or write the computed value into
|
1998-03-06 19:40:53 +00:00
|
|
|
|
the insn. */
|
1998-03-16 18:22:18 +00:00
|
|
|
|
|
|
|
|
|
if (fixup_count != 0)
|
1998-03-06 19:40:53 +00:00
|
|
|
|
{
|
1998-03-16 18:22:18 +00:00
|
|
|
|
/* FIXME: It might eventually be possible to combine all the various
|
|
|
|
|
copies of this bit of code. */
|
|
|
|
|
int op_type, reloc_type, offset;
|
|
|
|
|
const dvp_operand *operand;
|
|
|
|
|
fixS *fix;
|
|
|
|
|
|
|
|
|
|
op_type = fixups[0].opindex;
|
|
|
|
|
offset = fixups[0].offset;
|
|
|
|
|
reloc_type = encode_fixup_reloc_type (DVP_GIF, op_type);
|
|
|
|
|
operand = &gif_operands[op_type];
|
|
|
|
|
fix = fix_new_exp (gif_insn_frag,
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
(gif_insn_frag_loc + offset
|
|
|
|
|
- gif_insn_frag->fr_literal),
|
1998-03-16 18:22:18 +00:00
|
|
|
|
4, &fixups[0].exp, 0,
|
|
|
|
|
(bfd_reloc_code_real_type) reloc_type);
|
|
|
|
|
/* Record user specified value so we can test it when we compute the
|
|
|
|
|
actual value. */
|
|
|
|
|
fix->tc_fix_data.type = gif_insn_type;
|
|
|
|
|
fix->tc_fix_data.nregs = nregs;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
fix->tc_fix_data.user_value = specified_nloop;
|
1998-02-21 02:12:15 +00:00
|
|
|
|
}
|
1998-03-16 18:22:18 +00:00
|
|
|
|
else if (specified_nloop != -1)
|
|
|
|
|
; /* nothing to do */
|
1998-02-21 02:12:15 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1998-03-16 18:22:18 +00:00
|
|
|
|
DVP_INSN insn = bfd_getl32 (gif_insn_frag_loc);
|
1998-02-21 02:12:15 +00:00
|
|
|
|
insert_operand_final (DVP_GIF, &gif_operands[gif_operand_nloop],
|
|
|
|
|
DVP_MOD_THIS_WORD, &insn,
|
1998-03-06 19:40:53 +00:00
|
|
|
|
(offsetT) computed_nloop, file, line);
|
1998-03-16 18:22:18 +00:00
|
|
|
|
bfd_putl32 ((bfd_vma) insn, gif_insn_frag_loc);
|
1998-02-21 02:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
/* These needn't be reset, but to catch bugs they are. */
|
1998-02-21 02:12:15 +00:00
|
|
|
|
gif_data_name = NULL;
|
* config/tc-dvp.h (md_estimate_size_before_relax): Delete.
(md_convert_frag): Delete.
(TC_FIX_TYPE): New fields wl,cl,user_value;
* config/tc-dvp.c (insert_mpg_marker): New argument ignore.
All callers updated.
(insert_unpack_marker): New function.
(insert_file): New argument insert_marker_arg. All callers updated.
(gif_user_value): New static local.
(vif_data_start,vif_data_end): New static locals.
(mpgloc_sym,unpackloc_sym): New static locals.
(cur_varlen_frag,cur_varlen_insn,cur_varlen_value): Delete.
(cur_opcode,cur_operand): New static locals.
(endmpg_caller): New enum.
(md_pseudo_table): Pass ENDMPG_USER to s_endmpg.
(md_begin): Initialize mpgloc_sym, unpackloc_sym.
(dvp_fixup): New members user_value,wl,cl;
(assemble_vif): Rewrite.
(assemble_gif): Tweak name of data start label.
(assemble_one_insn): Allow special parser to punt and call the
normal expression parser. Set cur_opcode,cur_operand for md_operand.
(md_operand): Handle '*' value for mpgloc,unpackloc.
(md_estimate_size_before_relax): New function.
(dvp_relax_frag,md_convert_frag): New functions.
(md_pcrel_from_section): Handle end data label for variable length
vif insns.
(md_apply_fix3): Handle count field for variable length vif insns.
Handle address field for mpg,unpack.
(eval_expr): Initialize user_value,wl,cl fields of the fixup.
(cur_vif_insn_length): Delete.
(vif_length_value): New function.
(install_vif_length): Don't perform logical->physical conversion here.
(s_enddirect,s_endmpg,s_endunpack): Rewrite.
1998-03-25 22:31:13 +00:00
|
|
|
|
gif_insn_frag = NULL;
|
|
|
|
|
gif_insn_frag_loc = NULL;
|
|
|
|
|
|
1998-02-21 02:12:15 +00:00
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
}
|
|
|
|
|
|
1998-01-26 06:24:59 +00:00
|
|
|
|
static void
|
1998-01-29 12:37:45 +00:00
|
|
|
|
s_state (state)
|
|
|
|
|
int state;
|
1998-01-26 06:24:59 +00:00
|
|
|
|
{
|
1998-02-20 20:48:39 +00:00
|
|
|
|
/* If in MPG state and the user requests to change to VU state,
|
|
|
|
|
leave the state as MPG. This happens when we see an mpg followed
|
1998-04-10 01:37:00 +00:00
|
|
|
|
by a .include that has .vu. Note that no attempt is made to support
|
|
|
|
|
an include depth > 1 for this case. */
|
1998-02-21 03:26:47 +00:00
|
|
|
|
if (CUR_ASM_STATE == ASM_MPG && state == ASM_VU)
|
1998-02-20 20:48:39 +00:00
|
|
|
|
return;
|
|
|
|
|
|
1998-04-10 01:37:00 +00:00
|
|
|
|
/* If changing to the VU state, we need to set up things for $.mpgloc
|
|
|
|
|
calculations. */
|
|
|
|
|
if (state == ASM_VU)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: May need to check that we're not clobbering currently
|
|
|
|
|
in use versions of these. Also need to worry about which section
|
|
|
|
|
the .vu is issued in. On the other hand, ".vu" isn't intended
|
|
|
|
|
to be supported everywhere. */
|
|
|
|
|
vif_data_start = expr_build_dot ();
|
1998-05-28 23:29:19 +00:00
|
|
|
|
mpgloc_sym = expr_build_uconstant (0);
|
1998-05-29 01:08:08 +00:00
|
|
|
|
#if 0 /* ??? wip */
|
|
|
|
|
create_vuoverlay_section (vuoverlay_section_name (NULL), mpgloc_sym,
|
|
|
|
|
NULL, NULL);
|
1998-05-28 23:29:19 +00:00
|
|
|
|
#endif
|
1998-04-10 01:37:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-02-21 03:26:47 +00:00
|
|
|
|
set_asm_state (state);
|
1998-01-28 02:20:20 +00:00
|
|
|
|
|
1998-02-20 20:48:39 +00:00
|
|
|
|
demand_empty_rest_of_line ();
|
1998-01-29 17:06:52 +00:00
|
|
|
|
}
|
1998-06-02 16:54:20 +00:00
|
|
|
|
|
|
|
|
|
/* Same as read.c:s_func except prepend VU_LABEL_PREFIX by default. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
s_dvp_func (end_p)
|
|
|
|
|
int end_p;
|
|
|
|
|
{
|
|
|
|
|
do_s_func (end_p, VU_LABEL_PREFIX);
|
|
|
|
|
}
|