mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Fix line mapping information in LLVM JIT profiling with Vtune
The line mapping information for dynamic code is reported incorrectly. It causes VTune to map LLVM generated code to source lines incorrectly. This patch fix this issue. Patch by Denis Pravdin. Differential Revision: http://reviews.llvm.org/D6603 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224229 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1691fa27d7
commit
0bf492d3c1
@ -149,6 +149,18 @@ void IntelJITEventListener::NotifyObjectEmitted(
|
|||||||
FunctionMessage.line_number_size = 0;
|
FunctionMessage.line_number_size = 0;
|
||||||
FunctionMessage.line_number_table = 0;
|
FunctionMessage.line_number_table = 0;
|
||||||
} else {
|
} else {
|
||||||
|
// Source line information for the address range is provided as
|
||||||
|
// a code offset for the start of the corresponding sub-range and
|
||||||
|
// a source line. JIT API treats offsets in LineNumberInfo structures
|
||||||
|
// as the end of the corresponding code region. The start of the code
|
||||||
|
// is taken from the previous element. Need to shift the elements.
|
||||||
|
|
||||||
|
LineNumberInfo last = LineInfo.back();
|
||||||
|
last.Offset = FunctionMessage.method_size;
|
||||||
|
LineInfo.push_back(last);
|
||||||
|
for (size_t i = LineInfo.size() - 2; i > 0; --i)
|
||||||
|
LineInfo[i].LineNumber = LineInfo[i - 1].LineNumber;
|
||||||
|
|
||||||
SourceFileName = Lines.front().second.FileName;
|
SourceFileName = Lines.front().second.FileName;
|
||||||
FunctionMessage.source_file_name = const_cast<char *>(SourceFileName.c_str());
|
FunctionMessage.source_file_name = const_cast<char *>(SourceFileName.c_str());
|
||||||
FunctionMessage.line_number_size = LineInfo.size();
|
FunctionMessage.line_number_size = LineInfo.size();
|
||||||
|
@ -140,7 +140,7 @@ protected:
|
|||||||
TheJIT.reset(EngineBuilder(std::move(TheModule))
|
TheJIT.reset(EngineBuilder(std::move(TheModule))
|
||||||
.setEngineKind(EngineKind::JIT)
|
.setEngineKind(EngineKind::JIT)
|
||||||
.setErrorStr(&Error)
|
.setErrorStr(&Error)
|
||||||
.setMCJITMemoryManager(MemMgr)
|
.setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager>(MemMgr))
|
||||||
.create());
|
.create());
|
||||||
if (Error.empty() == false)
|
if (Error.empty() == false)
|
||||||
errs() << Error;
|
errs() << Error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user