mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
FMovIF.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <format>
6
#include <memory>
7
#include <string>
8
#include <unordered_set>
9
#include <utility>
10
11
#include "
mini-llvm/common/Precision.h
"
12
#include "
mini-llvm/mir/FormatPrecision.h
"
13
#include "
mini-llvm/mir/ImmediateOperand.h
"
14
#include "
mini-llvm/mir/Instruction.h
"
15
#include "
mini-llvm/mir/InstructionVisitor.h
"
16
#include "
mini-llvm/mir/MemoryOperand.h
"
17
#include "
mini-llvm/mir/Register.h
"
18
#include "
mini-llvm/mir/RegisterClass.h
"
19
#include "
mini-llvm/mir/RegisterOperand.h
"
20
#include "
mini-llvm/utils/Compiler.h
"
21
#include "
mini-llvm/utils/Memory.h
"
22
23
namespace
mini_llvm::mir
{
24
25
class
MINI_LLVM_EXPORT
FMovIF
:
public
Instruction
{
26
public
:
27
FMovIF
(
Precision
precision
, std::shared_ptr<Register>
dst
, std::shared_ptr<Register>
src
)
28
: precision_(
precision
),
29
dst_(
RegisterClass
::
kGPR
, std::move(
dst
)),
30
src_(
RegisterClass
::
kFPR
, std::move(
src
)) {}
31
32
Precision
precision
()
const
{
33
return
precision_;
34
}
35
36
template
<
typename
Self>
37
auto
&
dst
(
this
Self &&self) {
38
return
self.dst_;
39
}
40
41
template
<
typename
Self>
42
auto
&
src
(
this
Self &&self) {
43
return
self.src_;
44
}
45
46
std::unordered_set<const RegisterOperand *>
regOps
()
const override
{
47
return
{&
dst
(), &
src
()};
48
}
49
50
std::unordered_set<const RegisterOperand *>
dsts
()
const override
{
51
return
{&
dst
()};
52
}
53
54
std::unordered_set<const RegisterOperand *>
srcs
()
const override
{
55
return
{&
src
()};
56
}
57
58
std::unordered_set<const ImmediateOperand *>
immOps
()
const override
{
59
return
{};
60
}
61
62
std::unordered_set<const MemoryOperand *>
memOps
()
const override
{
63
return
{};
64
}
65
66
bool
hasSideEffects
()
const override
{
67
return
false
;
68
}
69
70
std::string
format
()
const override
{
71
return
std::format(
"FMOVIF {} {}, {}"
,
specifier
(
precision
()), *
dst
(), *
src
());
72
}
73
74
std::unique_ptr<Instruction>
clone
()
const override
{
75
return
std::make_unique<FMovIF>(
precision
(),
share
(*
dst
()),
share
(*
src
()));
76
}
77
78
void
accept
(
InstructionVisitor
&visitor)
override
{
79
visitor.
visitFMovIF
(*
this
);
80
}
81
82
void
accept
(
InstructionVisitor
&visitor)
const override
{
83
visitor.
visitFMovIF
(*
this
);
84
}
85
86
private
:
87
Precision
precision_;
88
RegisterOperand
dst_, src_;
89
};
90
91
}
// namespace mini_llvm::mir
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
FormatPrecision.h
ImmediateOperand.h
MemoryOperand.h
Memory.h
Precision.h
RegisterClass.h
RegisterOperand.h
Register.h
mini_llvm::mir::FMovIF::regOps
std::unordered_set< const RegisterOperand * > regOps() const override
Definition
FMovIF.h:46
mini_llvm::mir::FMovIF::dsts
std::unordered_set< const RegisterOperand * > dsts() const override
Definition
FMovIF.h:50
mini_llvm::mir::FMovIF::clone
std::unique_ptr< Instruction > clone() const override
Definition
FMovIF.h:74
mini_llvm::mir::FMovIF::FMovIF
FMovIF(Precision precision, std::shared_ptr< Register > dst, std::shared_ptr< Register > src)
Definition
FMovIF.h:27
mini_llvm::mir::FMovIF::accept
void accept(InstructionVisitor &visitor) override
Definition
FMovIF.h:78
mini_llvm::mir::FMovIF::immOps
std::unordered_set< const ImmediateOperand * > immOps() const override
Definition
FMovIF.h:58
mini_llvm::mir::FMovIF::srcs
std::unordered_set< const RegisterOperand * > srcs() const override
Definition
FMovIF.h:54
mini_llvm::mir::FMovIF::accept
void accept(InstructionVisitor &visitor) const override
Definition
FMovIF.h:82
mini_llvm::mir::FMovIF::hasSideEffects
bool hasSideEffects() const override
Definition
FMovIF.h:66
mini_llvm::mir::FMovIF::memOps
std::unordered_set< const MemoryOperand * > memOps() const override
Definition
FMovIF.h:62
mini_llvm::mir::FMovIF::dst
auto & dst(this Self &&self)
Definition
FMovIF.h:37
mini_llvm::mir::FMovIF::format
std::string format() const override
Definition
FMovIF.h:70
mini_llvm::mir::FMovIF::precision
Precision precision() const
Definition
FMovIF.h:32
mini_llvm::mir::FMovIF::src
auto & src(this Self &&self)
Definition
FMovIF.h:42
mini_llvm::mir::InstructionVisitor
Definition
InstructionVisitor.h:70
mini_llvm::mir::InstructionVisitor::visitFMovIF
virtual void visitFMovIF(FMovIF &I)
Definition
InstructionVisitor.h:107
mini_llvm::mir::Instruction::Instruction
Instruction()=default
mini_llvm::mir::RegisterOperand
Definition
RegisterOperand.h:13
InstructionVisitor.h
Instruction.h
mini_llvm::mir
Definition
BasicBlock.h:22
mini_llvm::mir::specifier
constexpr const char * specifier(Condition cond)
Definition
Condition.h:15
mini_llvm::mir::RegisterClass
RegisterClass
Definition
RegisterClass.h:7
mini_llvm::mir::RegisterClass::kFPR
@ kFPR
Definition
RegisterClass.h:9
mini_llvm::mir::RegisterClass::kGPR
@ kGPR
Definition
RegisterClass.h:8
mini_llvm::share
std::shared_ptr< T > share(T &value)
Definition
Memory.h:25
mini_llvm::Precision
Precision
Definition
Precision.h:7
include
mini-llvm
mir
Instruction
FMovIF.h
Generated by
1.17.0