summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-01 05:32:05 +0000
committerChris Lattner <sabre@nondot.org>2007-02-01 05:32:05 +0000
commit94c002a190cd2e3a52b1510bc997e53d63af0b3b (patch)
treef7966be2a37b2bfdaf9d7198138f00b46e7f1a3f /include
parente3f71b4198cebee9c9f2534c39bd3e19740eee6a (diff)
downloadllvm-94c002a190cd2e3a52b1510bc997e53d63af0b3b.tar.gz
llvm-94c002a190cd2e3a52b1510bc997e53d63af0b3b.tar.bz2
llvm-94c002a190cd2e3a52b1510bc997e53d63af0b3b.tar.xz
rename DenseMap to IndexedMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33749 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/DenseMap.h75
-rw-r--r--include/llvm/ADT/IndexedMap.h6
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h4
-rw-r--r--include/llvm/CodeGen/SSARegMap.h4
-rw-r--r--include/llvm/CodeGen/ScheduleDAG.h5
-rw-r--r--include/llvm/Target/MRegisterInfo.h2
6 files changed, 10 insertions, 86 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
deleted file mode 100644
index 740ecd38c3..0000000000
--- a/include/llvm/ADT/DenseMap.h
+++ /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
diff --git a/include/llvm/ADT/IndexedMap.h b/include/llvm/ADT/IndexedMap.h
index 7e0fbbb07e..bc38fddc61 100644
--- a/include/llvm/ADT/IndexedMap.h
+++ b/include/llvm/ADT/IndexedMap.h
@@ -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!");
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index e0f60452e3..70c189df78 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -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_;
diff --git a/include/llvm/CodeGen/SSARegMap.h b/include/llvm/CodeGen/SSARegMap.h
index 43eee10c5c..97d8d6988c 100644
--- a/include/llvm/CodeGen/SSARegMap.h
+++ b/include/llvm/CodeGen/SSARegMap.h
@@ -18,14 +18,14 @@
#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:
diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h
index 55b0d9f04a..86e08fe9d9 100644
--- a/include/llvm/CodeGen/ScheduleDAG.h
+++ b/include/llvm/CodeGen/ScheduleDAG.h
@@ -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)
diff --git a/include/llvm/Target/MRegisterInfo.h b/include/llvm/Target/MRegisterInfo.h
index aac932e0a2..46a2cc34f1 100644
--- a/include/llvm/Target/MRegisterInfo.h
+++ b/include/llvm/Target/MRegisterInfo.h
@@ -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;