Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* GAS cgen support. |
82704155 | 2 | Copyright (C) 1998-2019 Free Software Foundation, Inc. |
252b5132 RH |
3 | |
4 | This file is part of GAS, the GNU Assembler. | |
5 | ||
6 | GAS is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
ec2655a6 | 8 | the Free Software Foundation; either version 3, or (at your option) |
252b5132 RH |
9 | any later version. |
10 | ||
ec2655a6 NC |
11 | GAS is distributed in the hope that it will be useful, but WITHOUT |
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
14 | License for more details. | |
252b5132 RH |
15 | |
16 | You should have received a copy of the GNU General Public License | |
17 | along with GAS; see the file COPYING. If not, write to the Free | |
4b4da160 NC |
18 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
19 | 02110-1301, USA. */ | |
252b5132 RH |
20 | |
21 | #ifndef GAS_CGEN_H | |
22 | #define GAS_CGEN_H | |
23 | ||
24 | /* Opcode table handle. */ | |
25 | extern CGEN_CPU_DESC gas_cgen_cpu_desc; | |
26 | ||
27 | /* Maximum number of fixups in an insn. | |
28 | If you need to change this, allow target to override and do so there. */ | |
7c3dc350 | 29 | #ifndef GAS_CGEN_MAX_FIXUPS |
252b5132 | 30 | #define GAS_CGEN_MAX_FIXUPS 3 |
7c3dc350 | 31 | #endif |
252b5132 RH |
32 | |
33 | /* Struct defining result of gas_cgen_finish_insn. */ | |
32425e36 NC |
34 | typedef struct |
35 | { | |
36 | /* Frag containing the insn */ | |
e972090a | 37 | fragS * frag; |
252b5132 | 38 | /* Address of insn in frag. */ |
e972090a | 39 | char * addr; |
252b5132 RH |
40 | /* Number of fixups this insn has. */ |
41 | int num_fixups; | |
42 | /* Array of fixups. */ | |
e972090a | 43 | fixS * fixups[GAS_CGEN_MAX_FIXUPS]; |
252b5132 RH |
44 | } finished_insnS; |
45 | ||
46 | /* Callback for operand parsing. | |
47 | The result is an error message or NULL for success. | |
48 | The parsed value is stored in the bfd_vma *. */ | |
49 | extern const char * gas_cgen_parse_operand | |
73ee5e4c KH |
50 | (CGEN_CPU_DESC, enum cgen_parse_operand_type, |
51 | const char **, int, int, enum cgen_parse_operand_result *, | |
52 | bfd_vma *); | |
252b5132 RH |
53 | |
54 | /* Call this from md_assemble to initialize the assembler callback. */ | |
73ee5e4c | 55 | extern void gas_cgen_init_parse (void); |
252b5132 | 56 | |
d1a6c242 | 57 | /* Routines and macros for saving fixup chains. */ |
73ee5e4c KH |
58 | extern void gas_cgen_save_fixups (int); |
59 | extern void gas_cgen_restore_fixups (int); | |
60 | extern void gas_cgen_swap_fixups (int); | |
61 | extern void gas_cgen_initialize_saved_fixups_array (void); | |
002de68b | 62 | #define MAX_SAVED_FIXUP_CHAINS 50 |
30a2b4ef | 63 | |
252b5132 RH |
64 | /* Add a register to the assembler's hash table. |
65 | This makes lets GAS parse registers for us. | |
66 | ??? This isn't currently used, but it could be in the future. */ | |
73ee5e4c | 67 | extern void cgen_asm_record_register (char *, int); |
252b5132 RH |
68 | |
69 | /* After CGEN_SYM (assemble_insn) is done, this is called to | |
70 | output the insn and record any fixups. */ | |
73ee5e4c KH |
71 | extern void gas_cgen_finish_insn (const CGEN_INSN *, |
72 | CGEN_INSN_BYTES_PTR, unsigned int, | |
73 | int, finished_insnS *); | |
252b5132 RH |
74 | |
75 | /* Record a fixup. */ | |
73ee5e4c KH |
76 | extern fixS * gas_cgen_record_fixup (fragS *, int, const CGEN_INSN *, |
77 | int, const CGEN_OPERAND *, int, | |
78 | symbolS *, offsetT); | |
79 | extern fixS * gas_cgen_record_fixup_exp (fragS *, int, const CGEN_INSN *, | |
80 | int, const CGEN_OPERAND *, int, | |
81 | expressionS *); | |
252b5132 | 82 | |
32425e36 NC |
83 | extern bfd_reloc_code_real_type gas_cgen_pcrel_r_type (bfd_reloc_code_real_type); |
84 | ||
85 | /* md_apply_fix handler. */ | |
55cf6793 | 86 | extern void gas_cgen_md_apply_fix (fixS *, valueT *, segT); |
252b5132 | 87 | |
32425e36 | 88 | /* tc_gen_reloc handler. */ |
73ee5e4c | 89 | extern arelent *gas_cgen_tc_gen_reloc (asection *, fixS *); |
252b5132 RH |
90 | |
91 | /* Target supplied routine to lookup a reloc. */ | |
92 | extern bfd_reloc_code_real_type | |
73ee5e4c | 93 | md_cgen_lookup_reloc (const CGEN_INSN *, const CGEN_OPERAND *, fixS *); |
252b5132 RH |
94 | |
95 | /* Optional target supplied routine to record a fixup for an expression. */ | |
96 | extern fixS * | |
73ee5e4c KH |
97 | md_cgen_record_fixup_exp (fragS *, int, const CGEN_INSN *, int, |
98 | const CGEN_OPERAND *, int, expressionS *); | |
252b5132 | 99 | |
73ee5e4c | 100 | extern void gas_cgen_md_operand (expressionS *); |
0609eb57 | 101 | |
9cc92a36 | 102 | /* Perform any cgen specific initialisation for gas. */ |
73ee5e4c | 103 | extern void gas_cgen_begin (void); |
9cc92a36 | 104 | |
252b5132 | 105 | #endif /* GAS_CGEN_H */ |