| 1 | /* Declarations for stacks of tokenized Xtensa instructions. |
| 2 | Copyright (C) 2003, 2004, 2007 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, 51 Franklin Street - Fifth Floor, Boston, MA |
| 19 | 02110-1301, USA. */ |
| 20 | |
| 21 | #ifndef XTENSA_ISTACK_H |
| 22 | #define XTENSA_ISTACK_H |
| 23 | |
| 24 | #include "xtensa-isa.h" |
| 25 | |
| 26 | #define MAX_ISTACK 12 |
| 27 | #define MAX_INSN_ARGS 10 |
| 28 | |
| 29 | enum itype_enum |
| 30 | { |
| 31 | ITYPE_INSN, |
| 32 | ITYPE_LITERAL, |
| 33 | ITYPE_LABEL |
| 34 | }; |
| 35 | |
| 36 | |
| 37 | /* Literals have 1 token and no opcode. |
| 38 | Labels have 1 token and no opcode. */ |
| 39 | |
| 40 | typedef struct tinsn_struct |
| 41 | { |
| 42 | enum itype_enum insn_type; |
| 43 | |
| 44 | xtensa_opcode opcode; /* Literals have an invalid opcode. */ |
| 45 | bfd_boolean is_specific_opcode; |
| 46 | bfd_boolean keep_wide; |
| 47 | int ntok; |
| 48 | expressionS tok[MAX_INSN_ARGS]; |
| 49 | unsigned linenum; |
| 50 | |
| 51 | /* Filled out by relaxation_requirements: */ |
| 52 | enum xtensa_relax_statesE subtype; |
| 53 | int literal_space; |
| 54 | /* Filled out by vinsn_to_insnbuf: */ |
| 55 | symbolS *symbol; |
| 56 | offsetT offset; |
| 57 | fragS *literal_frag; |
| 58 | } TInsn; |
| 59 | |
| 60 | |
| 61 | /* tinsn_stack: This is a stack of instructions to be placed. */ |
| 62 | |
| 63 | typedef struct tinsn_stack |
| 64 | { |
| 65 | int ninsn; |
| 66 | TInsn insn[MAX_ISTACK]; |
| 67 | } IStack; |
| 68 | |
| 69 | |
| 70 | void istack_init (IStack *); |
| 71 | bfd_boolean istack_empty (IStack *); |
| 72 | bfd_boolean istack_full (IStack *); |
| 73 | TInsn *istack_top (IStack *); |
| 74 | void istack_push (IStack *, TInsn *); |
| 75 | TInsn *istack_push_space (IStack *); |
| 76 | void istack_pop (IStack *); |
| 77 | |
| 78 | /* TInsn utilities. */ |
| 79 | void tinsn_init (TInsn *); |
| 80 | |
| 81 | |
| 82 | /* vliw_insn: bundles of TInsns. */ |
| 83 | |
| 84 | typedef struct vliw_insn |
| 85 | { |
| 86 | xtensa_format format; |
| 87 | int num_slots; |
| 88 | unsigned int inside_bundle; |
| 89 | TInsn slots[MAX_SLOTS]; |
| 90 | xtensa_insnbuf insnbuf; |
| 91 | xtensa_insnbuf slotbuf[MAX_SLOTS]; |
| 92 | } vliw_insn; |
| 93 | |
| 94 | #endif /* !XTENSA_ISTACK_H */ |