xtensa-istack.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* Declarations for stacks of tokenized Xtensa instructions.
  2. Copyright (C) 2003-2022 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. #ifndef XTENSA_ISTACK_H
  17. #define XTENSA_ISTACK_H
  18. #include "xtensa-isa.h"
  19. #define MAX_ISTACK 12
  20. #define MAX_INSN_ARGS 64
  21. enum itype_enum
  22. {
  23. ITYPE_INSN,
  24. ITYPE_LITERAL,
  25. ITYPE_LABEL
  26. };
  27. /* Literals have 1 token and no opcode.
  28. Labels have 1 token and no opcode. */
  29. typedef struct tinsn_struct
  30. {
  31. enum itype_enum insn_type;
  32. xtensa_opcode opcode; /* Literals have an invalid opcode. */
  33. bool is_specific_opcode;
  34. bool keep_wide;
  35. int ntok;
  36. expressionS tok[MAX_INSN_ARGS];
  37. bool loc_directive_seen;
  38. struct dwarf2_line_info debug_line;
  39. /* This field is used for two types of special pseudo ops:
  40. 1. TLS-related operations. Eg: callx8.tls
  41. 2. j.l label, a2
  42. For the tls-related operations, it will hold a tls-related opcode
  43. and info to be used in a fixup. For j.l it will hold a
  44. register to be used during relaxation. */
  45. expressionS extra_arg;
  46. /* Filled out by relaxation_requirements: */
  47. enum xtensa_relax_statesE subtype;
  48. int literal_space;
  49. /* Filled out by vinsn_to_insnbuf: */
  50. symbolS *symbol;
  51. offsetT offset;
  52. fragS *literal_frag;
  53. } TInsn;
  54. /* tinsn_stack: This is a stack of instructions to be placed. */
  55. typedef struct tinsn_stack
  56. {
  57. int ninsn;
  58. TInsn insn[MAX_ISTACK];
  59. } IStack;
  60. void istack_init (IStack *);
  61. bool istack_empty (IStack *);
  62. bool istack_full (IStack *);
  63. TInsn *istack_top (IStack *);
  64. void istack_push (IStack *, TInsn *);
  65. TInsn *istack_push_space (IStack *);
  66. void istack_pop (IStack *);
  67. /* TInsn utilities. */
  68. void tinsn_init (TInsn *);
  69. /* vliw_insn: bundles of TInsns. */
  70. typedef struct vliw_insn
  71. {
  72. xtensa_format format;
  73. int num_slots;
  74. unsigned int inside_bundle;
  75. TInsn slots[MAX_SLOTS];
  76. xtensa_insnbuf insnbuf;
  77. xtensa_insnbuf slotbuf[MAX_SLOTS];
  78. } vliw_insn;
  79. #endif /* !XTENSA_ISTACK_H */