DXIL Added DXIL::ShouldIgnoreSourceMapping()

bool DXIL::ShouldIgnoreSourceMapping(const Instruction &inst)

Currently implemented as ignoring source mapping for handle creation instructions

CreateHandle
CreateHandleFromBinding
CreateHandleFromHeap
AnnotateHandle
This commit is contained in:
Jake Turner
2024-12-15 06:41:22 +00:00
parent 7fe2749b38
commit 48efe87d89
3 changed files with 26 additions and 1 deletions
@@ -1752,6 +1752,7 @@ DXILDebug::Id GetSSAId(const DXIL::Value *value);
bool IsDXCNop(const Instruction &inst);
bool IsLLVMDebugCall(const Instruction &inst);
bool IsLLVMIntrinsicCall(const Instruction &inst);
bool ShouldIgnoreSourceMapping(const Instruction &inst);
bool isUndef(const Value *v);
@@ -111,6 +111,30 @@ bool DXIL::IsLLVMIntrinsicCall(const Instruction &inst)
(inst.getFuncCall()->family == FunctionFamily::LLVMInstrinsic));
}
bool DXIL::ShouldIgnoreSourceMapping(const Instruction &inst)
{
// Do not set source mapping for handle creation instructions
if(inst.op == Operation::Call)
{
rdcstr funcCallName = inst.getFuncCall()->name;
if(funcCallName.beginsWith("dx.op."))
{
DXOp dxOpCode = DXOp::NumOpCodes;
RDCASSERT(getival<DXOp>(inst.args[0], dxOpCode));
RDCASSERT(dxOpCode < DXOp::NumOpCodes, dxOpCode, DXOp::NumOpCodes);
switch(dxOpCode)
{
case DXOp::CreateHandle:
case DXOp::CreateHandleFromBinding:
case DXOp::CreateHandleFromHeap:
case DXOp::AnnotateHandle: return true;
default: break;
}
}
}
return false;
}
// true if the Value is an SSA value i.e. from an instruction, not a constant etc.
bool DXIL::IsSSA(const Value *dxilValue)
{
@@ -2035,7 +2035,7 @@ void Program::GetLineInfo(size_t instruction, uintptr_t offset, LineColumnInfo &
if(getLineInfo)
{
const Instruction *const inst = f.instructions[instruction];
uint32_t dbgLoc = inst->debugLoc;
uint32_t dbgLoc = ShouldIgnoreSourceMapping(*inst) ? ~0U : inst->debugLoc;
if(dbgLoc != ~0U)
{
const DebugLocation &debugLoc = m_DebugLocations[dbgLoc];