mini-llvm 0.1.0
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
12#include "mini-llvm/ir/Type.h"
15
16namespace mini_llvm::ir {
17
18class MINI_LLVM_EXPORT Void final : public Type {
19public:
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
58protected:
59 bool equals(const Type &other) const override {
60 return typeid(*this) == typeid(other);
61 }
62};
63
64} // namespace mini_llvm::ir
#define MINI_LLVM_EXPORT
Definition Compiler.h:17
Definition TypeVisitor.h:25
virtual void visitVoid(Void &type)
Definition TypeVisitor.h:48
Definition Void.h:18
void accept(TypeVisitor &visitor) const override
Definition Void.h:54
std::unique_ptr< Type > promoted() const override
Definition Void.h:34
std::unique_ptr< Type > demoted() const override
Definition Void.h:38
void accept(TypeVisitor &visitor) override
Definition Void.h:50
bool equals(const Type &other) const override
Definition Void.h:59
std::unique_ptr< Type > clone() const override
Definition Void.h:46
int alignment() const override
Definition Void.h:24
int size() const override
Definition Void.h:20
std::string format() const override
Definition Void.h:42
std::unique_ptr< Constant > zeroValue() const override
std::unique_ptr< Constant > constant(int64_t) const override
Definition Void.h:30
Definition Argument.h:13