Back to index

cell-binutils  2.17cvs20070401
xtensa-istack.h
Go to the documentation of this file.
00001 /* Declarations for stacks of tokenized Xtensa instructions.
00002    Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
00003 
00004    This file is part of GAS, the GNU Assembler.
00005 
00006    GAS is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    GAS is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with GAS; see the file COPYING.  If not, write to the Free
00018    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00019    02110-1301, USA.  */
00020 
00021 #ifndef XTENSA_ISTACK_H
00022 #define XTENSA_ISTACK_H
00023 
00024 #include "xtensa-isa.h"
00025 
00026 #define MAX_ISTACK 12
00027 #define MAX_INSN_ARGS 10
00028 
00029 enum itype_enum
00030 {
00031   ITYPE_INSN,
00032   ITYPE_LITERAL,
00033   ITYPE_LABEL
00034 };
00035 
00036 
00037 /* Literals have 1 token and no opcode.
00038    Labels have 1 token and no opcode.  */
00039 
00040 typedef struct tinsn_struct
00041 {
00042   enum itype_enum insn_type;
00043 
00044   xtensa_opcode opcode;     /* Literals have an invalid opcode.  */
00045   bfd_boolean is_specific_opcode;
00046   bfd_boolean keep_wide;
00047   int ntok;
00048   expressionS tok[MAX_INSN_ARGS];
00049   unsigned linenum;
00050 
00051   /* Filled out by relaxation_requirements:  */
00052   enum xtensa_relax_statesE subtype;
00053   int literal_space;
00054   /* Filled out by vinsn_to_insnbuf:  */
00055   symbolS *symbol;
00056   offsetT offset;
00057   fragS *literal_frag;
00058 } TInsn;
00059 
00060 
00061 /* tinsn_stack:  This is a stack of instructions to  be placed.  */
00062 
00063 typedef struct tinsn_stack
00064 {
00065   int ninsn;
00066   TInsn insn[MAX_ISTACK];
00067 } IStack;
00068 
00069 
00070 void istack_init (IStack *);
00071 bfd_boolean istack_empty (IStack *);
00072 bfd_boolean istack_full (IStack *);
00073 TInsn *istack_top (IStack *);
00074 void istack_push (IStack *, TInsn *);
00075 TInsn *istack_push_space (IStack *);
00076 void istack_pop (IStack *);
00077 
00078 /* TInsn utilities.  */
00079 void tinsn_init (TInsn *);
00080 
00081 
00082 /* vliw_insn: bundles of TInsns.  */
00083 
00084 typedef struct vliw_insn
00085 {
00086   xtensa_format format;
00087   int num_slots;
00088   unsigned int inside_bundle;
00089   TInsn slots[MAX_SLOTS];
00090   xtensa_insnbuf insnbuf;
00091   xtensa_insnbuf slotbuf[MAX_SLOTS];
00092 } vliw_insn;
00093 
00094 #endif /* !XTENSA_ISTACK_H */