| 1 | /* GAS cgen support. | 
|---|
| 2 | Copyright 1998, 1999, 2000 Free Software Foundation, Inc. | 
|---|
| 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 | 
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 9 | any later version. | 
|---|
| 10 |  | 
|---|
| 11 | GAS is distributed in the hope that it will be useful, | 
|---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 14 | GNU General Public License for more details. | 
|---|
| 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 | 
|---|
| 18 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | 
|---|
| 19 | 02111-1307, USA.  */ | 
|---|
| 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.  */ | 
|---|
| 29 | #ifndef GAS_CGEN_MAX_FIXUPS | 
|---|
| 30 | #define GAS_CGEN_MAX_FIXUPS 3 | 
|---|
| 31 | #endif | 
|---|
| 32 |  | 
|---|
| 33 | /* Struct defining result of gas_cgen_finish_insn.  */ | 
|---|
| 34 | typedef struct { | 
|---|
| 35 | /* frag containing the insn */ | 
|---|
| 36 | fragS * frag; | 
|---|
| 37 | /* Address of insn in frag.  */ | 
|---|
| 38 | char * addr; | 
|---|
| 39 | /* Number of fixups this insn has.  */ | 
|---|
| 40 | int num_fixups; | 
|---|
| 41 | /* Array of fixups.  */ | 
|---|
| 42 | fixS * fixups[GAS_CGEN_MAX_FIXUPS]; | 
|---|
| 43 | } finished_insnS; | 
|---|
| 44 |  | 
|---|
| 45 | /* Callback for operand parsing. | 
|---|
| 46 | The result is an error message or NULL for success. | 
|---|
| 47 | The parsed value is stored in the bfd_vma *.  */ | 
|---|
| 48 | extern const char * gas_cgen_parse_operand | 
|---|
| 49 | PARAMS ((CGEN_CPU_DESC, enum cgen_parse_operand_type, | 
|---|
| 50 | const char **, int, int, enum cgen_parse_operand_result *, | 
|---|
| 51 | bfd_vma *)); | 
|---|
| 52 |  | 
|---|
| 53 | /* Call this from md_assemble to initialize the assembler callback.  */ | 
|---|
| 54 | extern void gas_cgen_init_parse PARAMS ((void)); | 
|---|
| 55 |  | 
|---|
| 56 | /* Routines and macros for saving fixup chains.  */ | 
|---|
| 57 | extern void gas_cgen_save_fixups PARAMS ((int)); | 
|---|
| 58 | extern void gas_cgen_restore_fixups PARAMS ((int)); | 
|---|
| 59 | extern void gas_cgen_swap_fixups PARAMS ((int)); | 
|---|
| 60 | extern void gas_cgen_initialize_saved_fixups_array PARAMS ((void)); | 
|---|
| 61 | #define MAX_SAVED_FIXUP_CHAINS 50 | 
|---|
| 62 |  | 
|---|
| 63 | /* Add a register to the assembler's hash table. | 
|---|
| 64 | This makes lets GAS parse registers for us. | 
|---|
| 65 | ??? This isn't currently used, but it could be in the future.  */ | 
|---|
| 66 | extern void cgen_asm_record_register PARAMS ((char *, int)); | 
|---|
| 67 |  | 
|---|
| 68 | /* After CGEN_SYM (assemble_insn) is done, this is called to | 
|---|
| 69 | output the insn and record any fixups.  */ | 
|---|
| 70 | extern void gas_cgen_finish_insn PARAMS ((const CGEN_INSN *, | 
|---|
| 71 | CGEN_INSN_BYTES_PTR, unsigned int, | 
|---|
| 72 | int, finished_insnS *)); | 
|---|
| 73 |  | 
|---|
| 74 | /* Record a fixup.  */ | 
|---|
| 75 | extern fixS * gas_cgen_record_fixup PARAMS ((fragS *, int, const CGEN_INSN *, | 
|---|
| 76 | int, const CGEN_OPERAND *, int, | 
|---|
| 77 | symbolS *, offsetT)); | 
|---|
| 78 | extern fixS * gas_cgen_record_fixup_exp PARAMS ((fragS *, int, const CGEN_INSN *, | 
|---|
| 79 | int, const CGEN_OPERAND *, int, | 
|---|
| 80 | expressionS *)); | 
|---|
| 81 |  | 
|---|
| 82 | /* md_apply_fix3 handler */ | 
|---|
| 83 | extern void gas_cgen_md_apply_fix3 PARAMS ((fixS *, valueT *, segT)); | 
|---|
| 84 |  | 
|---|
| 85 | /* tc_gen_reloc handler */ | 
|---|
| 86 | extern arelent *gas_cgen_tc_gen_reloc PARAMS ((asection *, fixS *)); | 
|---|
| 87 |  | 
|---|
| 88 | /* Target supplied routine to lookup a reloc.  */ | 
|---|
| 89 | extern bfd_reloc_code_real_type | 
|---|
| 90 | md_cgen_lookup_reloc PARAMS ((const CGEN_INSN *, const CGEN_OPERAND *, | 
|---|
| 91 | fixS *)); | 
|---|
| 92 |  | 
|---|
| 93 | /* Optional target supplied routine to record a fixup for an expression.  */ | 
|---|
| 94 | extern fixS * | 
|---|
| 95 | md_cgen_record_fixup_exp PARAMS ((fragS *, int, const CGEN_INSN *, int, | 
|---|
| 96 | const CGEN_OPERAND *, int, | 
|---|
| 97 | expressionS *)); | 
|---|
| 98 |  | 
|---|
| 99 | extern void gas_cgen_md_operand PARAMS ((expressionS *)); | 
|---|
| 100 |  | 
|---|
| 101 | /* Perform any cgen specific initialisation for gas.  */ | 
|---|
| 102 | extern void gas_cgen_begin PARAMS ((void)); | 
|---|
| 103 |  | 
|---|
| 104 | #endif /* GAS_CGEN_H */ | 
|---|