Typo.
[binutils.git] / gas / frags.h
blobb188e33cf4347726d1f7b2d21eea5e5efa96a376
1 /* frags.h - Header file for the frag concept.
2 Copyright (C) 1987, 92, 93, 94, 95, 97, 98, 1999
3 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #ifndef FRAGS_H
23 #define FRAGS_H
25 #ifdef ANSI_PROTOTYPES
26 struct obstack;
27 #endif
30 * A code fragment (frag) is some known number of chars, followed by some
31 * unknown number of chars. Typically the unknown number of chars is an
32 * instruction address whose size is yet unknown. We always know the greatest
33 * possible size the unknown number of chars may become, and reserve that
34 * much room at the end of the frag.
35 * Once created, frags do not change address during assembly.
36 * We chain the frags in (a) forward-linked list(s). The object-file address
37 * of the 1st char of a frag is generally not known until after relax().
38 * Many things at assembly time describe an address by {object-file-address
39 * of a particular frag}+offset.
41 BUG: it may be smarter to have a single pointer off to various different
42 notes for different frag kinds. See how code pans
45 struct frag
47 /* Object file address. */
48 addressT fr_address;
49 /* Chain forward; ascending address order. Rooted in frch_root. */
50 struct frag *fr_next;
52 /* (Fixed) number of chars we know we have. May be 0. */
53 offsetT fr_fix;
54 /* (Variable) number of chars after above. May be 0. */
55 offsetT fr_var;
56 /* For variable-length tail. */
57 symbolS *fr_symbol;
58 /* For variable-length tail. */
59 offsetT fr_offset;
60 /* Points to opcode low addr byte, for relaxation. */
61 char *fr_opcode;
63 #ifndef NO_LISTING
64 struct list_info_struct *line;
65 #endif
67 /* What state is my tail in? */
68 relax_stateT fr_type;
69 relax_substateT fr_subtype;
71 #ifdef USING_CGEN
72 /* Don't include this unless using CGEN to keep frag size down. */
73 struct {
74 /* CGEN_INSN entry for this instruction. */
75 const struct cgen_insn *insn;
76 /* Index into operand table. */
77 int opindex;
78 /* Target specific data, usually reloc number. */
79 int opinfo;
80 } fr_cgen;
81 #endif
83 #ifdef TC_FRAG_TYPE
84 TC_FRAG_TYPE tc_frag_data;
85 #endif
87 /* Where the frag was created, or where it became a variant frag. */
88 char *fr_file;
89 unsigned int fr_line;
91 /* Data begins here. */
92 char fr_literal[1];
95 #define SIZEOF_STRUCT_FRAG \
96 ((char *)zero_address_frag.fr_literal-(char *)&zero_address_frag)
97 /* We want to say fr_literal[0] above. */
99 /* Current frag we are building. This frag is incomplete. It is,
100 however, included in frchain_now. The fr_fix field is bogus;
101 instead, use frag_now_fix (). */
102 COMMON fragS *frag_now;
103 extern addressT frag_now_fix PARAMS ((void));
105 /* For foreign-segment symbol fixups. */
106 COMMON fragS zero_address_frag;
107 /* For local common (N_BSS segment) fixups. */
108 COMMON fragS bss_address_frag;
110 #if 0
112 * A macro to speed up appending exactly 1 char
113 * to current frag.
115 /* JF changed < 1 to <= 1 to avoid a race conditon */
116 #define FRAG_APPEND_1_CHAR(datum) \
118 if (obstack_room( &frags ) <= 1) {\
119 frag_wane (frag_now); \
120 frag_new (0); \
122 obstack_1grow( &frags, datum ); \
124 #else
125 extern void frag_append_1_char PARAMS ((int));
126 #define FRAG_APPEND_1_CHAR(X) frag_append_1_char (X)
127 #endif
130 void frag_init PARAMS ((void));
131 fragS *frag_alloc PARAMS ((struct obstack *));
132 void frag_grow PARAMS ((unsigned int nchars));
133 char *frag_more PARAMS ((int nchars));
134 void frag_align PARAMS ((int alignment, int fill_character, int max));
135 void frag_align_pattern PARAMS ((int alignment,
136 const char *fill_pattern,
137 int n_fill,
138 int max));
139 void frag_new PARAMS ((int old_frags_var_max_size));
140 void frag_wane PARAMS ((fragS * fragP));
142 char *frag_variant PARAMS ((relax_stateT type,
143 int max_chars,
144 int var,
145 relax_substateT subtype,
146 symbolS * symbol,
147 offsetT offset,
148 char *opcode));
150 char *frag_var PARAMS ((relax_stateT type,
151 int max_chars,
152 int var,
153 relax_substateT subtype,
154 symbolS * symbol,
155 offsetT offset,
156 char *opcode));
158 #endif /* FRAGS_H */