aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/MemoryDependenceAnalysis.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-08-08 21:39:39 +0000
committerOwen Anderson <resistor@mac.com>2007-08-08 21:39:39 +0000
commit8cad423d94fd7e30d84742311c454016f36e3ee3 (patch)
treef4f9158e439003d42a82dec6adb5b974504ee867 /lib/Analysis/MemoryDependenceAnalysis.cpp
parentd2887e4dcd23783f702d2b7804aeeac71dc2a10b (diff)
downloadexternal_llvm-8cad423d94fd7e30d84742311c454016f36e3ee3.zip
external_llvm-8cad423d94fd7e30d84742311c454016f36e3ee3.tar.gz
external_llvm-8cad423d94fd7e30d84742311c454016f36e3ee3.tar.bz2
Change the None and NonLocal markers in memdep to be const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r--lib/Analysis/MemoryDependenceAnalysis.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index d13b97d..43fa647 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -26,8 +26,8 @@ using namespace llvm;
char MemoryDependenceAnalysis::ID = 0;
-Instruction* MemoryDependenceAnalysis::NonLocal = (Instruction*)-3;
-Instruction* MemoryDependenceAnalysis::None = (Instruction*)-4;
+const Instruction* MemoryDependenceAnalysis::NonLocal = (Instruction*)-3;
+const Instruction* MemoryDependenceAnalysis::None = (Instruction*)-4;
// Register this pass...
static RegisterPass<MemoryDependenceAnalysis> X("memdep",
@@ -42,7 +42,7 @@ void MemoryDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
}
// Find the dependency of a CallSite
-Instruction* MemoryDependenceAnalysis::getCallSiteDependency(CallSite C, Instruction* start,
+const Instruction* MemoryDependenceAnalysis::getCallSiteDependency(CallSite C, Instruction* start,
BasicBlock* block) {
AliasAnalysis& AA = getAnalysis<AliasAnalysis>();
@@ -132,9 +132,9 @@ void MemoryDependenceAnalysis::nonLocalHelper(Instruction* query,
if (BB != block) {
visited.insert(BB);
- Instruction* localDep = getDependency(query, 0, BB);
+ const Instruction* localDep = getDependency(query, 0, BB);
if (localDep != NonLocal) {
- resp.insert(std::make_pair(BB, localDep));
+ resp.insert(std::make_pair(BB, const_cast<Instruction*>(localDep)));
stack.pop_back();
continue;
@@ -142,9 +142,9 @@ void MemoryDependenceAnalysis::nonLocalHelper(Instruction* query,
} else if (BB == block && stack.size() > 1) {
visited.insert(BB);
- Instruction* localDep = getDependency(query, 0, BB);
+ const Instruction* localDep = getDependency(query, 0, BB);
if (localDep != query)
- resp.insert(std::make_pair(BB, localDep));
+ resp.insert(std::make_pair(BB, const_cast<Instruction*>(localDep)));
stack.pop_back();
@@ -164,9 +164,9 @@ void MemoryDependenceAnalysis::nonLocalHelper(Instruction* query,
if (inserted)
continue;
else if (!inserted && !predOnStack) {
- resp.insert(std::make_pair(BB, None));
+ resp.insert(std::make_pair(BB, const_cast<Instruction*>(None)));
} else if (!inserted && predOnStack){
- resp.insert(std::make_pair(BB, NonLocal));
+ resp.insert(std::make_pair(BB, const_cast<Instruction*>(NonLocal)));
}
stack.pop_back();
@@ -175,9 +175,9 @@ void MemoryDependenceAnalysis::nonLocalHelper(Instruction* query,
void MemoryDependenceAnalysis::getNonLocalDependency(Instruction* query,
DenseMap<BasicBlock*, Value*>& resp) {
- Instruction* localDep = getDependency(query);
+ const Instruction* localDep = getDependency(query);
if (localDep != NonLocal) {
- resp.insert(std::make_pair(query->getParent(), localDep));
+ resp.insert(std::make_pair(query->getParent(), const_cast<Instruction*>(localDep)));
return;
}
@@ -187,20 +187,20 @@ void MemoryDependenceAnalysis::getNonLocalDependency(Instruction* query,
/// getDependency - Return the instruction on which a memory operation
/// depends. The local paramter indicates if the query should only
/// evaluate dependencies within the same basic block.
-Instruction* MemoryDependenceAnalysis::getDependency(Instruction* query,
+const Instruction* MemoryDependenceAnalysis::getDependency(Instruction* query,
Instruction* start,
BasicBlock* block) {
// Start looking for dependencies with the queried inst
BasicBlock::iterator QI = query;
// Check for a cached result
- std::pair<Instruction*, bool> cachedResult = depGraphLocal[query];
+ std::pair<const Instruction*, bool> cachedResult = depGraphLocal[query];
// If we have a _confirmed_ cached entry, return it
if (cachedResult.second)
return cachedResult.first;
else if (cachedResult.first && cachedResult.first != NonLocal)
// If we have an unconfirmed cached entry, we can start our search from there
- QI = cachedResult.first;
+ QI = const_cast<Instruction*>(cachedResult.first);
if (start)
QI = start;
@@ -342,7 +342,7 @@ Instruction* MemoryDependenceAnalysis::getDependency(Instruction* query,
/// updating the dependence of instructions that previously depended on it.
void MemoryDependenceAnalysis::removeInstruction(Instruction* rem) {
// Figure out the new dep for things that currently depend on rem
- Instruction* newDep = NonLocal;
+ const Instruction* newDep = NonLocal;
depMapType::iterator depGraphEntry = depGraphLocal.find(rem);
// We assume here that it's not in the reverse map if it's not in
@@ -352,7 +352,7 @@ void MemoryDependenceAnalysis::removeInstruction(Instruction* rem) {
if (depGraphEntry->second.first != NonLocal &&
depGraphEntry->second.second) {
// If we have dep info for rem, set them to it
- BasicBlock::iterator RI = depGraphEntry->second.first;
+ BasicBlock::iterator RI = const_cast<Instruction*>(depGraphEntry->second.first);
RI++;
newDep = RI;
} else if (depGraphEntry->second.first == NonLocal &&