summaryrefslogtreecommitdiff
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-03-04 12:09:19 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-03-04 12:09:19 +0000
commit5b74a01aad694cf1e885388c075afb952f2ebe86 (patch)
tree335d3c6052105ff44aaae552ccefa6d0420701e8 /include/llvm/Support
parentff956e7568a4d88762cd038497d97498c680e70c (diff)
downloadllvm-5b74a01aad694cf1e885388c075afb952f2ebe86.tar.gz
llvm-5b74a01aad694cf1e885388c075afb952f2ebe86.tar.bz2
llvm-5b74a01aad694cf1e885388c075afb952f2ebe86.tar.xz
[Modules] Move the PredIteratorCache into the IR library -- it is
hardcoded to use IR BasicBlocks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202835 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/PredIteratorCache.h70
1 files changed, 0 insertions, 70 deletions
diff --git a/include/llvm/Support/PredIteratorCache.h b/include/llvm/Support/PredIteratorCache.h
deleted file mode 100644
index 3fa056edb6..0000000000
--- a/include/llvm/Support/PredIteratorCache.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//===- llvm/Support/PredIteratorCache.h - pred_iterator Cache ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the PredIteratorCache class.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/IR/CFG.h"
-#include "llvm/Support/Allocator.h"
-
-#ifndef LLVM_SUPPORT_PREDITERATORCACHE_H
-#define LLVM_SUPPORT_PREDITERATORCACHE_H
-
-namespace llvm {
-
- /// PredIteratorCache - This class is an extremely trivial cache for
- /// predecessor iterator queries. This is useful for code that repeatedly
- /// wants the predecessor list for the same blocks.
- class PredIteratorCache {
- /// BlockToPredsMap - Pointer to null-terminated list.
- DenseMap<BasicBlock*, BasicBlock**> BlockToPredsMap;
- DenseMap<BasicBlock*, unsigned> BlockToPredCountMap;
-
- /// Memory - This is the space that holds cached preds.
- BumpPtrAllocator Memory;
- public:
-
- /// GetPreds - Get a cached list for the null-terminated predecessor list of
- /// the specified block. This can be used in a loop like this:
- /// for (BasicBlock **PI = PredCache->GetPreds(BB); *PI; ++PI)
- /// use(*PI);
- /// instead of:
- /// for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
- BasicBlock **GetPreds(BasicBlock *BB) {
- BasicBlock **&Entry = BlockToPredsMap[BB];
- if (Entry) return Entry;
-
- SmallVector<BasicBlock*, 32> PredCache(pred_begin(BB), pred_end(BB));
- PredCache.push_back(0); // null terminator.
-
- BlockToPredCountMap[BB] = PredCache.size()-1;
-
- Entry = Memory.Allocate<BasicBlock*>(PredCache.size());
- std::copy(PredCache.begin(), PredCache.end(), Entry);
- return Entry;
- }
-
- unsigned GetNumPreds(BasicBlock *BB) {
- GetPreds(BB);
- return BlockToPredCountMap[BB];
- }
-
- /// clear - Remove all information.
- void clear() {
- BlockToPredsMap.clear();
- BlockToPredCountMap.clear();
- Memory.Reset();
- }
- };
-} // end namespace llvm
-
-#endif