LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
asm
aarch64
aarch64/Operand.hpp
Go to the documentation of this file.
1
/* Copyright 2022 - 2026 R. Thomas
2
*
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
#ifndef LIEF_ASM_AARCH64_OPERAND_H
16
#define LIEF_ASM_AARCH64_OPERAND_H
17
#include "
LIEF/visibility.h
"
18
#include "
LIEF/iterators.hpp
"
19
20
#include <memory>
21
#include <string>
22
#include <cassert>
23
24
#include <ostream>
25
26
namespace
LIEF
{
27
namespace
assembly
{
28
namespace
aarch64
{
29
30
namespace
details
{
31
class
Operand
;
32
class
OperandIt;
33
}
34
36
class
LIEF_API
Operand {
37
public
:
39
class
Iterator
final
40
:
public
iterator_facade_base
<Iterator, std::forward_iterator_tag, Operand,
41
std::ptrdiff_t, const Operand*, const Operand&> {
42
public
:
43
using
implementation
= details::OperandIt;
44
using
iterator_facade_base::operator++;
45
46
LIEF_API
Iterator
();
47
48
LIEF_API
Iterator
(std::unique_ptr<details::OperandIt> impl);
49
LIEF_API
Iterator
(
const
Iterator
&);
50
LIEF_API
Iterator
&
operator=
(
const
Iterator
&);
51
52
LIEF_API
Iterator
(
Iterator
&&) noexcept;
53
LIEF_API
Iterator
& operator=(
Iterator
&&) noexcept;
54
55
LIEF_API
~
Iterator
();
56
57
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
58
LIEF_API
Iterator
& operator++();
59
60
friend
LIEF_API
bool
operator==(const
Iterator
& LHS, const
Iterator
& RHS);
61
62
friend
bool
operator!=(const
Iterator
& LHS, const
Iterator
& RHS) {
63
return
!(LHS == RHS);
64
}
65
66
LIEF_API
const
Operand&
operator*
()
const
;
67
68
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
69
LIEF_API
const
Operand*
operator->
()
const
;
70
73
LIEF_API
std::unique_ptr<Operand>
yield
();
74
75
private
:
76
void
load()
const
;
77
78
std::unique_ptr<details::OperandIt> impl_;
79
mutable
std::unique_ptr<Operand> cached_;
80
};
81
83
std::string
to_string
()
const
;
84
93
template
<
class
T>
94
const
T*
as
()
const
{
95
static_assert
(std::is_base_of<Operand, T>::value,
96
"Require Operand inheritance"
);
97
if
(T::classof(
this
)) {
98
return
static_cast<
const
T*
>
(
this
);
99
}
100
return
nullptr
;
101
}
102
103
virtual
~Operand
();
104
106
static
LIEF_LOCAL
std::unique_ptr<Operand>
107
create(std::unique_ptr<details::Operand> impl);
108
110
LIEF_LOCAL
const
details::Operand& impl()
const
{
111
assert(impl_ !=
nullptr
);
112
return
*impl_;
113
}
114
116
LIEF_LOCAL
details::Operand& impl() {
117
assert(impl_ !=
nullptr
);
118
return
*impl_;
119
}
120
121
friend
LIEF_API
std::ostream&
operator<<
(std::ostream& os,
const
Operand& op) {
122
os << op.
to_string
();
123
return
os;
124
}
125
126
protected
:
127
LIEF_LOCAL
Operand
(std::unique_ptr<details::Operand> impl);
128
std::unique_ptr<details::Operand> impl_;
129
};
130
131
}
132
}
133
}
134
135
#endif
LIEF::assembly::aarch64::Operand::Iterator::yield
std::unique_ptr< Operand > yield()
Transfer ownership of the operand at the current position to the caller. Returns nullptr if the itera...
LIEF::assembly::aarch64::Operand::Iterator::Iterator
Iterator()
LIEF::assembly::aarch64::Operand::Iterator::operator->
const Operand * operator->() const
LIEF::assembly::aarch64::Operand::Iterator::Iterator
Iterator(Iterator &&) noexcept
LIEF::assembly::aarch64::Operand::Iterator::Iterator
Iterator(std::unique_ptr< details::OperandIt > impl)
LIEF::assembly::aarch64::Operand::Iterator::operator*
const Operand & operator*() const
LIEF::assembly::aarch64::Operand::Iterator::operator=
Iterator & operator=(const Iterator &)
LIEF::assembly::aarch64::Operand::Iterator::Iterator
Iterator(const Iterator &)
LIEF::assembly::aarch64::Operand::Iterator::implementation
details::OperandIt implementation
Definition
aarch64/Operand.hpp:43
LIEF::assembly::aarch64::Operand
This class represents an operand for an AArch64 instruction.
Definition
aarch64/Operand.hpp:36
LIEF::assembly::aarch64::Operand::operator<<
friend std::ostream & operator<<(std::ostream &os, const Operand &op)
Definition
aarch64/Operand.hpp:121
LIEF::assembly::aarch64::Operand::to_string
std::string to_string() const
Pretty representation of the operand.
LIEF::assembly::aarch64::Operand::~Operand
virtual ~Operand()
LIEF::assembly::aarch64::Operand::as
const T * as() const
This function can be used to down cast an Operand instance:
Definition
aarch64/Operand.hpp:94
LIEF::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition
iterators.hpp:729
iterators.hpp
LIEF::assembly::aarch64::details
Definition
aarch64/Operand.hpp:30
LIEF::assembly::aarch64
AArch64 architecture-related namespace.
Definition
aarch64/Instruction.hpp:27
LIEF::assembly
Namespace related to assembly/disassembly support.
Definition
Abstract/Binary.hpp:47
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
LIEF_LOCAL
#define LIEF_LOCAL
Definition
visibility.h:46
Generated by
1.17.0