-
Notifications
You must be signed in to change notification settings - Fork 527
/
basicBlock.hpp
88 lines (65 loc) · 2.21 KB
/
basicBlock.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! \file
/*
** Copyright (C) - Triton
**
** This program is under the terms of the Apache License 2.0.
*/
#ifndef TRITON_BASICBLOCK_HPP
#define TRITON_BASICBLOCK_HPP
#include <ostream>
#include <vector>
#include <triton/dllexport.hpp>
#include <triton/instruction.hpp>
#include <triton/tritonTypes.hpp>
//! The Triton namespace
namespace triton {
/*!
* \addtogroup triton
* @{
*/
//! The Triton namespace
namespace arch {
/*!
* \ingroup triton
* \addtogroup arch
* @{
*/
/*! \class BasicBlock
* \brief This class is used to represent a basic block
*/
class BasicBlock {
private:
std::vector<triton::arch::Instruction> instructions;
public:
//! Constructor.
TRITON_EXPORT BasicBlock();
//! Constructor.
TRITON_EXPORT BasicBlock(const std::vector<triton::arch::Instruction>& instructions);
//! Constructor by copy.
TRITON_EXPORT BasicBlock(const BasicBlock& other);
//! Copies an BasicBlock.
TRITON_EXPORT BasicBlock& operator=(const BasicBlock& other);
//! Destructor.
TRITON_EXPORT ~BasicBlock();
//! Add an instruction to the block
TRITON_EXPORT void add(Instruction& instruction);
//! Remove an instruction from the block at the given position. Returns true if success.
TRITON_EXPORT bool remove(triton::uint32 position);
//! Gets all instructions of the block
TRITON_EXPORT std::vector<triton::arch::Instruction>& getInstructions(void);
//! Returns the number of instructions in the block
TRITON_EXPORT triton::usize size(void) const;
//! Returns the first instruction's address
TRITON_EXPORT triton::uint64 getFirstAddress(void) const;
//! Returns the last instruction's address
TRITON_EXPORT triton::uint64 getLastAddress(void) const;
};
//! Displays an BasicBlock.
TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, BasicBlock& block);
//! Displays an BasicBlock.
TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, BasicBlock* block);
/*! @} End of arch namespace */
};
/*! @} End of triton namespace */
};
#endif /* TRITON_BASICBLOCK_HPP */