Commit 87a37cc6 authored by pratik ashar's avatar pratik ashar Committed by gbsbuild

Fix missing entries in debug info line

number table

Change-Id: Iece497057272d4808203578c80f6246c03e98408
parent 4259a90b
......@@ -209,7 +209,8 @@ void DebugEmitter::Finalize(void *&pBuffer, unsigned int &size, bool finalize)
// Emit src line mapping directly instead of
// relying on dbgmerge. elf generated will have
// text section and debug_line sections populated.
std::map<unsigned int, const llvm::Instruction*>& VISAIndexToInst = m_pVISAModule->VISAIndexToInst;
auto& VISAIndexToInst = m_pVISAModule->VISAIndexToInst;
auto& VISAIndexToSize = m_pVISAModule->VISAIndexToSize;
std::vector<std::pair<unsigned int, unsigned int>> GenISAToVISAIndex;
unsigned int subEnd = m_pVISAModule->GetCurrentVISAId();
unsigned int prevLastGenOff = lastGenOff;
......@@ -244,7 +245,30 @@ void DebugEmitter::Finalize(void *&pBuffer, unsigned int &size, bool finalize)
pc = item.first;
auto instIt = VISAIndexToInst.find(item.second);
auto instIt = VISAIndexToInst.end();
auto sizeIt = VISAIndexToSize.find(item.second);
if (sizeIt != VISAIndexToSize.end())
{
// Lookup all VISA instructions that may
// map to an llvm::Instruction. This is useful
// when an llvm::Instruction leads to multiple
// VISA instructions, and VISA optimizer
// optimizes some of those away. Src line
// mapping for all VISA instructions is the
// same. So lookup any one that still exists.
auto startIdx = (*sizeIt).second.first;
auto numVISAInsts = (*sizeIt).second.second;
for (unsigned int visaId = startIdx;
visaId != (startIdx + numVISAInsts); visaId++)
{
instIt = VISAIndexToInst.find(visaId);
// Loop till at least one VISA instruction
// is found.
if(instIt != VISAIndexToInst.end())
break;
}
}
if (instIt != VISAIndexToInst.end())
{
auto loc = (*instIt).second->getDebugLoc();
......
......@@ -704,6 +704,7 @@ void VISAModule::Reset()
void VISAModule::buildDirectElfMaps()
{
VISAIndexToInst.clear();
VISAIndexToSize.clear();
for (VISAModule::const_iterator II = begin(), IE = end(); II != IE; ++II)
{
const Instruction *pInst = *II;
......@@ -714,6 +715,10 @@ void VISAModule::buildDirectElfMaps()
unsigned int currOffset = itr->second.m_offset;
VISAIndexToInst.insert(std::make_pair(currOffset, pInst));
unsigned int currSize = itr->second.m_size;
for(auto index = currOffset; index != (currOffset+currSize); index++)
VISAIndexToSize.insert(std::make_pair(index,
std::make_pair(currOffset, currSize)));
}
GenISAToVISAIndex.clear();
......
......@@ -301,7 +301,15 @@ public:
}
bool isDirectElfInput = false;
// Store first VISA index->llvm::Instruction mapping
std::map<unsigned int, const llvm::Instruction*> VISAIndexToInst;
// Store VISA index->[header VISA index, #VISA instructions] corresponding
// to same llvm::Instruction. If llvm inst A generates VISA 3,4,5 then
// this structure will have 3 entries:
// 3 -> [3,3]
// 4 -> [3,3]
// 5 -> [3,3]
std::map<unsigned int, std::pair<unsigned int, unsigned int>> VISAIndexToSize;
std::vector<std::pair<unsigned int, unsigned int>> GenISAToVISAIndex;
std::map<unsigned int, std::vector<unsigned int>> VISAIndexToAllGenISAOff;
std::map<unsigned int, unsigned int> GenISAInstSizeBytes;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment