mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 21:00:29 +00:00
rename DenseMap to IndexedMap.
llvm-svn: 33749
This commit is contained in:
parent
e61728144b
commit
a24a3aaa94
@ -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
|
@ -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!");
|
||||
|
@ -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_;
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user