Add OpUndef

This commit is contained in:
ReinUsesLisp 2018-10-31 04:26:35 -03:00
parent 01c658b891
commit 93c17d11f9
3 changed files with 23 additions and 0 deletions

View file

@ -219,6 +219,11 @@ class Module {
spv::Decoration decoration, spv::Decoration decoration,
const std::vector<Literal>& literals = {}); const std::vector<Literal>& literals = {});
// Misc
/// Make an intermediate object whose value is undefined.
Ref Undef(Ref result_type);
private: private:
Ref AddCode(Op* op); Ref AddCode(Op* op);

View file

@ -20,6 +20,7 @@ add_library(sirit
insts/debug.cpp insts/debug.cpp
insts/memory.cpp insts/memory.cpp
insts/annotation.cpp insts/annotation.cpp
insts/misc.cpp
) )
target_include_directories(sirit target_include_directories(sirit
PUBLIC ../include PUBLIC ../include

17
src/insts/misc.cpp Normal file
View file

@ -0,0 +1,17 @@
/* 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 "insts.h"
#include "sirit/sirit.h"
#include <cassert>
namespace Sirit {
Ref Module::Undef(Ref result_type) {
return AddCode(new Op(spv::Op::OpUndef, bound++, result_type));
}
} // namespace Sirit