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