Upload Tizen:Base source
[external/binutils.git] / gas / config / xtensa-istack.h
1 /* Declarations for stacks of tokenized Xtensa instructions.
2    Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
3    Free Software Foundation, Inc.
4
5    This file is part of GAS, the GNU Assembler.
6
7    GAS is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3, or (at your option)
10    any later version.
11
12    GAS is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GAS; see the file COPYING.  If not, write to the Free
19    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20    02110-1301, USA.  */
21
22 #ifndef XTENSA_ISTACK_H
23 #define XTENSA_ISTACK_H
24
25 #include "xtensa-isa.h"
26
27 #define MAX_ISTACK 12
28 #define MAX_INSN_ARGS 64
29
30 enum itype_enum
31 {
32   ITYPE_INSN,
33   ITYPE_LITERAL,
34   ITYPE_LABEL
35 };
36
37
38 /* Literals have 1 token and no opcode.
39    Labels have 1 token and no opcode.  */
40
41 typedef struct tinsn_struct
42 {
43   enum itype_enum insn_type;
44
45   xtensa_opcode opcode; /* Literals have an invalid opcode.  */
46   bfd_boolean is_specific_opcode;
47   bfd_boolean keep_wide;
48   int ntok;
49   expressionS tok[MAX_INSN_ARGS];
50   bfd_boolean loc_directive_seen;
51   struct dwarf2_line_info debug_line;
52
53   /* This field is used for two types of special pseudo ops:
54      1. TLS-related operations.  Eg:  callx8.tls
55      2. j.l  label, a2
56
57      For the tls-related operations, it will hold a tls-related opcode
58      and info to be used in a fixup.  For j.l it will hold a
59      register to be used during relaxation.  */
60   expressionS extra_arg;
61
62   /* Filled out by relaxation_requirements:  */
63   enum xtensa_relax_statesE subtype;
64   int literal_space;
65
66   /* Filled out by vinsn_to_insnbuf:  */
67   symbolS *symbol;
68   offsetT offset;
69   fragS *literal_frag;
70 } TInsn;
71
72
73 /* tinsn_stack:  This is a stack of instructions to  be placed.  */
74
75 typedef struct tinsn_stack
76 {
77   int ninsn;
78   TInsn insn[MAX_ISTACK];
79 } IStack;
80
81
82 void istack_init (IStack *);
83 bfd_boolean istack_empty (IStack *);
84 bfd_boolean istack_full (IStack *);
85 TInsn *istack_top (IStack *);
86 void istack_push (IStack *, TInsn *);
87 TInsn *istack_push_space (IStack *);
88 void istack_pop (IStack *);
89
90 /* TInsn utilities.  */
91 void tinsn_init (TInsn *);
92
93
94 /* vliw_insn: bundles of TInsns.  */
95
96 typedef struct vliw_insn
97 {
98   xtensa_format format;
99   int num_slots;
100   unsigned int inside_bundle;
101   TInsn slots[MAX_SLOTS];
102   xtensa_insnbuf insnbuf;
103   xtensa_insnbuf slotbuf[MAX_SLOTS];
104 } vliw_insn;
105
106 #endif /* !XTENSA_ISTACK_H */