aboutsummaryrefslogtreecommitdiff
path: root/externals/sirit/src/instructions/debug.cpp
blob: 1ca3462654f196d8759b689b81754251b703cdbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* This file is part of the sirit project.
 * Copyright (c) 2019 sirit
 * This software may be used and distributed according to the terms of the
 * 3-Clause BSD License
 */

#include "sirit/sirit.h"

#include "common_types.h"
#include "stream.h"

namespace Sirit {

Id Module::Name(Id target, std::string_view name) {
    debug->Reserve(3 + WordsInString(name));
    *debug << spv::Op::OpName << target << name << EndOp{};
    return target;
}

Id Module::MemberName(Id type, u32 member, std::string_view name) {
    debug->Reserve(4 + WordsInString(name));
    *debug << spv::Op::OpMemberName << type << member << name << EndOp{};
    return type;
}

Id Module::String(std::string_view string) {
    debug->Reserve(3 + WordsInString(string));
    return *debug << OpId{spv::Op::OpString} << string << EndOp{};
}

Id Module::OpLine(Id file, Literal line, Literal column) {
    debug->Reserve(4);
    return *debug << spv::Op::OpLine << file << line << column << EndOp{};
}

} // namespace Sirit