Back to index

cell-binutils  2.17cvs20070401
cgen.h
Go to the documentation of this file.
00001 /* GAS cgen support.
00002    Copyright 1998, 1999, 2000, 2001, 2002, 2003
00003    Free Software Foundation, Inc.
00004 
00005    This file is part of GAS, the GNU Assembler.
00006 
00007    GAS is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2, or (at your option)
00010    any later version.
00011 
00012    GAS is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with GAS; see the file COPYING.  If not, write to the Free
00019    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00020    02110-1301, USA.  */
00021 
00022 #ifndef GAS_CGEN_H
00023 #define GAS_CGEN_H
00024 
00025 /* Opcode table handle.  */
00026 extern CGEN_CPU_DESC gas_cgen_cpu_desc;
00027 
00028 /* Maximum number of fixups in an insn.
00029    If you need to change this, allow target to override and do so there.  */
00030 #ifndef GAS_CGEN_MAX_FIXUPS
00031 #define GAS_CGEN_MAX_FIXUPS 3
00032 #endif
00033 
00034 /* Struct defining result of gas_cgen_finish_insn.  */
00035 typedef struct {
00036   /* frag containing the insn */
00037   fragS * frag;
00038   /* Address of insn in frag.  */
00039   char * addr;
00040   /* Number of fixups this insn has.  */
00041   int num_fixups;
00042   /* Array of fixups.  */
00043   fixS * fixups[GAS_CGEN_MAX_FIXUPS];
00044 } finished_insnS;
00045 
00046 /* Callback for operand parsing.
00047    The result is an error message or NULL for success.
00048    The parsed value is stored in the bfd_vma *.  */
00049 extern const char * gas_cgen_parse_operand
00050      (CGEN_CPU_DESC, enum cgen_parse_operand_type,
00051       const char **, int, int, enum cgen_parse_operand_result *,
00052       bfd_vma *);
00053 
00054 /* Call this from md_assemble to initialize the assembler callback.  */
00055 extern void gas_cgen_init_parse (void);
00056 
00057 /* Routines and macros for saving fixup chains.  */
00058 extern void gas_cgen_save_fixups (int);
00059 extern void gas_cgen_restore_fixups (int);
00060 extern void gas_cgen_swap_fixups (int);
00061 extern void gas_cgen_initialize_saved_fixups_array (void);
00062 #define MAX_SAVED_FIXUP_CHAINS 50
00063 
00064 /* Add a register to the assembler's hash table.
00065    This makes lets GAS parse registers for us.
00066    ??? This isn't currently used, but it could be in the future.  */
00067 extern void cgen_asm_record_register (char *, int);
00068 
00069 /* After CGEN_SYM (assemble_insn) is done, this is called to
00070    output the insn and record any fixups.  */
00071 extern void gas_cgen_finish_insn (const CGEN_INSN *,
00072                               CGEN_INSN_BYTES_PTR, unsigned int,
00073                               int, finished_insnS *);
00074 
00075 /* Record a fixup.  */
00076 extern fixS * gas_cgen_record_fixup (fragS *, int, const CGEN_INSN *,
00077                                  int, const CGEN_OPERAND *, int,
00078                                  symbolS *, offsetT);
00079 extern fixS * gas_cgen_record_fixup_exp (fragS *, int, const CGEN_INSN *,
00080                                     int, const CGEN_OPERAND *, int,
00081                                     expressionS *);
00082 
00083 /* md_apply_fix handler */
00084 extern void gas_cgen_md_apply_fix (fixS *, valueT *, segT);
00085 
00086 /* tc_gen_reloc handler */
00087 extern arelent *gas_cgen_tc_gen_reloc (asection *, fixS *);
00088 
00089 /* Target supplied routine to lookup a reloc.  */
00090 extern bfd_reloc_code_real_type
00091 md_cgen_lookup_reloc (const CGEN_INSN *, const CGEN_OPERAND *, fixS *);
00092 
00093 /* Optional target supplied routine to record a fixup for an expression.  */
00094 extern fixS *
00095 md_cgen_record_fixup_exp (fragS *, int, const CGEN_INSN *, int,
00096                        const CGEN_OPERAND *, int, expressionS *);
00097 
00098 extern void gas_cgen_md_operand (expressionS *);
00099 
00100 /* Perform any cgen specific initialisation for gas.  */
00101 extern void gas_cgen_begin (void);
00102 
00103 #endif /* GAS_CGEN_H */