1
0
Fork 0
mirror of https://git.suyu.dev/suyu/sirit.git synced 2024-12-22 12:12:05 +00:00

Add OpLogicalNot and OpBitcast

This commit is contained in:
ReinUsesLisp 2018-11-02 23:24:10 -03:00
parent 4f66fb18e9
commit 9c7f96a809
4 changed files with 46 additions and 0 deletions

View file

@ -243,6 +243,11 @@ class Module {
/// Result is true if Operand is false. Result is false if Operand is true.
Id OpLogicalNot(Id result_type, Id operand);
// Conversion
/// Bit pattern-preserving type conversion.
Id OpBitcast(Id result_type, Id operand);
private:
Id AddCode(std::unique_ptr<Op> op);

View file

@ -21,6 +21,7 @@ add_library(sirit
insts/annotation.cpp
insts/misc.cpp
insts/logical.cpp
insts/conversion.cpp
)
target_include_directories(sirit
PUBLIC ../include

20
src/insts/conversion.cpp Normal file
View file

@ -0,0 +1,20 @@
/* 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 2.1 or any later version.
*/
#include "common_types.h"
#include "op.h"
#include "sirit/sirit.h"
#include <memory>
namespace Sirit {
Id Module::OpBitcast(Id result_type, Id operand) {
auto op{std::make_unique<Op>(spv::Op::OpBitcast, bound++, result_type)};
op->Add(operand);
return AddCode(std::move(op));
}
} // namespace Sirit

20
src/insts/logical.cpp Normal file
View file

@ -0,0 +1,20 @@
/* 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 2.1 or any later version.
*/
#include "common_types.h"
#include "op.h"
#include "sirit/sirit.h"
#include <memory>
namespace Sirit {
Id Module::OpLogicalNot(Id result_type, Id operand) {
auto op{std::make_unique<Op>(spv::Op::OpLogicalNot, bound++, result_type)};
op->Add(operand);
return AddCode(std::move(op));
}
} // namespace Sirit