[llvm-commits] CVS: llvm/lib/Analysis/AliasAnalysis.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Mar 14 22:08:01 PST 2004


Changes in directory llvm/lib/Analysis:

AliasAnalysis.cpp updated: 1.16 -> 1.17

---
Log message:

Deinline some virtual methods, provide better mod/ref answers through the
use of the boolean queries


---
Diffs of the changes:  (+21 -5)

Index: llvm/lib/Analysis/AliasAnalysis.cpp
diff -u llvm/lib/Analysis/AliasAnalysis.cpp:1.16 llvm/lib/Analysis/AliasAnalysis.cpp:1.17
--- llvm/lib/Analysis/AliasAnalysis.cpp:1.16	Fri Jan 30 16:16:42 2004
+++ llvm/lib/Analysis/AliasAnalysis.cpp	Sun Mar 14 22:07:29 2004
@@ -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 @@
   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 @@
 // 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 @@
   // Declare that we implement the AliasAnalysis interface
   RegisterAnalysisGroup<AliasAnalysis, NoAA> Y;
 }  // End of anonymous namespace
-
-} // End llvm namespace





More information about the llvm-commits mailing list