Talvos  0.1
SPIR-V interpreter and dynamic analysis framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Function.cpp
Go to the documentation of this file.
1 // Copyright (c) 2018 the Talvos developers. All rights reserved.
2 //
3 // This file is distributed under a three-clause BSD license. For full license
4 // terms please see the LICENSE file distributed with this source code.
5 
8 
9 #include <cassert>
10 
11 #include "talvos/Block.h"
12 #include "talvos/Function.h"
13 #include "talvos/Type.h"
14 
15 namespace talvos
16 {
17 
18 Function::Function(uint32_t Id, const Type *FuncType)
19 {
20  this->Id = Id;
21  this->FunctionType = FuncType;
22 }
23 
24 void Function::addBlock(std::unique_ptr<Block> B)
25 {
26  assert(Blocks.count(B->getId()) == 0);
27  Blocks[B->getId()] = std::move(B);
28 }
29 
30 } // namespace talvos
This file declares the Block class.
Function(uint32_t Id, const Type *FunctionType)
Create a new function with an ID and a type.
Definition: Function.cpp:18
uint32_t Id
The ID of this function.
Definition: Function.h:66
This file declares the Type class.
BlockMap Blocks
The blocks in the function.
Definition: Function.h:69
void addBlock(std::unique_ptr< Block > B)
Add a block to this function.
Definition: Function.cpp:24
This class represents a SPIR-V type.
Definition: Type.h:33
This file declares the Function class.
const Type * FunctionType
The function type.
Definition: Function.h:67