mini-llvm 0.1.0
Loading...
Searching...
No Matches
BasicBlockType.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"
14
15namespace mini_llvm::ir {
16
17class BasicBlockType final : public Type {
18public:
19 int size() const override {
20 abort();
21 }
22
23 int alignment() const override {
24 abort();
25 }
26
27 std::unique_ptr<Constant> zeroValue() const override {
28 abort();
29 }
30
31 std::unique_ptr<Constant> constant(int64_t) const override {
32 abort();
33 }
34
35 std::unique_ptr<Type> promoted() const override {
36 abort();
37 }
38
39 std::unique_ptr<Type> demoted() const override {
40 abort();
41 }
42
43 std::string format() const override {
44 return "label";
45 }
46
47 std::unique_ptr<Type> clone() const override {
48 return std::make_unique<BasicBlockType>();
49 }
50
51 void accept(TypeVisitor &visitor) override {
52 visitor.visitBasicBlockType(*this);
53 }
54
55 void accept(TypeVisitor &visitor) const override {
56 visitor.visitBasicBlockType(*this);
57 }
58
59protected:
60 bool equals(const Type &other) const override {
61 return typeid(*this) == typeid(other);
62 }
63};
64
65} // namespace mini_llvm::ir
Definition BasicBlockType.h:17
std::unique_ptr< Type > demoted() const override
Definition BasicBlockType.h:39
void accept(TypeVisitor &visitor) override
Definition BasicBlockType.h:51
std::unique_ptr< Type > clone() const override
Definition BasicBlockType.h:47
std::unique_ptr< Constant > constant(int64_t) const override
Definition BasicBlockType.h:31
std::unique_ptr< Constant > zeroValue() const override
Definition BasicBlockType.h:27
std::unique_ptr< Type > promoted() const override
Definition BasicBlockType.h:35
void accept(TypeVisitor &visitor) const override
Definition BasicBlockType.h:55
bool equals(const Type &other) const override
Definition BasicBlockType.h:60
int alignment() const override
Definition BasicBlockType.h:23
int size() const override
Definition BasicBlockType.h:19
std::string format() const override
Definition BasicBlockType.h:43
Definition TypeVisitor.h:25
virtual void visitBasicBlockType(BasicBlockType &type)
Definition TypeVisitor.h:38
Definition Argument.h:13