libTriton  version 1.0 build 1558
register.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_REGISTEROPERAND_HPP
9#define TRITON_REGISTEROPERAND_HPP
10
11#include <string>
12#include <ostream>
13
14#include <triton/archEnums.hpp>
16#include <triton/bitsVector.hpp>
17#include <triton/cpuSize.hpp>
18#include <triton/dllexport.hpp>
20
21
22
24namespace triton {
31 namespace arch {
39 class CpuInterface;
40
45 protected:
47 std::string name;
48
51
54
57
58 private:
60 void copy(const Register& other);
61
62 public:
64 TRITON_EXPORT Register();
65
68
71
73 TRITON_EXPORT Register(const Register& other);
74
76 TRITON_EXPORT triton::arch::register_e getParent(void) const;
77
79 TRITON_EXPORT bool isOverlapWith(const Register& other) const;
80
82 TRITON_EXPORT bool isMutable(void) const;
83
85 TRITON_EXPORT std::string getName(void) const;
86
88 TRITON_EXPORT triton::arch::register_e getId(void) const;
89
91 TRITON_EXPORT triton::uint32 getBitSize(void) const;
92
94 TRITON_EXPORT triton::uint32 getSize(void) const;
95
97 TRITON_EXPORT triton::arch::operand_e getType(void) const;
98
100 TRITON_EXPORT bool operator==(const Register& other) const;
101
103 TRITON_EXPORT bool operator!=(const Register& other) const;
104
106 TRITON_EXPORT Register& operator=(const Register& other);
107 };
108
110 TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, const Register& reg);
111
113 TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, const Register* reg);
114
116 TRITON_EXPORT bool operator<(const Register& reg1, const Register& reg2);
117
119 };
121};
122
123#endif /* TRITON_REGISTEROPERAND_HPP */
This class is used to deal with registers and memory as bits vector.
Definition: bitsVector.hpp:36
triton::uint32 low
The lower bit of the bitvector.
Definition: bitsVector.hpp:42
triton::uint32 high
The highest bit of the bitvector.
Definition: bitsVector.hpp:39
This interface is used as abstract CPU interface. All CPU must use this interface.
This class is used when an instruction has a register operand.
Definition: register.hpp:44
TRITON_EXPORT triton::uint32 getBitSize(void) const
Returns the size (in bits) of the register.
Definition: register.cpp:63
TRITON_EXPORT triton::arch::register_e getParent(void) const
Returns the parent id of the register.
Definition: register.cpp:58
TRITON_EXPORT triton::arch::register_e getId(void) const
Returns the id of the register.
Definition: register.cpp:53
triton::arch::register_e parent
The parent id of the register.
Definition: register.hpp:53
TRITON_EXPORT bool operator!=(const Register &other) const
Compare two registers specifications.
Definition: register.cpp:102
TRITON_EXPORT bool isOverlapWith(const Register &other) const
Returns true if other and self overlap.
Definition: register.cpp:83
TRITON_EXPORT Register & operator=(const Register &other)
Copies a Register.
Definition: register.cpp:107
TRITON_EXPORT triton::arch::operand_e getType(void) const
Returns the type of the operand (triton::arch::OPERAND_REGISTER).
Definition: register.cpp:78
TRITON_EXPORT bool operator==(const Register &other) const
Compare two registers specifications.
Definition: register.cpp:97
TRITON_EXPORT Register()
Constructor.
Definition: register.cpp:16
bool vmutable
True if the register is mutable. For example XZR in AArch64 is immutable.
Definition: register.hpp:56
triton::arch::register_e id
The id of the register.
Definition: register.hpp:50
TRITON_EXPORT bool isMutable(void) const
Returns true if this register is mutable. Mainly used in AArch64 to define that some registers like X...
Definition: register.cpp:92
std::string name
The name of the register.
Definition: register.hpp:47
TRITON_EXPORT std::string getName(void) const
Returns the name of the register.
Definition: register.cpp:73
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the size (in bytes) of the register.
Definition: register.cpp:68
This class is used to represent specific properties of an Arm operand.
std::ostream & operator<<(std::ostream &stream, BasicBlock &block)
Displays an BasicBlock.
Definition: basicBlock.cpp:82
bool operator<(const Immediate &imm1, const Immediate &imm2)
Compares two Immediate (needed for std::map)
Definition: immediate.cpp:142
register_e
Types of register.
Definition: archEnums.hpp:64
std::uint32_t uint32
unisgned 32-bits
Definition: tritonTypes.hpp:39
The Triton namespace.