/* tc-txvu.c -- Assembler for the TX VU. Copyright (C) 1997 Free Software Foundation. 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 #include #include "as.h" #include "subsegs.h" const char comment_chars[] = ";"; const char line_comment_chars[] = "#"; const char line_separator_chars[] = "!"; const char EXP_CHARS[] = "eE"; const char FLT_CHARS[] = "dD"; const char *md_shortopts = ""; struct option md_longopts[] = { /* insert options here */ {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof(md_longopts); int md_parse_option (c, arg) int c; char *arg; { return 0; } void md_show_usage (stream) FILE *stream; { #if 0 fprintf (stream, "TX VU options:\n"); #endif } /* Set by md_assemble for use by txvu_fill_insn. */ static subsegT prev_subseg; static segT prev_seg; /* The target specific pseudo-ops which we support. */ const pseudo_typeS md_pseudo_table[] = { { "word", cons, 4 }, { NULL, NULL, 0 } }; void md_begin () { flagword applicable; segT seg; subsegT subseg; /* Save the current subseg so we can restore it [it's the default one and we don't want the initial section to be .sbss. */ seg = now_seg; subseg = now_subseg; subseg_set (seg, subseg); } void md_assemble (str) char *str; { } void md_operand (expressionP) expressionS *expressionP; { } 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; } /* Functions concerning relocs. */ /* 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)) { /* The symbol is undefined (or is defined but not in this section). Let the linker figure it out. */ return 0; } /* FIXME: `& -16L'? */ return (fixP->fx_frag->fr_address + fixP->fx_where) & -4L; } /* 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; as_fatal ("txvu md_apply_fix3\n"); } /* Translate internal representation of relocation info to BFD target format. */ arelent * tc_gen_reloc (section, fixp) asection *section; fixS *fixp; { /* relocs not handled yet */ as_fatal ("txvu tc_gen_reloc\n"); } /* 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; }