Skip to content

Commit 34740d0

Browse files
sys-igcigcbot
authored andcommitted
Changes in code.
1 parent 8d8eb6b commit 34740d0

File tree

5 files changed

+5
-148
lines changed

5 files changed

+5
-148
lines changed

IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp

+2-23
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ class SPIRVToLLVMDbgTran {
11211121
return diModule;
11221122
}
11231123

1124-
DINode* createImportedEntity(SPIRVExtInst* inst, SmallVector<TrackingMDNodeRef, 4>& allImportedModules)
1124+
DINode* createImportedEntity(SPIRVExtInst* inst)
11251125
{
11261126
if (auto n = getExistingNode<DINode*>(inst))
11271127
return n;
@@ -1139,18 +1139,6 @@ class SPIRVToLLVMDbgTran {
11391139
{
11401140
auto diModule = createModuleINTEL(BM->get<SPIRVExtInst>(entity));
11411141
diNode = addMDNode(inst, Builder.createImportedModule(scope, diModule, file, line));
1142-
DIImportedEntity* IE = Builder.createImportedModule(scope, diModule, file, line);
1143-
diNode = addMDNode(inst, IE);
1144-
1145-
IGC_ASSERT_MESSAGE(scope, "Invalid Scope encoding!");
1146-
if (isa<DILocalScope>(scope))
1147-
{
1148-
allImportedModules.emplace_back(IE);
1149-
}
1150-
else
1151-
{
1152-
// TODO? ReplaceImportedEntities = true;
1153-
}
11541142
}
11551143

11561144
return diNode;
@@ -1323,21 +1311,12 @@ class SPIRVToLLVMDbgTran {
13231311
if (!Enable)
13241312
return;
13251313

1326-
DICompileUnit* CU = getCompileUnit();
1327-
13281314
auto importedEntities = BM->getImportedEntities();
13291315

1330-
SmallVector<TrackingMDNodeRef, 4> AllImportedModules;
13311316
for (auto& importedEntity : importedEntities)
13321317
{
1333-
(void)createImportedEntity(importedEntity, AllImportedModules);
1318+
(void)createImportedEntity(importedEntity);
13341319
}
1335-
1336-
if (!AllImportedModules.empty())
1337-
CU->replaceImportedEntities(
1338-
MDTuple::get(CU->getContext(), SmallVector<Metadata*, 16>(AllImportedModules.begin(), AllImportedModules.end())));
1339-
else
1340-
CU->replaceImportedEntities(nullptr); // If there were no local scope imported entities, we can map the whole list to nullptr.
13411320
}
13421321

13431322
void transDbgInfo(SPIRVValue *SV, Value *V);

IGC/DebugInfo/DwarfCompileUnit.cpp

+1-67
Original file line numberDiff line numberDiff line change
@@ -446,20 +446,6 @@ void CompileUnit::addSourceLine(DIE* Die, DIScope* S, unsigned Line)
446446
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
447447
}
448448

449-
/// addSourceLine - Add location information to specified debug information
450-
/// entry.
451-
void CompileUnit::addSourceLine(DIE* Die, DIImportedEntity* IE, unsigned Line)
452-
{
453-
// If the line number is 0, don't add it.
454-
if (Line == 0)
455-
return;
456-
457-
unsigned FileID = DD->getOrCreateSourceID(IE->getFile()->getFilename(), IE->getFile()->getDirectory(), getUniqueID());
458-
IGC_ASSERT_MESSAGE(FileID, "Invalid file id");
459-
addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);
460-
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
461-
}
462-
463449
/// addSourceLine - Add location information to specified debug information
464450
/// entry.
465451
void CompileUnit::addSourceLine(DIE* Die, DIVariable* V)
@@ -756,6 +742,7 @@ IGC::DIE* CompileUnit::getOrCreateContextDIE(DIScope* Context)
756742
return getOrCreateModuleDIE(MD);
757743

758744
return getDIE(Context);
745+
759746
}
760747

761748
/// getOrCreateTypeDIE - Find existing DIE or create new DIE for the
@@ -2030,36 +2017,6 @@ void CompileUnit::constructTemplateValueParameterDIE(
20302017
}
20312018
}
20322019

2033-
/// constructImportedEntityDIE - Create a DIE for DIImportedEntity.
2034-
IGC::DIE* CompileUnit::constructImportedEntityDIE(
2035-
DIImportedEntity* Module)
2036-
{
2037-
DIE* IMDie = new(DIEValueAllocator) DIE((dwarf::Tag)Module->getTag());
2038-
insertDIE(Module, IMDie);
2039-
DIE* EntityDie;
2040-
auto* Entity = Module->getEntity();
2041-
if (auto* NS = dyn_cast<DINamespace>(Entity))
2042-
EntityDie = getOrCreateNameSpace(NS);
2043-
else if (auto* M = dyn_cast<DIModule>(Entity))
2044-
EntityDie = getOrCreateModuleDIE(M);
2045-
else if (auto* SP = dyn_cast<DISubprogram>(Entity))
2046-
EntityDie = getOrCreateSubprogramDIE(SP);
2047-
else if (auto* T = dyn_cast<DIType>(Entity))
2048-
EntityDie = getOrCreateTypeDIE(T);
2049-
// else if (auto* GV = dyn_cast<DIGlobalVariable>(Entity)) // TODO missing support
2050-
// EntityDie = getOrCreateGlobalVariableDIE(GV, {});
2051-
else
2052-
EntityDie = getDIE(Entity);
2053-
assert(EntityDie);
2054-
2055-
addSourceLine(IMDie, Module, Module->getLine());
2056-
addDIEEntry(IMDie, dwarf::DW_AT_import, EntityDie);
2057-
StringRef Name = Module->getName();
2058-
if (!Name.empty())
2059-
addString(IMDie, dwarf::DW_AT_name, Name);
2060-
2061-
return IMDie;
2062-
}
20632020

20642021
/// getOrCreateNameSpace - Create a DIE for DINameSpace.
20652022
IGC::DIE* CompileUnit::getOrCreateNameSpace(DINamespace* NS)
@@ -2224,33 +2181,10 @@ IGC::DIE* CompileUnit::getOrCreateModuleDIE(DIModule* MD)
22242181
// Construct the context before querying for the existence of the DIE in case
22252182
// such construction creates the DIE (as is the case for member function
22262183
// declarations).
2227-
DIE* ContextDIE = getOrCreateContextDIE(MD->getScope());
22282184

22292185
IGC_ASSERT_MESSAGE(false, "Missing implementation for DIModule!");
2230-
DIE* MDDie = getDIE(MD);
2231-
if (MDDie)
2232-
return MDDie;
2233-
2234-
MDDie = createAndAddDIE(dwarf::DW_TAG_module, *ContextDIE, MD);
2235-
2236-
if (!MD->getName().empty())
2237-
{
2238-
addString(MDDie, dwarf::DW_AT_name, MD->getName());
2239-
}
2240-
2241-
#if LLVM_VERSION_MAJOR >= 12
2242-
if (!MD->getIsDecl())
2243-
{
2244-
addSourceLine(MDDie, MD, MD->getLineNo());
2245-
}
2246-
else
2247-
{
2248-
addFlag(MDDie, dwarf::DW_AT_declaration);
2249-
}
2250-
#endif // LLVM_VERSION_MAJOR >= 12.
22512186

22522187
return nullptr;
2253-
return MDDie;
22542188
}
22552189

22562190
/// constructSubrangeDIE - Construct subrange DIE from DISubrange.

IGC/DebugInfo/DwarfCompileUnit.hpp

+1-26
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ See LICENSE.TXT for details.
2222
#include "llvm/Config/llvm-config.h"
2323

2424
#include "common/LLVMWarningsPush.hpp"
25-
#include "llvm/ADT/Optional.h"
2625
#include "llvm/ADT/DenseMap.h"
27-
#include "llvm/ADT/SmallVector.h"
26+
#include "llvm/ADT/Optional.h"
2827
#include "llvm/ADT/StringMap.h"
29-
#include "llvm/ADT/StringRef.h"
3028
#include "llvm/IR/DebugInfo.h"
3129
#include "llvm/IR/GlobalValue.h"
3230
#include "common/LLVMWarningsPop.hpp"
@@ -100,11 +98,6 @@ namespace IGC
10098
DIEInteger* DIEIntegerOne;
10199

102100
public:
103-
using ImportedEntityList = llvm::SmallVector<const llvm::MDNode*, 8>;
104-
using ImportedEntityMap = llvm::DenseMap<const llvm::MDNode*, ImportedEntityList>;
105-
106-
ImportedEntityMap ImportedEntities;
107-
108101
CompileUnit(unsigned UID, DIE* D, llvm::DICompileUnit* CU,
109102
StreamEmitter* A, IGC::DwarfDebug* DW);
110103
~CompileUnit();
@@ -212,7 +205,6 @@ namespace IGC
212205
/// addSourceLine - Add location information to specified debug information
213206
/// entry.
214207
void addSourceLine(DIE* Die, llvm::DIScope* S, unsigned Line);
215-
void addSourceLine(DIE* Die, llvm::DIImportedEntity* IE, unsigned Line);
216208
void addSourceLine(DIE* Die, llvm::DIVariable* V);
217209
void addSourceLine(DIE* Die, llvm::DISubprogram* SP);
218210
void addSourceLine(DIE* Die, llvm::DIType* Ty);
@@ -306,9 +298,6 @@ namespace IGC
306298
const DbgDecoder::LiveIntervalsVISA& lr,
307299
uint64_t varSizeInBits, uint64_t offsetInBits);
308300

309-
/// Construct import_module DIE.
310-
IGC::DIE* constructImportedEntityDIE(llvm::DIImportedEntity* Module);
311-
312301
/// getOrCreateNameSpace - Create a DIE for DINameSpace.
313302
DIE* getOrCreateNameSpace(llvm::DINamespace* NS);
314303

@@ -336,20 +325,6 @@ namespace IGC
336325
/// call insertDIE if MD is not null.
337326
DIE* createAndAddDIE(unsigned Tag, DIE& Parent, llvm::DINode* N = nullptr);
338327

339-
void addImportedEntity(const llvm::DIImportedEntity* IE)
340-
{
341-
llvm::DIScope* Scope = IE->getScope();
342-
assert(Scope && "Invalid Scope encoding!");
343-
if (!llvm::isa<llvm::DILocalScope>(Scope))
344-
{
345-
// No need to add imported enities that are not local declaration.
346-
return;
347-
}
348-
349-
auto* LocalScope = llvm::cast<llvm::DILocalScope>(Scope)->getNonLexicalBlockFileScope();
350-
ImportedEntities[LocalScope].push_back(IE);
351-
}
352-
353328
/// Compute the size of a header for this unit, not including the initial
354329
/// length field.
355330
unsigned getHeaderSize() const

IGC/DebugInfo/DwarfDebug.cpp

+1-28
Original file line numberDiff line numberDiff line change
@@ -778,14 +778,6 @@ DIE* DwarfDebug::createScopeChildrenDIE(CompileUnit* TheCU, LexicalScope* Scope,
778778
}
779779
}
780780

781-
// There is no need to emit empty lexical block DIE.
782-
for (auto* constIE : TheCU->ImportedEntities[Scope->getScopeNode()])
783-
{
784-
auto* IE = const_cast<llvm::MDNode*>(constIE);
785-
Children.push_back(
786-
TheCU->constructImportedEntityDIE(cast<llvm::DIImportedEntity>(IE)));
787-
}
788-
789781
const SmallVectorImpl<LexicalScope*>& Scopes = Scope->getChildren();
790782
for (unsigned j = 0, M = Scopes.size(); j < M; ++j)
791783
{
@@ -1022,9 +1014,6 @@ CompileUnit* DwarfDebug::constructCompileUnit(DICompileUnit* DIUnit)
10221014
FirstCU = NewCU;
10231015
}
10241016

1025-
for (auto* IE : DIUnit->getImportedEntities())
1026-
NewCU->addImportedEntity(IE);
1027-
10281017
CUs.push_back(NewCU);
10291018

10301019
CUMap.insert(std::make_pair(DIUnit, NewCU));
@@ -1055,15 +1044,6 @@ void DwarfDebug::constructSubprogramDIE(CompileUnit* TheCU, const MDNode* N)
10551044
TheCU->getOrCreateSubprogramDIE(SP);
10561045
}
10571046

1058-
void DwarfDebug::constructThenAddImportedEntityDIE(CompileUnit* TheCU,
1059-
DIImportedEntity* IE)
1060-
{
1061-
if (isa<DILocalScope>(IE->getScope()))
1062-
return;
1063-
if (DIE* D = TheCU->getOrCreateContextDIE(IE->getScope()))
1064-
D->addChild(TheCU->constructImportedEntityDIE(IE));
1065-
}
1066-
10671047
void DwarfDebug::discoverDISPNodes(DwarfDISubprogramCache &Cache)
10681048
{
10691049
IGC_ASSERT(DISubprogramNodes.empty());
@@ -1119,21 +1099,14 @@ void DwarfDebug::beginModule()
11191099
CU->getOrCreateTypeDIE(RetainedTypes[i]);
11201100
}
11211101

1122-
// Emit imported_modules last so that the relevant context is already
1123-
// available.
1124-
for (auto* IE : CUNode->getImportedEntities())
1125-
{
1126-
constructThenAddImportedEntityDIE(CU, IE);
1127-
}
1128-
11291102
// Assume there is a single CU
11301103
break;
11311104
}
11321105

11331106
// Prime section data.
11341107
SectionMap[Asm->GetTextSection()];
11351108

1136-
if (DwarfFrameSectionNeeded())
1109+
if(DwarfFrameSectionNeeded())
11371110
{
11381111
Asm->SwitchSection(Asm->GetDwarfFrameSection());
11391112
if (m_pModule->hasOrIsStackCall(*decodedDbg))

IGC/DebugInfo/DwarfDebug.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,6 @@ namespace IGC
637637
return nullptr;
638638
}
639639

640-
/// Construct imported_module or imported_declaration DIE.
641-
void constructThenAddImportedEntityDIE(CompileUnit* TheCU,
642-
llvm::DIImportedEntity* IE);
643-
644640
private:
645641

646642
// DISubprograms used by the currently processed shader

0 commit comments

Comments
 (0)