aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-15 04:07:29 +0000
committerChris Lattner <sabre@nondot.org>2004-03-15 04:07:29 +0000
commit992860c44ed8d8b82c6b7fde6645123772965c65 (patch)
treeecb95f541ee887e5cf7f68206c2af4bbc7710078 /lib/Analysis
parentb79d79297d7115e89776155c92eeb5e7ba518a01 (diff)
downloadexternal_llvm-992860c44ed8d8b82c6b7fde6645123772965c65.zip
external_llvm-992860c44ed8d8b82c6b7fde6645123772965c65.tar.gz
external_llvm-992860c44ed8d8b82c6b7fde6645123772965c65.tar.bz2
Deinline some virtual methods, provide better mod/ref answers through the
use of the boolean queries git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/AliasAnalysis.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp
index 373524b..a2b852b 100644
--- a/lib/Analysis/AliasAnalysis.cpp
+++ b/lib/Analysis/AliasAnalysis.cpp
@@ -28,8 +28,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/iMemory.h"
#include "llvm/Target/TargetData.h"
-
-namespace llvm {
+using namespace llvm;
// Register the AliasAnalysis interface, providing a nice name to refer to.
namespace {
@@ -55,6 +54,25 @@ AliasAnalysis::getModRefInfo(StoreInst *S, Value *P, unsigned Size) {
return pointsToConstantMemory(P) ? NoModRef : Mod;
}
+AliasAnalysis::ModRefResult
+AliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
+ if (Function *F = CS.getCalledFunction())
+ if (onlyReadsMemory(F)) {
+ if (doesNotAccessMemory(F)) return NoModRef;
+ return Ref;
+ }
+
+ // If P points to a constant memory location, the call definitely could not
+ // modify the memory location.
+ return pointsToConstantMemory(P) ? Ref : ModRef;
+}
+
+AliasAnalysis::ModRefResult
+AliasAnalysis::getModRefInfo(CallSite CS1, CallSite CS2) {
+ // FIXME: could probably do better.
+ return ModRef;
+}
+
// AliasAnalysis destructor: DO NOT move this to the header file for
// AliasAnalysis or else clients of the AliasAnalysis class may not depend on
@@ -110,7 +128,7 @@ bool AliasAnalysis::canInstructionRangeModify(const Instruction &I1,
// the risk of AliasAnalysis being used, but the default implementation not
// being linked into the tool that uses it.
//
-extern void BasicAAStub();
+extern void llvm::BasicAAStub();
static IncludeFile INCLUDE_BASICAA_CPP((void*)&BasicAAStub);
@@ -132,5 +150,3 @@ namespace {
// Declare that we implement the AliasAnalysis interface
RegisterAnalysisGroup<AliasAnalysis, NoAA> Y;
} // End of anonymous namespace
-
-} // End llvm namespace