Upcoming revisions of isl require us to include header files explicitly, which have previously been already transitively included. Before we add them, we sort the existing includes. Thanks to Chandler for sort_includes.py. A simple, but very convenient script. llvm-svn: 236930
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
//=== ScopLocation.cpp - Debug location for ScopDetection ----- -*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Helper function for extracting region debug information.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
#include "polly/Support/ScopLocation.h"
|
|
#include "llvm/Analysis/RegionInfo.h"
|
|
#include "llvm/IR/BasicBlock.h"
|
|
#include "llvm/IR/DebugInfo.h"
|
|
#include "llvm/IR/DebugLoc.h"
|
|
|
|
using namespace llvm;
|
|
|
|
namespace polly {
|
|
|
|
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)
|
|
continue;
|
|
|
|
auto *Scope = cast<DIScope>(DL.getScope());
|
|
|
|
if (FileName.empty())
|
|
FileName = Scope->getFilename();
|
|
|
|
unsigned NewLine = DL.getLine();
|
|
|
|
LineBegin = std::min(LineBegin, NewLine);
|
|
LineEnd = std::max(LineEnd, NewLine);
|
|
}
|
|
}
|
|
}
|