Files
sirit/src/instructions/debug.cpp

48 lines
1.1 KiB
C++
Raw Normal View History

2018-08-31 04:40:15 -03:00
/* This file is part of the sirit project.
2019-07-14 18:48:59 -03:00
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
2018-08-31 04:40:15 -03:00
*/
#include <memory>
#include <string>
2019-03-11 03:26:21 -03:00
#include "op.h"
#include "sirit/sirit.h"
2018-08-31 04:40:15 -03:00
namespace Sirit {
Id Module::Name(Id target, 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(std::move(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
}
Id Module::MemberName(Id type, u32 member, std::string name) {
2018-11-03 21:29:24 -03:00
auto op{std::make_unique<Op>(spv::Op::OpMemberName)};
op->Add(type);
op->Add(member);
op->Add(std::move(name));
2018-11-03 21:29:24 -03:00
debug.push_back(std::move(op));
return type;
}
Id Module::String(std::string string) {
2018-11-03 01:14:29 -03:00
auto op{std::make_unique<Op>(spv::Op::OpString, bound++)};
op->Add(std::move(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