OpenADFortTk (basic)
src/lib/support/Open64IRInterface/IntrinsicInfo.h
Go to the documentation of this file.
00001 // -*-Mode: C++;-*-
00002 #ifndef IntrinsicInfo_H 
00003 #define IntrinsicInfo_H
00004 
00005 #include <map>
00006 #include "Open64BasicTypes.h"
00007 
00008 class IntrinsicInfo {
00009 
00010 public:
00011   
00015   static bool isIntrinsic(const WN* aWN_p); 
00016 
00020   static const char* intrinsicBaseName(INTRINSIC opcode);
00021 
00025   struct Key {
00026     Key(const OPERATOR& opr, const char* name): myWNopr(opr), myName(name) {};
00027     OPERATOR myWNopr;   // the WN operator
00028     const char* myName; // string qualifier for calls
00029   };
00030 
00034   struct KeyLT {
00035     bool operator()(const Key& k1, const Key& k2) const; 
00036   };
00037 
00038 
00042   enum IntrinsicType_E{ 
00043     FLOAT_INTR,             // defined for float (incl. complex), may also be defined for integers
00044     INTEGER_INTR,           // defined only for integers  
00045     STRING_INTR,            // defined only for strings
00046     BOOL_INTR,              // defined only for booleans
00047     IO_INTR,                // I/O operations
00048     ARRAY_INTR,             // array operations
00049     COMPILER_INTERNAL_INTR, // compiler internal methods
00050     UNDEFINED_INTR_TYPE     // value for default initializer
00051   }; 
00052 
00053 
00057   struct Info {
00058     Info(): myVarOps(false), myNumOp(0), myType(UNDEFINED_INTR_TYPE) {};
00059     Info(bool varOps, unsigned int aNumOp,IntrinsicType_E aType): myVarOps(varOps), myNumOp(aNumOp), myType(aType){};
00060     bool myVarOps; // do we have variable number of arguments?
00061     unsigned int myNumOp; // number of operands to intrinsic
00062     IntrinsicType_E myType; // the type of the intrinsic
00063   };
00064 
00068   static const Info&  getIntrinsicInfo(WN* aWN_p); 
00069 
00070   typedef std::map<Key,Info,KeyLT> IntrinsicMap;
00071 
00072   static const IntrinsicMap& getMap();
00073 
00074 private:
00075   
00079   IntrinsicInfo();
00080   
00084   ~IntrinsicInfo();
00085 
00086   static IntrinsicMap ourIntrinsicInfoMap;
00087   static bool ourInitFlag;
00088 
00094   static bool lookupIntrinsicPrefix(const char* str);
00095 
00099   static bool lookupIntrinsicInfo(const WN* aWN_p, const Info* anInfo); 
00100   
00101 }; 
00102 
00103 #endif
00104 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines