[PM/AA] Extract the ModRef enums from the AliasAnalysis class in
[oota-llvm.git] / lib / Analysis / LibCallAliasAnalysis.cpp
index 991a0e3e2752c91cd4208b80bea7820f6da4e9fc..c9e2585bd6649013a83e74d6eb0444d925fd3eb8 100644 (file)
@@ -45,15 +45,16 @@ bool LibCallAliasAnalysis::runOnFunction(Function &F) {
 /// AnalyzeLibCallDetails - Given a call to a function with the specified
 /// LibCallFunctionInfo, see if we can improve the mod/ref footprint of the call
 /// vs the specified pointer/size.
-AliasAnalysis::ModRefResult
+ModRefInfo
 LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
                                             ImmutableCallSite CS,
                                             const MemoryLocation &Loc) {
   // If we have a function, check to see what kind of mod/ref effects it
   // has.  Start by including any info globally known about the function.
-  AliasAnalysis::ModRefResult MRInfo = FI->UniversalBehavior;
-  if (MRInfo == NoModRef) return MRInfo;
-  
+  ModRefInfo MRInfo = FI->UniversalBehavior;
+  if (MRInfo == MRI_NoModRef)
+    return MRInfo;
+
   // If that didn't tell us that the function is 'readnone', check to see
   // if we have detailed info and if 'P' is any of the locations we know
   // about.
@@ -75,7 +76,7 @@ LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
       
       // If we find a match against a location that we 'do not' interact with,
       // learn this info into MRInfo.
-      return ModRefResult(MRInfo & ~Details[i].MRInfo);
+      return ModRefInfo(MRInfo & ~Details[i].MRInfo);
     }
     return MRInfo;
   }
@@ -83,7 +84,7 @@ LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
   // If the details are of the 'DoesOnly' sort, we know something if the pointer
   // is a match for one of the locations in 'Details'.  Also, if we can prove
   // that the pointers is *not* one of the locations in 'Details', we know that
-  // the call is NoModRef.
+  // the call is MRI_NoModRef.
   assert(FI->DetailsType == LibCallFunctionInfo::DoesOnly);
   
   // Find out if the pointer refers to a known location.
@@ -103,16 +104,16 @@ LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
     
     // If we know that this pointer definitely is pointing into the location,
     // merge in this information.
-    return ModRefResult(MRInfo & Details[i].MRInfo);
+    return ModRefInfo(MRInfo & Details[i].MRInfo);
   }
   
   // If we found that the pointer is guaranteed to not match any of the
   // locations in our 'DoesOnly' rule, then we know that the pointer must point
   // to some other location.  Since the libcall doesn't mod/ref any other
-  // locations, return NoModRef.
+  // locations, return MRI_NoModRef.
   if (NoneMatch)
-    return NoModRef;
-  
+    return MRI_NoModRef;
+
   // Otherwise, return any other info gained so far.
   return MRInfo;
 }
@@ -120,22 +121,22 @@ LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
 // getModRefInfo - Check to see if the specified callsite can clobber the
 // specified memory object.
 //
-AliasAnalysis::ModRefResult
-LibCallAliasAnalysis::getModRefInfo(ImmutableCallSite CS,
-                                    const MemoryLocation &Loc) {
-  ModRefResult MRInfo = ModRef;
-  
+ModRefInfo LibCallAliasAnalysis::getModRefInfo(ImmutableCallSite CS,
+                                               const MemoryLocation &Loc) {
+  ModRefInfo MRInfo = MRI_ModRef;
+
   // If this is a direct call to a function that LCI knows about, get the
   // information about the runtime function.
   if (LCI) {
     if (const Function *F = CS.getCalledFunction()) {
       if (const LibCallFunctionInfo *FI = LCI->getFunctionInfo(F)) {
-        MRInfo = ModRefResult(MRInfo & AnalyzeLibCallDetails(FI, CS, Loc));
-        if (MRInfo == NoModRef) return NoModRef;
+        MRInfo = ModRefInfo(MRInfo & AnalyzeLibCallDetails(FI, CS, Loc));
+        if (MRInfo == MRI_NoModRef)
+          return MRI_NoModRef;
       }
     }
   }
   
   // The AliasAnalysis base class has some smarts, lets use them.
-  return (ModRefResult)(MRInfo | AliasAnalysis::getModRefInfo(CS, Loc));
+  return (ModRefInfo)(MRInfo | AliasAnalysis::getModRefInfo(CS, Loc));
 }