mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Void.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <cstdint>
6
#include <cstdlib>
7
#include <memory>
8
#include <string>
9
#include <typeinfo>
10
11
#include "
mini-llvm/ir/Constant.h
"
12
#include "
mini-llvm/ir/Type.h
"
13
#include "
mini-llvm/ir/TypeVisitor.h
"
14
#include "
mini-llvm/utils/Compiler.h
"
15
16
namespace
mini_llvm::ir
{
17
18
class
MINI_LLVM_EXPORT
Void
final :
public
Type
{
19
public
:
20
int
size
()
const override
{
21
abort();
22
}
23
24
int
alignment
()
const override
{
25
abort();
26
}
27
28
std::unique_ptr<Constant>
zeroValue
()
const override
;
29
30
std::unique_ptr<Constant>
constant
(int64_t)
const override
{
31
abort();
32
}
33
34
std::unique_ptr<Type>
promoted
()
const override
{
35
abort();
36
}
37
38
std::unique_ptr<Type>
demoted
()
const override
{
39
abort();
40
}
41
42
std::string
format
()
const override
{
43
return
"void"
;
44
}
45
46
std::unique_ptr<Type>
clone
()
const override
{
47
return
std::make_unique<Void>();
48
}
49
50
void
accept
(
TypeVisitor
&visitor)
override
{
51
visitor.
visitVoid
(*
this
);
52
}
53
54
void
accept
(
TypeVisitor
&visitor)
const override
{
55
visitor.
visitVoid
(*
this
);
56
}
57
58
protected
:
59
bool
equals
(
const
Type
&other)
const override
{
60
return
typeid
(*this) ==
typeid
(other);
61
}
62
};
63
64
}
// namespace mini_llvm::ir
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
TypeVisitor.h
Type.h
mini_llvm::ir::TypeVisitor
Definition
TypeVisitor.h:25
mini_llvm::ir::TypeVisitor::visitVoid
virtual void visitVoid(Void &type)
Definition
TypeVisitor.h:48
mini_llvm::ir::Type::Type
Type()=default
mini_llvm::ir::Void
Definition
Void.h:18
mini_llvm::ir::Void::accept
void accept(TypeVisitor &visitor) const override
Definition
Void.h:54
mini_llvm::ir::Void::promoted
std::unique_ptr< Type > promoted() const override
Definition
Void.h:34
mini_llvm::ir::Void::demoted
std::unique_ptr< Type > demoted() const override
Definition
Void.h:38
mini_llvm::ir::Void::accept
void accept(TypeVisitor &visitor) override
Definition
Void.h:50
mini_llvm::ir::Void::equals
bool equals(const Type &other) const override
Definition
Void.h:59
mini_llvm::ir::Void::clone
std::unique_ptr< Type > clone() const override
Definition
Void.h:46
mini_llvm::ir::Void::alignment
int alignment() const override
Definition
Void.h:24
mini_llvm::ir::Void::size
int size() const override
Definition
Void.h:20
mini_llvm::ir::Void::format
std::string format() const override
Definition
Void.h:42
mini_llvm::ir::Void::zeroValue
std::unique_ptr< Constant > zeroValue() const override
mini_llvm::ir::Void::constant
std::unique_ptr< Constant > constant(int64_t) const override
Definition
Void.h:30
Constant.h
mini_llvm::ir
Definition
Argument.h:13
include
mini-llvm
ir
Type
Void.h
Generated by
1.17.0