|
|
1.1 root 1: /* md.h -machine dependent- */
2:
3: /* Copyright (C) 1987 Free Software Foundation, Inc.
4:
5: This file is part of Gas, the GNU Assembler.
6:
7: The GNU assembler is distributed in the hope that it will be
8: useful, but WITHOUT ANY WARRANTY. No author or distributor
9: accepts responsibility to anyone for the consequences of using it
10: or for whether it serves any particular purpose or works at all,
11: unless he says so in writing. Refer to the GNU Assembler General
12: Public License for full details.
13:
14: Everyone is granted permission to copy, modify and redistribute
15: the GNU Assembler, but only under the conditions described in the
16: GNU Assembler General Public License. A copy of this license is
17: supposed to have been given to you along with the GNU Assembler
18: so you can know your rights and responsibilities. It should be
19: in a file named COPYING. Among other things, the copyright
20: notice and this notice must be preserved on all copies. */
21:
22: #import <mach/machine.h>
23: #import "stuff/bytesex.h"
24: #import "frags.h"
25: #import "relax.h"
26: #import "struc-symbol.h"
27: #import "fixes.h"
28: #import "read.h"
29:
30: /* These are the default cputype and cpusubtype for this target MACHINE */
31: extern const cpu_type_t md_cputype;
32: extern cpu_subtype_t md_cpusubtype;
33:
34: /* This is the byte sex for this target MACHINE */
35: extern const enum byte_sex md_target_byte_sex;
36:
37: /* These characters start a comment anywhere on the line */
38: extern const char md_comment_chars[];
39:
40: /* These characters only start a comment at the beginning of a line */
41: extern const char md_line_comment_chars[];
42:
43: /*
44: * These characters can be used to separate mantissa decimal digits from
45: * exponent decimal digits in floating point numbers.
46: */
47: extern const char md_EXP_CHARS[];
48:
49: /*
50: * The characters after a leading 0 that means this number is a floating point
51: * constant as in 0f123.456 or 0d1.234E-12 (the characters 'f' and 'd' in these
52: * case).
53: */
54: extern const char md_FLT_CHARS[];
55:
56: /*
57: * This is the machine dependent pseudo opcode table for this target MACHINE.
58: */
59: extern const pseudo_typeS md_pseudo_table[];
60:
61: /*
62: * This is the machine dependent table that is used to drive the span dependent
63: * branch algorithm in relax_section() in layout.c. See the comments in relax.h
64: * on how this table is used. For machines with all instructions of the same
65: * size (RISC machines) this this table is just a zero filled element and not
66: * used.
67: */
68: extern const relax_typeS md_relax_table[];
69:
70: /*
71: * md_parse_option() is called from main() in as.c to parse target machine
72: * dependent command line options. This routine returns 0 if it is passed an
73: * option that is not recognized non-zero otherwise.
74: */
75: extern int md_parse_option(
76: char **argP,
77: int *cntP,
78: char ***vecP);
79:
80: /*
81: * md_begin() is called from main() in as.c before assembly begins. It is used
82: * to allow target machine dependent initialization.
83: */
84: extern void md_begin(
85: void);
86:
87: /*
88: * md_end() is called from main() in as.c after assembly ends. It is used
89: * to allow target machine dependent clean up.
90: */
91: extern void md_end(
92: void);
93:
94: /*
95: * md_assemble() is passed a pointer to a string that should be a assembly
96: * statement for the target machine. This routine assembles the string into
97: * a machine instruction.
98: */
99: extern void md_assemble(
100: char *str);
101:
102: /*
103: * md_atof() turns a string pointed to by input_line_pointer into a floating
104: * point constant of type type, and store the appropriate bytes in *litP.
105: * The number of LITTLENUMS emitted is stored indirectly through *sizeP.
106: * An error message is returned, or a string containg only a '\0' for OK.
107: */
108: extern char *md_atof(
109: int type,
110: char *litP,
111: int *sizeP);
112:
113: /*
114: * md_number_to_chars() is the target machine dependent routine that puts out
115: * a binary value of size 4, 2, or 1 bytes into the specified buffer. This is
116: * done in the target machine's byte sex.
117: */
118: extern void md_number_to_chars(
119: char *buf,
120: long val,
121: int n);
122:
123: /*
124: * md_number_to_imm() is the target machine dependent routine that puts out
125: * a binary value of size 4, 2, or 1 bytes into the specified buffer with
126: * reguard to a possible relocation entry (the fixP->fx_r_type field in the fixS
127: * structure pointed to by fixP) for the section with the ordinal nsect. This
128: * is done in the target machine's byte sex using it's relocation types.
129: */
130: extern void md_number_to_imm(
131: unsigned char *buf,
132: long val,
133: int n,
134: fixS *fixP,
135: int nsect);
136:
137: /*
138: * md_estimate_size_before_relax() is called as part of the algorithm in
139: * relax_section() in layout.c that drives the span dependent branch algorithm.
140: * It is called once for each machine dependent frag to allow things like
141: * braches to undefined symbols to be "relaxed" to their maximum size.
142: * For machines with all instructions of the same size (RISC machines) this
143: * won't ever be called.
144: */
145: extern int md_estimate_size_before_relax(
146: fragS *fragP,
147: int nsect);
148:
149: /*
150: * md_convert_frag() is called on each machine dependent frag after the span
151: * dependent branch algorithm has been run to determine the sizes and addresses
152: * of all the fragments. This routine is to put the bytes inside the fragment
153: * and make it conform to the "relaxed" final size. For machines with all
154: * instructions of the same size (RISC machines) this won't ever be called.
155: */
156: extern void md_convert_frag(
157: fragS *fragP);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.