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

Revision 16965, 5.0 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r16964, which included commits to RCS files with non-trunk default branches.
Line 
1/* frags.h - Header file for the frag concept.
2   Copyright 1987, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001
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/* A code fragment (frag) is some known number of chars, followed by some
30   unknown number of chars. Typically the unknown number of chars is an
31   instruction address whose size is yet unknown. We always know the greatest
32   possible size the unknown number of chars may become, and reserve that
33   much room at the end of the frag.
34   Once created, frags do not change address during assembly.
35   We chain the frags in (a) forward-linked list(s). The object-file address
36   of the 1st char of a frag is generally not known until after relax().
37   Many things at assembly time describe an address by {object-file-address
38   of a particular frag}+offset.
39
40   BUG: it may be smarter to have a single pointer off to various different
41   notes for different frag kinds.  See how code pans.   */
42
43struct frag {
44  /* Object file address (as an octet offset).  */
45  addressT fr_address;
46  /* Chain forward; ascending address order.  Rooted in frch_root.  */
47  struct frag *fr_next;
48
49  /* (Fixed) number of octets we know we have.  May be 0.  */
50  offsetT fr_fix;
51  /* May be used for (Variable) number of octets after above.
52     The generic frag handling code no longer makes any use of fr_var.  */
53  offsetT fr_var;
54  /* For variable-length tail.  */
55  symbolS *fr_symbol;
56  /* For variable-length tail.  */
57  offsetT fr_offset;
58  /* Points to opcode low addr byte, for relaxation.  */
59  char *fr_opcode;
60
61#ifndef NO_LISTING
62  struct list_info_struct *line;
63#endif
64
65  /* Flipped each relax pass so we can easily determine whether
66     fr_address has been adjusted.  */
67  unsigned int relax_marker:1;
68
69  /* What state is my tail in? */
70  relax_stateT fr_type;
71  relax_substateT fr_subtype;
72
73#ifdef USING_CGEN
74  /* Don't include this unless using CGEN to keep frag size down.  */
75  struct {
76    /* CGEN_INSN entry for this instruction.  */
77    const struct cgen_insn *insn;
78    /* Index into operand table.  */
79    int opindex;
80    /* Target specific data, usually reloc number.  */
81    int opinfo;
82  } fr_cgen;
83#endif
84
85#ifdef TC_FRAG_TYPE
86  TC_FRAG_TYPE tc_frag_data;
87#endif
88
89  /* Where the frag was created, or where it became a variant frag.  */
90  char *fr_file;
91  unsigned int fr_line;
92
93  /* Data begins here.  */
94  char fr_literal[1];
95};
96
97#define SIZEOF_STRUCT_FRAG \
98((char *) zero_address_frag.fr_literal - (char *) &zero_address_frag)
99/* We want to say fr_literal[0] above.  */
100
101/* Current frag we are building.  This frag is incomplete.  It is,
102   however, included in frchain_now.  The fr_fix field is bogus;
103   instead, use frag_now_fix ().  */
104COMMON fragS *frag_now;
105extern addressT frag_now_fix PARAMS ((void));
106extern addressT frag_now_fix_octets PARAMS ((void));
107
108/* For foreign-segment symbol fixups.  */
109COMMON fragS zero_address_frag;
110/* For local common (N_BSS segment) fixups.  */
111COMMON fragS bss_address_frag;
112
113#if 0
114/* A macro to speed up appending exactly 1 char to current frag.  */
115/* JF changed < 1 to <= 1 to avoid a race conditon.  */
116#define FRAG_APPEND_1_CHAR(datum)                       \
117{                                                       \
118  if (obstack_room (&frags) <= 1)                       \
119    {                                                   \
120      frag_wane (frag_now);                             \
121      frag_new (0);                                     \
122    }                                                   \
123  obstack_1grow (&frags, datum);                        \
124}
125#else
126extern void frag_append_1_char PARAMS ((int));
127#define FRAG_APPEND_1_CHAR(X) frag_append_1_char (X)
128#endif
129
130void frag_init PARAMS ((void));
131fragS *frag_alloc PARAMS ((struct obstack *));
132void frag_grow PARAMS ((unsigned int nchars));
133char *frag_more PARAMS ((int nchars));
134void frag_align PARAMS ((int alignment, int fill_character, int max));
135void frag_align_pattern PARAMS ((int alignment,
136                                 const char *fill_pattern,
137                                 int n_fill,
138                                 int max));
139void frag_align_code PARAMS ((int alignment, int max));
140void frag_new PARAMS ((int old_frags_var_max_size));
141void frag_wane PARAMS ((fragS * fragP));
142
143char *frag_variant PARAMS ((relax_stateT type,
144                            int max_chars,
145                            int var,
146                            relax_substateT subtype,
147                            symbolS * symbol,
148                            offsetT offset,
149                            char *opcode));
150
151char *frag_var PARAMS ((relax_stateT type,
152                        int max_chars,
153                        int var,
154                        relax_substateT subtype,
155                        symbolS * symbol,
156                        offsetT offset,
157                        char *opcode));
158
159#endif /* FRAGS_H */
Note: See TracBrowser for help on using the repository browser.