rename DenseMap to IndexedMap.
authorChris Lattner <sabre@nondot.org>
Thu, 1 Feb 2007 05:32:05 +0000 (05:32 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 1 Feb 2007 05:32:05 +0000 (05:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33749 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/DenseMap.h [deleted file]
include/llvm/ADT/IndexedMap.h
include/llvm/CodeGen/LiveIntervalAnalysis.h
include/llvm/CodeGen/SSARegMap.h
include/llvm/CodeGen/ScheduleDAG.h
include/llvm/Target/MRegisterInfo.h
lib/CodeGen/PHIElimination.cpp
lib/CodeGen/RegAllocLocal.cpp
lib/CodeGen/VirtRegMap.h

diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
deleted file mode 100644 (file)
index 740ecd3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-//===- llvm/ADT/DenseMap.h - A dense map implmentation ----------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements a dense map. A dense map template takes two
-// types. The first is the mapped type and the second is a functor
-// that maps its argument to a size_t. On instantiation a "null" value
-// can be provided to be used as a "does not exist" indicator in the
-// map. A member function grow() is provided that given the value of
-// the maximally indexed key (the argument of the functor) makes sure
-// the map has enough space for it.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_DENSEMAP_H
-#define LLVM_ADT_DENSEMAP_H
-
-#include <functional>
-#include <vector>
-#include <cassert>
-
-namespace llvm {
-
-  struct IdentityFunctor : std::unary_function<unsigned, unsigned> {
-    unsigned operator()(unsigned Index) const {
-      return Index;
-    }
-  };
-
-  template <typename T, typename ToIndexT = IdentityFunctor>
-  class DenseMap {
-    typedef typename ToIndexT::argument_type IndexT;
-    typedef std::vector<T> StorageT;
-    StorageT storage_;
-    T nullVal_;
-    ToIndexT toIndex_;
-
-  public:
-    DenseMap() : nullVal_(T()) { }
-
-    explicit DenseMap(const T& val) : nullVal_(val) { }
-
-    typename StorageT::reference operator[](IndexT n) {
-      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
-      return storage_[toIndex_(n)];
-    }
-
-    typename StorageT::const_reference operator[](IndexT n) const {
-      assert(toIndex_(n) < storage_.size() && "index out of bounds!");
-      return storage_[toIndex_(n)];
-    }
-
-    void clear() {
-      storage_.clear();
-    }
-
-    void grow(IndexT n) {
-      unsigned NewSize = toIndex_(n) + 1;
-      if (NewSize > storage_.size())
-        storage_.resize(NewSize, nullVal_);
-    }
-
-    typename StorageT::size_type size() const {
-      return storage_.size();
-    }
-  };
-
-} // End llvm namespace
-
-#endif
index 7e0fbbb07ebf005dbeb2be00a5de3eb3206cf492..bc38fddc61941ff7fbf19e2b54753edf09d58ee9 100644 (file)
@@ -33,7 +33,7 @@ namespace llvm {
   };
 
   template <typename T, typename ToIndexT = IdentityFunctor>
-  class IndexMap {
+  class IndexedMap {
     typedef typename ToIndexT::argument_type IndexT;
     typedef std::vector<T> StorageT;
     StorageT storage_;
@@ -41,9 +41,9 @@ namespace llvm {
     ToIndexT toIndex_;
 
   public:
-    IndexMap() : nullVal_(T()) { }
+    IndexedMap() : nullVal_(T()) { }
 
-    explicit IndexMap(const T& val) : nullVal_(val) { }
+    explicit IndexedMap(const T& val) : nullVal_(val) { }
 
     typename StorageT::reference operator[](IndexT n) {
       assert(toIndex_(n) < storage_.size() && "index out of bounds!");
index e0f60452e39a28f88ae745e8a3768ce7823cc9d2..70c189df7806800a6655feb5c9797170194a1642 100644 (file)
@@ -20,9 +20,9 @@
 #ifndef LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H
 #define LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H
 
-#include "llvm/ADT/DenseMap.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/LiveInterval.h"
+#include "llvm/ADT/IndexedMap.h"
 
 namespace llvm {
 
@@ -51,7 +51,7 @@ namespace llvm {
     typedef std::map<unsigned, LiveInterval> Reg2IntervalMap;
     Reg2IntervalMap r2iMap_;
 
-    typedef DenseMap<unsigned> Reg2RegMap;
+    typedef IndexedMap<unsigned> Reg2RegMap;
     Reg2RegMap r2rMap_;
 
     std::vector<bool> allocatableRegs_;
index 43eee10c5c5b42590fe6c3e009bd06f5eeb05db7..97d8d6988c4ff5dc0c9e53eb93c2b1003cd49740 100644 (file)
 #define LLVM_CODEGEN_SSAREGMAP_H
 
 #include "llvm/Target/MRegisterInfo.h"
-#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/IndexedMap.h"
 
 namespace llvm {
 
 class TargetRegisterClass;
 
 class SSARegMap {
-  DenseMap<const TargetRegisterClass*, VirtReg2IndexFunctor> RegClassMap;
+  IndexedMap<const TargetRegisterClass*, VirtReg2IndexFunctor> RegClassMap;
   unsigned NextRegNum;
 
  public:
index 55b0d9f04a2be21b82fd7ea46b6c89b492f0075d..86e08fe9d9e260526ddb24a217c30c9b969aac7e 100644 (file)
@@ -16,8 +16,7 @@
 #define LLVM_CODEGEN_SCHEDULEDAG_H
 
 #include "llvm/CodeGen/SelectionDAG.h"
-
-#include <set>
+#include "llvm/ADT/SmallSet.h"
 
 namespace llvm {
   struct InstrStage;
@@ -183,7 +182,7 @@ namespace llvm {
                                           // represent noop instructions.
     std::map<SDNode*, SUnit*> SUnitMap;   // SDNode to SUnit mapping (n -> 1).
     std::vector<SUnit> SUnits;            // The scheduling units.
-    std::set<SDNode*> CommuteSet;         // Nodes the should be commuted.
+    SmallSet<SDNode*, 16> CommuteSet;     // Nodes the should be commuted.
 
     ScheduleDAG(SelectionDAG &dag, MachineBasicBlock *bb,
                 const TargetMachine &tm)
index aac932e0a20056b3dd8c88256470d827cd13189d..46a2cc34f1747d26d00fdb38e06d3478706f5428 100644 (file)
@@ -465,7 +465,7 @@ public:
   virtual void getInitialFrameState(std::vector<MachineMove> &Moves) const;
 };
 
-// This is useful when building DenseMaps keyed on virtual registers
+// This is useful when building IndexedMaps keyed on virtual registers
 struct VirtReg2IndexFunctor : std::unary_function<unsigned, unsigned> {
   unsigned operator()(unsigned Reg) const {
     return Reg - MRegisterInfo::FirstVirtualRegister;
index a5d17c2e4b075f13cc9cb072db488d6877eed86f..6a9f4282080048edaf0adcacd4ffebd789bac4c0 100644 (file)
@@ -21,7 +21,6 @@
 #include "llvm/CodeGen/SSARegMap.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetMachine.h"
-#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Compiler.h"
index 644e221212ae360a8fefb1e4dd158d7ce34c1393..74d76c14fc4575136fa729f065fabc8b3f5801b7 100644 (file)
@@ -26,7 +26,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Compiler.h"
-#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/IndexedMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include <algorithm>
@@ -55,7 +55,7 @@ namespace {
 
     // Virt2PhysRegMap - This map contains entries for each virtual register
     // that is currently available in a physical register.
-    DenseMap<unsigned, VirtReg2IndexFunctor> Virt2PhysRegMap;
+    IndexedMap<unsigned, VirtReg2IndexFunctor> Virt2PhysRegMap;
 
     unsigned &getVirt2PhysRegMapSlot(unsigned VirtReg) {
       return Virt2PhysRegMap[VirtReg];
index 84cf238035017286adb583a6bbbe48f296f95ef3..5b06c01bfdf7c99ba0c7716b603b48a3ea2853d3 100644 (file)
@@ -18,7 +18,7 @@
 #define LLVM_CODEGEN_VIRTREGMAP_H
 
 #include "llvm/Target/MRegisterInfo.h"
-#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/IndexedMap.h"
 #include "llvm/Support/Streams.h"
 #include <map>
 
@@ -41,12 +41,12 @@ namespace llvm {
     /// it; even spilled virtual registers (the register mapped to a
     /// spilled register is the temporary used to load it from the
     /// stack).
-    DenseMap<unsigned, VirtReg2IndexFunctor> Virt2PhysMap;
+    IndexedMap<unsigned, VirtReg2IndexFunctor> Virt2PhysMap;
     /// Virt2StackSlotMap - This is virtual register to stack slot
     /// mapping. Each spilled virtual register has an entry in it
     /// which corresponds to the stack slot this register is spilled
     /// at.
-    DenseMap<int, VirtReg2IndexFunctor> Virt2StackSlotMap;
+    IndexedMap<int, VirtReg2IndexFunctor> Virt2StackSlotMap;
     /// MI2VirtMap - This is MachineInstr to virtual register
     /// mapping. In the case of memory spill code being folded into
     /// instructions, we need to know which virtual register was