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