source: trunk/binutils/gas/config/tc-tahoe.c@ 2562

Last change on this file since 2562 was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 58.7 KB
Line 
1/* This file is tc-tahoe.c
2
3 Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000, 2001, 2002
4 Free Software Foundation, Inc.
5
6 This file is part of GAS, the GNU Assembler.
7
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)
11 any later version.
12
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.
17
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
21 02111-1307, USA. */
22#include "as.h"
23#include "safe-ctype.h"
24#include "obstack.h"
25
26/* This bit glommed from tahoe-inst.h. */
27
28typedef unsigned char byte;
29typedef byte tahoe_opcodeT;
30
31/* This is part of tahoe-ins-parse.c & friends.
32 We want to parse a tahoe instruction text into a tree defined here. */
33
34#define TIT_MAX_OPERANDS (4) /* maximum number of operands in one
35 single tahoe instruction */
36
37struct top /* tahoe instruction operand */
38 {
39 int top_ndx; /* -1, or index register. eg 7=[R7] */
40 int top_reg; /* -1, or register number. eg 7 = R7 or (R7) */
41 byte top_mode; /* Addressing mode byte. This byte, defines
42 which of the 11 modes opcode is. */
43
44 char top_access; /* Access type wanted for this opperand
45 'b'branch ' 'no-instruction 'amrvw' */
46 char top_width; /* Operand width expected, one of "bwlq?-:!" */
47
48 char * top_error; /* Say if operand is inappropriate */
49
50 segT seg_of_operand; /* segment as returned by expression()*/
51
52 expressionS exp_of_operand; /* The expression as parsed by expression()*/
53
54 byte top_dispsize; /* Number of bytes in the displacement if we
55 can figure it out */
56 };
57
58/* The addressing modes for an operand. These numbers are the acutal values
59 for certain modes, so be carefull if you screw with them. */
60#define TAHOE_DIRECT_REG (0x50)
61#define TAHOE_REG_DEFERRED (0x60)
62
63#define TAHOE_REG_DISP (0xE0)
64#define TAHOE_REG_DISP_DEFERRED (0xF0)
65
66#define TAHOE_IMMEDIATE (0x8F)
67#define TAHOE_IMMEDIATE_BYTE (0x88)
68#define TAHOE_IMMEDIATE_WORD (0x89)
69#define TAHOE_IMMEDIATE_LONGWORD (0x8F)
70#define TAHOE_ABSOLUTE_ADDR (0x9F)
71
72#define TAHOE_DISPLACED_RELATIVE (0xEF)
73#define TAHOE_DISP_REL_DEFERRED (0xFF)
74
75#define TAHOE_AUTO_DEC (0x7E)
76#define TAHOE_AUTO_INC (0x8E)
77#define TAHOE_AUTO_INC_DEFERRED (0x9E)
78/* INDEXED_REG is decided by the existance or lack of a [reg]. */
79
80/* These are encoded into top_width when top_access=='b'
81 and it's a psuedo op. */
82#define TAHOE_WIDTH_ALWAYS_JUMP '-'
83#define TAHOE_WIDTH_CONDITIONAL_JUMP '?'
84#define TAHOE_WIDTH_BIG_REV_JUMP '!'
85#define TAHOE_WIDTH_BIG_NON_REV_JUMP ':'
86
87/* The hex code for certain tahoe commands and modes.
88 This is just for readability. */
89#define TAHOE_JMP (0x71)
90#define TAHOE_PC_REL_LONG (0xEF)
91#define TAHOE_BRB (0x11)
92#define TAHOE_BRW (0x13)
93/* These, when 'ored' with, or added to, a register number,
94 set up the number for the displacement mode. */
95#define TAHOE_PC_OR_BYTE (0xA0)
96#define TAHOE_PC_OR_WORD (0xC0)
97#define TAHOE_PC_OR_LONG (0xE0)
98
99struct tit /* Get it out of the sewer, it stands for
100 tahoe instruction tree (Geeze!). */
101{
102 tahoe_opcodeT tit_opcode; /* The opcode. */
103 byte tit_operands; /* How many operands are here. */
104 struct top tit_operand[TIT_MAX_OPERANDS]; /* Operands */
105 char *tit_error; /* "" or fatal error text */
106};
107
108/* end: tahoe-inst.h */
109
110/* tahoe.c - tahoe-specific -
111 Not part of gas yet.
112 */
113
114#include "opcode/tahoe.h"
115
116/* This is the number to put at the beginning of the a.out file */
117long omagic = OMAGIC;
118
119/* These chars start a comment anywhere in a source file (except inside
120 another comment or a quoted string. */
121const char comment_chars[] = "#;";
122
123/* These chars only start a comment at the beginning of a line. */
124const char line_comment_chars[] = "#";
125
126/* Chars that can be used to separate mant from exp in floating point nums */
127const char EXP_CHARS[] = "eE";
128
129/* Chars that mean this number is a floating point constant
130 as in 0f123.456
131 or 0d1.234E-12 (see exp chars above)
132 Note: The Tahoe port doesn't support floating point constants. This is
133 consistant with 'as' If it's needed, I can always add it later. */
134const char FLT_CHARS[] = "df";
135
136/* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
137 changed in read.c . Ideally it shouldn't have to know about it at all,
138 but nothing is ideal around here.
139 (The tahoe has plenty of room, so the change currently isn't needed.)
140 */
141
142static struct tit t; /* A tahoe instruction after decoding. */
143
144void float_cons ();
145/* A table of pseudo ops (sans .), the function called, and an integer op
146 that the function is called with. */
147
148const pseudo_typeS md_pseudo_table[] =
149{
150 {"dfloat", float_cons, 'd'},
151 {"ffloat", float_cons, 'f'},
152 {0}
153};
154
155
156/*
157 * For Tahoe, relative addresses of "just the right length" are pretty easy.
158 * The branch displacement is always the last operand, even in
159 * synthetic instructions.
160 * For Tahoe, we encode the relax_substateTs (in e.g. fr_substate) as:
161 *
162 * 4 3 2 1 0 bit number
163 * ---/ /--+-------+-------+-------+-------+-------+
164 * | what state ? | how long ? |
165 * ---/ /--+-------+-------+-------+-------+-------+
166 *
167 * The "how long" bits are 00=byte, 01=word, 10=long.
168 * This is a Un*x convention.
169 * Not all lengths are legit for a given value of (what state).
170 * The four states are listed below.
171 * The "how long" refers merely to the displacement length.
172 * The address usually has some constant bytes in it as well.
173 *
174
175States for Tahoe address relaxing.
1761. TAHOE_WIDTH_ALWAYS_JUMP (-)
177 Format: "b-"
178 Tahoe opcodes are: (Hex)
179 jr 11
180 jbr 11
181 Simple branch.
182 Always, 1 byte opcode, then displacement/absolute.
183 If word or longword, change opcode to brw or jmp.
184
1852. TAHOE_WIDTH_CONDITIONAL_JUMP (?)
186 J<cond> where <cond> is a simple flag test.
187 Format: "b?"
188 Tahoe opcodes are: (Hex)
189 jneq/jnequ 21
190 jeql/jeqlu 31
191 jgtr 41
192 jleq 51
193 jgeq 81
194 jlss 91
195 jgtru a1
196 jlequ b1
197 jvc c1
198 jvs d1
199 jlssu/jcs e1
200 jgequ/jcc f1
201 Always, you complement 4th bit to reverse the condition.
202 Always, 1-byte opcode, then 1-byte displacement.
203
2043. TAHOE_WIDTH_BIG_REV_JUMP (!)
205 Jbc/Jbs where cond tests a memory bit.
206 Format: "rlvlb!"
207 Tahoe opcodes are: (Hex)
208 jbs 0e
209 jbc 1e
210 Always, you complement 4th bit to reverse the condition.
211 Always, 1-byte opcde, longword, longword-address, 1-word-displacement
212
2134. TAHOE_WIDTH_BIG_NON_REV_JUMP (:)
214 JaoblXX/Jbssi
215 Format: "rlmlb:"
216 Tahoe opcodes are: (Hex)
217 aojlss 2f
218 jaoblss 2f
219 aojleq 3f
220 jaobleq 3f
221 jbssi 5f
222 Always, we cannot reverse the sense of the branch; we have a word
223 displacement.
224
225We need to modify the opcode is for class 1, 2 and 3 instructions.
226After relax() we may complement the 4th bit of 2 or 3 to reverse sense of
227branch.
228
229We sometimes store context in the operand literal. This way we can figure out
230after relax() what the original addressing mode was. (Was is pc_rel, or
231pc_rel_disp? That sort of thing.) */
232
233
234/* These displacements are relative to the START address of the
235 displacement which is at the start of the displacement, not the end of
236 the instruction. The hardware pc_rel is at the end of the instructions.
237 That's why all the displacements have the length of the displacement added
238 to them. (WF + length(word))
239
240 The first letter is Byte, Word.
241 2nd letter is Forward, Backward. */
242#define BF (1+ 127)
243#define BB (1+-128)
244#define WF (2+ 32767)
245#define WB (2+-32768)
246/* Dont need LF, LB because they always reach. [They are coded as 0.] */
247
248#define C(a,b) ENCODE_RELAX(a,b)
249/* This macro has no side-effects. */
250#define ENCODE_RELAX(what,length) (((what) << 2) + (length))
251#define RELAX_STATE(s) ((s) >> 2)
252#define RELAX_LENGTH(s) ((s) & 3)
253
254#define STATE_ALWAYS_BRANCH (1)
255#define STATE_CONDITIONAL_BRANCH (2)
256#define STATE_BIG_REV_BRANCH (3)
257#define STATE_BIG_NON_REV_BRANCH (4)
258#define STATE_PC_RELATIVE (5)
259
260#define STATE_BYTE (0)
261#define STATE_WORD (1)
262#define STATE_LONG (2)
263#define STATE_UNDF (3) /* Symbol undefined in pass1 */
264
265/* This is the table used by gas to figure out relaxing modes. The fields are
266 forward_branch reach, backward_branch reach, number of bytes it would take,
267 where the next biggest branch is. */
268const relax_typeS md_relax_table[] =
269{
270 {
271 1, 1, 0, 0
272 }, /* error sentinel 0,0 */
273 {
274 1, 1, 0, 0
275 }, /* unused 0,1 */
276 {
277 1, 1, 0, 0
278 }, /* unused 0,2 */
279 {
280 1, 1, 0, 0
281 }, /* unused 0,3 */
282/* Unconditional branch cases "jrb"
283 The relax part is the actual displacement */
284 {
285 BF, BB, 1, C (1, 1)
286 }, /* brb B`foo 1,0 */
287 {
288 WF, WB, 2, C (1, 2)
289 }, /* brw W`foo 1,1 */
290 {
291 0, 0, 5, 0
292 }, /* Jmp L`foo 1,2 */
293 {
294 1, 1, 0, 0
295 }, /* unused 1,3 */
296/* Reversible Conditional Branch. If the branch won't reach, reverse
297 it, and jump over a brw or a jmp that will reach. The relax part is the
298 actual address. */
299 {
300 BF, BB, 1, C (2, 1)
301 }, /* b<cond> B`foo 2,0 */
302 {
303 WF + 2, WB + 2, 4, C (2, 2)
304 }, /* brev over, brw W`foo, over: 2,1 */
305 {
306 0, 0, 7, 0
307 }, /* brev over, jmp L`foo, over: 2,2 */
308 {
309 1, 1, 0, 0
310 }, /* unused 2,3 */
311/* Another type of reversable branch. But this only has a word
312 displacement. */
313 {
314 1, 1, 0, 0
315 }, /* unused 3,0 */
316 {
317 WF, WB, 2, C (3, 2)
318 }, /* jbX W`foo 3,1 */
319 {
320 0, 0, 8, 0
321 }, /* jrevX over, jmp L`foo, over: 3,2 */
322 {
323 1, 1, 0, 0
324 }, /* unused 3,3 */
325/* These are the non reversable branches, all of which have a word
326 displacement. If I can't reach, branch over a byte branch, to a
327 jump that will reach. The jumped branch jumps over the reaching
328 branch, to continue with the flow of the program. It's like playing
329 leap frog. */
330 {
331 1, 1, 0, 0
332 }, /* unused 4,0 */
333 {
334 WF, WB, 2, C (4, 2)
335 }, /* aobl_ W`foo 4,1 */
336 {
337 0, 0, 10, 0
338 }, /*aobl_ W`hop,br over,hop: jmp L^foo,over 4,2*/
339 {
340 1, 1, 0, 0
341 }, /* unused 4,3 */
342/* Normal displacement mode, no jumping or anything like that.
343 The relax points to one byte before the address, thats why all
344 the numbers are up by one. */
345 {
346 BF + 1, BB + 1, 2, C (5, 1)
347 }, /* B^"foo" 5,0 */
348 {
349 WF + 1, WB + 1, 3, C (5, 2)
350 }, /* W^"foo" 5,1 */
351 {
352 0, 0, 5, 0
353 }, /* L^"foo" 5,2 */
354 {
355 1, 1, 0, 0
356 }, /* unused 5,3 */
357};
358
359#undef C
360#undef BF
361#undef BB
362#undef WF
363#undef WB
364/* End relax stuff */
365
366
367/* Handle of the OPCODE hash table. NULL means any use before
368 md_begin() will crash. */
369static struct hash_control *op_hash;
370
371/* Init function. Build the hash table. */
372void
373md_begin ()
374{
375 struct tot *tP;
376 char *errorval = 0;
377 int synthetic_too = 1; /* If 0, just use real opcodes. */
378
379 op_hash = hash_new ();
380
381 for (tP = totstrs; *tP->name && !errorval; tP++)
382 errorval = hash_insert (op_hash, tP->name, &tP->detail);
383
384 if (synthetic_too)
385 for (tP = synthetic_totstrs; *tP->name && !errorval; tP++)
386 errorval = hash_insert (op_hash, tP->name, &tP->detail);
387
388 if (errorval)
389 as_fatal (errorval);
390}
391
392
393const char *md_shortopts = "ad:STt:V";
394struct option md_longopts[] = {
395 {NULL, no_argument, NULL, 0}
396};
397size_t md_longopts_size = sizeof (md_longopts);
398
399int
400md_parse_option (c, arg)
401 int c;
402 char *arg;
403{
404 switch (c)
405 {
406 case 'a':
407 as_warn (_("The -a option doesn't exist. (Despite what the man page says!"));
408 break;
409
410 case 'd':
411 as_warn (_("Displacement length %s ignored!"), arg);
412 break;
413
414 case 'S':
415 as_warn (_("SYMBOL TABLE not implemented"));
416 break;
417
418 case 'T':
419 as_warn (_("TOKEN TRACE not implemented"));
420 break;
421
422 case 't':
423 as_warn (_("I don't need or use temp. file \"%s\"."), arg);
424 break;
425
426 case 'V':
427 as_warn (_("I don't use an interpass file! -V ignored"));
428 break;
429
430 default:
431 return 0;
432 }
433
434 return 1;
435}
436
437void
438md_show_usage (stream)
439 FILE *stream;
440{
441 fprintf (stream, _("\
442Tahoe options:\n\
443-a ignored\n\
444-d LENGTH ignored\n\
445-J ignored\n\
446-S ignored\n\
447-t FILE ignored\n\
448-T ignored\n\
449-V ignored\n"));
450}
451
452
453/* The functions in this section take numbers in the machine format, and
454 munges them into Tahoe byte order.
455 They exist primarily for cross assembly purpose. */
456void /* Knows about order of bytes in address. */
457md_number_to_chars (con, value, nbytes)
458 char con[]; /* Return 'nbytes' of chars here. */
459 valueT value; /* The value of the bits. */
460 int nbytes; /* Number of bytes in the output. */
461{
462 number_to_chars_bigendian (con, value, nbytes);
463}
464
465#ifdef comment
466void /* Knows about order of bytes in address. */
467md_number_to_imm (con, value, nbytes)
468 char con[]; /* Return 'nbytes' of chars here. */
469 long int value; /* The value of the bits. */
470 int nbytes; /* Number of bytes in the output. */
471{
472 md_number_to_chars (con, value, nbytes);
473}
474
475#endif /* comment */
476
477void
478md_apply_fix3 (fixP, valP, seg)
479 fixS *fixP ATTRIBUTE_UNUSED;
480 valueT * valP ATTRIBUTE_UNUSED;
481 segT seg ATTRIBUTE_UNUSED:
482{
483 /* Should never be called. */
484 know (0);
485}
486
487void /* Knows about order of bytes in address. */
488md_number_to_disp (con, value, nbytes)
489 char con[]; /* Return 'nbytes' of chars here. */
490 long int value; /* The value of the bits. */
491 int nbytes; /* Number of bytes in the output. */
492{
493 md_number_to_chars (con, value, nbytes);
494}
495
496void /* Knows about order of bytes in address. */
497md_number_to_field (con, value, nbytes)
498 char con[]; /* Return 'nbytes' of chars here. */
499 long int value; /* The value of the bits. */
500 int nbytes; /* Number of bytes in the output. */
501{
502 md_number_to_chars (con, value, nbytes);
503}
504
505/* Put the bits in an order that a tahoe will understand, despite the ordering
506 of the native machine.
507 On Tahoe: first 4 bytes are normal unsigned big endian long,
508 next three bytes are symbolnum, in kind of 3 byte big endian (least sig. byte last).
509 The last byte is broken up with bit 7 as pcrel,
510 bits 6 & 5 as length,
511 bit 4 as extern and the last nibble as 'undefined'. */
512
513#if comment
514void
515md_ri_to_chars (ri_p, ri)
516 struct relocation_info *ri_p, ri;
517{
518 byte the_bytes[sizeof (struct relocation_info)];
519 /* The reason I can't just encode these directly into ri_p is that
520 ri_p may point to ri. */
521
522 /* This is easy */
523 md_number_to_chars (the_bytes, ri.r_address, sizeof (ri.r_address));
524
525 /* now the fun stuff */
526 the_bytes[4] = (ri.r_symbolnum >> 16) & 0x0ff;
527 the_bytes[5] = (ri.r_symbolnum >> 8) & 0x0ff;
528 the_bytes[6] = ri.r_symbolnum & 0x0ff;
529 the_bytes[7] = (((ri.r_extern << 4) & 0x10) | ((ri.r_length << 5) & 0x60) |
530 ((ri.r_pcrel << 7) & 0x80)) & 0xf0;
531
532 bcopy (the_bytes, (char *) ri_p, sizeof (struct relocation_info));
533}
534
535#endif /* comment */
536
537/* Put the bits in an order that a tahoe will understand, despite the ordering
538 of the native machine.
539 On Tahoe: first 4 bytes are normal unsigned big endian long,
540 next three bytes are symbolnum, in kind of 3 byte big endian (least sig. byte last).
541 The last byte is broken up with bit 7 as pcrel,
542 bits 6 & 5 as length,
543 bit 4 as extern and the last nibble as 'undefined'. */
544
545void
546tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
547 char *where;
548 fixS *fixP;
549 relax_addressT segment_address_in_file;
550{
551 long r_symbolnum;
552
553 know (fixP->fx_addsy != NULL);
554
555 md_number_to_chars (where,
556 fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file,
557 4);
558
559 r_symbolnum = (S_IS_DEFINED (fixP->fx_addsy)
560 ? S_GET_TYPE (fixP->fx_addsy)
561 : fixP->fx_addsy->sy_number);
562
563 where[4] = (r_symbolnum >> 16) & 0x0ff;
564 where[5] = (r_symbolnum >> 8) & 0x0ff;
565 where[6] = r_symbolnum & 0x0ff;
566 where[7] = (((is_pcrel (fixP) << 7) & 0x80)
567 | ((((fixP->fx_type == FX_8 || fixP->fx_type == FX_PCREL8
568 ? 0
569 : (fixP->fx_type == FX_16 || fixP->fx_type == FX_PCREL16
570 ? 1
571 : (fixP->fx_type == FX_32 || fixP->fx_type == FX_PCREL32
572 ? 2
573 : 42)))) << 5) & 0x60)
574 | ((!S_IS_DEFINED (fixP->fx_addsy) << 4) & 0x10));
575}
576
577/* Relocate byte stuff */
578
579
580/* This is for broken word. */
581const int md_short_jump_size = 3;
582
583void
584md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
585 char *ptr;
586 addressT from_addr, to_addr;
587 fragS *frag;
588 symbolS *to_symbol;
589{
590 valueT offset;
591
592 offset = to_addr - (from_addr + 1);
593 *ptr++ = TAHOE_BRW;
594 md_number_to_chars (ptr, offset, 2);
595}
596
597const int md_long_jump_size = 6;
598const int md_reloc_size = 8; /* Size of relocation record */
599
600void
601md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
602 char *ptr;
603 addressT from_addr, to_addr;
604 fragS *frag;
605 symbolS *to_symbol;
606{
607 valueT offset;
608
609 offset = to_addr - (from_addr + 4);
610 *ptr++ = TAHOE_JMP;
611 *ptr++ = TAHOE_PC_REL_LONG;
612 md_number_to_chars (ptr, offset, 4);
613}
614
615
616/* md_estimate_size_before_relax(), called just before relax().
617 Any symbol that is now undefined will not become defined.
618 Return the correct fr_subtype in the frag and the growth beyond
619 fr_fix. */
620int
621md_estimate_size_before_relax (fragP, segment_type)
622 register fragS *fragP;
623 segT segment_type; /* N_DATA or N_TEXT. */
624{
625 if (RELAX_LENGTH (fragP->fr_subtype) == STATE_UNDF)
626 {
627 if (S_GET_SEGMENT (fragP->fr_symbol) != segment)
628 {
629 /* Non-relaxable cases. */
630 char *p;
631 int old_fr_fix;
632
633 old_fr_fix = fragP->fr_fix;
634 p = fragP->fr_literal + old_fr_fix;
635 switch (RELAX_STATE (fragP->fr_subtype))
636 {
637 case STATE_PC_RELATIVE:
638 *p |= TAHOE_PC_OR_LONG;
639 /* We now know how big it will be, one long word. */
640 fragP->fr_fix += 1 + 4;
641 fix_new (fragP, old_fr_fix + 1, fragP->fr_symbol,
642 fragP->fr_offset, FX_PCREL32, NULL);
643 break;
644
645 case STATE_CONDITIONAL_BRANCH:
646 *fragP->fr_opcode ^= 0x10; /* Reverse sense of branch. */
647 *p++ = 6;
648 *p++ = TAHOE_JMP;
649 *p++ = TAHOE_PC_REL_LONG;
650 fragP->fr_fix += 1 + 1 + 1 + 4;
651 fix_new (fragP, old_fr_fix + 3, fragP->fr_symbol,
652 fragP->fr_offset, FX_PCREL32, NULL);
653 break;
654
655 case STATE_BIG_REV_BRANCH:
656 *fragP->fr_opcode ^= 0x10; /* Reverse sense of branch. */
657 *p++ = 0;
658 *p++ = 6;
659 *p++ = TAHOE_JMP;
660 *p++ = TAHOE_PC_REL_LONG;
661 fragP->fr_fix += 2 + 2 + 4;
662 fix_new (fragP, old_fr_fix + 4, fragP->fr_symbol,
663 fragP->fr_offset, FX_PCREL32, NULL);
664 break;
665
666 case STATE_BIG_NON_REV_BRANCH:
667 *p++ = 2;
668 *p++ = 0;
669 *p++ = TAHOE_BRB;
670 *p++ = 6;
671 *p++ = TAHOE_JMP;
672 *p++ = TAHOE_PC_REL_LONG;
673 fragP->fr_fix += 2 + 2 + 2 + 4;
674 fix_new (fragP, old_fr_fix + 6, fragP->fr_symbol,
675 fragP->fr_offset, FX_PCREL32, NULL);
676 break;
677
678 case STATE_ALWAYS_BRANCH:
679 *fragP->fr_opcode = TAHOE_JMP;
680 *p++ = TAHOE_PC_REL_LONG;
681 fragP->fr_fix += 1 + 4;
682 fix_new (fragP, old_fr_fix + 1, fragP->fr_symbol,
683 fragP->fr_offset, FX_PCREL32, NULL);
684 break;
685
686 default:
687 abort ();
688 }
689 frag_wane (fragP);
690
691 /* Return the growth in the fixed part of the frag. */
692 return fragP->fr_fix - old_fr_fix;
693 }
694
695 /* Relaxable cases. Set up the initial guess for the variable
696 part of the frag. */
697 switch (RELAX_STATE (fragP->fr_subtype))
698 {
699 case STATE_PC_RELATIVE:
700 fragP->fr_subtype = ENCODE_RELAX (STATE_PC_RELATIVE, STATE_BYTE);
701 break;
702 case STATE_CONDITIONAL_BRANCH:
703 fragP->fr_subtype = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE);
704 break;
705 case STATE_BIG_REV_BRANCH:
706 fragP->fr_subtype = ENCODE_RELAX (STATE_BIG_REV_BRANCH, STATE_WORD);
707 break;
708 case STATE_BIG_NON_REV_BRANCH:
709 fragP->fr_subtype = ENCODE_RELAX (STATE_BIG_NON_REV_BRANCH, STATE_WORD);
710 break;
711 case STATE_ALWAYS_BRANCH:
712 fragP->fr_subtype = ENCODE_RELAX (STATE_ALWAYS_BRANCH, STATE_BYTE);
713 break;
714 }
715 }
716
717 if (fragP->fr_subtype >= sizeof (md_relax_table) / sizeof (md_relax_table[0]))
718 abort ();
719
720 /* Return the size of the variable part of the frag. */
721 return md_relax_table[fragP->fr_subtype].rlx_length;
722}
723
724
725/*
726 * md_convert_frag();
727 *
728 * Called after relax() is finished.
729 * In: Address of frag.
730 * fr_type == rs_machine_dependent.
731 * fr_subtype is what the address relaxed to.
732 *
733 * Out: Any fixSs and constants are set up.
734 * Caller will turn frag into a ".space 0".
735 */
736void
737md_convert_frag (headers, seg, fragP)
738 object_headers *headers;
739 segT seg;
740 register fragS *fragP;
741{
742 register char *addressP; /* -> _var to change. */
743 register char *opcodeP; /* -> opcode char(s) to change. */
744 register short int extension = 0; /* Size of relaxed address.
745 Added to fr_fix: incl. ALL var chars. */
746 register symbolS *symbolP;
747 register long int where;
748 register long int address_of_var;
749 /* Where, in file space, is _var of *fragP? */
750 register long int target_address;
751 /* Where, in file space, does addr point? */
752
753 know (fragP->fr_type == rs_machine_dependent);
754 where = fragP->fr_fix;
755 addressP = fragP->fr_literal + where;
756 opcodeP = fragP->fr_opcode;
757 symbolP = fragP->fr_symbol;
758 know (symbolP);
759 target_address = S_GET_VALUE (symbolP) + fragP->fr_offset;
760 address_of_var = fragP->fr_address + where;
761 switch (fragP->fr_subtype)
762 {
763 case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_BYTE):
764 /* *addressP holds the registers number, plus 0x10, if it's deferred
765 mode. To set up the right mode, just OR the size of this displacement */
766 /* Byte displacement. */
767 *addressP++ |= TAHOE_PC_OR_BYTE;
768 *addressP = target_address - (address_of_var + 2);
769 extension = 2;
770 break;
771
772 case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_WORD):
773 /* Word displacement. */
774 *addressP++ |= TAHOE_PC_OR_WORD;
775 md_number_to_chars (addressP, target_address - (address_of_var + 3), 2);
776 extension = 3;
777 break;
778
779 case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_LONG):
780 /* Long word displacement. */
781 *addressP++ |= TAHOE_PC_OR_LONG;
782 md_number_to_chars (addressP, target_address - (address_of_var + 5), 4);
783 extension = 5;
784 break;
785
786 case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE):
787 *addressP = target_address - (address_of_var + 1);
788 extension = 1;
789 break;
790
791 case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_WORD):
792 *opcodeP ^= 0x10; /* Reverse sense of test. */
793 *addressP++ = 3; /* Jump over word branch */
794 *addressP++ = TAHOE_BRW;
795 md_number_to_chars (addressP, target_address - (address_of_var + 4), 2);
796 extension = 4;
797 break;
798
799 case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_LONG):
800 *opcodeP ^= 0x10; /* Reverse sense of test. */
801 *addressP++ = 6;
802 *addressP++ = TAHOE_JMP;
803 *addressP++ = TAHOE_PC_REL_LONG;
804 md_number_to_chars (addressP, target_address, 4);
805 extension = 7;
806 break;
807
808 case ENCODE_RELAX (STATE_ALWAYS_BRANCH, STATE_BYTE):
809 *addressP = target_address - (address_of_var + 1);
810 extension = 1;
811 break;
812
813 case ENCODE_RELAX (STATE_ALWAYS_BRANCH, STATE_WORD):
814 *opcodeP = TAHOE_BRW;
815 md_number_to_chars (addressP, target_address - (address_of_var + 2), 2);
816 extension = 2;
817 break;
818
819 case ENCODE_RELAX (STATE_ALWAYS_BRANCH, STATE_LONG):
820 *opcodeP = TAHOE_JMP;
821 *addressP++ = TAHOE_PC_REL_LONG;
822 md_number_to_chars (addressP, target_address - (address_of_var + 5), 4);
823 extension = 5;
824 break;
825
826 case ENCODE_RELAX (STATE_BIG_REV_BRANCH, STATE_WORD):
827 md_number_to_chars (addressP, target_address - (address_of_var + 2), 2);
828 extension = 2;
829 break;
830
831 case ENCODE_RELAX (STATE_BIG_REV_BRANCH, STATE_LONG):
832 *opcodeP ^= 0x10;
833 *addressP++ = 0;
834 *addressP++ = 6;
835 *addressP++ = TAHOE_JMP;
836 *addressP++ = TAHOE_PC_REL_LONG;
837 md_number_to_chars (addressP, target_address, 4);
838 extension = 8;
839 break;
840
841 case ENCODE_RELAX (STATE_BIG_NON_REV_BRANCH, STATE_WORD):
842 md_number_to_chars (addressP, target_address - (address_of_var + 2), 2);
843 extension = 2;
844 break;
845
846 case ENCODE_RELAX (STATE_BIG_NON_REV_BRANCH, STATE_LONG):
847 *addressP++ = 0;
848 *addressP++ = 2;
849 *addressP++ = TAHOE_BRB;
850 *addressP++ = 6;
851 *addressP++ = TAHOE_JMP;
852 *addressP++ = TAHOE_PC_REL_LONG;
853 md_number_to_chars (addressP, target_address, 4);
854 extension = 10;
855 break;
856
857 default:
858 BAD_CASE (fragP->fr_subtype);
859 break;
860 }
861 fragP->fr_fix += extension;
862} /* md_convert_frag */
863
864
865
866/* This is the stuff for md_assemble. */
867#define FP_REG 13
868#define SP_REG 14
869#define PC_REG 15
870#define BIGGESTREG PC_REG
871
872/*
873 * Parse the string pointed to by START
874 * If it represents a valid register, point START to the character after
875 * the last valid register char, and return the register number (0-15).
876 * If invalid, leave START alone, return -1.
877 * The format has to be exact. I don't do things like eat leading zeros
878 * or the like.
879 * Note: This doesn't check for the next character in the string making
880 * this invalid. Ex: R123 would return 12, it's the callers job to check
881 * what start is point to apon return.
882 *
883 * Valid registers are R1-R15, %1-%15, FP (13), SP (14), PC (15)
884 * Case doesn't matter.
885 */
886int
887tahoe_reg_parse (start)
888 char **start; /* A pointer to the string to parse. */
889{
890 register char *regpoint = *start;
891 register int regnum = -1;
892
893 switch (*regpoint++)
894 {
895 case '%': /* Registers can start with a %,
896 R or r, and then a number. */
897 case 'R':
898 case 'r':
899 if (ISDIGIT (*regpoint))
900 {
901 /* Got the first digit. */
902 regnum = *regpoint++ - '0';
903 if ((regnum == 1) && ISDIGIT (*regpoint))
904 {
905 /* Its a two digit number. */
906 regnum = 10 + (*regpoint++ - '0');
907 if (regnum > BIGGESTREG)
908 { /* Number too big? */
909 regnum = -1;
910 }
911 }
912 }
913 break;
914 case 'F': /* Is it the FP */
915 case 'f':
916 switch (*regpoint++)
917 {
918 case 'p':
919 case 'P':
920 regnum = FP_REG;
921 }
922 break;
923 case 's': /* How about the SP */
924 case 'S':
925 switch (*regpoint++)
926 {
927 case 'p':
928 case 'P':
929 regnum = SP_REG;
930 }
931 break;
932 case 'p': /* OR the PC even */
933 case 'P':
934 switch (*regpoint++)
935 {
936 case 'c':
937 case 'C':
938 regnum = PC_REG;
939 }
940 break;
941 }
942
943 if (regnum != -1)
944 { /* No error, so move string pointer */
945 *start = regpoint;
946 }
947 return regnum; /* Return results */
948} /* tahoe_reg_parse */
949
950
951/*
952 * This chops up an operand and figures out its modes and stuff.
953 * It's a little touchy about extra characters.
954 * Optex to start with one extra character so it can be overwritten for
955 * the backward part of the parsing.
956 * You can't put a bunch of extra characters in side to
957 * make the command look cute. ie: * foo ( r1 ) [ r0 ]
958 * If you like doing a lot of typing, try COBOL!
959 * Actually, this parser is a little weak all around. It's designed to be
960 * used with compliers, so I emphisise correct decoding of valid code quickly
961 * rather that catching every possable error.
962 * Note: This uses the expression function, so save input_line_pointer before
963 * calling.
964 *
965 * Sperry defines the semantics of address modes (and values)
966 * by a two-letter code, explained here.
967 *
968 * letter 1: access type
969 *
970 * a address calculation - no data access, registers forbidden
971 * b branch displacement
972 * m read - let go of bus - write back "modify"
973 * r read
974 * w write
975 * v bit field address: like 'a' but registers are OK
976 *
977 * letter 2: data type (i.e. width, alignment)
978 *
979 * b byte
980 * w word
981 * l longword
982 * q quadword (Even regs < 14 allowed) (if 12, you get a warning)
983 * - unconditional synthetic jbr operand
984 * ? simple synthetic reversable branch operand
985 * ! complex synthetic reversable branch operand
986 * : complex synthetic non-reversable branch operand
987 *
988 * The '-?!:' letter 2's are not for external consumption. They are used
989 * by GAS for psuedo ops relaxing code.
990 *
991 * After parsing topP has:
992 *
993 * top_ndx: -1, or the index register. eg 7=[R7]
994 * top_reg: -1, or register number. eg 7 = R7 or (R7)
995 * top_mode: The addressing mode byte. This byte, defines which of
996 * the 11 modes opcode is.
997 * top_access: Access type wanted for this opperand 'b'branch ' '
998 * no-instruction 'amrvw'
999 * top_width: Operand width expected, one of "bwlq?-:!"
1000 * exp_of_operand: The expression as parsed by expression()
1001 * top_dispsize: Number of bytes in the displacement if we can figure it
1002 * out and it's relavent.
1003 *
1004 * Need syntax checks built.
1005 */
1006
1007void
1008tip_op (optex, topP)
1009 char *optex; /* The users text input, with one leading character */
1010 struct top *topP; /* The tahoe instruction with some fields already set:
1011 in: access, width
1012 out: ndx, reg, mode, error, dispsize */
1013
1014{
1015 int mode = 0; /* This operand's mode. */
1016 char segfault = *optex; /* To keep the back parsing from freaking. */
1017 char *point = optex + 1; /* Parsing from front to back. */
1018 char *end; /* Parsing from back to front. */
1019 int reg = -1; /* major register, -1 means absent */
1020 int imreg = -1; /* Major register in immediate mode */
1021 int ndx = -1; /* index register number, -1 means absent */
1022 char dec_inc = ' '; /* Is the SP auto-incremented '+' or
1023 auto-decremented '-' or neither ' '. */
1024 int immediate = 0; /* 1 if '$' immediate mode */
1025 int call_width = 0; /* If the caller casts the displacement */
1026 int abs_width = 0; /* The width of the absolute displacment */
1027 int com_width = 0; /* Displacement width required by branch */
1028 int deferred = 0; /* 1 if '*' deferral is used */
1029 byte disp_size = 0; /* How big is this operand. 0 == don't know */
1030 char *op_bad = ""; /* Bad operand error */
1031
1032 char *tp, *temp, c; /* Temporary holders */
1033
1034 char access = topP->top_access; /* Save on a deref. */
1035 char width = topP->top_width;
1036
1037 int really_none = 0; /* Empty expressions evaluate to 0
1038 but I need to know if it's there or not */
1039 expressionS *expP; /* -> expression values for this operand */
1040
1041 /* Does this command restrict the displacement size. */
1042 if (access == 'b')
1043 com_width = (width == 'b' ? 1 :
1044 (width == 'w' ? 2 :
1045 (width == 'l' ? 4 : 0)));
1046
1047 *optex = '\0'; /* This is kind of a back stop for all
1048 the searches to fail on if needed.*/
1049 if (*point == '*')
1050 { /* A dereference? */
1051 deferred = 1;
1052 point++;
1053 }
1054
1055 /* Force words into a certain mode */
1056 /* Bitch, Bitch, Bitch! */
1057 /*
1058 * Using the ^ operator is ambigous. If I have an absolute label
1059 * called 'w' set to, say 2, and I have the expression 'w^1', do I get
1060 * 1, forced to be in word displacement mode, or do I get the value of
1061 * 'w' or'ed with 1 (3 in this case).
1062 * The default is 'w' as an offset, so that's what I use.
1063 * Stick with `, it does the same, and isn't ambig.
1064 */
1065
1066 if (*point != '\0' && ((point[1] == '^') || (point[1] == '`')))
1067 switch (*point)
1068 {
1069 case 'b':
1070 case 'B':
1071 case 'w':
1072 case 'W':
1073 case 'l':
1074 case 'L':
1075 if (com_width)
1076 as_warn (_("Casting a branch displacement is bad form, and is ignored."));
1077 else
1078 {
1079 c = TOLOWER (*point);
1080 call_width = ((c == 'b') ? 1 :
1081 ((c == 'w') ? 2 : 4));
1082 }
1083 point += 2;
1084 break;
1085 }
1086
1087 /* Setting immediate mode */
1088 if (*point == '$')
1089 {
1090 immediate = 1;
1091 point++;
1092 }
1093
1094 /*
1095 * I've pulled off all the easy stuff off the front, move to the end and
1096 * yank.
1097 */
1098
1099 for (end = point; *end != '\0'; end++) /* Move to the end. */
1100 ;
1101
1102 if (end != point) /* Null string? */
1103 end--;
1104
1105 if (end > point && *end == ' ' && end[-1] != '\'')
1106 end--; /* Hop white space */
1107
1108 /* Is this an index reg. */
1109 if ((*end == ']') && (end[-1] != '\''))
1110 {
1111 temp = end;
1112
1113 /* Find opening brace. */
1114 for (--end; (*end != '[' && end != point); end--)
1115 ;
1116
1117 /* If I found the opening brace, get the index register number. */
1118 if (*end == '[')
1119 {
1120 tp = end + 1; /* tp should point to the start of a reg. */
1121 ndx = tahoe_reg_parse (&tp);
1122 if (tp != temp)
1123 { /* Reg. parse error. */
1124 ndx = -1;
1125 }
1126 else
1127 {
1128 end--; /* Found it, move past brace. */
1129 }
1130 if (ndx == -1)
1131 {
1132 op_bad = _("Couldn't parse the [index] in this operand.");
1133 end = point; /* Force all the rest of the tests to fail. */
1134 }
1135 }
1136 else
1137 {
1138 op_bad = _("Couldn't find the opening '[' for the index of this operand.");
1139 end = point; /* Force all the rest of the tests to fail. */
1140 }
1141 }
1142
1143 /* Post increment? */
1144 if (*end == '+')
1145 {
1146 dec_inc = '+';
1147 /* was: *end--; */
1148 end--;
1149 }
1150
1151 /* register in parens? */
1152 if ((*end == ')') && (end[-1] != '\''))
1153 {
1154 temp = end;
1155
1156 /* Find opening paren. */
1157 for (--end; (*end != '(' && end != point); end--)
1158 ;
1159
1160 /* If I found the opening paren, get the register number. */
1161 if (*end == '(')
1162 {
1163 tp = end + 1;
1164 reg = tahoe_reg_parse (&tp);
1165 if (tp != temp)
1166 {
1167 /* Not a register, but could be part of the expression. */
1168 reg = -1;
1169 end = temp; /* Rest the pointer back */
1170 }
1171 else
1172 {
1173 end--; /* Found the reg. move before opening paren. */
1174 }
1175 }
1176 else
1177 {
1178 op_bad = _("Couldn't find the opening '(' for the deref of this operand.");
1179 end = point; /* Force all the rest of the tests to fail. */
1180 }
1181 }
1182
1183 /* Pre decrement? */
1184 if (*end == '-')
1185 {
1186 if (dec_inc != ' ')
1187 {
1188 op_bad = _("Operand can't be both pre-inc and post-dec.");
1189 end = point;
1190 }
1191 else
1192 {
1193 dec_inc = '-';
1194 /* was: *end--; */
1195 end--;
1196 }
1197 }
1198
1199 /*
1200 * Everything between point and end is the 'expression', unless it's
1201 * a register name.
1202 */
1203
1204 c = end[1];
1205 end[1] = '\0';
1206
1207 tp = point;
1208 imreg = tahoe_reg_parse (&point); /* Get the immediate register
1209 if it is there.*/
1210 if (*point != '\0')
1211 {
1212 /* If there is junk after point, then the it's not immediate reg. */
1213 point = tp;
1214 imreg = -1;
1215 }
1216
1217 if (imreg != -1 && reg != -1)
1218 op_bad = _("I parsed 2 registers in this operand.");
1219
1220 /*
1221 * Evaluate whats left of the expression to see if it's valid.
1222 * Note again: This assumes that the calling expression has saved
1223 * input_line_pointer. (Nag, nag, nag!)
1224 */
1225
1226 if (*op_bad == '\0')
1227 {
1228 /* Statement has no syntax goofs yet: let's sniff the expression. */
1229 input_line_pointer = point;
1230 expP = &(topP->exp_of_operand);
1231 topP->seg_of_operand = expression (expP);
1232 switch (expP->X_op)
1233 {
1234 case O_absent:
1235 /* No expression. For BSD4.2 compatibility, missing expression is
1236 absolute 0 */
1237 expP->X_op = O_constant;
1238 expP->X_add_number = 0;
1239 really_none = 1;
1240 case O_constant:
1241 /* for SEG_ABSOLUTE, we shouldnt need to set X_op_symbol,
1242 X_add_symbol to any particular value. */
1243 /* But, we will program defensively. Since this situation occurs
1244 rarely so it costs us little to do so. */
1245 expP->X_add_symbol = NULL;
1246 expP->X_op_symbol = NULL;
1247 /* How many bytes are needed to express this abs value? */
1248 abs_width =
1249 ((((expP->X_add_number & 0xFFFFFF80) == 0) ||
1250 ((expP->X_add_number & 0xFFFFFF80) == 0xFFFFFF80)) ? 1 :
1251 (((expP->X_add_number & 0xFFFF8000) == 0) ||
1252 ((expP->X_add_number & 0xFFFF8000) == 0xFFFF8000)) ? 2 : 4);
1253
1254 case O_symbol:
1255 break;
1256
1257 default:
1258 /*
1259 * Major bug. We can't handle the case of an operator
1260 * expression in a synthetic opcode variable-length
1261 * instruction. We don't have a frag type that is smart
1262 * enough to relax an operator, and so we just force all
1263 * operators to behave like SEG_PASS1s. Clearly, if there is
1264 * a demand we can invent a new or modified frag type and
1265 * then coding up a frag for this case will be easy.
1266 */
1267 need_pass_2 = 1;
1268 op_bad = _("Can't relocate expression error.");
1269 break;
1270
1271 case O_big:
1272 /* This is an error. Tahoe doesn't allow any expressions
1273 bigger that a 32 bit long word. Any bigger has to be referenced
1274 by address. */
1275 op_bad = _("Expression is too large for a 32 bits.");
1276 break;
1277 }
1278 if (*input_line_pointer != '\0')
1279 {
1280 op_bad = _("Junk at end of expression.");
1281 }
1282 }
1283
1284 end[1] = c;
1285
1286 /* I'm done, so restore optex */
1287 *optex = segfault;
1288
1289 /*
1290 * At this point in the game, we (in theory) have all the components of
1291 * the operand at least parsed. Now it's time to check for syntax/semantic
1292 * errors, and build the mode.
1293 * This is what I have:
1294 * deferred = 1 if '*'
1295 * call_width = 0,1,2,4
1296 * abs_width = 0,1,2,4
1297 * com_width = 0,1,2,4
1298 * immediate = 1 if '$'
1299 * ndx = -1 or reg num
1300 * dec_inc = '-' or '+' or ' '
1301 * reg = -1 or reg num
1302 * imreg = -1 or reg num
1303 * topP->exp_of_operand
1304 * really_none
1305 */
1306 /* Is there a displacement size? */
1307 disp_size = (call_width ? call_width :
1308 (com_width ? com_width :
1309 abs_width ? abs_width : 0));
1310
1311 if (*op_bad == '\0')
1312 {
1313 if (imreg != -1)
1314 {
1315 /* Rn */
1316 mode = TAHOE_DIRECT_REG;
1317 if (deferred || immediate || (dec_inc != ' ') ||
1318 (reg != -1) || !really_none)
1319 op_bad = _("Syntax error in direct register mode.");
1320 else if (ndx != -1)
1321 op_bad = _("You can't index a register in direct register mode.");
1322 else if (imreg == SP_REG && access == 'r')
1323 op_bad =
1324 _("SP can't be the source operand with direct register addressing.");
1325 else if (access == 'a')
1326 op_bad = _("Can't take the address of a register.");
1327 else if (access == 'b')
1328 op_bad = _("Direct Register can't be used in a branch.");
1329 else if (width == 'q' && ((imreg % 2) || (imreg > 13)))
1330 op_bad = _("For quad access, the register must be even and < 14.");
1331 else if (call_width)
1332 op_bad = _("You can't cast a direct register.");
1333
1334 if (*op_bad == '\0')
1335 {
1336 /* No errors, check for warnings */
1337 if (width == 'q' && imreg == 12)
1338 as_warn (_("Using reg 14 for quadwords can tromp the FP register."));
1339
1340 reg = imreg;
1341 }
1342
1343 /* We know: imm = -1 */
1344 }
1345 else if (dec_inc == '-')
1346 {
1347 /* -(SP) */
1348 mode = TAHOE_AUTO_DEC;
1349 if (deferred || immediate || !really_none)
1350 op_bad = _("Syntax error in auto-dec mode.");
1351 else if (ndx != -1)
1352 op_bad = _("You can't have an index auto dec mode.");
1353 else if (access == 'r')
1354 op_bad = _("Auto dec mode cant be used for reading.");
1355 else if (reg != SP_REG)
1356 op_bad = _("Auto dec only works of the SP register.");
1357 else if (access == 'b')
1358 op_bad = _("Auto dec can't be used in a branch.");
1359 else if (width == 'q')
1360 op_bad = _("Auto dec won't work with quadwords.");
1361
1362 /* We know: imm = -1, dec_inc != '-' */
1363 }
1364 else if (dec_inc == '+')
1365 {
1366 if (immediate || !really_none)
1367 op_bad = _("Syntax error in one of the auto-inc modes.");
1368 else if (deferred)
1369 {
1370 /* *(SP)+ */
1371 mode = TAHOE_AUTO_INC_DEFERRED;
1372 if (reg != SP_REG)
1373 op_bad = _("Auto inc deferred only works of the SP register.");
1374 else if (ndx != -1)
1375 op_bad = _("You can't have an index auto inc deferred mode.");
1376 else if (access == 'b')
1377 op_bad = _("Auto inc can't be used in a branch.");
1378 }
1379 else
1380 {
1381 /* (SP)+ */
1382 mode = TAHOE_AUTO_INC;
1383 if (access == 'm' || access == 'w')
1384 op_bad = _("You can't write to an auto inc register.");
1385 else if (reg != SP_REG)
1386 op_bad = _("Auto inc only works of the SP register.");
1387 else if (access == 'b')
1388 op_bad = _("Auto inc can't be used in a branch.");
1389 else if (width == 'q')
1390 op_bad = _("Auto inc won't work with quadwords.");
1391 else if (ndx != -1)
1392 op_bad = _("You can't have an index in auto inc mode.");
1393 }
1394
1395 /* We know: imm = -1, dec_inc == ' ' */
1396 }
1397 else if (reg != -1)
1398 {
1399 if ((ndx != -1) && (reg == SP_REG))
1400 op_bad = _("You can't index the sp register.");
1401 if (deferred)
1402 {
1403 /* *<disp>(Rn) */
1404 mode = TAHOE_REG_DISP_DEFERRED;
1405 if (immediate)
1406 op_bad = _("Syntax error in register displaced mode.");
1407 }
1408 else if (really_none)
1409 {
1410 /* (Rn) */
1411 mode = TAHOE_REG_DEFERRED;
1412 /* if reg = SP then cant be indexed */
1413 }
1414 else
1415 {
1416 /* <disp>(Rn) */
1417 mode = TAHOE_REG_DISP;
1418 }
1419
1420 /* We know: imm = -1, dec_inc == ' ', Reg = -1 */
1421 }
1422 else
1423 {
1424 if (really_none)
1425 op_bad = _("An offest is needed for this operand.");
1426 if (deferred && immediate)
1427 {
1428 /* *$<ADDR> */
1429 mode = TAHOE_ABSOLUTE_ADDR;
1430 disp_size = 4;
1431 }
1432 else if (immediate)
1433 {
1434 /* $<disp> */
1435 mode = TAHOE_IMMEDIATE;
1436 if (ndx != -1)
1437 op_bad = _("You can't index a register in immediate mode.");
1438 if (access == 'a')
1439 op_bad = _("Immediate access can't be used as an address.");
1440 /* ponder the wisdom of a cast because it doesn't do any good. */
1441 }
1442 else if (deferred)
1443 {
1444 /* *<disp> */
1445 mode = TAHOE_DISP_REL_DEFERRED;
1446 }
1447 else
1448 {
1449 /* <disp> */
1450 mode = TAHOE_DISPLACED_RELATIVE;
1451 }
1452 }
1453 }
1454
1455 /*
1456 * At this point, all the errors we can do have be checked for.
1457 * We can build the 'top'. */
1458
1459 topP->top_ndx = ndx;
1460 topP->top_reg = reg;
1461 topP->top_mode = mode;
1462 topP->top_error = op_bad;
1463 topP->top_dispsize = disp_size;
1464} /* tip_op */
1465
1466
1467/*
1468 * t i p ( )
1469 *
1470 * This converts a string into a tahoe instruction.
1471 * The string must be a bare single instruction in tahoe (with BSD4 frobs)
1472 * format.
1473 * It provides at most one fatal error message (which stops the scan)
1474 * some warning messages as it finds them.
1475 * The tahoe instruction is returned in exploded form.
1476 *
1477 * The exploded instruction is returned to a struct tit of your choice.
1478 * #include "tahoe-inst.h" to know what a struct tit is.
1479 *
1480 */
1481
1482static void
1483tip (titP, instring)
1484 struct tit *titP; /* We build an exploded instruction here. */
1485 char *instring; /* Text of a vax instruction: we modify. */
1486{
1487 register struct tot_wot *twP = NULL; /* How to bit-encode this opcode. */
1488 register char *p; /* 1/skip whitespace.2/scan vot_how */
1489 register char *q; /* */
1490 register unsigned char count; /* counts number of operands seen */
1491 register struct top *operandp;/* scan operands in struct tit */
1492 register char *alloperr = ""; /* error over all operands */
1493 register char c; /* Remember char, (we clobber it
1494 with '\0' temporarily). */
1495 char *save_input_line_pointer;
1496
1497 if (*instring == ' ')
1498 ++instring; /* Skip leading whitespace. */
1499 for (p = instring; *p && *p != ' '; p++)
1500 ; /* MUST end in end-of-string or
1501 exactly 1 space. */
1502 /* Scanned up to end of operation-code. */
1503 /* Operation-code is ended with whitespace. */
1504 if (p == instring)
1505 {
1506 titP->tit_error = _("No operator");
1507 count = 0;
1508 titP->tit_opcode = 0;
1509 }
1510 else
1511 {
1512 c = *p;
1513 *p = '\0';
1514 /*
1515 * Here with instring pointing to what better be an op-name, and p
1516 * pointing to character just past that.
1517 * We trust instring points to an op-name, with no whitespace.
1518 */
1519 twP = (struct tot_wot *) hash_find (op_hash, instring);
1520 *p = c; /* Restore char after op-code. */
1521 if (twP == 0)
1522 {
1523 titP->tit_error = _("Unknown operator");
1524 count = 0;
1525 titP->tit_opcode = 0;
1526 }
1527 else
1528 {
1529 /*
1530 * We found a match! So let's pick up as many operands as the
1531 * instruction wants, and even gripe if there are too many.
1532 * We expect comma to seperate each operand.
1533 * We let instring track the text, while p tracks a part of the
1534 * struct tot.
1535 */
1536
1537 count = 0; /* no operands seen yet */
1538 instring = p + (*p != '\0'); /* point past the operation code */
1539 /* tip_op() screws with the input_line_pointer, so save it before
1540 I jump in */
1541 save_input_line_pointer = input_line_pointer;
1542 for (p = twP->args, operandp = titP->tit_operand;
1543 !*alloperr && *p;
1544 operandp++, p += 2)
1545 {
1546 /*
1547 * Here to parse one operand. Leave instring pointing just
1548 * past any one ',' that marks the end of this operand.
1549 */
1550 if (!p[1])
1551 as_fatal (_("Compiler bug: ODD number of bytes in arg structure %s."),
1552 twP->args);
1553 else if (*instring)
1554 {
1555 for (q = instring; (*q != ',' && *q != '\0'); q++)
1556 {
1557 if (*q == '\'' && q[1] != '\0') /* Jump quoted characters */
1558 q++;
1559 }
1560 c = *q;
1561 /*
1562 * Q points to ',' or '\0' that ends argument. C is that
1563 * character.
1564 */
1565 *q = '\0';
1566 operandp->top_access = p[0];
1567 operandp->top_width = p[1];
1568 tip_op (instring - 1, operandp);
1569 *q = c; /* Restore input text. */
1570 if (*(operandp->top_error))
1571 {
1572 alloperr = operandp->top_error;
1573 }
1574 instring = q + (c ? 1 : 0); /* next operand (if any) */
1575 count++; /* won another argument, may have an operr */
1576 }
1577 else
1578 alloperr = _("Not enough operands");
1579 }
1580 /* Restore the pointer. */
1581 input_line_pointer = save_input_line_pointer;
1582
1583 if (!*alloperr)
1584 {
1585 if (*instring == ' ')
1586 instring++; /* Skip whitespace. */
1587 if (*instring)
1588 alloperr = _("Too many operands");
1589 }
1590 titP->tit_error = alloperr;
1591 }
1592 }
1593
1594 titP->tit_opcode = twP->code; /* The op-code. */
1595 titP->tit_operands = count;
1596} /* tip */
1597
1598
1599/* md_assemble() emit frags for 1 instruction */
1600void
1601md_assemble (instruction_string)
1602 char *instruction_string; /* A string: assemble 1 instruction. */
1603{
1604 char *p;
1605 register struct top *operandP;/* An operand. Scans all operands. */
1606 /* char c_save; fixme: remove this line *//* What used to live after an expression. */
1607 /* struct frag *fragP; fixme: remove this line *//* Fragment of code we just made. */
1608 /* register struct top *end_operandP; fixme: remove this line *//* -> slot just after last operand
1609 Limit of the for (each operand). */
1610 register expressionS *expP; /* -> expression values for this operand */
1611
1612 /* These refer to an instruction operand expression. */
1613 segT to_seg; /* Target segment of the address. */
1614
1615 register valueT this_add_number;
1616 register symbolS *this_add_symbol; /* +ve (minuend) symbol. */
1617
1618 /* tahoe_opcodeT opcode_as_number; fixme: remove this line *//* The opcode as a number. */
1619 char *opcodeP; /* Where it is in a frag. */
1620 /* char *opmodeP; fixme: remove this line *//* Where opcode type is, in a frag. */
1621
1622 int dispsize; /* From top_dispsize: tahoe_operand_width
1623 (in bytes) */
1624 int is_undefined; /* 1 if operand expression's
1625 segment not known yet. */
1626 int pc_rel; /* Is this operand pc relative? */
1627
1628 /* Decode the operand. */
1629 tip (&t, instruction_string);
1630
1631 /*
1632 * Check to see if this operand decode properly.
1633 * Notice that we haven't made any frags yet.
1634 * If it goofed, then this instruction will wedge in any pass,
1635 * and we can safely flush it, without causing interpass symbol phase
1636 * errors. That is, without changing label values in different passes.
1637 */
1638 if (*t.tit_error)
1639 {
1640 as_warn (_("Ignoring statement due to \"%s\""), t.tit_error);
1641 }
1642 else
1643 {
1644 /* We saw no errors in any operands - try to make frag(s) */
1645 /* Emit op-code. */
1646 /* Remember where it is, in case we want to modify the op-code later. */
1647 opcodeP = frag_more (1);
1648 *opcodeP = t.tit_opcode;
1649 /* Now do each operand. */
1650 for (operandP = t.tit_operand;
1651 operandP < t.tit_operand + t.tit_operands;
1652 operandP++)
1653 { /* for each operand */
1654 expP = &(operandP->exp_of_operand);
1655 if (operandP->top_ndx >= 0)
1656 {
1657 /* Indexed addressing byte
1658 Legality of indexed mode already checked: it is OK */
1659 FRAG_APPEND_1_CHAR (0x40 + operandP->top_ndx);
1660 } /* if(top_ndx>=0) */
1661
1662 /* Here to make main operand frag(s). */
1663 this_add_number = expP->X_add_number;
1664 this_add_symbol = expP->X_add_symbol;
1665 to_seg = operandP->seg_of_operand;
1666 know (to_seg == SEG_UNKNOWN || \
1667 to_seg == SEG_ABSOLUTE || \
1668 to_seg == SEG_DATA || \
1669 to_seg == SEG_TEXT || \
1670 to_seg == SEG_BSS);
1671 is_undefined = (to_seg == SEG_UNKNOWN);
1672 /* Do we know how big this opperand is? */
1673 dispsize = operandP->top_dispsize;
1674 pc_rel = 0;
1675 /* Deal with the branch possabilities. (Note, this doesn't include
1676 jumps.)*/
1677 if (operandP->top_access == 'b')
1678 {
1679 /* Branches must be expressions. A psuedo branch can also jump to
1680 an absolute address. */
1681 if (to_seg == now_seg || is_undefined)
1682 {
1683 /* If is_undefined, then it might BECOME now_seg by relax time. */
1684 if (dispsize)
1685 {
1686 /* I know how big the branch is supposed to be (it's a normal
1687 branch), so I set up the frag, and let GAS do the rest. */
1688 p = frag_more (dispsize);
1689 fix_new (frag_now, p - frag_now->fr_literal,
1690 this_add_symbol, this_add_number,
1691 size_to_fx (dispsize, 1),
1692 NULL);
1693 }
1694 else
1695 {
1696 /* (to_seg==now_seg || to_seg == SEG_UNKNOWN) && dispsize==0 */
1697 /* If we don't know how big it is, then its a synthetic branch,
1698 so we set up a simple relax state. */
1699 switch (operandP->top_width)
1700 {
1701 case TAHOE_WIDTH_CONDITIONAL_JUMP:
1702 /* Simple (conditional) jump. I may have to reverse the
1703 condition of opcodeP, and then jump to my destination.
1704 I set 1 byte aside for the branch off set, and could need 6
1705 more bytes for the pc_rel jump */
1706 frag_var (rs_machine_dependent, 7, 1,
1707 ENCODE_RELAX (STATE_CONDITIONAL_BRANCH,
1708 is_undefined ? STATE_UNDF : STATE_BYTE),
1709 this_add_symbol, this_add_number, opcodeP);
1710 break;
1711 case TAHOE_WIDTH_ALWAYS_JUMP:
1712 /* Simple (unconditional) jump. I may have to convert this to
1713 a word branch, or an absolute jump. */
1714 frag_var (rs_machine_dependent, 5, 1,
1715 ENCODE_RELAX (STATE_ALWAYS_BRANCH,
1716 is_undefined ? STATE_UNDF : STATE_BYTE),
1717 this_add_symbol, this_add_number, opcodeP);
1718 break;
1719 /* The smallest size for the next 2 cases is word. */
1720 case TAHOE_WIDTH_BIG_REV_JUMP:
1721 frag_var (rs_machine_dependent, 8, 2,
1722 ENCODE_RELAX (STATE_BIG_REV_BRANCH,
1723 is_undefined ? STATE_UNDF : STATE_WORD),
1724 this_add_symbol, this_add_number,
1725 opcodeP);
1726 break;
1727 case TAHOE_WIDTH_BIG_NON_REV_JUMP:
1728 frag_var (rs_machine_dependent, 10, 2,
1729 ENCODE_RELAX (STATE_BIG_NON_REV_BRANCH,
1730 is_undefined ? STATE_UNDF : STATE_WORD),
1731 this_add_symbol, this_add_number,
1732 opcodeP);
1733 break;
1734 default:
1735 as_fatal (_("Compliler bug: Got a case (%d) I wasn't expecting."),
1736 operandP->top_width);
1737 }
1738 }
1739 }
1740 else
1741 {
1742 /* to_seg != now_seg && to_seg != seg_unknown (still in branch)
1743 In other words, I'm jumping out of my segment so extend the
1744 branches to jumps, and let GAS fix them. */
1745
1746 /* These are "branches" what will always be branches around a jump
1747 to the correct addresss in real life.
1748 If to_seg is SEG_ABSOLUTE, just encode the branch in,
1749 else let GAS fix the address. */
1750
1751 switch (operandP->top_width)
1752 {
1753 /* The theory:
1754 For SEG_ABSOLUTE, then mode is ABSOLUTE_ADDR, jump
1755 to that addresss (not pc_rel).
1756 For other segs, address is a long word PC rel jump. */
1757 case TAHOE_WIDTH_CONDITIONAL_JUMP:
1758 /* b<cond> */
1759 /* To reverse the condition in a TAHOE branch,
1760 complement bit 4 */
1761 *opcodeP ^= 0x10;
1762 p = frag_more (7);
1763 *p++ = 6;
1764 *p++ = TAHOE_JMP;
1765 *p++ = (operandP->top_mode ==
1766 TAHOE_ABSOLUTE_ADDR ? TAHOE_ABSOLUTE_ADDR :
1767 TAHOE_PC_REL_LONG);
1768 fix_new (frag_now, p - frag_now->fr_literal,
1769 this_add_symbol, this_add_number,
1770 (to_seg != SEG_ABSOLUTE) ? FX_PCREL32 : FX_32, NULL);
1771 /*
1772 * Now (eg) BLEQ 1f
1773 * JMP foo
1774 * 1:
1775 */
1776 break;
1777 case TAHOE_WIDTH_ALWAYS_JUMP:
1778 /* br, just turn it into a jump */
1779 *opcodeP = TAHOE_JMP;
1780 p = frag_more (5);
1781 *p++ = (operandP->top_mode ==
1782 TAHOE_ABSOLUTE_ADDR ? TAHOE_ABSOLUTE_ADDR :
1783 TAHOE_PC_REL_LONG);
1784 fix_new (frag_now, p - frag_now->fr_literal,
1785 this_add_symbol, this_add_number,
1786 (to_seg != SEG_ABSOLUTE) ? FX_PCREL32 : FX_32, NULL);
1787 /* Now (eg) JMP foo */
1788 break;
1789 case TAHOE_WIDTH_BIG_REV_JUMP:
1790 p = frag_more (8);
1791 *opcodeP ^= 0x10;
1792 *p++ = 0;
1793 *p++ = 6;
1794 *p++ = TAHOE_JMP;
1795 *p++ = (operandP->top_mode ==
1796 TAHOE_ABSOLUTE_ADDR ? TAHOE_ABSOLUTE_ADDR :
1797 TAHOE_PC_REL_LONG);
1798 fix_new (frag_now, p - frag_now->fr_literal,
1799 this_add_symbol, this_add_number,
1800 (to_seg != SEG_ABSOLUTE) ? FX_PCREL32 : FX_32, NULL);
1801 /*
1802 * Now (eg) ACBx 1f
1803 * JMP foo
1804 * 1:
1805 */
1806 break;
1807 case TAHOE_WIDTH_BIG_NON_REV_JUMP:
1808 p = frag_more (10);
1809 *p++ = 0;
1810 *p++ = 2;
1811 *p++ = TAHOE_BRB;
1812 *p++ = 6;
1813 *p++ = TAHOE_JMP;
1814 *p++ = (operandP->top_mode ==
1815 TAHOE_ABSOLUTE_ADDR ? TAHOE_ABSOLUTE_ADDR :
1816 TAHOE_PC_REL_LONG);
1817 fix_new (frag_now, p - frag_now->fr_literal,
1818 this_add_symbol, this_add_number,
1819 (to_seg != SEG_ABSOLUTE) ? FX_PCREL32 : FX_32, NULL);
1820 /*
1821 * Now (eg) xOBxxx 1f
1822 * BRB 2f
1823 * 1: JMP @#foo
1824 * 2:
1825 */
1826 break;
1827 case 'b':
1828 case 'w':
1829 as_warn (_("Real branch displacements must be expressions."));
1830 break;
1831 default:
1832 as_fatal (_("Complier error: I got an unknown synthetic branch :%c"),
1833 operandP->top_width);
1834 break;
1835 }
1836 }
1837 }
1838 else
1839 {
1840 /* It ain't a branch operand. */
1841 switch (operandP->top_mode)
1842 {
1843 /* Auto-foo access, only works for one reg (SP)
1844 so the only thing needed is the mode. */
1845 case TAHOE_AUTO_DEC:
1846 case TAHOE_AUTO_INC:
1847 case TAHOE_AUTO_INC_DEFERRED:
1848 FRAG_APPEND_1_CHAR (operandP->top_mode);
1849 break;
1850
1851 /* Numbered Register only access. Only thing needed is the
1852 mode + Register number */
1853 case TAHOE_DIRECT_REG:
1854 case TAHOE_REG_DEFERRED:
1855 FRAG_APPEND_1_CHAR (operandP->top_mode + operandP->top_reg);
1856 break;
1857
1858 /* An absolute address. It's size is always 5 bytes.
1859 (mode_type + 4 byte address). */
1860 case TAHOE_ABSOLUTE_ADDR:
1861 know ((this_add_symbol == NULL));
1862 p = frag_more (5);
1863 *p = TAHOE_ABSOLUTE_ADDR;
1864 md_number_to_chars (p + 1, this_add_number, 4);
1865 break;
1866
1867 /* Immediate data. If the size isn't known, then it's an address
1868 + and offset, which is 4 bytes big. */
1869 case TAHOE_IMMEDIATE:
1870 if (this_add_symbol != NULL)
1871 {
1872 p = frag_more (5);
1873 *p++ = TAHOE_IMMEDIATE_LONGWORD;
1874 fix_new (frag_now, p - frag_now->fr_literal,
1875 this_add_symbol, this_add_number,
1876 FX_32, NULL);
1877 }
1878 else
1879 {
1880 /* It's an integer, and I know it's size. */
1881 if ((unsigned) this_add_number < 0x40)
1882 {
1883 /* Will it fit in a literal? */
1884 FRAG_APPEND_1_CHAR ((byte) this_add_number);
1885 }
1886 else
1887 {
1888 p = frag_more (dispsize + 1);
1889 switch (dispsize)
1890 {
1891 case 1:
1892 *p++ = TAHOE_IMMEDIATE_BYTE;
1893 *p = (byte) this_add_number;
1894 break;
1895 case 2:
1896 *p++ = TAHOE_IMMEDIATE_WORD;
1897 md_number_to_chars (p, this_add_number, 2);
1898 break;
1899 case 4:
1900 *p++ = TAHOE_IMMEDIATE_LONGWORD;
1901 md_number_to_chars (p, this_add_number, 4);
1902 break;
1903 }
1904 }
1905 }
1906 break;
1907
1908 /* Distance from the PC. If the size isn't known, we have to relax
1909 into it. The difference between this and disp(sp) is that
1910 this offset is pc_rel, and disp(sp) isn't.
1911 Note the drop through code. */
1912
1913 case TAHOE_DISPLACED_RELATIVE:
1914 case TAHOE_DISP_REL_DEFERRED:
1915 operandP->top_reg = PC_REG;
1916 pc_rel = 1;
1917
1918 /* Register, plus a displacement mode. Save the register number,
1919 and weather its deffered or not, and relax the size if it isn't
1920 known. */
1921 case TAHOE_REG_DISP:
1922 case TAHOE_REG_DISP_DEFERRED:
1923 if (operandP->top_mode == TAHOE_DISP_REL_DEFERRED ||
1924 operandP->top_mode == TAHOE_REG_DISP_DEFERRED)
1925 operandP->top_reg += 0x10; /* deffered mode is always 0x10 higher
1926 than it's non-deffered sibling. */
1927
1928 /* Is this a value out of this segment?
1929 The first part of this conditional is a cludge to make gas
1930 produce the same output as 'as' when there is a lable, in
1931 the current segment, displaceing a register. It's strange,
1932 and no one in their right mind would do it, but it's easy
1933 to cludge. */
1934 if ((dispsize == 0 && !pc_rel) ||
1935 (to_seg != now_seg && !is_undefined && to_seg != SEG_ABSOLUTE))
1936 dispsize = 4;
1937
1938 if (dispsize == 0)
1939 {
1940 /*
1941 * We have a SEG_UNKNOWN symbol, or the size isn't cast.
1942 * It might turn out to be in the same segment as
1943 * the instruction, permitting relaxation.
1944 */
1945 p = frag_var (rs_machine_dependent, 5, 2,
1946 ENCODE_RELAX (STATE_PC_RELATIVE,
1947 is_undefined ? STATE_UNDF : STATE_BYTE),
1948 this_add_symbol, this_add_number, 0);
1949 *p = operandP->top_reg;
1950 }
1951 else
1952 {
1953 /* Either this is an abs, or a cast. */
1954 p = frag_more (dispsize + 1);
1955 switch (dispsize)
1956 {
1957 case 1:
1958 *p = TAHOE_PC_OR_BYTE + operandP->top_reg;
1959 break;
1960 case 2:
1961 *p = TAHOE_PC_OR_WORD + operandP->top_reg;
1962 break;
1963 case 4:
1964 *p = TAHOE_PC_OR_LONG + operandP->top_reg;
1965 break;
1966 };
1967 fix_new (frag_now, p + 1 - frag_now->fr_literal,
1968 this_add_symbol, this_add_number,
1969 size_to_fx (dispsize, pc_rel), NULL);
1970 }
1971 break;
1972 default:
1973 as_fatal (_("Barf, bad mode %x\n"), operandP->top_mode);
1974 }
1975 }
1976 } /* for(operandP) */
1977 } /* if(!need_pass_2 && !goofed) */
1978} /* tahoe_assemble() */
1979
1980/* We have no need to default values of symbols. */
1981
1982symbolS *
1983md_undefined_symbol (name)
1984 char *name;
1985{
1986 return 0;
1987} /* md_undefined_symbol() */
1988
1989/* Round up a section size to the appropriate boundary. */
1990valueT
1991md_section_align (segment, size)
1992 segT segment;
1993 valueT size;
1994{
1995 return ((size + 7) & ~7); /* Round all sects to multiple of 8 */
1996} /* md_section_align() */
1997
1998/* Exactly what point is a PC-relative offset relative TO?
1999 On the sparc, they're relative to the address of the offset, plus
2000 its size. This gets us to the following instruction.
2001 (??? Is this right? FIXME-SOON) */
2002long
2003md_pcrel_from (fixP)
2004 fixS *fixP;
2005{
2006 return (((fixP->fx_type == FX_8
2007 || fixP->fx_type == FX_PCREL8)
2008 ? 1
2009 : ((fixP->fx_type == FX_16
2010 || fixP->fx_type == FX_PCREL16)
2011 ? 2
2012 : ((fixP->fx_type == FX_32
2013 || fixP->fx_type == FX_PCREL32)
2014 ? 4
2015 : 0))) + fixP->fx_where + fixP->fx_frag->fr_address);
2016} /* md_pcrel_from() */
2017
2018int
2019tc_is_pcrel (fixP)
2020 fixS *fixP;
2021{
2022 /* should never be called */
2023 know (0);
2024 return (0);
2025} /* tc_is_pcrel() */
Note: See TracBrowser for help on using the repository browser.