Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
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 // si_gen.h 00038 // 00039 // Interface to hardware scheduling information generation library. 00040 // This library is used to describe of a processor's various scheduling 00041 // properties, primarily latencies and resources. Once a machine description 00042 // had been written, it can be used to generate a machine readable machine 00043 // description in one of a number of different formats, including one 00044 // readable by the mongoose compiler and one readable by mixie. (Others?) 00045 // 00046 // In order to describe your machine you write a C++ program (could be C, but 00047 // then I couldn't use end of line comments in this header) that does the 00048 // following: 00049 // 00050 // 1. Initialize 00051 // ============= 00052 // 00053 // This is done by including this header file and by calling: 00054 // 00055 // void Machine( char* name, ISA_SUBSET isa, int argc, char** argv ) 00056 // <name> is a name you wish to give to the processor being 00057 // described. <isa> is the ISA for the machine. <argc> and 00058 // <argv> are the command line arguments passed to main. 00059 // After this call, machine description can begin. 00060 // 00061 // 2. Describe the fundamental resources 00062 // ===================================== 00063 // 00064 // Resources are represented by the abstract type RES, which has no 00065 // client visible fields. These are created by the function: 00066 // 00067 // RESOURCE RESOURCE_Create( char* name, int count ) 00068 // Creates a resource with <count> instances available per 00069 // machine cycle. <name> is given to the resource for debugging 00070 // and documentation purposes. 00071 // 00072 // 3. Describe the skew rules, if any 00073 // ================================== 00074 // 00075 // Beast has a "skewed pipe" which allows some instructions to be issued 00076 // one cycle earlier than they execute. If your machine does not have 00077 // such a feature, you can ignore this section. To accomadate this 00078 // feature, we support a concept of multiple issue slots in an instrution 00079 // word. The issue slots are ordered and the rule is that all the 00080 // instructions assigned to earlier issue slots must appear before those 00081 // assigned to later issue slots. For beast, the slots are A-stage and 00082 // E-stage, but we actually order E-stage before A-stage to force the 00083 // E-stage instructions to be grouped with the A-stage instruction from 00084 // the previous instruction. (Earl, this is a very scheduler-centric 00085 // description. Do you want to offer some more simulator friendly 00086 // language?) 00087 // 00088 // An abstract type, ISSUE_SLOT, is used to force instructions to be 00089 // grouped together: 00090 // 00091 // ISSUE_SLOT ISSUE_SLOT_Create( char* name, int skew, int count ) 00092 // Creates an ISSUE_SLOT giving it the given <name> for 00093 // documentation and debugging purposes. ISSUE_SLOTs must be 00094 // created in the order in which the operations assigned to them 00095 // should be emitted. <skew> gives a number of cycles to add to 00096 // the access time of operand, available time of result. <count> 00097 // gives the maximum number of instructions that may occupy this 00098 // issue slot. A count of 0 means that an unlimited number of 00099 // instructions may be issued in the slot. 00100 // 00101 // 4. Describe the instruction groups 00102 // ================================== 00103 // 00104 // An instruction group is a set of opcodes with identical scheduling 00105 // properties. The description of each instruction group begins with a 00106 // call to: 00107 // 00108 // void Instruction_Group( char* name, 00109 // TOP top,...,TOP_UNDEFINED) 00110 // Start a description of a new instruction group that includes 00111 // all the given <topi>, each of which should be the symbolic 00112 // name for an opcode. Notice the TOP_UNDEFINED, which 00113 // terminates the list and must be the last argument of this 00114 // function. This is called the "current instruction group" and 00115 // remains current until the next call to Instruction_Group (or 00116 // the call to Machine_Done). <name> is used only for 00117 // documentation and debugging. 00118 // 00119 // Latencies are described by giving an access time for the operand(s) 00120 // and an available time for the for the result(s) of the members of an 00121 // instruction group. If I1 defines a register which I2 uses, I2 will 00122 // execute at least: 00123 // 00124 // Max(Available_Time(I2) - Access_Time(I1),0) 00125 // 00126 // after I1. (But I2 must occur after I1 in the instruction stream in 00127 // any case.) 00128 // 00129 // Both operand access time and result available times can be defined in 00130 // one of two styles. A single access time can apply to any operand or 00131 // specific operands can be given specific access times (similarly for 00132 // results). This allows instructions with different numbers of operands 00133 // to be described in the same instruction group so long as any operands 00134 // all have the same access time. Here are the access and available time 00135 // functions: 00136 // 00137 // void Any_Operand_Access_Time( int time ) 00138 // All the operands of the instructions in the current 00139 // instruction group are be accessed at the given <time> 00140 // relative to execution. 00141 // 00142 // void Operand_Access_Time( int operand_index, int time ) 00143 // The <operand_index>'th operand of the current instruction 00144 // group access their operands at the given <time> relative to 00145 // execution. This does not imply that all the instructions in 00146 // the current group actually have this many operands, only that 00147 // those with enough operands have this access time. 00148 // 00149 // void Any_Result_Available_Time( int time ) 00150 // Similar to Any_Operand_Access_Time, but specifies time the 00151 // results are available. 00152 // 00153 // void Result_Available_Time( int result_index, int time ) 00154 // Similar to Operand_Access_Time, but specifies time the 00155 // results are available. 00156 // 00157 // void Store_Available_Time( int time ) 00158 // For memory stores, gives the time the stored value is 00159 // available in memory. 00160 // 00161 // void Load_Access_Time( int time ) 00162 // For memory loads, gives the time the loaded value is accessed 00163 // from memory. 00164 // 00165 // void Last_Issue_Cycle( int time ) 00166 // For simulated instructions, the cycle that the last 00167 // instruction of the sequence is issued. Non-simulated 00168 // instructions always have a last-issue-cycle of 0, 00169 // which is the default. 00170 // 00171 // Resource requirements are described by calls to: 00172 // 00173 // void Resource_Requirement( RESOURCE resource, int time ) 00174 // The members of the current instruction group use one instance 00175 // of <resource> at the given <time> relative to execution. 00176 // Write loops and functions to decribe complex resource use 00177 // patterns (you are writing in C++ after all). 00178 // 00179 // For machines with exposed issue slots (or skewed pipes), the following 00180 // exist to control assignment of instructions to issue slots: 00181 // 00182 // void Valid_Issue_Slot( ISSUE_SLOT slot ) 00183 // The members of the current instruction group may be assigned 00184 // to the given <slot>. More than one valid issue slot may be 00185 // specified for an instruction group, or if no valid issue slot 00186 // is specified, the instructions can issue without a skew if 00187 // their resource restrictions are satisfied. In other words, 00188 // don't have to specify a valid issue slot if it really isn't an 00189 // problem for this group of instructions. 00190 // 00191 // Some miscellany exists: 00192 // 00193 // void Write_Write_Interlock() 00194 // The members of the current instruction group incur a stall 00195 // when trying to write to a register which has already been 00196 // written to but not yet defined. (Earl, is this right?) 00197 // 00198 // (More to come for the compiler) 00199 // 00200 // 5. Finalize the machine description 00201 // =================================== 00202 // 00203 // After all the instruction groups have been described, call: 00204 // 00205 // void Machine_Done( char* filename ) 00206 // Writes out the machine description to the given <filename>, 00207 // appending an approprite extension depending on the particular 00208 // format requested in the command line. 00209 // 00211 00212 00213 00214 00215 #ifndef SI_GEN_INCLUDED 00216 #define SI_GEN_INCLUDED 00217 00218 #include "targ_isa_subset.h" 00219 00220 typedef class RES* RESOURCE; 00221 typedef class ISLOT* ISSUE_SLOT; 00222 00223 extern void Machine( char* name, ISA_SUBSET isa, int argc, char** argv ); 00224 extern RESOURCE RESOURCE_Create( char* name, int count ); 00225 extern ISSUE_SLOT ISSUE_SLOT_Create( char* name, int skew, int count ); 00226 extern void Instruction_Group( char* name, ... ); 00227 extern void Any_Operand_Access_Time( int time ); 00228 extern void Operand_Access_Time( int operand_index, int time ); 00229 extern void Any_Result_Available_Time( int time ); 00230 extern void Result_Available_Time( int result_index, int time ); 00231 extern void Store_Available_Time( int time ); 00232 extern void Load_Access_Time( int time ); 00233 extern void Last_Issue_Cycle( int time ); 00234 extern void Resource_Requirement( RESOURCE resource, int time ); 00235 extern void Valid_Issue_Slot( ISSUE_SLOT slot ); 00236 extern void Write_Write_Interlock(); 00237 extern void Machine_Done( char* filename ); 00238 00239 #endif