mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed reusing of inlined debug locations
This commit is contained in:
parent
f96b1a5d7a
commit
706153348a
3 changed files with 36 additions and 0 deletions
|
@ -2270,6 +2270,11 @@ void BeIRCodeGen::HandleNextCmd()
|
||||||
mSavedDebugLocs.pop_back();
|
mSavedDebugLocs.pop_back();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BfIRCmd_DupDebugLocation:
|
||||||
|
{
|
||||||
|
mBeModule->DupCurrentDebugLocation();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BfIRCmd_ClearDebugLocation:
|
case BfIRCmd_ClearDebugLocation:
|
||||||
{
|
{
|
||||||
mBeModule->SetCurrentDebugLocation(NULL);
|
mBeModule->SetCurrentDebugLocation(NULL);
|
||||||
|
|
|
@ -2609,6 +2609,9 @@ void BeModule::DoInlining(BeFunction* func)
|
||||||
if (funcInlined.find(inlineFunc) != funcInlined.end())
|
if (funcInlined.find(inlineFunc) != funcInlined.end())
|
||||||
continue; // Don't recursively inline
|
continue; // Don't recursively inline
|
||||||
|
|
||||||
|
// Incase we have multiple inlines from the same location, those need to have unique dbgLocs
|
||||||
|
callInst->mDbgLoc = DupDebugLocation(callInst->mDbgLoc);
|
||||||
|
|
||||||
hadInlining = true;
|
hadInlining = true;
|
||||||
|
|
||||||
BeInliner inliner;
|
BeInliner inliner;
|
||||||
|
@ -3096,6 +3099,32 @@ void BeModule::SetCurrentDebugLocation(int line, int column, BeMDNode* dbgScope,
|
||||||
mLastDbgLoc = mCurDbgLoc;
|
mLastDbgLoc = mCurDbgLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BeDbgLoc* BeModule::DupDebugLocation(BeDbgLoc* dbgLoc)
|
||||||
|
{
|
||||||
|
if (dbgLoc == NULL)
|
||||||
|
return dbgLoc;
|
||||||
|
|
||||||
|
auto newDbgLoc = mAlloc.Alloc<BeDbgLoc>();
|
||||||
|
newDbgLoc->mLine = dbgLoc->mLine;
|
||||||
|
newDbgLoc->mColumn = dbgLoc->mColumn;
|
||||||
|
newDbgLoc->mDbgScope = dbgLoc->mDbgScope;
|
||||||
|
newDbgLoc->mDbgInlinedAt = dbgLoc->mDbgInlinedAt;
|
||||||
|
newDbgLoc->mIdx = mCurDbgLocIdx++;
|
||||||
|
|
||||||
|
if ((newDbgLoc->mDbgInlinedAt != NULL) && (!newDbgLoc->mDbgInlinedAt->mHadInline))
|
||||||
|
{
|
||||||
|
newDbgLoc->mDbgInlinedAt->mHadInline = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newDbgLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BeModule::DupCurrentDebugLocation()
|
||||||
|
{
|
||||||
|
mCurDbgLoc = DupDebugLocation(mCurDbgLoc);
|
||||||
|
mLastDbgLoc = mCurDbgLoc;
|
||||||
|
}
|
||||||
|
|
||||||
BeNopInst* BeModule::CreateNop()
|
BeNopInst* BeModule::CreateNop()
|
||||||
{
|
{
|
||||||
auto inst = mAlloc.Alloc<BeNopInst>();
|
auto inst = mAlloc.Alloc<BeNopInst>();
|
||||||
|
|
|
@ -2104,6 +2104,8 @@ public:
|
||||||
BeDbgLoc* GetCurrentDebugLocation();
|
BeDbgLoc* GetCurrentDebugLocation();
|
||||||
void SetCurrentDebugLocation(BeDbgLoc* dbgLoc);
|
void SetCurrentDebugLocation(BeDbgLoc* dbgLoc);
|
||||||
void SetCurrentDebugLocation(int line, int column, BeMDNode* diScope, BeDbgLoc* diInlinedAt);
|
void SetCurrentDebugLocation(int line, int column, BeMDNode* diScope, BeDbgLoc* diInlinedAt);
|
||||||
|
BeDbgLoc* DupDebugLocation(BeDbgLoc* dbgLoc);
|
||||||
|
void DupCurrentDebugLocation();
|
||||||
|
|
||||||
///
|
///
|
||||||
BeNopInst* CreateNop();
|
BeNopInst* CreateNop();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue