Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
isa_decode_gen.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 // isa_decode_gen.h
00038 //
00039 //  Interface for decoding instructions.
00040 //
00041 //  The decoding interface is specification is in the form of a state
00042 //  machine. Each intermediate (non-final) state examines a bit field
00043 //  of the instruction word and uses that to determine the next state.
00044 //  When a final state is reached, that state will specify the topcode
00045 //  for the instruction.
00046 //
00047 //  void ISA_Decode_Begin(const char* archname)
00048 //      Initialize to generate instruction decoding information for the 
00049 //      architecture with the given <archname>.  The information will be 
00050 //      written to the files targ_isa_decode.[ch].  
00051 //
00052 //  void ISA_Decode_End(void)
00053 //      Complete processing of decoding information.
00054 //
00055 //  TYPE STATE
00056 //      This type holds the information about a state. It's content
00057 //      are hidden from the client.
00058 //
00059 //  STATE Create_Unit_State(const char *tag, int pos, int width)
00060 //  STATE Create_Inst_State(const char *tag, int idx, int pos, int width)
00061 //      Create a intermediate (non-final) state. <tag> is a short string
00062 //      to uniquely identify the state. The string is used as part of
00063 //      an identifier, so it should only contain characters legal in an
00064 //      identifier. Create_Unit_State identifies that this state
00065 //      transitions based on bits in the execution unit. Create_Inst_State
00066 //      identifies that this state transitions based on bits in the
00067 //      instruction. <pos> and <width> specify a bit field in the 
00068 //      instruction word or the execution unit that will determine the 
00069 //      next state. <idx> determines what instruction word contains
00070 //      the specified bit field.
00071 //
00072 //  STATE Final(TOP topcode)
00073 //      Creates a final state. <topcode> specifies the resulting
00074 //      topcode for the decode operation.
00075 //
00076 //  const int END_TRANSITIONS
00077 //      Marks the end of a transition list. See the description for
00078 //      Transitions() for details.
00079 //
00080 //  void Transitions(STATE state, ...)
00081 //      Specifies the transitions for <state>. Each transition is
00082 //      specified by the pair: int num, STATE newstate. <num> specifies
00083 //      the transition number (corresponds to the bitfield specified
00084 //      in Create_State). <newstate> is the state to move to when
00085 //      the value of the bitfield matches the transition number.
00086 //      The list of transitions is terminated by passing the constant
00087 //      END_TRANSITIONS for <num>.
00088 //
00089 //  void Initial_State(STATE state)
00090 //      This sets the initial state for the instruction decoder.
00091 //
00093 
00094 
00095 #ifndef isa_decode_gen_INCLUDED
00096 #define isa_decode_gen_INCLUDED
00097 
00098 #ifdef _KEEP_RCS_ID
00099 #endif /* _KEEP_RCS_ID */
00100 
00101 #ifdef __cplusplus
00102 extern "C" {
00103 #endif
00104 
00105 extern void ISA_Decode_Begin(const char* archname);
00106 extern void ISA_Decode_End(void);
00107 
00108 typedef struct state *STATE;
00109 enum { END_TRANSITIONS = -1 };
00110 extern STATE Create_Unit_State(const char *tag, int pos, int width);
00111 extern STATE Create_Inst_State(const char *tag, int idx, int pos, int width);
00112 extern void Transitions(STATE state, ...);
00113 extern void Initial_State(STATE state);
00114 extern STATE Final(TOP topcode);
00115 
00116 #ifdef __cplusplus
00117 }
00118 #endif
00119 #endif /* isa_decode_gen_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines