libTriton  version 1.0 build 1549
basicBlock.hpp
Go to the documentation of this file.
1
2/*
3** Copyright (C) - Triton
4**
5** This program is under the terms of the Apache License 2.0.
6*/
7
8#ifndef TRITON_BASICBLOCK_HPP
9#define TRITON_BASICBLOCK_HPP
10
11#include <ostream>
12#include <vector>
13
14#include <triton/dllexport.hpp>
17
18
19
21namespace triton {
28 namespace arch {
38 class BasicBlock {
39 private:
40 std::vector<triton::arch::Instruction> instructions;
41
42 public:
44 TRITON_EXPORT BasicBlock();
45
47 TRITON_EXPORT BasicBlock(const std::vector<triton::arch::Instruction>& instructions);
48
50 TRITON_EXPORT BasicBlock(const BasicBlock& other);
51
53 TRITON_EXPORT BasicBlock& operator=(const BasicBlock& other);
54
56 TRITON_EXPORT ~BasicBlock();
57
59 TRITON_EXPORT void add(const Instruction& instruction);
60
62 TRITON_EXPORT bool remove(triton::uint32 position);
63
65 TRITON_EXPORT std::vector<triton::arch::Instruction>& getInstructions(void);
66
68 TRITON_EXPORT triton::usize getSize(void) const;
69
71 TRITON_EXPORT triton::uint64 getFirstAddress(void) const;
72
74 TRITON_EXPORT triton::uint64 getLastAddress(void) const;
75 };
76
78 TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, BasicBlock& block);
79
81 TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, BasicBlock* block);
82
84 };
86};
87
88#endif /* TRITON_BASICBLOCK_HPP */
This class is used to represent a basic block.
Definition: basicBlock.hpp:38
TRITON_EXPORT triton::usize getSize(void) const
Returns the number of instructions in the block.
Definition: basicBlock.cpp:63
TRITON_EXPORT bool remove(triton::uint32 position)
Remove an instruction from the block at the given position. Returns true if success.
Definition: basicBlock.cpp:50
TRITON_EXPORT triton::uint64 getFirstAddress(void) const
Returns the first instruction's address.
Definition: basicBlock.cpp:68
TRITON_EXPORT BasicBlock & operator=(const BasicBlock &other)
Copies an BasicBlock.
Definition: basicBlock.cpp:30
TRITON_EXPORT void add(const Instruction &instruction)
Add an instruction to the block.
Definition: basicBlock.cpp:41
TRITON_EXPORT BasicBlock()
Constructor.
Definition: basicBlock.cpp:16
TRITON_EXPORT triton::uint64 getLastAddress(void) const
Returns the last instruction's address.
Definition: basicBlock.cpp:75
TRITON_EXPORT std::vector< triton::arch::Instruction > & getInstructions(void)
Gets all instructions of the block.
Definition: basicBlock.cpp:58
TRITON_EXPORT ~BasicBlock()
Destructor.
Definition: basicBlock.cpp:36
This class is used to represent an instruction.
Definition: instruction.hpp:48
std::ostream & operator<<(std::ostream &stream, BasicBlock &block)
Displays an BasicBlock.
Definition: basicBlock.cpp:82
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits
Definition: tritonTypes.hpp:42
std::uint32_t uint32
unisgned 32-bits
Definition: tritonTypes.hpp:39
The Triton namespace.