itbl-ops.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* itbl-ops.h
  2. Copyright (C) 1997-2015 Free Software Foundation, Inc.
  3. This file is part of GAS, the GNU Assembler.
  4. GAS is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GAS is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GAS; see the file COPYING. If not, write to the Free
  14. Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
  15. 02110-1301, USA. */
  16. /* External functions, constants and defines for itbl support */
  17. #ifdef HAVE_ITBL_CPU
  18. #include "itbl-cpu.h"
  19. #endif
  20. /* Defaults for definitions required by generic code */
  21. #ifndef ITBL_NUMBER_OF_PROCESSORS
  22. #define ITBL_NUMBER_OF_PROCESSORS 1
  23. #endif
  24. #ifndef ITBL_MAX_BITPOS
  25. #define ITBL_MAX_BITPOS 31
  26. #endif
  27. #ifndef ITBL_TYPE
  28. #define ITBL_TYPE unsigned long
  29. #endif
  30. #ifndef ITBL_IS_INSN
  31. #define ITBL_IS_INSN(insn) 1
  32. #endif
  33. #ifndef ITBL_DECODE_PNUM
  34. #define ITBL_DECODE_PNUM(insn) 0
  35. #endif
  36. #ifndef ITBL_ENCODE_PNUM
  37. #define ITBL_ENCODE_PNUM(pnum) 0
  38. #endif
  39. typedef ITBL_TYPE t_insn;
  40. /* types of entries */
  41. typedef enum
  42. {
  43. e_insn,
  44. e_dreg,
  45. e_regtype0 = e_dreg,
  46. e_creg,
  47. e_greg,
  48. e_addr,
  49. e_nregtypes = e_greg + 1,
  50. e_immed,
  51. e_ntypes,
  52. e_invtype /* invalid type */
  53. } e_type;
  54. typedef enum
  55. {
  56. e_p0,
  57. e_nprocs = ITBL_NUMBER_OF_PROCESSORS,
  58. e_invproc /* invalid processor */
  59. } e_processor;
  60. /* 0 means an instruction table was not specified. */
  61. extern int itbl_have_entries;
  62. /* These routines are visible to the main part of the assembler */
  63. int itbl_parse (char *insntbl);
  64. void itbl_init (void);
  65. char *itbl_get_field (char **s);
  66. unsigned long itbl_assemble (char *name, char *operands);
  67. int itbl_disassemble (char *str, unsigned long insn);
  68. int itbl_parse (char *tbl); /* parses insn tbl */
  69. int itbl_get_reg_val (char *name, unsigned long *pval);
  70. int itbl_get_val (e_processor processor, e_type type, char *name,
  71. unsigned long *pval);
  72. char *itbl_get_name (e_processor processor, e_type type, unsigned long val);
  73. /* These routines are called by the table parser used to build the
  74. dynamic list of new processor instructions and registers. */
  75. struct itbl_entry *itbl_add_reg (int yyproc, int yytype,
  76. char *regname, int regnum);
  77. struct itbl_entry *itbl_add_insn (int yyproc, char *name,
  78. unsigned long value, int sbit, int ebit, unsigned long flags);
  79. struct itbl_field *itbl_add_operand (struct itbl_entry * e, int yytype,
  80. int sbit, int ebit, unsigned long flags);