Files
sirit/src/instructions/debug.cpp

48 lines
1.2 KiB
C++
Raw Normal View History

2018-08-31 04:40:15 -03:00
/* This file is part of the sirit project.
* Copyright (c) 2018 ReinUsesLisp
* This software may be used and distributed according to the terms of the GNU
2018-11-16 04:10:10 -03:00
* Lesser General Public License version 3 or any later version.
2018-08-31 04:40:15 -03:00
*/
#include "op.h"
#include "sirit/sirit.h"
#include <memory>
#include <string>
2018-08-31 04:40:15 -03:00
namespace Sirit {
2018-10-31 22:20:49 -03:00
Id Module::Name(Id target, const std::string& name) {
auto op{std::make_unique<Op>(spv::Op::OpName)};
2018-08-31 04:40:15 -03:00
op->Add(target);
op->Add(name);
debug.push_back(std::move(op));
2018-08-31 04:55:01 -03:00
return target;
2018-08-31 04:40:15 -03:00
}
2018-11-03 21:29:24 -03:00
Id Module::MemberName(Id type, u32 member, const std::string& name) {
auto op{std::make_unique<Op>(spv::Op::OpMemberName)};
op->Add(type);
op->Add(member);
op->Add(name);
debug.push_back(std::move(op));
return type;
}
2018-11-03 03:40:20 -03:00
Id Module::String(const std::string& string) {
2018-11-03 01:14:29 -03:00
auto op{std::make_unique<Op>(spv::Op::OpString, bound++)};
op->Add(string);
2018-11-03 03:40:20 -03:00
const auto id = op.get();
debug.push_back(std::move(op));
return id;
}
Id Module::OpLine(Id file, Literal line, Literal column) {
auto op{std::make_unique<Op>(spv::Op::OpLine)};
op->Add(file);
op->Add(line);
op->Add(column);
2018-11-03 01:14:29 -03:00
return AddCode(std::move(op));
}
2018-08-31 04:40:15 -03:00
} // namespace Sirit