1 /* tc-a29k.c -- Assemble for the AMD 29000.
2 Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001,
4 Free Software Foundation, Inc.
6 This file is part of GAS, the GNU Assembler.
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GAS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GAS; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /* John Gilmore has reorganized this module somewhat, to make it easier
24 to convert it to new machines' assemblers as desired. There was too
25 much bloody rewriting required before. There still probably is. */
28 #include "safe-ctype.h"
30 #include "opcode/a29k.h"
32 /* Make it easier to clone this machine desc into another one. */
33 #define machine_opcode a29k_opcode
34 #define machine_opcodes a29k_opcodes
35 #define machine_ip a29k_ip
36 #define machine_it a29k_it
38 #define IMMEDIATE_BIT 0x01000000 /* Turns RB into Immediate. */
39 #define ABSOLUTE_BIT 0x01000000 /* Turns PC-relative to Absolute. */
40 #define CE_BIT 0x00800000 /* Coprocessor enable in LOAD. */
41 #define UI_BIT 0x00000080 /* Unsigned integer in CONVERT. */
43 /* handle of the OPCODE hash table. */
44 static struct hash_control *op_hash = NULL;
53 int reloc_offset; /* Offset of reloc within insn. */
58 #if defined(BFD_HEADERS)
60 const int md_reloc_size = RELSZ; /* Coff headers. */
62 const int md_reloc_size = 12; /* Something else headers. */
65 const int md_reloc_size = 12; /* Not bfdized. */
68 /* This array holds the chars that always start a comment. If the
69 pre-processor is disabled, these aren't very useful. */
70 const char comment_chars[] = ";";
72 /* This array holds the chars that only start a comment at the beginning of
73 a line. If the line seems to have the form '# 123 filename'
74 .line and .file directives will appear in the pre-processed output. */
75 /* Note that input_file.c hand checks for '#' at the beginning of the
76 first line of the input file. This is because the compiler outputs
77 #NO_APP at the beginning of its output. */
78 /* Also note that comments like this one will always work. */
79 const char line_comment_chars[] = "#";
81 /* We needed an unused char for line separation to work around the
82 lack of macros, using sed and such. */
83 const char line_separator_chars[] = "@";
85 /* Chars that can be used to separate mant from exp in floating point nums. */
86 const char EXP_CHARS[] = "eE";
88 /* Chars that mean this number is a floating point constant.
91 const char FLT_CHARS[] = "rRsSfFdDxXpP";
93 /* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
94 changed in read.c. Ideally it shouldn't have to know about it at
95 all, but nothing is ideal around here. */
97 /* anull bit - causes the branch delay slot instructions to not be executed. */
98 #define ANNUL (1 << 29)
105 if (strncmp (input_line_pointer, ".text", 5) == 0)
107 input_line_pointer += 5;
111 if (strncmp (input_line_pointer, ".data", 5) == 0)
113 input_line_pointer += 5;
117 if (strncmp (input_line_pointer, ".data1", 6) == 0)
119 input_line_pointer += 6;
123 /* Literals can't go in the text segment because you can't read from
124 instruction memory on some 29k's. So, into initialized data. */
125 if (strncmp (input_line_pointer, ".lit", 4) == 0)
127 input_line_pointer += 4;
128 subseg_set (SEG_DATA, 200);
129 demand_empty_rest_of_line ();
133 as_bad (_("Unknown segment type"));
134 demand_empty_rest_of_line ();
140 subseg_set (SEG_DATA, 1);
141 demand_empty_rest_of_line ();
144 #endif /* OBJ_COFF */
146 /* Install symbol definition that maps REGNAME to REGNO.
147 FIXME-SOON: These are not recognized in mixed case. */
150 insert_sreg (char *regname, int regnum)
152 /* FIXME-SOON, put something in these syms so they won't be output
153 to the symbol table of the resulting object file. */
155 /* Must be large enough to hold the names of the special registers. */
159 symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum,
160 &zero_address_frag));
161 for (i = 0; regname[i]; i++)
162 buf[i] = TOUPPER (regname[i]);
165 symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum,
166 &zero_address_frag));
169 /* Install symbol definitions for assorted special registers.
170 See ASM29K Ref page 2-9. */
173 define_some_regs (void)
177 /* Protected special-purpose register names. */
178 insert_sreg ("vab", SREG + 0);
179 insert_sreg ("ops", SREG + 1);
180 insert_sreg ("cps", SREG + 2);
181 insert_sreg ("cfg", SREG + 3);
182 insert_sreg ("cha", SREG + 4);
183 insert_sreg ("chd", SREG + 5);
184 insert_sreg ("chc", SREG + 6);
185 insert_sreg ("rbp", SREG + 7);
186 insert_sreg ("tmc", SREG + 8);
187 insert_sreg ("tmr", SREG + 9);
188 insert_sreg ("pc0", SREG + 10);
189 insert_sreg ("pc1", SREG + 11);
190 insert_sreg ("pc2", SREG + 12);
191 insert_sreg ("mmu", SREG + 13);
192 insert_sreg ("lru", SREG + 14);
194 /* Additional protected special-purpose registers for the 29050. */
195 insert_sreg ("rsn", SREG + 15);
196 insert_sreg ("rma0", SREG + 16);
197 insert_sreg ("rmc0", SREG + 17);
198 insert_sreg ("rma1", SREG + 18);
199 insert_sreg ("rmc1", SREG + 19);
200 insert_sreg ("spc0", SREG + 20);
201 insert_sreg ("spc1", SREG + 21);
202 insert_sreg ("spc2", SREG + 22);
203 insert_sreg ("iba0", SREG + 23);
204 insert_sreg ("ibc0", SREG + 24);
205 insert_sreg ("iba1", SREG + 25);
206 insert_sreg ("ibc1", SREG + 26);
208 /* Additional registers for the 29040. */
209 insert_sreg ("dba", SREG + 27);
210 insert_sreg ("dbc", SREG + 28);
211 insert_sreg ("cir", SREG + 29);
212 insert_sreg ("cdr", SREG + 30);
214 /* Unprotected special-purpose register names. */
215 insert_sreg ("ipc", SREG + 128);
216 insert_sreg ("ipa", SREG + 129);
217 insert_sreg ("ipb", SREG + 130);
218 insert_sreg ("q", SREG + 131);
219 insert_sreg ("alu", SREG + 132);
220 insert_sreg ("bp", SREG + 133);
221 insert_sreg ("fc", SREG + 134);
222 insert_sreg ("cr", SREG + 135);
223 insert_sreg ("fpe", SREG + 160);
224 insert_sreg ("inte", SREG + 161);
225 insert_sreg ("fps", SREG + 162);
226 /* "", SREG+163); Reserved */
227 insert_sreg ("exop", SREG + 164);
230 /* This function is called once, at assembler startup time. It should
231 set up all the tables, etc., that the MD part of the assembler will
237 const char *retval = NULL;
241 char *strend, *strend2;
243 /* Hash up all the opcodes for fast use later. */
245 op_hash = hash_new ();
247 for (i = 0; i < num_opcodes; i++)
249 const char *name = machine_opcodes[i].name;
257 /* Hack to avoid multiple opcode entries. We pre-locate all the
258 variations (b/i field and P/A field) and handle them. */
259 if (!strcmp (name, machine_opcodes[i + 1].name))
261 if ((machine_opcodes[i].opcode & 0x01000000) != 0
262 || (machine_opcodes[i + 1].opcode & 0x01000000) == 0
263 || ((machine_opcodes[i].opcode | 0x01000000)
264 != machine_opcodes[i + 1].opcode))
267 strend = machine_opcodes[i].args + strlen (machine_opcodes[i].args) - 1;
268 strend2 = machine_opcodes[i + 1].args + strlen (machine_opcodes[i + 1].args) - 1;
284 fprintf (stderr, "internal error: can't handle opcode %s\n",
289 /* OK, this is an i/b or A/P pair. We skip the
290 higher-valued one, and let the code for operand checking
291 handle OR-ing in the bit. */
295 retval = hash_insert (op_hash, name, (void *) &machine_opcodes[i]);
298 fprintf (stderr, "internal error: can't hash `%s': %s\n",
299 machine_opcodes[i].name, retval);
305 as_fatal (_("Broken assembler. No assembly attempted."));
311 parse_operand (char *s, expressionS *operandp, int opt)
313 char *save = input_line_pointer;
316 input_line_pointer = s;
317 expression (operandp);
318 if (operandp->X_op == O_absent && ! opt)
319 as_bad (_("missing operand"));
320 new = input_line_pointer;
321 input_line_pointer = save;
325 /* Instruction parsing. Takes a string containing the opcode.
326 Operands are at input_line_pointer. Output is in the_insn.
327 Warnings or errors are generated. */
330 machine_ip (char *str)
334 struct machine_opcode *insn;
336 unsigned long opcode;
337 expressionS the_operand;
338 expressionS *operand = &the_operand;
341 /* Must handle `div0' opcode. */
344 for (; ISALNUM (*s); ++s)
352 case ' ': /* FIXME-SOMEDAY more whitespace. */
357 as_bad (_("Unknown opcode: `%s'"), str);
360 if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL)
362 as_bad (_("Unknown opcode `%s'."), str);
366 opcode = insn->opcode;
367 memset (&the_insn, '\0', sizeof (the_insn));
368 the_insn.reloc = NO_RELOC;
370 /* Build the opcode, checking as we go to make sure that the
373 If an operand matches, we modify the_insn or opcode appropriately,
374 and do a "continue". If an operand fails to match, we "break". */
375 if (insn->args[0] != '\0')
376 /* Prime the pump. */
377 s = parse_operand (s, operand, insn->args[0] == 'I');
379 for (args = insn->args;; ++args)
386 /* We are truly done. */
387 the_insn.opcode = opcode;
390 as_bad (_("Too many operands: %s"), s);
396 /* Parse next operand. */
397 s = parse_operand (s, operand, args[1] == 'I');
403 /* Trap numbers (immediate field). */
404 if (operand->X_op == O_constant)
406 if (operand->X_add_number < 256)
407 opcode |= (operand->X_add_number << 16);
409 as_bad (_("Immediate value of %ld is too large"),
410 (long) operand->X_add_number);
413 the_insn.reloc = RELOC_8;
414 /* BIG-ENDIAN Byte 1 of insn. */
415 the_insn.reloc_offset = 1;
416 the_insn.exp = *operand;
419 case 'b': /* A general register or 8-bit immediate. */
421 /* We treat the two cases identically since we mashed
422 them together in the opcode table. */
423 if (operand->X_op == O_register)
426 /* Make sure the 'i' case really exists. */
427 if ((insn->opcode | IMMEDIATE_BIT) != (insn + 1)->opcode)
430 opcode |= IMMEDIATE_BIT;
431 if (operand->X_op == O_constant)
433 if (operand->X_add_number < 256)
434 opcode |= operand->X_add_number;
436 as_bad (_("Immediate value of %ld is too large"),
437 (long) operand->X_add_number);
440 the_insn.reloc = RELOC_8;
441 the_insn.reloc_offset = 3; /* BIG-ENDIAN Byte 3 of insn. */
442 the_insn.exp = *operand;
445 case 'a': /* Next operand must be a register. */
448 /* lrNNN or grNNN or %%expr or a user-def register name. */
449 if (operand->X_op != O_register)
451 know (operand->X_add_symbol == 0);
452 know (operand->X_op_symbol == 0);
453 reg = operand->X_add_number;
457 /* Got the register, now figure out where it goes in the
474 as_fatal (_("failed sanity check."));
477 case 'x': /* 16 bit constant, zero-extended. */
478 case 'X': /* 16 bit constant, one-extended. */
479 if (operand->X_op == O_constant)
481 opcode |= (operand->X_add_number & 0xFF) << 0
482 | ((operand->X_add_number & 0xFF00) << 8);
485 the_insn.reloc = RELOC_CONST;
486 the_insn.exp = *operand;
490 if (operand->X_op == O_constant)
492 opcode |= (operand->X_add_number & 0x00FF0000) >> 16
493 | (((unsigned long) operand->X_add_number
494 /* Avoid sign ext. */ & 0xFF000000) >> 8);
497 the_insn.reloc = RELOC_CONSTH;
498 the_insn.exp = *operand;
501 case 'P': /* PC-relative jump address. */
502 case 'A': /* Absolute jump address. */
503 /* These two are treated together since we folded the
504 opcode table entries together. */
505 if (operand->X_op == O_constant)
507 /* Make sure the 'A' case really exists. */
508 if ((insn->opcode | ABSOLUTE_BIT) != (insn + 1)->opcode)
515 v = operand->X_add_number & ~ mask;
517 as_bad ("call/jmp target out of range");
520 opcode |= ABSOLUTE_BIT
521 | (operand->X_add_number & 0x0003FC00) << 6
522 | ((operand->X_add_number & 0x000003FC) >> 2);
526 the_insn.reloc = RELOC_JUMPTARG;
527 the_insn.exp = *operand;
528 the_insn.pcrel = 1; /* Assume PC-relative jump. */
529 /* FIXME-SOON, Do we figure out whether abs later, after
533 case 'e': /* Coprocessor enable bit for LOAD/STORE insn. */
534 if (operand->X_op == O_constant)
536 if (operand->X_add_number == 0)
538 if (operand->X_add_number == 1)
546 case 'n': /* Control bits for LOAD/STORE instructions. */
547 if (operand->X_op == O_constant
548 && operand->X_add_number < 128)
550 opcode |= (operand->X_add_number << 16);
555 case 's': /* Special register number. */
556 if (operand->X_op != O_register)
558 if (operand->X_add_number < SREG)
560 opcode |= (operand->X_add_number & 0xFF) << 8;
563 case 'u': /* UI bit of CONVERT. */
564 if (operand->X_op == O_constant)
566 if (operand->X_add_number == 0)
568 if (operand->X_add_number == 1)
576 case 'r': /* RND bits of CONVERT. */
577 if (operand->X_op == O_constant
578 && operand->X_add_number < 8)
580 opcode |= operand->X_add_number << 4;
585 case 'I': /* ID bits of INV and IRETINV. */
586 /* This operand is optional. */
587 if (operand->X_op == O_absent)
589 else if (operand->X_op == O_constant
590 && operand->X_add_number < 4)
592 opcode |= operand->X_add_number << 16;
597 case 'd': /* FD bits of CONVERT. */
598 if (operand->X_op == O_constant
599 && operand->X_add_number < 4)
601 opcode |= operand->X_add_number << 2;
606 case 'f': /* FS bits of CONVERT. */
607 if (operand->X_op == O_constant
608 && operand->X_add_number < 4)
610 opcode |= operand->X_add_number << 0;
616 if (operand->X_op == O_constant
617 && operand->X_add_number < 4)
619 opcode |= operand->X_add_number << 16;
625 if (operand->X_op == O_constant
626 && operand->X_add_number < 16)
628 opcode |= operand->X_add_number << 18;
636 /* Types or values of args don't match. */
637 as_bad ("Invalid operands");
642 /* Assemble a single instruction. Its label has already been handled
643 by the generic front end. We just parse opcode and operands, and
644 produce the bytes of data and relocation. */
647 md_assemble (char *str)
654 /* Put out the opcode. */
655 md_number_to_chars (toP, the_insn.opcode, 4);
657 /* Put out the symbol-dependent stuff. */
658 if (the_insn.reloc != NO_RELOC)
659 fix_new_exp (frag_now,
660 (toP - frag_now->fr_literal + the_insn.reloc_offset),
661 4, & the_insn.exp, the_insn.pcrel, the_insn.reloc);
664 /* This is identical to the md_atof in m68k.c. I think this is right,
667 Turn a string in input_line_pointer into a floating point constant
668 of type TYPE, and store the appropriate bytes in *LITP. The number
669 of LITTLENUMS emitted is stored in *SIZEP. An error message is
670 returned, or NULL on OK. */
672 /* Equal to MAX_PRECISION in atof-ieee.c */
673 #define MAX_LITTLENUMS 6
676 md_atof (int type, char *litP, int *sizeP)
679 LITTLENUM_TYPE words[MAX_LITTLENUMS];
680 LITTLENUM_TYPE *wordP;
712 return "Bad call to MD_ATOF()";
714 t = atof_ieee (input_line_pointer, type, words);
716 input_line_pointer = t;
717 *sizeP = prec * sizeof (LITTLENUM_TYPE);
718 for (wordP = words; prec--;)
720 md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
721 litP += sizeof (LITTLENUM_TYPE);
726 /* Write out big-endian. */
729 md_number_to_chars (char *buf, valueT val, int n)
731 number_to_chars_bigendian (buf, val, n);
735 md_apply_fix3 (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
738 char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
740 fixP->fx_addnumber = val; /* Remember value for emit_reloc. */
742 know (fixP->fx_size == 4);
743 know (fixP->fx_r_type < NO_RELOC);
745 /* This is a hack. There should be a better way to handle this. */
746 if (fixP->fx_r_type == RELOC_WDISP30 && fixP->fx_addsy)
747 val += fixP->fx_where + fixP->fx_frag->fr_address;
749 switch (fixP->fx_r_type)
763 val = (val >> 2) + 1;
764 buf[0] |= (val >> 24) & 0x3f;
765 buf[1] = (val >> 16);
771 buf[1] |= (val >> 26) & 0x3f;
777 buf[2] |= (val >> 8) & 0x03;
782 buf[2] |= (val >> 8) & 0x1f;
787 val = (val >> 2) + 1;
790 buf[1] |= (val >> 16) & 0x3f;
795 case RELOC_JUMPTARG: /* 00XX00XX pattern in a word. */
798 /* The linker tries to support both AMD and old GNU style
799 R_IREL relocs. That means that if the addend is exactly
800 the negative of the address within the section, the
801 linker will not handle it correctly. */
804 && val == - (fixP->fx_frag->fr_address + fixP->fx_where))
806 (fixP->fx_file, fixP->fx_line,
807 "the linker will not handle this relocation correctly");
809 else if (fixP->fx_pcrel)
811 if (val + 0x20000 > 0x3ffff)
812 as_bad_where (fixP->fx_file, fixP->fx_line,
813 "call/jmp target out of range");
816 /* This case was supposed to be handled in machine_ip. */
819 buf[1] = val >> 10; /* Holds bits 0003FFFC of address. */
823 case RELOC_CONST: /* 00XX00XX pattern in a word. */
824 buf[1] = val >> 8; /* Holds bits 0000XXXX. */
828 case RELOC_CONSTH: /* 00XX00XX pattern in a word. */
829 buf[1] = val >> 24; /* Holds bits XXXX0000. */
835 as_bad (_("bad relocation type: 0x%02x"), fixP->fx_r_type);
839 if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
845 tc_coff_fix2rtype (fixS *fixP)
847 switch (fixP->fx_r_type)
849 case RELOC_32: return R_WORD;
850 case RELOC_8: return R_BYTE;
851 case RELOC_CONST: return R_ILOHALF;
852 case RELOC_CONSTH: return R_IHIHALF;
853 case RELOC_JUMPTARG: return R_IREL;
855 printf (_("need %o3\n"), fixP->fx_r_type);
862 #endif /* OBJ_COFF */
864 /* Should never be called for 29k. */
867 md_convert_frag (object_headers *headers ATTRIBUTE_UNUSED,
868 segT seg ATTRIBUTE_UNUSED,
869 fragS *fragP ATTRIBUTE_UNUSED)
871 as_fatal (_("a29k_convert_frag\n"));
874 /* Should never be called for a29k. */
877 md_estimate_size_before_relax (fragS *fragP ATTRIBUTE_UNUSED,
878 segT segtype ATTRIBUTE_UNUSED)
880 as_fatal (_("a29k_estimate_size_before_relax\n"));
884 /* Translate internal representation of relocation info to target format.
886 On sparc/29k: first 4 bytes are normal unsigned long address, next three
887 bytes are index, most sig. byte first. Byte 7 is broken up with
888 bit 7 as external, bits 6 & 5 unused, and the lower
889 five bits as relocation type. Next 4 bytes are long addend. */
891 /* Thanx and a tip of the hat to Michael Bloom, mb@ttidca.tti.com. */
896 tc_aout_fix_to_chars (char *where,
898 relax_addressT segment_address_in_file)
902 know (fixP->fx_r_type < NO_RELOC);
903 know (fixP->fx_addsy != NULL);
905 md_number_to_chars (where,
906 fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file,
909 r_symbolnum = (S_IS_DEFINED (fixP->fx_addsy)
910 ? S_GET_TYPE (fixP->fx_addsy)
911 : fixP->fx_addsy->sy_number);
913 where[4] = (r_symbolnum >> 16) & 0x0ff;
914 where[5] = (r_symbolnum >> 8) & 0x0ff;
915 where[6] = r_symbolnum & 0x0ff;
916 where[7] = (((!S_IS_DEFINED (fixP->fx_addsy)) << 7) & 0x80) | (0 & 0x60) | (fixP->fx_r_type & 0x1F);
919 md_number_to_chars (&where[8], fixP->fx_addnumber, 4);
922 #endif /* OBJ_AOUT */
924 const char *md_shortopts = "";
926 struct option md_longopts[] =
928 {NULL, no_argument, NULL, 0}
931 size_t md_longopts_size = sizeof (md_longopts);
934 md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
940 md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
944 /* This is called when a line is unrecognized. This is used to handle
945 definitions of a29k style local labels. */
948 a29k_unrecognized_line (int c)
954 || ! ISDIGIT (input_line_pointer[0]))
957 s = input_line_pointer;
962 lab = lab * 10 + *s - '0';
968 /* Not a label definition. */
972 if (dollar_label_defined (lab))
974 as_bad (_("label \"$%d\" redefined"), lab);
978 define_dollar_label (lab);
979 colon (dollar_label_name (lab, 0));
980 input_line_pointer = s + 1;
985 /* Default the values of symbols known that should be "predefined". We
986 don't bother to predefine them unless you actually use one, since there
987 are a lot of them. */
990 md_undefined_symbol (char *name)
993 char testbuf[5 + /*SLOP*/ 5];
995 if (name[0] == 'g' || name[0] == 'G'
996 || name[0] == 'l' || name[0] == 'L'
997 || name[0] == 's' || name[0] == 'S')
999 /* Perhaps a global or local register name. */
1000 if (name[1] == 'r' || name[1] == 'R')
1004 /* Parse the number, make sure it has no extra zeroes or
1006 regnum = atol (&name[2]);
1008 if (name[0] == 's' || name[0] == 'S')
1012 if (regnum > maxreg)
1015 sprintf (testbuf, "%ld", regnum);
1016 if (strcmp (testbuf, &name[2]) != 0)
1017 return NULL; /* gr007 or lr7foo or whatever. */
1019 /* We have a wiener! Define and return a new symbol for it. */
1020 if (name[0] == 'l' || name[0] == 'L')
1022 else if (name[0] == 's' || name[0] == 'S')
1024 return (symbol_new (name, SEG_REGISTER, (valueT) regnum,
1025 &zero_address_frag));
1032 /* Parse an operand that is machine-specific. */
1035 md_operand (expressionS *expressionP)
1037 if (input_line_pointer[0] == '%' && input_line_pointer[1] == '%')
1039 /* We have a numeric register expression. No biggy. */
1040 input_line_pointer += 2; /* Skip %% */
1041 (void) expression (expressionP);
1042 if (expressionP->X_op != O_constant
1043 || expressionP->X_add_number > 255)
1044 as_bad (_("Invalid expression after %%%%\n"));
1045 expressionP->X_op = O_register;
1047 else if (input_line_pointer[0] == '&')
1049 /* We are taking the 'address' of a register...this one is not
1050 in the manual, but it *is* in traps/fpsymbol.h! What they
1051 seem to want is the register number, as an absolute number. */
1052 input_line_pointer++; /* Skip & */
1053 (void) expression (expressionP);
1054 if (expressionP->X_op != O_register)
1055 as_bad (_("Invalid register in & expression"));
1057 expressionP->X_op = O_constant;
1059 else if (input_line_pointer[0] == '$'
1060 && ISDIGIT (input_line_pointer[1]))
1066 /* This is a local label. */
1067 ++input_line_pointer;
1068 lab = (long) get_absolute_expression ();
1069 if (dollar_label_defined (lab))
1071 name = dollar_label_name (lab, 0);
1072 sym = symbol_find (name);
1076 name = dollar_label_name (lab, 1);
1077 sym = symbol_find_or_make (name);
1080 expressionP->X_op = O_symbol;
1081 expressionP->X_add_symbol = sym;
1082 expressionP->X_add_number = 0;
1084 else if (input_line_pointer[0] == '$')
1088 int fieldnum, fieldlimit;
1089 LITTLENUM_TYPE floatbuf[8];
1091 /* $float(), $doubleN(), or $extendN() convert floating values
1094 s = input_line_pointer;
1099 if (strncmp (s, "double", sizeof "double" - 1) == 0)
1101 s += sizeof "double" - 1;
1105 else if (strncmp (s, "float", sizeof "float" - 1) == 0)
1107 s += sizeof "float" - 1;
1111 else if (strncmp (s, "extend", sizeof "extend" - 1) == 0)
1113 s += sizeof "extend" - 1;
1122 fieldnum = *s - '0';
1126 if (fieldnum >= fieldlimit)
1135 s = atof_ieee (s, type, floatbuf);
1146 input_line_pointer = s;
1147 expressionP->X_op = O_constant;
1148 expressionP->X_unsigned = 1;
1149 expressionP->X_add_number = ((floatbuf[fieldnum * 2]
1150 << LITTLENUM_NUMBER_OF_BITS)
1151 + floatbuf[fieldnum * 2 + 1]);
1155 /* Round up a section size to the appropriate boundary. */
1158 md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
1160 return size; /* Byte alignment is fine. */
1163 /* Exactly what point is a PC-relative offset relative TO?
1164 On the 29000, they're relative to the address of the instruction,
1165 which we have set up as the address of the fixup too. */
1168 md_pcrel_from (fixS *fixP)
1170 return fixP->fx_where + fixP->fx_frag->fr_address;
1176 {"align", s_align_bytes, 4},
1177 {"block", s_space, 0},
1178 {"cputype", s_ignore, 0}, /* CPU as 29000 or 29050. */
1179 {"reg", s_lsym, 0}, /* Register equate, same as equ. */
1180 {"space", s_ignore, 0}, /* Listing control. */
1181 {"sect", s_ignore, 0}, /* Creation of coff sections. */
1183 {"use", s_use, 0}, /* We can do this right with coff. */