diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 344fbb0..9e50877 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -200,6 +200,9 @@ class Module { /// @return target Id Name(Id target, const std::string& name); + /// Assign a Result to a string for use by other debug instructions. + Id OpString(const std::string& string); + // Memory /// Allocate an object in memory, resulting in a copy to it. diff --git a/src/insts/debug.cpp b/src/insts/debug.cpp index 072833b..688862d 100644 --- a/src/insts/debug.cpp +++ b/src/insts/debug.cpp @@ -19,4 +19,10 @@ Id Module::Name(Id target, const std::string& name) { return target; } +Id Module::OpString(const std::string& string) { + auto op{std::make_unique(spv::Op::OpString, bound++)}; + op->Add(string); + return AddCode(std::move(op)); +} + } // namespace Sirit