diff options
| author | Mukund Keshava <mkeshava@nvidia.com> | 2025-05-11 02:29:37 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-10 20:59:37 +0000 |
| commit | 083eecee3f56b90c7011895f53aaafa9db15856e (patch) | |
| tree | a0a18f0905f2884374ee351713fe77af0843f679 /source/slang/slang-ir.cpp | |
| parent | 48203ea02250ba517f749a222092f091d9bef15e (diff) | |
Add debug information for slang inling (#6621)
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 98c0fa471..fb7d752d5 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -3411,6 +3411,53 @@ IRInst* IRBuilder::emitDebugValue(IRInst* debugVar, IRInst* debugValue) args.getBuffer()); } +IRInst* IRBuilder::emitDebugInlinedAt( + IRInst* line, + IRInst* col, + IRInst* file, + IRInst* debugFunc, + IRInst* outerInlinedAt) +{ + if (outerInlinedAt) + { + IRInst* args[] = {line, col, file, debugFunc, outerInlinedAt}; + return emitIntrinsicInst(getVoidType(), kIROp_DebugInlinedAt, 5, args); + } + else + { + IRInst* args[] = {line, col, file, debugFunc}; + return emitIntrinsicInst(getVoidType(), kIROp_DebugInlinedAt, 4, args); + } +} + +IRInst* IRBuilder::emitDebugFunction( + IRInst* name, + IRInst* line, + IRInst* col, + IRInst* file, + IRInst* debugType) +{ + IRInst* args[] = {name, line, col, file, debugType}; + return emitIntrinsicInst(getVoidType(), kIROp_DebugFunction, 5, args); +} + +IRInst* IRBuilder::emitDebugInlinedVariable(IRInst* variable, IRInst* inlinedAt) +{ + IRInst* args[] = {variable, inlinedAt}; + return emitIntrinsicInst(getVoidType(), kIROp_DebugInlinedVariable, 2, args); +} + +IRInst* IRBuilder::emitDebugScope(IRInst* scope, IRInst* inlinedAt) +{ + IRInst* args[] = {scope, inlinedAt}; + return emitIntrinsicInst(getVoidType(), kIROp_DebugScope, 2, args); +} + +IRInst* IRBuilder::emitDebugNoScope() +{ + return emitIntrinsicInst(getVoidType(), kIROp_DebugNoScope, 0, nullptr); +} + IRLiveRangeStart* IRBuilder::emitLiveRangeStart(IRInst* referenced) { // This instruction doesn't produce any result, @@ -7941,8 +7988,8 @@ IRInstList<IRDecoration> IRInst::getDecorations() IRInst* IRInst::getFirstChild() { // The children come after any decorations, - // so if there are any decorations, then the - // first child is right after the last decoration. + // so if there are any decorations, then + // the first child is right after the last decoration. // if (auto lastDecoration = getLastDecoration()) return lastDecoration->getNextInst(); @@ -8462,6 +8509,7 @@ bool IRInst::mightHaveSideEffects(SideEffectAnalysisOptions options) case kIROp_RTTIObject: case kIROp_RTTIType: case kIROp_Func: + case kIROp_DebugFunction: case kIROp_Generic: case kIROp_Var: case kIROp_Param: |
