[polly] r210752 - Move getDebugLocation to ScopDetectionDiagnostic

Andreas Simbuerger simbuerg at fim.uni-passau.de
Thu Jun 12 00:23:04 PDT 2014


Author: simbuerg
Date: Thu Jun 12 02:23:04 2014
New Revision: 210752

URL: http://llvm.org/viewvc/llvm-project?rev=210752&view=rev
Log:
Move getDebugLocation to ScopDetectionDiagnostic

Modified:
    polly/trunk/include/polly/ScopDetection.h
    polly/trunk/include/polly/ScopDetectionDiagnostic.h
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp

Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=210752&r1=210751&r2=210752&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Thu Jun 12 02:23:04 2014
@@ -258,15 +258,6 @@ class ScopDetection : public FunctionPas
   /// @return True if the function is not an OpenMP subfunction.
   bool isValidFunction(llvm::Function &F);
 
-  /// @brief Get the location of a region from the debug info.
-  ///
-  /// @param R The region to get debug info for.
-  /// @param LineBegin The first line in the region.
-  /// @param LineEnd The last line in the region.
-  /// @param FileName The filename where the region was defined.
-  void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd,
-                        std::string &FileName);
-
   /// @brief Print the locations of all detected scops.
   void printLocations(llvm::Function &F);
 

Modified: polly/trunk/include/polly/ScopDetectionDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetectionDiagnostic.h?rev=210752&r1=210751&r2=210752&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetectionDiagnostic.h (original)
+++ polly/trunk/include/polly/ScopDetectionDiagnostic.h Thu Jun 12 02:23:04 2014
@@ -42,6 +42,16 @@ class Region;
 }
 
 namespace polly {
+
+/// @brief Get the location of a region from the debug info.
+///
+/// @param R The region to get debug info for.
+/// @param LineBegin The first line in the region.
+/// @param LineEnd The last line in the region.
+/// @param FileName The filename where the region was defined.
+void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd,
+                      std::string &FileName);
+
 //===----------------------------------------------------------------------===//
 /// @brief Base class of all reject reasons found during Scop detection.
 ///

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=210752&r1=210751&r2=210752&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Thu Jun 12 02:23:04 2014
@@ -762,29 +762,6 @@ bool ScopDetection::isValidFunction(llvm
   return !InvalidFunctions.count(&F);
 }
 
-void ScopDetection::getDebugLocation(const Region *R, unsigned &LineBegin,
-                                     unsigned &LineEnd, std::string &FileName) {
-  LineBegin = -1;
-  LineEnd = 0;
-
-  for (const BasicBlock *BB : R->blocks())
-    for (const Instruction &Inst : *BB) {
-      DebugLoc DL = Inst.getDebugLoc();
-      if (DL.isUnknown())
-        continue;
-
-      DIScope Scope(DL.getScope(Inst.getContext()));
-
-      if (FileName.empty())
-        FileName = Scope.getFilename();
-
-      unsigned NewLine = DL.getLine();
-
-      LineBegin = std::min(LineBegin, NewLine);
-      LineEnd = std::max(LineEnd, NewLine);
-    }
-}
-
 void ScopDetection::printLocations(llvm::Function &F) {
   for (const Region *R : *this) {
     unsigned LineEntry, LineExit;

Modified: polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp?rev=210752&r1=210751&r2=210752&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp Thu Jun 12 02:23:04 2014
@@ -26,6 +26,9 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 
+#include "llvm/Analysis/RegionInfo.h"
+#include "llvm/IR/DebugInfo.h"
+
 #define DEBUG_TYPE "polly-detect"
 #include "llvm/Support/Debug.h"
 
@@ -55,6 +58,29 @@ template <typename T> std::string operat
   return LHS.concat(Buf).str();
 }
 
+void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd,
+                      std::string &FileName) {
+  LineBegin = -1;
+  LineEnd = 0;
+
+  for (const BasicBlock *BB : R->blocks())
+    for (const Instruction &Inst : *BB) {
+      DebugLoc DL = Inst.getDebugLoc();
+      if (DL.isUnknown())
+        continue;
+
+      DIScope Scope(DL.getScope(Inst.getContext()));
+
+      if (FileName.empty())
+        FileName = Scope.getFilename();
+
+      unsigned NewLine = DL.getLine();
+
+      LineBegin = std::min(LineBegin, NewLine);
+      LineEnd = std::max(LineEnd, NewLine);
+    }
+}
+
 //===----------------------------------------------------------------------===//
 // ReportCFG.
 





More information about the llvm-commits mailing list