mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
FStore.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
FStore
:
public
Instruction
{
26
public
:
27
FStore
(
Precision
precision
,
MemoryOperand
dst
, std::shared_ptr<Register>
src
)
28
: precision_(
precision
), dst_(std::move(
dst
)), src_(
RegisterClass
::
kFPR
, std::move(
src
)) {}
29
30
Precision
precision
()
const
{
31
return
precision_;
32
}
33
34
template
<
typename
Self>
35
auto
&
dst
(
this
Self &&self) {
36
return
self.dst_;
37
}
38
39
template
<
typename
Self>
40
auto
&
src
(
this
Self &&self) {
41
return
self.src_;
42
}
43
44
std::unordered_set<const RegisterOperand *>
regOps
()
const override
{
45
return
{&
dst
().baseReg(), &
src
()};
46
}
47
48
std::unordered_set<const RegisterOperand *>
dsts
()
const override
{
49
return
{};
50
}
51
52
std::unordered_set<const RegisterOperand *>
srcs
()
const override
{
53
return
{&
dst
().baseReg(), &
src
()};
54
}
55
56
std::unordered_set<const ImmediateOperand *>
immOps
()
const override
{
57
return
{&
dst
().offset()};
58
}
59
60
std::unordered_set<const MemoryOperand *>
memOps
()
const override
{
61
return
{&
dst
()};
62
}
63
64
bool
hasSideEffects
()
const override
{
65
return
true
;
66
}
67
68
std::string
format
()
const override
{
69
return
std::format(
"FSTORE {} {}, {}"
,
specifier
(
precision
()),
dst
(), *
src
());
70
}
71
72
std::unique_ptr<Instruction>
clone
()
const override
{
73
return
std::make_unique<FStore>(
precision
(),
dst
().
clone
(),
share
(*
src
()));
74
}
75
76
void
accept
(
InstructionVisitor
&visitor)
override
{
77
visitor.
visitFStore
(*
this
);
78
}
79
80
void
accept
(
InstructionVisitor
&visitor)
const override
{
81
visitor.
visitFStore
(*
this
);
82
}
83
84
private
:
85
Precision
precision_;
86
MemoryOperand
dst_;
87
RegisterOperand
src_;
88
};
89
90
}
// 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::FStore::dsts
std::unordered_set< const RegisterOperand * > dsts() const override
Definition
FStore.h:48
mini_llvm::mir::FStore::format
std::string format() const override
Definition
FStore.h:68
mini_llvm::mir::FStore::hasSideEffects
bool hasSideEffects() const override
Definition
FStore.h:64
mini_llvm::mir::FStore::precision
Precision precision() const
Definition
FStore.h:30
mini_llvm::mir::FStore::regOps
std::unordered_set< const RegisterOperand * > regOps() const override
Definition
FStore.h:44
mini_llvm::mir::FStore::dst
auto & dst(this Self &&self)
Definition
FStore.h:35
mini_llvm::mir::FStore::memOps
std::unordered_set< const MemoryOperand * > memOps() const override
Definition
FStore.h:60
mini_llvm::mir::FStore::FStore
FStore(Precision precision, MemoryOperand dst, std::shared_ptr< Register > src)
Definition
FStore.h:27
mini_llvm::mir::FStore::immOps
std::unordered_set< const ImmediateOperand * > immOps() const override
Definition
FStore.h:56
mini_llvm::mir::FStore::src
auto & src(this Self &&self)
Definition
FStore.h:40
mini_llvm::mir::FStore::accept
void accept(InstructionVisitor &visitor) const override
Definition
FStore.h:80
mini_llvm::mir::FStore::accept
void accept(InstructionVisitor &visitor) override
Definition
FStore.h:76
mini_llvm::mir::FStore::clone
std::unique_ptr< Instruction > clone() const override
Definition
FStore.h:72
mini_llvm::mir::FStore::srcs
std::unordered_set< const RegisterOperand * > srcs() const override
Definition
FStore.h:52
mini_llvm::mir::InstructionVisitor
Definition
InstructionVisitor.h:70
mini_llvm::mir::InstructionVisitor::visitFStore
virtual void visitFStore(FStore &I)
Definition
InstructionVisitor.h:110
mini_llvm::mir::Instruction::Instruction
Instruction()=default
mini_llvm::mir::MemoryOperand
Definition
MemoryOperand.h:20
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::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
FStore.h
Generated by
1.17.0