Skip to content

Commit b06a51d

Browse files
svenvhsys-ce-bb
authored andcommitted
addDecorate: make debug messages readable (#2526)
Don't attempt to print the object itself (which results in binary noise) but print the relevant information from the SPIRVDecorate* objects. Original commit: KhronosGroup/SPIRV-LLVM-Translator@eb0d9f6b1e755fa
1 parent 992e4be commit b06a51d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVEntry.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "SPIRVFunction.h"
4646
#include "SPIRVInstruction.h"
4747
#include "SPIRVMemAliasingINTEL.h"
48+
#include "SPIRVNameMapEnum.h"
4849
#include "SPIRVStream.h"
4950
#include "SPIRVType.h"
5051

@@ -299,13 +300,18 @@ void SPIRVEntry::addDecorate(SPIRVDecorate *Dec) {
299300
auto *LinkageAttr = static_cast<const SPIRVDecorateLinkageAttr *>(Dec);
300301
setName(LinkageAttr->getLinkageName());
301302
}
302-
SPIRVDBG(spvdbgs() << "[addDecorate] " << *Dec << '\n';)
303+
SPIRVDBG(spvdbgs() << "[addDecorate] Add "
304+
<< SPIRVDecorationNameMap::map(Kind) << " to Id " << Id
305+
<< '\n';)
303306
}
304307

305308
void SPIRVEntry::addDecorate(SPIRVDecorateId *Dec) {
306-
DecorateIds.insert(std::make_pair(Dec->getDecorateKind(), Dec));
309+
auto Kind = Dec->getDecorateKind();
310+
DecorateIds.insert(std::make_pair(Kind, Dec));
307311
Module->addDecorate(Dec);
308-
SPIRVDBG(spvdbgs() << "[addDecorateId] " << *Dec << '\n';)
312+
SPIRVDBG(spvdbgs() << "[addDecorateId] Add"
313+
<< SPIRVDecorationNameMap::map(Kind) << " to Id " << Id
314+
<< '\n';)
309315
}
310316

311317
void SPIRVEntry::addDecorate(Decoration Kind) {

0 commit comments

Comments
 (0)