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