Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

legoOp.H

Go to the documentation of this file.
00001 /*
00002  *   Name:        legoOp.H
00003  *
00004  *   Designer:    Willie Glover
00005  *
00006  *   Created:     3/19/96
00007  *
00008  *   Description: This file contains the LEGO header file which
00009  *                defines the op base class used for the LEGO IR.
00010  *
00011  *   Location:    /ncsu/tinker/LEGO/src/base/legoOp.H
00012  *
00013  *   Methods:     /ncsu/tinker/LEGO/src/base/legoOp.C
00014  */
00015 
00016  /*
00017   *  Notes:
00018   *
00019   *      Style:  The first character of object identifiers is lowercase
00020   *              The first character of member functions is uppercase except
00021   *                 in the case of constructors and destructors
00022   *              Pointer identifiers (other than array and string types)
00023   *                 end in "Ptr".
00024   *
00025   * "op" is the base region class.  All other regions types are derived
00026   *  from "op".
00027   *
00028   * 3/21/96 WTG: Removed type opParmList. Object added as item to op class
00029   * 4/02/96 WTG: Changed format of opEdges. Added function declarations.
00030   * 4/02/96 WTG: Added declarations for member functions to legoOprd.
00031   * 4/02/96 WTG: Changed opid from a char string to an int
00032   * 4/02/96 WTG: Added structure for relatedOps.
00033   * 4/02/96 WTG: Added structure for flags (flag.h).
00034   * 4/02/96 WTG: Added structure for attrs (attr.h).
00035   * 4/03/96 WTG: Changed format of legoOprd so that it does not include
00036   *                any references to src/dest.  This is more generic and
00037   *                uses less storage. Also changed op so that it has objects
00038   *                for both source operand and dest operand.
00039   * 4/03/96 WTG: Added declarations for member functions to op.  Still
00040   *                incomplete,
00041   *
00042   * 4/04/96 SSW, DB: Modified for testing of translation of one Hppa Insn: ADD
00043   *
00044   * 4/05/96 DB: Added opcode field to legoOp to identify the instruction
00045   *
00046   * 4/10/96 WTG: Add additional comments for clarification. Added member
00047   *                function prototypes needed to implement write op.  Modified
00048   *                legoOp enum statement for spectype to insure proper match
00049   *                with rebel input/output.
00050   * 4/26/96 WB:  Added include for legoOprd.H
00051   * 5/13/96 WTG: Implemented inlining of the simple Set and Get- members.
00052   * 8/16/96 WTG: Added attr id field.
00053   * 12/5/96 WAH: Added copy constructor.
00054   * 3/15/97 WAH: Added IsDummy method.
00055   * 5/1/97  WAH: Added utilityPtr field and associated methods.
00056   * 5/15/97 WAH: Added oldOpId and associated methods.
00057   * 6/2/97 WAH:  Changed oldOpId to duplicateOpsPtr, etc.
00058   * 1/6/98 WAH:  Removed struct declarations, redid #includes.
00059   * 1/9/98 WAH:  Fixed SetSchedOpcode to handle NULL.
00060   * 3/4/98 WAH:  Added mdesInfoPtr and ruInfoPtr fields and associated
00061   *              methods.
00062   * 03/03/02 HZ: Add Is??Op  to legoOp class. The reason
00063   *    is that some of the Ops can not be decided by opcode alone, e.g., IsBRUOp
00064   */
00065 
00066 #ifndef LEGOOP_H
00067 #define LEGOOP_H
00068 
00069 #include "legoMap.H"
00070 #include "legoOpcode.H"
00071 #include "legoOprd.H"
00072 #include "opEdges.H"
00073 #include "opList.H"
00074 //#include "bitvector.H"
00075 
00076 class flags;
00077 
00078 //---------------------------------------------------------------------------
00079 
00080 class HppaTxOp;
00081 struct Mdes_Info;
00082 struct _RU_Info;
00083 typedef struct _RU_Info RU_Info;
00084 class bitvector; 
00085 
00086 class legoOp {
00087   friend class HppaTxOp;
00088 
00089   enum specTypes {
00090     SPECULATIVE=0,
00091     NONSPECULATIVE
00092   };
00093 
00094   int opId;
00095   legoOpcode *opCodePtr;
00096   int opCode;
00097 
00098   legoOprd *srcOprdPtr;         // ptr to src operand list
00099   legoOprd *destOprdPtr;        // ptr to dest operand list
00100   legoOprd *predOprdPtr;        // ptr to pred operand list
00101 
00102   char *schedOpcode;            // scheduled opcode
00103 
00104   opList *relatedOpsPtr;        // ptr to list of (op, flowfreq)
00105   opList *duplicateOpsPtr;      // ptr to list of duplicate ops
00106 
00107   int schedTime;                // multiop scheduled time
00108   
00109   //HZ: added to use Emre's WeldSim
00110   int mdestime;                 // Emre: machine slot number
00111   
00112   //HZ:
00113   int est_r_time;  //estimated issue time
00114 
00115   int oplat;                    // Emre: operation latency  
00116 
00117   int specflag;                 // speculative, nonspeculative
00118 
00119   opList *inListPtr;            // ptr to list of (op,flowfreq)
00120   opList *outListPtr;           // ptr to list of (op,flowfreq)
00121 
00122   flags *opFlagPtr;             //ptr to list of region flags
00123 
00124   int blockId;                  // ??? not sure how created
00125   void *parentBlockPtr;         // pointer to containing region
00126                                 // use cast to legoRegion
00127   attrList *opAttrListPtr;      // ptr to attribute list
00128 
00129   void *utilityPtr;             // general use pointer
00130   Mdes_Info *mdesInfoPtr;       // ptr to mdes info
00131   RU_Info *ruInfoPtr;           // ptr to resource info
00132 
00133   legoOp *prevOpPtr;            // ptr to previous op in prog flow
00134   legoOp *nextOpPtr;            // ptr to next op in prog flow
00135 
00136   legoOp *allListPtr;           //pointer to next non-seq op
00137 
00138   bitvector *PredVector;        // used to determine dependence/independece  
00139                                 // based on control-flow prior to if-conv
00140 
00141   void BuildInitialDuplicateList (void);
00142 
00143 public:
00144 /*
00145  *     *** not inlined ***
00146  */
00147   legoOp (unsigned);
00148   legoOp (legoOp &);
00149   legoOp (const legoOp &);
00150   ~legoOp (void);
00151 /*-----------------------------------------------------------
00152  * rebel file reference number
00153  *-----------------------------------------------------------*/
00154 void  SetOpId (int newOpId) { opId = newOpId; }
00155 
00156 /*-----------------------------------------------------------
00157  * opcode -- hash defined in tinker.tab.h
00158  *-----------------------------------------------------------*/
00159 void  SetOpcode (int newOpcode) { opCode = newOpcode; }
00160 
00161 //Sau
00162 void  SetOpcodePtr (legoOpcode *newOpcodePtr) { opCodePtr = newOpcodePtr; }
00163 
00164 /*-----------------------------------------------------------
00165  * update schedOpcode
00166  *-----------------------------------------------------------*/
00167 void  SetSchedOpcode (char* newSchedOp)
00168   {
00169     delete[] schedOpcode;
00170     if (newSchedOp != NULL)
00171       {
00172         schedOpcode = new char[strlen(newSchedOp)+1];
00173         (void) strcpy( schedOpcode, newSchedOp );
00174       } // end if
00175     else schedOpcode = NULL;
00176   }
00177   
00178   
00179 void SetMdesTime(int t) {mdestime=t;} // Emre
00180 
00181 void SetEstTime(int t) {est_r_time = t;} //HZ
00182 int GetEstTime() {return est_r_time;}
00183 
00184 void SetOpLatency(int l) {oplat=l;} // Emre
00185   
00186 
00187 /*-----------------------------------------------------------
00188  * update related op info (insert)
00189  *-----------------------------------------------------------*/
00190 void  SetRelatedOpsPtr (opList *newRelatedOpsPtr)
00191   { relatedOpsPtr = newRelatedOpsPtr; }
00192 
00193 /*-----------------------------------------------------------
00194  * update duplicate op info
00195  *-----------------------------------------------------------*/
00196 void  SetDuplicateOpsPtr (opList *newDuplicateOpsPtr)
00197   { duplicateOpsPtr = newDuplicateOpsPtr; }
00198 
00199 /*-----------------------------------------------------------
00200  * update schedTime
00201  *-----------------------------------------------------------*/
00202 void  SetSchedTime (int newSTime) { schedTime = newSTime; }
00203 
00204 /*-----------------------------------------------------------
00205  * update speculative info
00206  *-----------------------------------------------------------*/
00207 void  SetSpeculative  (int newSpecul) { specflag = newSpecul; }
00208 
00209 /*-----------------------------------------------------------
00210  * update prevOpPtr
00211  *-----------------------------------------------------------*/
00212 void  SetPrevLink (legoOp* fromOpPtr) { prevOpPtr = fromOpPtr; }
00213 
00214 /*-----------------------------------------------------------
00215  * update nextOpPtr
00216  *-----------------------------------------------------------*/
00217 void  SetNextLink (legoOp* toOpPtr) { nextOpPtr = toOpPtr; }
00218 
00219 /*-----------------------------------------------------------
00220  * update nextOpPtr update allListPtr of prev op
00221  *-----------------------------------------------------------*/
00222 void  SetListOpPtr (legoOp* allOpPtr) { allListPtr = allOpPtr; }
00223 
00224 /*-----------------------------------------------------------
00225  * update block_id
00226  *-----------------------------------------------------------*/
00227 void  SetBlockId (int newBlockId) { blockId = newBlockId; }
00228 
00229 /*-----------------------------------------------------------
00230  * update in and out edges ptrs
00231  *-----------------------------------------------------------*/
00232 void SetInListPtr(opList *inPtr) {inListPtr = inPtr;}
00233 void SetOutListPtr(opList *outPtr) {outListPtr = outPtr;}
00234 
00235 /*-------------------------------------------------------------
00236  * update flag pointer
00237  *-------------------------------------------------------------*/
00238 void  SetFlagPtr (flags *newFlagPtr) { opFlagPtr = newFlagPtr; }
00239 
00240 /*-------------------------------------------------------------
00241  * update pointer to attribute dictionary
00242  *-------------------------------------------------------------*/
00243 void  SetOpAttrListPtr (attrList *newAttrListPtr) { opAttrListPtr = newAttrListPtr; }
00244 
00245 /*-------------------------------------------------------------
00246  * set first lego src operand pointer
00247  *-----------------------------------------------------------*/
00248 void  SetSrcOprdPtr (legoOprd *srcPtr) { srcOprdPtr = srcPtr; }
00249 
00250 /*-------------------------------------------------------------
00251  * set first lego dest operand pointer
00252  *-----------------------------------------------------------*/
00253 void  SetDestOprdPtr (legoOprd *destPtr) { destOprdPtr = destPtr; }
00254 
00255 /*-------------------------------------------------------------
00256  * set lego predicate operand pointer
00257  *-------------------------------------------------------------*/
00258 void  SetPredOprdPtr (legoOprd *predPtr) { predOprdPtr = predPtr; }
00259 
00260 /*-------------------------------------------------------------
00261  * set (legoRegion) parent block pointer
00262  *-------------------------------------------------------------*/
00263 void  SetParentBlockPtr (void *regionPtr)
00264          { parentBlockPtr = regionPtr; }
00265 
00266 /*-------------------------------------------------------------
00267  * set utility pointer
00268  *-------------------------------------------------------------*/
00269 void  SetUtilityPtr (void *utilPtr) { utilityPtr = utilPtr; }
00270 
00271 /*-------------------------------------------------------------
00272  * set mdes info pointer
00273  *-------------------------------------------------------------*/
00274 void  SetMdesInfoPtr (Mdes_Info *mdPtr) { mdesInfoPtr = mdPtr; }
00275 
00276 /*-------------------------------------------------------------
00277  * set resource info pointer
00278  *-------------------------------------------------------------*/
00279 void  SetRUInfoPtr (RU_Info *ruPtr) { ruInfoPtr = ruPtr; }
00280 
00281 /*-------------------------------------------------------------
00282  * set PredVector pointer
00283  *-------------------------------------------------------------*/
00284 void SetPredVectorPtr (bitvector *vectorPtr) { PredVector = vectorPtr; }
00285 
00286 
00287 /*-------------------------------------------------------------
00288  * get op sequence number
00289  *-------------------------------------------------------------*/
00290 int       GetOpId (void) { return opId; }
00291 
00292 /*-------------------------------------------------------------
00293  * get opCode (intval ** see tinker.tab.h for map)
00294  *-------------------------------------------------------------*/
00295 int       GetOpcode (void) { return opCode; }
00296 
00297 //HZ: //in order to make the opcode class work for legoMach module,
00298 // we choose to use base opcode in legoMach module (as ops with same base opcode
00299 // and different qualifiers have the same machine resource requirement.
00300 int GetBaseOpcode(void) 
00301 {
00302     if(opCodePtr == NULL)
00303         return opCode;
00304     else
00305         return opCodePtr->GetBaseOpcode();
00306 }
00307 
00308 //Sau
00309 legoOpcode *GetOpcodePtr (void) { return opCodePtr; }
00310 
00311 /*-------------------------------------------------------------
00312  * get first lego src operand pointer
00313  *-------------------------------------------------------------*/
00314 legoOprd *GetSrcOprdPtr (void) { return srcOprdPtr; }
00315 
00316 /*-------------------------------------------------------------
00317  * get first lego dest operand pointer
00318  *-------------------------------------------------------------*/
00319 legoOprd *GetDestOprdPtr (void) { return destOprdPtr; }
00320 
00321 /*-------------------------------------------------------------
00322  * get lego oprd operand pointer
00323  *-------------------------------------------------------------*/
00324 legoOprd *GetPredOprdPtr (void) { return predOprdPtr; }
00325 
00326 /*-------------------------------------------------------------
00327  * get schedOpcode
00328  *-------------------------------------------------------------*/
00329 char *GetSchedOpcode (void) { return schedOpcode; }
00330 
00331 /*-------------------------------------------------------------
00332  * get related op pointer
00333  *-------------------------------------------------------------*/
00334 opList *GetRelatedOpsPtr (void) { return relatedOpsPtr; }
00335 
00336 /*-------------------------------------------------------------
00337  * get duplicate ops pointer
00338  *-------------------------------------------------------------*/
00339 opList *GetDuplicateOpsPtr (void) { return duplicateOpsPtr; }
00340 
00341 /*-------------------------------------------------------------
00342  * get sched_time
00343  *-------------------------------------------------------------*/
00344 int      GetSchedTime (void) { return schedTime; }
00345 
00346 int      GetMdesTime (void) {return mdestime;}    // Emre
00347 
00348 int      GetOpLatency(void) {return oplat;}         // Emre
00349 
00350 
00351 /*-------------------------------------------------------------
00352  * get speculative info
00353  *-------------------------------------------------------------*/
00354 int      GetSpeculative (void) { return specflag; }
00355 
00356 /*-------------------------------------------------------------
00357  * get prevOpPtr
00358  *-------------------------------------------------------------*/
00359 legoOp  *GetPrevLink (void) { return prevOpPtr; }
00360 
00361 /*
00362 /*-------------------------------------------------------------
00363  * get nextOpPtr
00364  *-------------------------------------------------------------*/
00365 legoOp  *GetNextLink (void) { return nextOpPtr; }
00366 
00367 /*-------------------------------------------------------------
00368  * get allListPtr
00369  *-------------------------------------------------------------*/
00370 legoOp  *GetListOpPtr (void) { return allListPtr; }
00371 
00372 /*-------------------------------------------------------------
00373  * get blockId
00374  *-------------------------------------------------------------*/
00375 int      GetBlockId (void) { return blockId; }
00376 
00377 /*-------------------------------------------------------------
00378  * get parent's pointer
00379  *-------------------------------------------------------------*/
00380 void    *GetParentBlockPtr (void) { return parentBlockPtr; }
00381 
00382 /*-------------------------------------------------------------
00383  * get utility pointer
00384  *-------------------------------------------------------------*/
00385 void    *GetUtilityPtr (void) { return utilityPtr; }
00386 
00387 /*-------------------------------------------------------------
00388  * get mdes info pointer
00389  *-------------------------------------------------------------*/
00390 Mdes_Info *GetMdesInfoPtr (void) { return mdesInfoPtr; }
00391 
00392 /*-------------------------------------------------------------
00393  * get ru info pointer
00394  *-------------------------------------------------------------*/
00395 RU_Info *GetRUInfoPtr (void) { return ruInfoPtr; }
00396 
00397 /*-------------------------------------------------------------
00398  * get inital flags pointer
00399  *-------------------------------------------------------------*/
00400 flags  *GetOpFlagPtr (void) { return opFlagPtr; }
00401 
00402 /*-------------------------------------------------------------
00403  * get in and out edges ptrs
00404  *-------------------------------------------------------------*/
00405 opList *GetInListPtr(void) {return inListPtr;}
00406 opList *GetOutListPtr(void) {return outListPtr;}
00407 
00408 /*-------------------------------------------------------------
00409  * get initial attrList pointer
00410  *-------------------------------------------------------------*/
00411 attrList  *GetOpAttrListPtr (void) { return opAttrListPtr; }
00412 
00413 /*-------------------------------------------------------------
00414  * get PredVector pointer
00415  *-------------------------------------------------------------*/
00416 bitvector *GetPredVectorPtr (void) { return PredVector; }
00417 
00418 
00419 /*-------------------------------------------------------------
00420  * other methods
00421  *-------------------------------------------------------------*/
00422 int IsDummy (void);
00423 
00424 //HZ: Is??Op
00425    bool IsCMERGEOp();
00426    bool IsDEFINEOp();
00427    bool IsDUMMYBROp();
00428    bool IsBRLOp();
00429    bool IsBRUOp();
00430    bool IsBRCONDOp();
00431    bool IsDIVOp(); //Divsion related ops (exception potential)
00432    bool IsRETOp();
00433    bool IsLDOp();
00434    bool IsSTOp();
00435    bool IsIntegerOp();
00436    bool IsFloatOp();
00437    bool IsCMPPOp(); //Compare to a predicate
00438    bool IsCompareOp(); //CMPP or CMPR (compare to a register)
00439    bool IsBranchOp(); 
00440    bool IsBranchOpButNotBRL();
00441    bool IsPBROp();
00442    bool IsPBRROp();
00443    bool IsADDOp();
00444    bool IsRealOp();
00445    bool IsAllocOp();
00446    bool IsMOVOp();
00447    bool IsBRLExitOp(); //br.call exit#. 
00448    bool IsBreakOp();
00449 };
00450 #endif

Generated on Mon Jul 21 20:27:36 2003 for TINKER LEGO DOC by doxygen 1.3.2