Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
isa_operands_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_operands_gen.h
00038 //
00039 //  Interface for specifying operands and results for various
00040 //  instructions in the ISA.
00041 //
00042 //  void ISA_Operands_Begin( const char* archname )
00043 //      Initialize to generate operands information for the architecture 
00044 //      with the given <archname>.  The information will be written to the 
00045 //      files targ_isa_operands.[ch].  
00046 //
00047 //  type OPERAND_VALUE_TYPE
00048 //      An abstract type that describes different types of operands,
00049 //      including results. An operand type can be a register or an
00050 //      immediate or an enumeration.
00051 //
00052 //  type OPERAND_USE_TYPE
00053 //      An abstract type that describes the useage of an operand.
00054 //
00055 //  OPERAND_VALUE_TYPE ISA_Reg_Opnd_Type_Create( 
00056 //                      const char* name, 
00057 //                      ISA_REGISTER_CLASS register_class, 
00058 //                      ISA_REGISTER_SUBCLASS sub_class,
00059 //                      int size, 
00060 //                      RTYPE type, 
00061 //                      REG_ALIAS_TYPE reg_alias,
00062 //                      FP_TYPE is_fp_int )
00063 //      Used to create a new OPERAND_VALUE_TYPE.  
00064 //      <name> is the operand_type name.
00065 //
00066 //  OPERAND_VALUE_TYPE ISA_Lit_Opnd_Type_Create( 
00067 //                      const char* name, 
00068 //                      int size,
00069 //                      RTYPE type, 
00070 //                      ISA_LIT_CLASS lc )
00071 //      Used to create a new OPERAND_VALUE_TYPE.  
00072 //      <name> is the operand_type name.
00073 //
00074 //  OPERAND_VALUE_TYPE ISA_Enum_Opnd_Type_Create( 
00075 //                      const char* name, 
00076 //                      int size,
00077 //                      RTYPE type, 
00078 //                      ISA_ENUM_CLASS ec )
00079 //      Used to create a new OPERAND_VALUE_TYPE.  
00080 //      <name> is the operand_type name.
00081 //
00082 //  OPERAND_USE_TYPE Create_Operand_Use(const char *name)
00083 //      Create a new OPERAND_USE_TYPE. <name> identifies the usage
00084 //      and is used to form enumerated constants of the form OU_<name>.
00085 //
00086 //  void Instruction_Group( const char *name, 
00087 //                          TOP top, ....., TOP_UNDEFINED )
00088 //      Start a list of instructions that have the same operand/result
00089 //      descriptions. The list of TOPs is terminated by TOP_UNDEFINED.
00090 //
00091 //  void Operand (int operand_index, 
00092 //                OPERAND_VALUE_TYPE operand_type,
00093 //                [ OPERAND_USE_TYPE operand_use ])
00094 //      The <operand_index>'th operand of the current instruction group
00095 //      is of <operand_type> and usage <operand_use>. If <operand_use>
00096 //      is omitted it defaults to "undefined".
00097 //
00098 //  void Relocatable (int operand_index)
00099 //      The <operand_index>'th operand of the current instruction group
00100 //      is relocatable. Not supported for results, and there can
00101 //      be only one relocatable operand per topcode.
00102 //
00103 //  void Result (int result_index, OPERAND_VALUE_TYPE result_type)
00104 //      The <result_index>'th result of the current instruction group 
00105 //      is of <result_type>. 
00106 //
00107 //  void ISA_Operands_End(void)
00108 //      Complete processing of operands/results.
00109 //
00110 //
00112 
00113 
00114 #ifndef isa_operands_gen_INCLUDED
00115 #define isa_operands_gen_INCLUDED
00116 
00117 #ifdef _KEEP_RCS_ID
00118 #endif /* _KEEP_RCS_ID */
00119 
00120 #ifdef __cplusplus
00121 extern "C" {
00122 #endif
00123 
00124 #include "targ_isa_registers.h"
00125 #include "targ_isa_lits.h"
00126 #include "targ_isa_enums.h"
00127 
00128 /* Types:
00129  */
00130 
00131 typedef struct operand_value_type *OPERAND_VALUE_TYPE;
00132 
00133 // RTYPE (or the range-description type) is used to annotate a proper
00134 // range value to the concerned OPERAND_VALUE_TYPE.  
00135 
00136 typedef enum {PCREL, SIGNED, UNSIGNED, UNKNOWN} RTYPE; 
00137 
00138 // FP_TYPE description is used to determine the fp-value in a floating register
00139 // i.e. FP32_INT => 32-bit int value in a fp- register (fixed-point)
00140 // or   FP64_INT => 64-bit int value in a fp- register (fixed-point)
00141 // or   INVALID (which includes the rest of the category)
00142 
00143 typedef enum {FP32_INT, FP64_INT, INVALID} FP_TYPE; 
00144 
00145 typedef struct operand_use_type *OPERAND_USE_TYPE;
00146 
00147 /* External functions 
00148  */
00149 
00150 extern void ISA_Operands_Begin ( const char* archname );
00151 extern OPERAND_VALUE_TYPE ISA_Reg_Opnd_Type_Create ( 
00152                 const char* name, 
00153                 ISA_REGISTER_CLASS register_class, 
00154                 ISA_REGISTER_SUBCLASS sub_class,
00155                 int size, 
00156                 RTYPE rtype, 
00157                 FP_TYPE is_fp_int );
00158 extern OPERAND_VALUE_TYPE ISA_Lit_Opnd_Type_Create ( 
00159                 const char* name, 
00160                 int size,
00161                 RTYPE rtype, 
00162                 ISA_LIT_CLASS lc );
00163 extern OPERAND_VALUE_TYPE ISA_Enum_Opnd_Type_Create ( 
00164                 const char* name, 
00165                 int size,
00166                 RTYPE rtype, 
00167                 ISA_ENUM_CLASS ec );
00168 extern OPERAND_USE_TYPE Create_Operand_Use(const char *name);
00169 extern void Instruction_Group ( const char *name, ... );
00170 extern void Operand (int operand_index, 
00171                      OPERAND_VALUE_TYPE operand_type,
00172                      OPERAND_USE_TYPE operand_use = 0);
00173 extern void Relocatable (int operand_index);
00174 extern void Result (int result_index, OPERAND_VALUE_TYPE result_type);
00175 extern void ISA_Operands_End(void);
00176 
00177 #ifdef __cplusplus
00178 }
00179 #endif
00180 #endif /* isa_operands_gen_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines