sirit/src/op.h
Lioncash 47d85b81a7 CMakeLists: Apply compilation flags to the sirit target
Previously this wasn't utilizing any of the compiler flags, meaning it
wasn't applying any of the specified warnings.

Since applying the warnings to the target, this uncovered a few warning
cases, such as shadowing class variables on MSVC, etc, which have been fixed.
2019-03-14 19:30:54 -03:00

59 lines
1.2 KiB
C++

/* 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
* Lesser General Public License version 3 or any later version.
*/
#pragma once
#include <optional>
#include "common_types.h"
#include "operand.h"
#include "sirit/sirit.h"
#include "stream.h"
namespace Sirit {
class Op : public Operand {
public:
explicit Op(spv::Op opcode, std::optional<u32> id = {}, Id result_type = nullptr);
~Op() override;
void Fetch(Stream& stream) const override;
u16 GetWordCount() const override;
bool operator==(const Operand& other) const override;
void Write(Stream& stream) const;
void Sink(Operand* operand);
void Sink(const std::vector<Operand*>& operands_);
void Add(const Literal& literal);
void Add(const std::vector<Literal>& literals);
void Add(const Operand* operand);
void Add(u32 integer);
void Add(std::string string);
void Add(const std::vector<Id>& ids);
private:
u16 WordCount() const;
spv::Op opcode;
Id result_type;
std::optional<u32> id;
std::vector<const Operand*> operands;
std::vector<std::unique_ptr<Operand>> operand_store;
};
} // namespace Sirit