* elf32-ppc.c (LWZU_0_X_11): Delete.
[binutils.git] / gas / frags.h
blob578732c8c3e8782c7374d46c14b54bbc2b966a11
1 /* frags.h - Header file for the frag concept.
2 Copyright 1987, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
3 2002, 2003, 2004, 2005 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, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
22 #ifndef FRAGS_H
23 #define FRAGS_H
25 #ifdef ANSI_PROTOTYPES
26 struct obstack;
27 #endif
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.
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. */
43 struct frag {
44 /* Object file address (as an octet offset). */
45 addressT fr_address;
46 /* When relaxing multiple times, remember the address the frag had
47 in the last relax pass. */
48 addressT last_fr_address;
50 /* (Fixed) number of octets we know we have. May be 0. */
51 offsetT fr_fix;
52 /* May be used for (Variable) number of octets after above.
53 The generic frag handling code no longer makes any use of fr_var. */
54 offsetT fr_var;
55 /* For variable-length tail. */
56 offsetT fr_offset;
57 /* For variable-length tail. */
58 symbolS *fr_symbol;
59 /* Points to opcode low addr byte, for relaxation. */
60 char *fr_opcode;
62 /* Chain forward; ascending address order. Rooted in frch_root. */
63 struct frag *fr_next;
65 /* Where the frag was created, or where it became a variant frag. */
66 char *fr_file;
67 unsigned int fr_line;
69 #ifndef NO_LISTING
70 struct list_info_struct *line;
71 #endif
73 /* Flipped each relax pass so we can easily determine whether
74 fr_address has been adjusted. */
75 unsigned int relax_marker:1;
77 /* Used to ensure that all insns are emitted on proper address
78 boundaries. */
79 unsigned int has_code:1;
80 unsigned int insn_addr:6;
82 /* What state is my tail in? */
83 relax_stateT fr_type;
84 relax_substateT fr_subtype;
86 #ifdef USING_CGEN
87 /* Don't include this unless using CGEN to keep frag size down. */
88 struct {
89 /* CGEN_INSN entry for this instruction. */
90 const struct cgen_insn *insn;
91 /* Index into operand table. */
92 int opindex;
93 /* Target specific data, usually reloc number. */
94 int opinfo;
95 } fr_cgen;
96 #endif
98 #ifdef TC_FRAG_TYPE
99 TC_FRAG_TYPE tc_frag_data;
100 #endif
102 /* Data begins here. */
103 char fr_literal[1];
106 #define SIZEOF_STRUCT_FRAG \
107 ((char *) zero_address_frag.fr_literal - (char *) &zero_address_frag)
108 /* We want to say fr_literal[0] above. */
110 /* Current frag we are building. This frag is incomplete. It is,
111 however, included in frchain_now. The fr_fix field is bogus;
112 instead, use frag_now_fix (). */
113 COMMON fragS *frag_now;
114 extern addressT frag_now_fix (void);
115 extern addressT frag_now_fix_octets (void);
117 /* For foreign-segment symbol fixups. */
118 COMMON fragS zero_address_frag;
119 /* For local common (N_BSS segment) fixups. */
120 COMMON fragS bss_address_frag;
122 extern void frag_append_1_char (int);
123 #define FRAG_APPEND_1_CHAR(X) frag_append_1_char (X)
125 void frag_init (void);
126 fragS *frag_alloc (struct obstack *);
127 void frag_grow (unsigned int nchars);
128 char *frag_more (int nchars);
129 void frag_align (int alignment, int fill_character, int max);
130 void frag_align_pattern (int alignment, const char *fill_pattern,
131 int n_fill, int max);
132 void frag_align_code (int alignment, int max);
133 void frag_new (int old_frags_var_max_size);
134 void frag_wane (fragS * fragP);
135 int frag_room (void);
137 char *frag_variant (relax_stateT type,
138 int max_chars,
139 int var,
140 relax_substateT subtype,
141 symbolS * symbol,
142 offsetT offset,
143 char *opcode);
145 char *frag_var (relax_stateT type,
146 int max_chars,
147 int var,
148 relax_substateT subtype,
149 symbolS * symbol,
150 offsetT offset,
151 char *opcode);
153 #endif /* FRAGS_H */