Talvos  0.1
SPIR-V interpreter and dynamic analysis framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Block.h
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 #ifndef TALVOS_BLOCK_H
10 #define TALVOS_BLOCK_H
11 
12 #include <cstdint>
13 #include <memory>
14 
15 namespace talvos
16 {
17 
18 class Instruction;
19 
21 class Block
22 {
23 public:
25  Block(uint32_t Id);
26 
27  ~Block();
28 
29  // Do not allow Block objects to be copied.
31  Block(const Block &) = delete;
32  Block &operator=(const Block &) = delete;
34 
36  uint32_t getId() const { return Id; }
37 
39  Instruction &getLabel() const { return *Label.get(); }
40 
41 private:
42  uint32_t Id;
43 
44  std::unique_ptr<Instruction> Label;
45 };
46 
47 } // namespace talvos
48 
49 #endif
Instruction & getLabel() const
Returns the label instruction for this block.
Definition: Block.h:39
Block & operator=(const Block &)=delete
std::unique_ptr< Instruction > Label
The label instruction.
Definition: Block.h:44
Block(uint32_t Id)
Create a new block with an ID.
Definition: Block.cpp:17
uint32_t getId() const
Returns the ID of this block.
Definition: Block.h:36
This class represents a SPIR-V instruction.
Definition: Instruction.h:27
uint32_t Id
The unique ID of the block.
Definition: Block.h:42
A block of instructions ending with a termination instruction.
Definition: Block.h:21