Use deterministic iterator for SchedGraphs. This is actually not
authorVikram S. Adve <vadve@cs.uiuc.edu>
Sun, 24 Mar 2002 03:53:03 +0000 (03:53 +0000)
committerVikram S. Adve <vadve@cs.uiuc.edu>
Sun, 24 Mar 2002 03:53:03 +0000 (03:53 +0000)
useful right now when we only do local scheduling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1975 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/InstrSched/SchedGraph.h
lib/Target/SparcV9/InstrSched/SchedGraph.h

index 99e20576b8f14b279f1b52b14c24327af4ee36e1..8a8a523f004ea37e8d1458e19a4830289fd5080d 100644 (file)
@@ -336,49 +336,35 @@ private:
 
 class SchedGraphSet :  
   public NonCopyable,
-  private std::hash_map<const BasicBlock*, SchedGraph*>
+  private std::vector<SchedGraph*>
 {
 private:
   const Function* method;
   
 public:
-  typedef std::hash_map<const BasicBlock*, SchedGraph*> map_base;
-  using map_base::iterator;
-  using map_base::const_iterator;
+  typedef std::vector<SchedGraph*> baseVector;
+  using baseVector::iterator;
+  using baseVector::const_iterator;
   
 public:
   /*ctor*/     SchedGraphSet           (const Function * function,
                                         const TargetMachine& target);
   /*dtor*/     ~SchedGraphSet          ();
   
-  //
-  // Accessors
-  //
-  SchedGraph*  getGraphForBasicBlock   (const BasicBlock* bb) const {
-    const_iterator onePair = this->find(bb);
-    return (onePair != this->end())? (*onePair).second : NULL;
-  }
-  
-  //
   // Iterators
-  //
-  using map_base::begin;
-  using map_base::end;
+  using baseVector::begin;
+  using baseVector::end;
   
-  //
   // Debugging support
-  // 
   void         dump    () const;
   
 private:
-  inline void  noteGraphForBlock(const BasicBlock* bb, SchedGraph* graph) {
-    assert((*this)[bb] == NULL);
-    (*this)[bb] = graph;
+  inline void  addGraph(SchedGraph* graph) {
+    assert(graph != NULL);
+    this->push_back(graph);
   }
-
-  //
+  
   // Graph builder
-  //
   void         buildGraphsForMethod    (const Function *F,
                                         const TargetMachine& target);
 };
index 99e20576b8f14b279f1b52b14c24327af4ee36e1..8a8a523f004ea37e8d1458e19a4830289fd5080d 100644 (file)
@@ -336,49 +336,35 @@ private:
 
 class SchedGraphSet :  
   public NonCopyable,
-  private std::hash_map<const BasicBlock*, SchedGraph*>
+  private std::vector<SchedGraph*>
 {
 private:
   const Function* method;
   
 public:
-  typedef std::hash_map<const BasicBlock*, SchedGraph*> map_base;
-  using map_base::iterator;
-  using map_base::const_iterator;
+  typedef std::vector<SchedGraph*> baseVector;
+  using baseVector::iterator;
+  using baseVector::const_iterator;
   
 public:
   /*ctor*/     SchedGraphSet           (const Function * function,
                                         const TargetMachine& target);
   /*dtor*/     ~SchedGraphSet          ();
   
-  //
-  // Accessors
-  //
-  SchedGraph*  getGraphForBasicBlock   (const BasicBlock* bb) const {
-    const_iterator onePair = this->find(bb);
-    return (onePair != this->end())? (*onePair).second : NULL;
-  }
-  
-  //
   // Iterators
-  //
-  using map_base::begin;
-  using map_base::end;
+  using baseVector::begin;
+  using baseVector::end;
   
-  //
   // Debugging support
-  // 
   void         dump    () const;
   
 private:
-  inline void  noteGraphForBlock(const BasicBlock* bb, SchedGraph* graph) {
-    assert((*this)[bb] == NULL);
-    (*this)[bb] = graph;
+  inline void  addGraph(SchedGraph* graph) {
+    assert(graph != NULL);
+    this->push_back(graph);
   }
-
-  //
+  
   // Graph builder
-  //
   void         buildGraphsForMethod    (const Function *F,
                                         const TargetMachine& target);
 };