mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Load.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/Use.h
"
14
#include "
mini-llvm/ir/Value.h
"
15
#include "
mini-llvm/utils/Compiler.h
"
16
17
namespace
mini_llvm::ir
{
18
19
class
MINI_LLVM_EXPORT
Load
final :
public
Instruction
{
20
public
:
21
Load
(std::unique_ptr<Type>
type
, std::shared_ptr<Value> addr)
22
: type_(std::move(
type
)), ptr_(this, std::move(addr)) {}
23
24
template
<
typename
Self>
25
auto
&
ptr
(
this
Self &&self) {
26
return
self.ptr_;
27
}
28
29
std::unordered_set<const UseBase *>
operands
()
const override
{
30
return
{&
ptr
()};
31
}
32
33
void
accept
(
InstructionVisitor
&visitor)
override
{
34
visitor.
visitLoad
(*
this
);
35
}
36
37
void
accept
(
InstructionVisitor
&visitor)
const override
{
38
visitor.
visitLoad
(*
this
);
39
}
40
41
bool
isWellFormed
()
const override
;
42
43
std::unique_ptr<Type>
type
()
const override
{
44
return
type_->clone();
45
}
46
47
std::string
format
()
const override
;
48
std::unique_ptr<Value>
clone
()
const override
;
49
50
private
:
51
std::unique_ptr<Type> type_;
52
Use<Value>
ptr_;
53
};
54
55
}
// namespace mini_llvm::ir
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
Type.h
Use.h
Value.h
mini_llvm::ir::InstructionVisitor
Definition
InstructionVisitor.h:58
mini_llvm::ir::InstructionVisitor::visitLoad
virtual void visitLoad(Load &I)
Definition
InstructionVisitor.h:93
mini_llvm::ir::Instruction
Definition
Instruction.h:22
mini_llvm::ir::Load::isWellFormed
bool isWellFormed() const override
mini_llvm::ir::Load::clone
std::unique_ptr< Value > clone() const override
mini_llvm::ir::Load::operands
std::unordered_set< const UseBase * > operands() const override
Definition
Load.h:29
mini_llvm::ir::Load::accept
void accept(InstructionVisitor &visitor) const override
Definition
Load.h:37
mini_llvm::ir::Load::accept
void accept(InstructionVisitor &visitor) override
Definition
Load.h:33
mini_llvm::ir::Load::ptr
auto & ptr(this Self &&self)
Definition
Load.h:25
mini_llvm::ir::Load::type
std::unique_ptr< Type > type() const override
Definition
Load.h:43
mini_llvm::ir::Load::format
std::string format() const override
mini_llvm::ir::Load::Load
Load(std::unique_ptr< Type > type, std::shared_ptr< Value > addr)
Definition
Load.h:21
mini_llvm::ir::Use
Definition
Use.h:44
InstructionVisitor.h
Instruction.h
mini_llvm::ir
Definition
Argument.h:13
include
mini-llvm
ir
Instruction
Load.h
Generated by
1.17.0