Skip to content

Commit 0a08292

Browse files
pratikasharsys_zuul
authored andcommitted
Initial support for stackcall in debug info.
Change-Id: Icfbd9b4d5b55a896dd0862c2ffdc2bb1ed7a72db
1 parent 79a6425 commit 0a08292

16 files changed

+631
-77
lines changed

IGC/Compiler/CISACodeGen/DebugInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ bool DebugInfoPass::runOnModule(llvm::Module& M)
143143
return p1.first < p2.first;
144144
});
145145

146+
for (auto& m : sortedVISAModules)
147+
{
148+
m_pDebugEmitter->AddVISAModFunc(m.second.second, m.second.first);
149+
}
150+
146151
for (auto& m : sortedVISAModules)
147152
{
148153
isOneStepElf |= m.second.second->isDirectElfInput;

IGC/Compiler/DebugInfo/DwarfCompileUnit.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ using namespace ::IGC;
6666

6767
/// CompileUnit - Compile unit constructor.
6868
CompileUnit::CompileUnit(unsigned UID, DIE* D, DICompileUnit* Node,
69-
StreamEmitter* A, VISAModule* M, IGC::DwarfDebug* DW)
70-
: UniqueID(UID), Node(Node), CUDie(D), Asm(A), m_pModule(M), DD(DW),
69+
StreamEmitter* A, IGC::DwarfDebug* DW)
70+
: UniqueID(UID), Node(Node), CUDie(D), Asm(A), DD(DW),
7171
IndexTyDie(0), DebugInfoOffset(0)
7272
{
7373
DIEIntegerOne = new (DIEValueAllocator)DIEInteger(1);
@@ -221,7 +221,7 @@ void CompileUnit::addSInt(DIEBlock* Die, Optional<dwarf::Form> Form, int64_t Int
221221
/// table.
222222
void CompileUnit::addString(DIE* Die, dwarf::Attribute Attribute, StringRef String)
223223
{
224-
if (m_pModule->isDirectElfInput)
224+
if (DD->IsDirectElfInput())
225225
{
226226
// Emit string inlined
227227
auto Str = new (DIEValueAllocator) DIEInlinedString(String);
@@ -1743,7 +1743,7 @@ DIE* CompileUnit::constructVariableDIE(DbgVariable& DV, bool isScopeAbstract)
17431743
unsigned Offset = DV.getDotDebugLocOffset();
17441744
if (Offset != ~0U)
17451745
{
1746-
if (m_pModule->isDirectElfInput)
1746+
if (DD->IsDirectElfInput())
17471747
{
17481748
// Copy over references ranges to DotLocDebugEntries
17491749
Offset = DD->CopyDebugLoc(Offset);
@@ -1778,7 +1778,9 @@ DIE* CompileUnit::constructVariableDIE(DbgVariable& DV, bool isScopeAbstract)
17781778

17791779
void CompileUnit::buildLocation(const llvm::Instruction* pDbgInst, DbgVariable& DV, IGC::DIE* VariableDie)
17801780
{
1781-
VISAVariableLocation Loc = m_pModule->GetVariableLocation(pDbgInst);
1781+
auto F = pDbgInst->getParent()->getParent();
1782+
auto VISAModule = DD->GetVISAModule(F);
1783+
VISAVariableLocation Loc = VISAModule->GetVariableLocation(pDbgInst);
17821784

17831785
// Variable can be immdeiate or in a location (but not both)
17841786
if (Loc.IsImmediate())
@@ -1795,15 +1797,15 @@ void CompileUnit::buildLocation(const llvm::Instruction* pDbgInst, DbgVariable&
17951797
else
17961798
{
17971799
VISAModule::DataVector rawData;
1798-
m_pModule->GetConstantData(pConstVal, rawData);
1800+
VISAModule->GetConstantData(pConstVal, rawData);
17991801
addConstantData(VariableDie, rawData.data(), rawData.size());
18001802
}
18011803
DV.setDIE(VariableDie);
18021804
return;
18031805
}
18041806

18051807
bool addDecoration = false;
1806-
if (m_pModule->isDirectElfInput)
1808+
if (VISAModule->isDirectElfInput)
18071809
{
18081810
if (Loc.HasSurface())
18091811
{
@@ -1894,7 +1896,7 @@ void CompileUnit::buildLocation(const llvm::Instruction* pDbgInst, DbgVariable&
18941896
{
18951897
// Add description stating whether variable was vectorized in VISA
18961898
addString(VariableDie, dwarf::DW_AT_description, "vectorized");
1897-
uint16_t simdSize = m_pModule->GetSIMDSize();
1899+
uint16_t simdSize = VISAModule->GetSIMDSize();
18981900
addString(VariableDie, dwarf::DW_AT_description,
18991901
simdSize == 8 ? "simd8" : simdSize == 16 ? "simd16" : "???");
19001902
}
@@ -1971,6 +1973,7 @@ void CompileUnit::buildSampler(DbgVariable& var, DIE* die, VISAVariableLocation*
19711973

19721974
void CompileUnit::buildSLM(DbgVariable& var, DIE* die, VISAVariableLocation* loc)
19731975
{
1976+
auto VISAMod = const_cast<VISAModule*>(loc->GetVISAModule());
19741977
if (loc->IsRegister())
19751978
{
19761979
DIEBlock* Block = new (DIEValueAllocator)DIEBlock();
@@ -1979,7 +1982,7 @@ void CompileUnit::buildSLM(DbgVariable& var, DIE* die, VISAVariableLocation* loc
19791982
{
19801983
DbgDecoder::VarInfo varInfo;
19811984
auto regNum = loc->GetRegister();
1982-
m_pModule->getVarInfo("V", regNum, varInfo);
1985+
VISAMod->getVarInfo("V", regNum, varInfo);
19831986

19841987
Address addr;
19851988
addr.Set(Address::Space::eLocal, 0, 0);
@@ -2048,7 +2051,8 @@ void CompileUnit::buildGeneral(DbgVariable& var, DIE* die, VISAVariableLocation*
20482051
{
20492052
DbgDecoder::VarInfo varInfo;
20502053
auto regNum = loc->GetRegister();
2051-
m_pModule->getVarInfo("V", regNum, varInfo);
2054+
auto VISAMod = const_cast<VISAModule*>(loc->GetVISAModule());
2055+
VISAMod->getVarInfo("V", regNum, varInfo);
20522056

20532057
if (varInfo.isGRF())
20542058
{
@@ -2063,7 +2067,7 @@ void CompileUnit::buildGeneral(DbgVariable& var, DIE* die, VISAVariableLocation*
20632067
{
20642068
unsigned int subReg = varInfo.getGRF().subRegNum;
20652069
auto offsetInBits = subReg * 8;
2066-
auto sizeInBits = (m_pModule->m_pShader->getGRFSize() * 8) - offsetInBits;
2070+
auto sizeInBits = (VISAMod->m_pShader->getGRFSize() * 8) - offsetInBits;
20672071

20682072
addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_bit_piece);
20692073
addUInt(Block, dwarf::DW_FORM_udata, sizeInBits);
@@ -2085,7 +2089,7 @@ void CompileUnit::buildGeneral(DbgVariable& var, DIE* die, VISAVariableLocation*
20852089
}
20862090
else
20872091
{
2088-
uint16_t grfSize = (uint16_t)m_pModule->m_pShader->getGRFSize();
2092+
uint16_t grfSize = (uint16_t)VISAMod->m_pShader->getGRFSize();
20892093
uint16_t varSizeInBits = loc->IsInMemory() ? (uint16_t)Asm->GetPointerSize() * 8 : (uint16_t)var.getBasicSize(DD);
20902094
uint16_t varSizeInReg = (uint16_t)(loc->IsInMemory() && varSizeInBits < 32) ? 32 : varSizeInBits;
20912095
uint16_t numOfRegs = ((varSizeInReg * (uint16_t)DD->simdWidth) > (grfSize * 8)) ?
@@ -2123,7 +2127,7 @@ void CompileUnit::buildGeneral(DbgVariable& var, DIE* die, VISAVariableLocation*
21232127
}
21242128
else
21252129
{
2126-
uint16_t grfSize = (uint16_t)m_pModule->m_pShader->getGRFSize();
2130+
uint16_t grfSize = (uint16_t)VISAMod->m_pShader->getGRFSize();
21272131
uint16_t varSizeInBits = loc->IsInMemory() ? (uint16_t)Asm->GetPointerSize() * 8 : (uint16_t)var.getBasicSize(DD);
21282132
uint16_t varSizeInReg = (uint16_t)(loc->IsInMemory() && varSizeInBits < 32) ? 32 : varSizeInBits;
21292133
uint16_t numOfRegs = ((varSizeInReg * (uint16_t)DD->simdWidth) > (grfSize * 8)) ?

IGC/Compiler/DebugInfo/DwarfCompileUnit.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ namespace IGC
8080

8181
/// Asm - Target of Dwarf emission.
8282
StreamEmitter* Asm;
83-
/// m_pModule - VISA processed module
84-
VISAModule* m_pModule;
8583

8684
// Holders for some common dwarf information.
8785
IGC::DwarfDebug* DD;
@@ -116,7 +114,7 @@ namespace IGC
116114

117115
public:
118116
CompileUnit(unsigned UID, DIE* D, llvm::DICompileUnit* CU,
119-
StreamEmitter* A, VISAModule* M, IGC::DwarfDebug* DW);
117+
StreamEmitter* A, IGC::DwarfDebug* DW);
120118
~CompileUnit();
121119

122120
// Accessors.

0 commit comments

Comments
 (0)