summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-07-24 16:37:51 -0700
committerGitHub <noreply@github.com>2020-07-24 16:37:51 -0700
commit261fe7587d7413070a4e0f29e1a1bb7b0d2b5429 (patch)
treeed565454d0cbd7883b575fc746de21fde69b2e0c /source/slang/slang-ir.cpp
parent17d0da23ada17e60b037d0d642fa292d194d8d06 (diff)
Ensure labels are dumped in `lower-to-ir` (#1459)
* Ensure labels are dumped in `lower-to-ir`. There is a `dumpIR` function that accepts a label parameter already in slang-emit.cpp. This change moves it to slang-ir.cpp so it may be called from other files. * update expected test result Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index f551dcbba..a5e0de0c5 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -4637,6 +4637,25 @@ namespace Slang
writer->flush();
}
+ void dumpIR(IRModule* module, ISlangWriter* slangWriter, char const* label)
+ {
+ WriterHelper writer(slangWriter);
+
+ if (label)
+ {
+ writer.put("### ");
+ writer.put(label);
+ writer.put(":\n");
+ }
+
+ dumpIR(module, slangWriter, IRDumpMode::Simplified);
+
+ if (label)
+ {
+ writer.put("###\n");
+ }
+ }
+
String getSlangIRAssembly(IRModule* module, IRDumpMode mode)
{
StringBuilder sb;
@@ -5377,4 +5396,3 @@ namespace Slang
ptrType->getOperand(0)->op == opCode;
}
}
-