From 96e8290eefb67c7521ebb347190604eeb1ca4477 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 3 Nov 2018 01:14:29 -0300 Subject: [PATCH] Add OpString --- include/sirit/sirit.h | 3 +++ src/insts/debug.cpp | 6 ++++++ 2 files changed, 9 insertions(+) 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