For DXIL Disassembly change "." -> "_" in Instruction names

Disabled when DXC_COMPATIBLE_DISASM is enabled
The shader debugger treats "." in a variable name as a field separator
This commit is contained in:
Jake Turner
2024-07-27 14:32:37 +01:00
parent c6ef900f34
commit e92a6a6527
@@ -2225,17 +2225,39 @@ rdcstr Program::GetValueSymtabString(Value *v)
void Program::SetValueSymtabString(Value *v, const rdcstr &s)
{
if(Constant *c = cast<Constant>(v))
{
c->str = s;
}
else if(Instruction *i = cast<Instruction>(v))
i->extra(alloc).name = s;
{
#if DISABLED(DXC_COMPATIBLE_DISASM)
// For instruction names convert "." -> "_" to allow the name to be used as debugger variable name
// "." is treated as a field separator by the debugger
rdcstr &str = i->extra(alloc).name;
str = s;
for(size_t j = 0; j < str.size(); ++j)
{
if(str[j] == '.')
str[j] = '_';
}
#endif
}
else if(Block *b = cast<Block>(v))
{
b->name = s;
}
else if(GlobalVar *g = cast<GlobalVar>(v))
{
g->name = s;
}
else if(Function *f = cast<Function>(v))
{
f->name = s;
}
else if(Alias *a = cast<Alias>(v))
{
a->name = s;
}
}
uint32_t Program::GetMetaSlot(const Metadata *m) const