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