source: trunk/third/binutils/gas/frags.h @ 15803

Revision 15803, 4.8 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15802, which included commits to RCS files with non-trunk default branches.
Line 
1/* frags.h - Header file for the frag concept.
2   Copyright (C) 1987, 92, 93, 94, 95, 97, 98, 99, 2000
3   Free Software Foundation, Inc.
4
5   This file is part of GAS, the GNU Assembler.
6
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.
11
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.
16
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.  */
21
22#ifndef FRAGS_H
23#define FRAGS_H
24
25#ifdef ANSI_PROTOTYPES
26struct obstack;
27#endif
28
29/*
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.
40
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
43 */
44
45struct frag
46{
47  /* Object file address (as an octet offset). */
48  addressT fr_address;
49  /* Chain forward; ascending address order.  Rooted in frch_root. */
50  struct frag *fr_next;
51
52  /* (Fixed) number of octets we know we have.  May be 0. */
53  offsetT fr_fix;
54  /* May be used for (Variable) number of octets after above.
55     The generic frag handling code no longer makes any use of fr_var.  */
56  offsetT fr_var;
57  /* For variable-length tail. */
58  symbolS *fr_symbol;
59  /* For variable-length tail. */
60  offsetT fr_offset;
61  /* Points to opcode low addr byte, for relaxation.  */
62  char *fr_opcode;
63
64#ifndef NO_LISTING
65  struct list_info_struct *line;
66#endif
67
68  /* What state is my tail in? */
69  relax_stateT fr_type;
70  relax_substateT fr_subtype;
71
72#ifdef USING_CGEN
73  /* Don't include this unless using CGEN to keep frag size down.  */
74  struct {
75    /* CGEN_INSN entry for this instruction.  */
76    const struct cgen_insn *insn;
77    /* Index into operand table.  */
78    int opindex;
79    /* Target specific data, usually reloc number.  */
80    int opinfo;
81  } fr_cgen;
82#endif
83
84#ifdef TC_FRAG_TYPE
85  TC_FRAG_TYPE tc_frag_data;
86#endif
87
88  /* Where the frag was created, or where it became a variant frag.  */
89  char *fr_file;
90  unsigned int fr_line;
91
92  /* Data begins here.  */
93  char fr_literal[1];
94};
95
96#define SIZEOF_STRUCT_FRAG \
97((char *)zero_address_frag.fr_literal-(char *)&zero_address_frag)
98/* We want to say fr_literal[0] above. */
99
100/* Current frag we are building.  This frag is incomplete.  It is,
101   however, included in frchain_now.  The fr_fix field is bogus;
102   instead, use frag_now_fix ().  */
103COMMON fragS *frag_now;
104extern addressT frag_now_fix PARAMS ((void));
105extern addressT frag_now_fix_octets PARAMS ((void));
106
107/* For foreign-segment symbol fixups. */
108COMMON fragS zero_address_frag;
109/* For local common (N_BSS segment) fixups. */
110COMMON fragS bss_address_frag;
111
112#if 0
113/*
114 * A macro to speed up appending exactly 1 char
115 * to current frag.
116 */
117/* JF changed < 1 to <= 1 to avoid a race conditon */
118#define FRAG_APPEND_1_CHAR(datum)       \
119{                                       \
120  if (obstack_room( &frags ) <= 1) {\
121    frag_wane (frag_now);       \
122    frag_new (0);               \
123  }                             \
124  obstack_1grow( &frags, datum );       \
125}
126#else
127extern void frag_append_1_char PARAMS ((int));
128#define FRAG_APPEND_1_CHAR(X) frag_append_1_char (X)
129#endif
130
131
132void frag_init PARAMS ((void));
133fragS *frag_alloc PARAMS ((struct obstack *));
134void frag_grow PARAMS ((unsigned int nchars));
135char *frag_more PARAMS ((int nchars));
136void frag_align PARAMS ((int alignment, int fill_character, int max));
137void frag_align_pattern PARAMS ((int alignment,
138                                 const char *fill_pattern,
139                                 int n_fill,
140                                 int max));
141void frag_new PARAMS ((int old_frags_var_max_size));
142void frag_wane PARAMS ((fragS * fragP));
143
144char *frag_variant PARAMS ((relax_stateT type,
145                            int max_chars,
146                            int var,
147                            relax_substateT subtype,
148                            symbolS * symbol,
149                            offsetT offset,
150                            char *opcode));
151
152char *frag_var PARAMS ((relax_stateT type,
153                        int max_chars,
154                        int var,
155                        relax_substateT subtype,
156                        symbolS * symbol,
157                        offsetT offset,
158                        char *opcode));
159
160#endif /* FRAGS_H */
Note: See TracBrowser for help on using the repository browser.