mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Ptr.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/Type.h
"
12
#include "
mini-llvm/ir/Type/IntegerOrPointerType.h
"
13
#include "
mini-llvm/ir/TypeVisitor.h
"
14
#include "
mini-llvm/utils/Compiler.h
"
15
16
namespace
mini_llvm::ir
{
17
18
class
Constant
;
19
20
class
MINI_LLVM_EXPORT
Ptr
final :
public
IntegerOrPointerType
{
21
public
:
22
int
size
()
const override
{
23
abort();
24
}
25
26
int
alignment
()
const override
{
27
abort();
28
}
29
30
int
size
(
int
pointerSize)
const override
{
31
return
pointerSize;
32
}
33
34
int
alignment
(
int
pointerAlignment)
const override
{
35
return
pointerAlignment;
36
}
37
38
std::unique_ptr<Constant>
zeroValue
()
const override
;
39
40
std::unique_ptr<Constant>
constant
(int64_t)
const override
{
41
abort();
42
}
43
44
std::unique_ptr<Type>
promoted
()
const override
{
45
abort();
46
}
47
48
std::unique_ptr<Type>
demoted
()
const override
{
49
abort();
50
}
51
52
std::string
format
()
const override
{
53
return
"ptr"
;
54
}
55
56
std::unique_ptr<Type>
clone
()
const override
{
57
return
std::make_unique<Ptr>();
58
}
59
60
void
accept
(
TypeVisitor
&visitor)
override
{
61
visitor.
visitPtr
(*
this
);
62
}
63
64
void
accept
(
TypeVisitor
&visitor)
const override
{
65
visitor.
visitPtr
(*
this
);
66
}
67
68
protected
:
69
bool
equals
(
const
Type
&other)
const override
{
70
return
typeid
(*this) ==
typeid
(other);
71
}
72
};
73
74
}
// namespace mini_llvm::ir
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
IntegerOrPointerType.h
TypeVisitor.h
Type.h
mini_llvm::ir::Constant
Definition
Constant.h:13
mini_llvm::ir::IntegerOrPointerType
Definition
IntegerOrPointerType.h:10
mini_llvm::ir::Ptr
Definition
Ptr.h:20
mini_llvm::ir::Ptr::demoted
std::unique_ptr< Type > demoted() const override
Definition
Ptr.h:48
mini_llvm::ir::Ptr::zeroValue
std::unique_ptr< Constant > zeroValue() const override
mini_llvm::ir::Ptr::format
std::string format() const override
Definition
Ptr.h:52
mini_llvm::ir::Ptr::alignment
int alignment(int pointerAlignment) const override
Definition
Ptr.h:34
mini_llvm::ir::Ptr::equals
bool equals(const Type &other) const override
Definition
Ptr.h:69
mini_llvm::ir::Ptr::alignment
int alignment() const override
Definition
Ptr.h:26
mini_llvm::ir::Ptr::size
int size(int pointerSize) const override
Definition
Ptr.h:30
mini_llvm::ir::Ptr::promoted
std::unique_ptr< Type > promoted() const override
Definition
Ptr.h:44
mini_llvm::ir::Ptr::accept
void accept(TypeVisitor &visitor) const override
Definition
Ptr.h:64
mini_llvm::ir::Ptr::clone
std::unique_ptr< Type > clone() const override
Definition
Ptr.h:56
mini_llvm::ir::Ptr::accept
void accept(TypeVisitor &visitor) override
Definition
Ptr.h:60
mini_llvm::ir::Ptr::constant
std::unique_ptr< Constant > constant(int64_t) const override
Definition
Ptr.h:40
mini_llvm::ir::Ptr::size
int size() const override
Definition
Ptr.h:22
mini_llvm::ir::TypeVisitor
Definition
TypeVisitor.h:25
mini_llvm::ir::TypeVisitor::visitPtr
virtual void visitPtr(Ptr &type)
Definition
TypeVisitor.h:47
mini_llvm::ir::Type
Definition
Type.h:18
mini_llvm::ir
Definition
Argument.h:13
include
mini-llvm
ir
Type
Ptr.h
Generated by
1.17.0