From 73a61edda8893901acad05bb4e7d3110db5041a8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 28 Feb 2024 22:57:07 -0800 Subject: [SPIRV] Add NonSemanticDebugInfo for step-through debugging. (#3644) * [SPIRV] Add NonSemanticDebugInfo for step-through debugging. * Fix. * Fix. --- source/slang/slang-ir.cpp | 48 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) (limited to 'source/slang/slang-ir.cpp') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index a016679e7..3f10e3d3e 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -3214,13 +3214,28 @@ namespace Slang IRInst* args[] = { source, - getIntValue(getIntType(), lineStart), - getIntValue(getIntType(), lineEnd), - getIntValue(getIntType(), colStart), - getIntValue(getIntType(), colEnd) + getIntValue(getUIntType(), lineStart), + getIntValue(getUIntType(), lineEnd), + getIntValue(getUIntType(), colStart), + getIntValue(getUIntType(), colEnd) }; return emitIntrinsicInst(getVoidType(), kIROp_DebugLine, 5, args); } + IRInst* IRBuilder::emitDebugVar(IRType* type, IRInst* source, IRInst* line, IRInst* col) + { + IRInst* args[] = { source, line, col }; + return emitIntrinsicInst(type, kIROp_DebugVar, 3, args); + } + + IRInst* IRBuilder::emitDebugValue(IRInst* debugVar, IRInst* debugValue, ArrayView accessChain) + { + List args; + args.add(debugVar); + args.add(debugValue); + args.addRange(accessChain); + return emitIntrinsicInst(getVoidType(), kIROp_DebugValue, (UInt)args.getCount(), args.getBuffer()); + } + IRLiveRangeStart* IRBuilder::emitLiveRangeStart(IRInst* referenced) { // This instruction doesn't produce any result, @@ -8242,28 +8257,7 @@ namespace Slang bool isDefinition( IRInst* inVal) { - IRInst* val = inVal; - // unwrap any generic declarations to see - // the value they return. - for(;;) - { - // An instruciton marked `[import(...)]` cannot - // be a definition, since it is claiming that - // the actual body comes from another module. - // - if(val->findDecoration()) - return false; - - auto genericInst = as(val); - if(!genericInst) - break; - - auto returnVal = findGenericReturnVal(genericInst); - if(!returnVal) - break; - - val = returnVal; - } + IRInst* val = getResolvedInstForDecorations(inVal); // Some cases of instructions have structural // rules about when they are considered to have @@ -8272,7 +8266,6 @@ namespace Slang switch (val->getOp()) { case kIROp_Func: - case kIROp_Generic: return val->getFirstChild() != nullptr; case kIROp_GlobalConstant: @@ -8285,7 +8278,6 @@ namespace Slang // In all other cases, if we have an instruciton // that has *not* been marked for import, then // we consider it to be a definition. - return true; } -- cgit v1.2.3