xref: /386bsd/usr/src/usr.bin/gas/write.h (revision a2142627)
1 /* write.h -> write.c
2    Copyright (C) 1987 Free Software Foundation, Inc.
3 
4 This file is part of GAS, the GNU Assembler.
5 
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
9 any later version.
10 
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING.  If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19 
20 /* The bit_fix was implemented to support machines that need variables
21    to be inserted in bitfields other than 1, 2 and 4 bytes.
22    Furthermore it gives us a possibillity to mask in bits in the symbol
23    when it's fixed in the objectcode and check the symbols limits.
24 
25    The or-mask is used to set the huffman bits in displacements for the
26    ns32k port.
27    The acbi, addqi, movqi, cmpqi instruction requires an assembler that
28    can handle bitfields. Ie handle an expression, evaluate it and insert
29    the result in an some bitfield. ( ex: 5 bits in a short field of a opcode)
30  */
31 
32 
33 struct bit_fix {
34   int			fx_bit_size;	/* Length of bitfield		*/
35   int			fx_bit_offset;	/* Bit offset to bitfield	*/
36   long			fx_bit_base;	/* Where do we apply the bitfix.
37 					If this is zero, default is assumed. */
38   long                  fx_bit_base_adj;/* Adjustment of base */
39   long			fx_bit_max;	/* Signextended max for bitfield */
40   long			fx_bit_min;	/* Signextended min for bitfield */
41   long			fx_bit_add;	/* Or mask, used for huffman prefix */
42 };
43 typedef struct bit_fix bit_fixS;
44 /*
45  * FixSs may be built up in any order.
46  */
47 
48 struct fix
49 {
50   fragS *		fx_frag;	/* Which frag? */
51   long int		fx_where;	/* Where is the 1st byte to fix up? */
52   symbolS *		fx_addsy; /* NULL or Symbol whose value we add in. */
53   symbolS *		fx_subsy; /* NULL or Symbol whose value we subtract. */
54   long int		fx_offset;	/* Absolute number we add in. */
55   struct fix *		fx_next;	/* NULL or -> next fixS. */
56   short int		fx_size;	/* How many bytes are involved? */
57   char			fx_pcrel;	/* TRUE: pc-relative. */
58   char			fx_pcrel_adjust;/* pc-relative offset adjust */
59   char			fx_im_disp;	/* TRUE: value is a displacement */
60   bit_fixS *		fx_bit_fixP;	/* IF NULL no bitfix's to do */
61   char			fx_bsr;		/* sequent-hack */
62 #if defined(SPARC) || defined(I860)
63   char			fx_r_type;	/* Sparc hacks */
64   long			fx_addnumber;
65 #endif
66 };
67 
68 typedef struct fix	fixS;
69 
70 
71 COMMON fixS *	text_fix_root;	/* Chains fixSs. */
72 COMMON fixS *	data_fix_root;	/* Chains fixSs. */
73 COMMON fixS **	seg_fix_rootP;	/* -> one of above. */
74 
75 bit_fixS *bit_fix_new();
76 /* end: write.h */
77 
78