mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Store.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <memory>
6
#include <string>
7
#include <unordered_set>
8
#include <utility>
9
10
#include "
mini-llvm/ir/Instruction.h
"
11
#include "
mini-llvm/ir/InstructionVisitor.h
"
12
#include "
mini-llvm/ir/Type.h
"
13
#include "
mini-llvm/ir/Type/Void.h
"
14
#include "
mini-llvm/ir/Use.h
"
15
#include "
mini-llvm/ir/Value.h
"
16
#include "
mini-llvm/utils/Compiler.h
"
17
18
namespace
mini_llvm::ir
{
19
20
class
MINI_LLVM_EXPORT
Store
final :
public
Instruction
{
21
public
:
22
Store
(std::shared_ptr<Value>
value
, std::shared_ptr<Value> addr)
23
: value_(this, std::move(
value
)), ptr_(this, std::move(addr)) {}
24
25
template
<
typename
Self>
26
auto
&
value
(
this
Self &&self) {
27
return
self.value_;
28
}
29
30
template
<
typename
Self>
31
auto
&
ptr
(
this
Self &&self) {
32
return
self.ptr_;
33
}
34
35
std::unordered_set<const UseBase *>
operands
()
const override
{
36
return
{&
value
(), &
ptr
()};
37
}
38
39
void
accept
(
InstructionVisitor
&visitor)
override
{
40
visitor.
visitStore
(*
this
);
41
}
42
43
void
accept
(
InstructionVisitor
&visitor)
const override
{
44
visitor.
visitStore
(*
this
);
45
}
46
47
bool
isWellFormed
()
const override
;
48
49
std::unique_ptr<Type>
type
()
const override
{
50
return
std::make_unique<Void>();
51
}
52
53
std::string
format
()
const override
;
54
std::unique_ptr<Value>
clone
()
const override
;
55
56
private
:
57
Use<Value>
value_;
58
Use<Value>
ptr_;
59
};
60
61
}
// namespace mini_llvm::ir
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
Type.h
Use.h
Value.h
Void.h
mini_llvm::ir::InstructionVisitor
Definition
InstructionVisitor.h:58
mini_llvm::ir::InstructionVisitor::visitStore
virtual void visitStore(Store &I)
Definition
InstructionVisitor.h:106
mini_llvm::ir::Instruction
Definition
Instruction.h:22
mini_llvm::ir::Store::format
std::string format() const override
mini_llvm::ir::Store::type
std::unique_ptr< Type > type() const override
Definition
Store.h:49
mini_llvm::ir::Store::value
auto & value(this Self &&self)
Definition
Store.h:26
mini_llvm::ir::Store::clone
std::unique_ptr< Value > clone() const override
mini_llvm::ir::Store::ptr
auto & ptr(this Self &&self)
Definition
Store.h:31
mini_llvm::ir::Store::operands
std::unordered_set< const UseBase * > operands() const override
Definition
Store.h:35
mini_llvm::ir::Store::accept
void accept(InstructionVisitor &visitor) const override
Definition
Store.h:43
mini_llvm::ir::Store::accept
void accept(InstructionVisitor &visitor) override
Definition
Store.h:39
mini_llvm::ir::Store::isWellFormed
bool isWellFormed() const override
mini_llvm::ir::Store::Store
Store(std::shared_ptr< Value > value, std::shared_ptr< Value > addr)
Definition
Store.h:22
mini_llvm::ir::Use
Definition
Use.h:44
InstructionVisitor.h
Instruction.h
mini_llvm::ir
Definition
Argument.h:13
include
mini-llvm
ir
Instruction
Store.h
Generated by
1.17.0