[llvm-commits] CVS: llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp PrimInfo.cpp PrimInfo.h

Joel Stanley jstanley at cs.uiuc.edu
Fri May 30 10:58:02 PDT 2003


Changes in directory llvm/lib/Reoptimizer/Inst/lib/Phase1:

Phase1.cpp updated: 1.26.2.3 -> 1.26.2.4
PrimInfo.cpp updated: 1.15.2.1 -> 1.15.2.2
PrimInfo.h updated: 1.10.2.1 -> 1.10.2.2

---
Log message:

Just cleaning up.


---
Diffs of the changes:

Index: llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp
diff -u llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp:1.26.2.3 llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp:1.26.2.4
--- llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp:1.26.2.3	Fri May 30 10:25:34 2003
+++ llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp	Fri May 30 10:57:09 2003
@@ -187,12 +187,12 @@
 
     // Populate with builtins
 
-    // The new approach: pp_declareInterval{Start,End} are the only sigfuns used
-    // to declare an interval, instead of the interval being implicit by the
-    // given locations of the calls to (registered) region sigfuns.  For now, we
-    // will still use the old code for processing the contents of 'rpairs', but
-    // the only element of rpairs will be the pair of interval-declaration
-    // sigfuns.  TODO: Clean up this approach.
+    // The new approach: pp_declareInterval{Start,End} are the only sigfuns used to
+    // declare an interval, instead of the interval being implicit by the given locations
+    // of the calls to (registered) region sigfuns.  For now, we will still use the old
+    // code for processing the contents of 'rpairs', but the only element of rpairs will
+    // be the pair of interval-declaration sigfuns.  TODO: Clean up this approach, and do
+    // the same for point-site declarations.
 
     Function* intervalStartDeclFunc = m_module->getNamedFunction("pp_declareIntervalStart");
     Function* intervalEndDeclFunc = m_module->getNamedFunction("pp_declareIntervalEnd");
@@ -229,26 +229,10 @@
     for(unsigned i = 0, e = rpairs.size(); i < e; ++i)
         transformSites(rpairs[i]);
 
-    // Build the interval PrimInfo instance -> GBT index map. This maps the address of a
-    // particular interval PrimInfo instance to the index in the GBT that corresponds to
-    // the record that represents the start-interval global-volatile and related
-    // information.
-
-    std::map<PrimInfo*, unsigned> gbtIdxMap;
-    int idx = 0;
-    for(vector<PrimInfo>::iterator i = m_primInfos.begin(), e = m_primInfos.end(); i != e; ++i){
-        if(i->getType() == PrimInfo::REGION) {
-            gbtIdxMap[&*i] = idx;
-            idx += 2;
-        }
-        else
-            idx++;
-    }
-
     // Build the global bookkeeping table (GBT) contents
     vector<Constant*> gbtElems;
     for(vector<PrimInfo>::iterator i = m_primInfos.begin(), e = m_primInfos.end(); i != e; ++i)
-        i->buildStructInstances(gbtElems, gbtIdxMap, &m_targetData);
+        i->buildStructInstances(gbtElems);
 
     // Make the GBT itself, and the corresponding global variable.
     ArrayType* gbtType = ArrayType::get(PrimInfo::getStructType(), gbtElems.size());


Index: llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.cpp
diff -u llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.cpp:1.15.2.1 llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.cpp:1.15.2.2
--- llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.cpp:1.15.2.1	Fri May 30 10:25:34 2003
+++ llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.cpp	Fri May 30 10:57:10 2003
@@ -2,10 +2,8 @@
 // programmer: Joel Stanley
 //       date: Tue Jan 28 14:07:05 CST 2003
 //     fileid: PrimInfo.cpp
-//    purpose: Captures information about an instance of a performance primitive.  The
-//    information is intended to be carried between phases by reconstructing PrimInfo
-//    contents that have been placed in global static data structures by Phase1's
-//    invocation of PrimInfo::Document.
+//    purpose: Captures information about an instance of a performance primitive "marker"
+//             in the code.
 
 #include "llvm/Module.h"
 #include "llvm/Type.h"
@@ -15,7 +13,6 @@
 #include "llvm/GlobalVariable.h"
 #include "llvm/Constant.h"
 #include "Support/VectorExtras.h"
-#include "llvm/Target/TargetData.h"
 
 #include "PrimInfo.h"
 #include "Intraphase.h"
@@ -29,7 +26,6 @@
 //////////////// PrimInfo implementation ////////////////
 
 StructType* PrimInfo::sm_structType = 0;
-StructType* PrimInfo::sm_infoNodeType = 0;
 
 PrimInfo::PrimInfo(PrimType type,
                    unsigned siteID,
@@ -69,34 +65,6 @@
     assert(!init && "Expect only one invocation of this function");
     init = true;
 
-    // The linked list of containing information about each instrumentation function
-    // registered for a particular site.
-
-    // {{{ struct InstInfoNode 
-    // {
-    //     // Size, in bytes, of the parameter to the instrumentation function.
-    //     unsigned paramSize;
-    // 
-    //     // Pointer to memory for instFunc's return value This is initialized to null for
-    //     // start-interval sites, and filled in at runtime by a pointer to heap-allocated
-    //     // memory of the appropriate size.  For all other site types, the address is
-    //     // specified explicitly when a particular instrumentation is bound to a particular
-    //     // interval.
-    //     void* retVal;
-    // 
-    //     // Pointer to the instrumentation function itself.
-    //     void* instFunc;
-    //
-    //     // The next node in the list
-    //     InstInfoNode* next;
-    // };
-    // }}}
-    
-    // TODO: figger out how to make a recursive struct type
-    PointerType* vpt = PointerType::get(Type::VoidTy);
-    sm_infoNodeType = StructType::get(make_vector<const Type*>(Type::UIntTy, vpt, vpt, 0));
-    module->addTypeName("InstInfoNode", sm_infoNodeType);
-
     // {{{ struct PrimInfo
     // {
     //   // Site ID for this site (one value identifies one entire interval as well)
@@ -108,15 +76,6 @@
     //   // Address of global variable corresponding to this primitive.
     //   unsigned short* loadVar;
     //
-    //   // Index in GBT of struct of corresponding GBT_INTERVAL_START entry
-    //   // (NB: Only valid if gbtType == GBT_INTERVAL_END)
-    //   unsigned gbtStartIdx;
-    //
-    //   // Linked list of info about what inst functions are registered for this site
-    //   // Always initialized to null, and is filled in at runtime.
-    //   InstInfoNode* instInfoList;
-    //
-    // Other stuff will need to go here...(TODO)
     // };
     // }}}
 
@@ -124,8 +83,7 @@
 
     sm_structType =
         StructType::get(make_vector<const Type*>(
-          Type::UIntTy, Type::UIntTy, uspt, Type::UIntTy,
-          PointerType::get(sm_infoNodeType), 0));
+          Type::UIntTy, Type::UIntTy, uspt, 0));
 
     module->addTypeName("PrimInfo", sm_structType);
 }
@@ -133,41 +91,29 @@
 static ConstantStruct* makeConstStruct(StructType* st,
                                        unsigned siteID,
                                        unsigned gbtType,
-                                       GlobalVariable* loadVar,
-                                       StructType* infoNodeType,
-                                       unsigned startLinkIdx = 0)
+                                       GlobalVariable* loadVar)
 {
     std::vector<Constant*> init;
-    init.push_back(ConstantUInt::get(Type::UIntTy, siteID));                // siteID
-    init.push_back(ConstantUInt::get(Type::UIntTy, gbtType));               // gbtType
-    init.push_back(ConstantPointerRef::get(loadVar));                       // loadVar
-    init.push_back(ConstantUInt::get(Type::UIntTy, startLinkIdx));          // gbtStartIdx
-    init.push_back(Constant::getNullValue(PointerType::get(infoNodeType))); // instInfoList
+    init.push_back(ConstantUInt::get(Type::UIntTy, siteID));  // siteID
+    init.push_back(ConstantUInt::get(Type::UIntTy, gbtType)); // gbtType
+    init.push_back(ConstantPointerRef::get(loadVar));         // loadVar
     return ConstantStruct::get(st, init);
 }
 
-void PrimInfo::buildStructInstances(std::vector<Constant*>& gbtElems,
-                                    std::map<PrimInfo*, unsigned>& gbtIdxMap,
-                                    const TargetData* targetData)
+void PrimInfo::buildStructInstances(std::vector<Constant*>& gbtElems)
 {
     StructType* st = getStructType();
 
     switch(m_type) {
         case REGION: {
-            
-            std::map<PrimInfo*, unsigned>::iterator i = gbtIdxMap.find(this);
-            assert(i != gbtIdxMap.end() && "No entry in map for this PrimInfo instance");
-            
+
             // Create the struct for the start of the region
             assert(m_startFunc->asize() == 2 && "Unexpected # args for start func");
-
-            gbtElems.push_back(makeConstStruct(st, m_siteID, GBT_INTERVAL_START,
-                                               m_globVol, sm_infoNodeType));
+            gbtElems.push_back(makeConstStruct(st, m_siteID, GBT_INTERVAL_START, m_globVol));
 
             // Create the struct for the end of the region
             assert(m_endFunc->asize() == 2 && "Unexpected # args for end func");
-            gbtElems.push_back(makeConstStruct(st, m_siteID, GBT_INTERVAL_END,
-                                               m_globVolEnd, sm_infoNodeType, i->second));
+            gbtElems.push_back(makeConstStruct(st, m_siteID, GBT_INTERVAL_END, m_globVolEnd));
 
             break;
         }


Index: llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.h
diff -u llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.h:1.10.2.1 llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.h:1.10.2.2
--- llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.h:1.10.2.1	Fri May 30 10:25:35 2003
+++ llvm/lib/Reoptimizer/Inst/lib/Phase1/PrimInfo.h	Fri May 30 10:57:10 2003
@@ -13,8 +13,6 @@
 
 #include <map>
 
-class TargetData;
-
 namespace pp
 {
 
@@ -58,9 +56,7 @@
     const Function*       getEndFunc() const    { return m_endFunc;    }
     PrimType              getType() const       { return m_type;       }
 
-    void buildStructInstances(std::vector<Constant*>& gbtElems,
-                              std::map<PrimInfo*, unsigned>& gbtIdxMap,
-                              const TargetData* targetData);
+    void buildStructInstances(std::vector<Constant*>& gbtElems);
 
     static void           buildStructTypes(Module* module);
     static StructType*    getStructType() { return sm_structType; }
@@ -79,7 +75,6 @@
     Function*          m_endFunc;
     
     static StructType* sm_structType;
-    static StructType* sm_infoNodeType;
 };
  
 }; // end namespace pp





More information about the llvm-commits mailing list