mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Module.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <format>
6
#include <iterator>
7
#include <list>
8
#include <string>
9
#include <utility>
10
11
#include "
mini-llvm/mc/GlobalValue.h
"
12
#include "
mini-llvm/utils/Compiler.h
"
13
14
namespace
mini_llvm::mc
{
15
16
class
MINI_LLVM_EXPORT
Module
{
17
using
GlobalValueList = std::list<GlobalValue>;
18
19
public
:
20
using
iterator
= GlobalValueList::iterator;
21
using
const_iterator
= GlobalValueList::const_iterator;
22
using
reverse_iterator
= GlobalValueList::reverse_iterator;
23
using
const_reverse_iterator
= GlobalValueList::const_reverse_iterator;
24
25
Module
() =
default
;
26
Module
(
const
Module
&) =
delete
;
27
Module
(
Module
&&) =
default
;
28
Module
&
operator=
(
const
Module
&) =
delete
;
29
Module
&
operator=
(
Module
&&) =
default
;
30
31
iterator
begin
() {
32
return
globalValues_.begin();
33
}
34
35
const_iterator
begin
()
const
{
36
return
globalValues_.begin();
37
}
38
39
iterator
end
() {
40
return
globalValues_.end();
41
}
42
43
const_iterator
end
()
const
{
44
return
globalValues_.end();
45
}
46
47
reverse_iterator
rbegin
() {
48
return
globalValues_.rbegin();
49
}
50
51
const_reverse_iterator
rbegin
()
const
{
52
return
globalValues_.rbegin();
53
}
54
55
reverse_iterator
rend
() {
56
return
globalValues_.rend();
57
}
58
59
const_reverse_iterator
rend
()
const
{
60
return
globalValues_.rend();
61
}
62
63
GlobalValue
&
add
(
const_iterator
pos,
GlobalValue
G);
64
65
GlobalValue
&
prepend
(
GlobalValue
G) {
66
return
add
(
begin
(), std::move(G));
67
}
68
69
GlobalValue
&
append
(
GlobalValue
G) {
70
return
add
(
end
(), std::move(G));
71
}
72
73
void
remove
(
const_iterator
pos);
74
75
void
removeFirst
() {
76
remove
(
begin
());
77
}
78
79
void
removeLast
() {
80
remove
(std::prev(
end
()));
81
}
82
83
void
clear
();
84
85
std::string
format
()
const
;
86
87
private
:
88
GlobalValueList globalValues_;
89
};
90
91
}
// namespace mini_llvm::mc
92
93
template
<>
94
struct
std::formatter<
mini_llvm
::mc::Module> {
95
constexpr
auto
parse
(std::format_parse_context &ctx) {
96
return
ctx.begin();
97
}
98
99
template
<
typename
FormatContext>
100
auto
format
(
const
mini_llvm::mc::Module
&I, FormatContext &ctx)
const
{
101
return
std::format_to(ctx.out(),
"{}"
, I.
format
());
102
}
103
};
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
mini_llvm::mc::GlobalValue
Definition
GlobalValue.h:21
mini_llvm::mc::Module
Definition
Module.h:16
mini_llvm::mc::Module::rbegin
const_reverse_iterator rbegin() const
Definition
Module.h:51
mini_llvm::mc::Module::rbegin
reverse_iterator rbegin()
Definition
Module.h:47
mini_llvm::mc::Module::prepend
GlobalValue & prepend(GlobalValue G)
Definition
Module.h:65
mini_llvm::mc::Module::removeFirst
void removeFirst()
Definition
Module.h:75
mini_llvm::mc::Module::rend
reverse_iterator rend()
Definition
Module.h:55
mini_llvm::mc::Module::operator=
Module & operator=(Module &&)=default
mini_llvm::mc::Module::add
GlobalValue & add(const_iterator pos, GlobalValue G)
mini_llvm::mc::Module::Module
Module(const Module &)=delete
mini_llvm::mc::Module::clear
void clear()
mini_llvm::mc::Module::rend
const_reverse_iterator rend() const
Definition
Module.h:59
mini_llvm::mc::Module::end
const_iterator end() const
Definition
Module.h:43
mini_llvm::mc::Module::Module
Module()=default
mini_llvm::mc::Module::Module
Module(Module &&)=default
mini_llvm::mc::Module::append
GlobalValue & append(GlobalValue G)
Definition
Module.h:69
mini_llvm::mc::Module::begin
iterator begin()
Definition
Module.h:31
mini_llvm::mc::Module::begin
const_iterator begin() const
Definition
Module.h:35
mini_llvm::mc::Module::removeLast
void removeLast()
Definition
Module.h:79
mini_llvm::mc::Module::operator=
Module & operator=(const Module &)=delete
mini_llvm::mc::Module::format
std::string format() const
mini_llvm::mc::Module::const_iterator
GlobalValueList::const_iterator const_iterator
Definition
Module.h:21
mini_llvm::mc::Module::end
iterator end()
Definition
Module.h:39
mini_llvm::mc::Module::reverse_iterator
GlobalValueList::reverse_iterator reverse_iterator
Definition
Module.h:22
mini_llvm::mc::Module::iterator
GlobalValueList::iterator iterator
Definition
Module.h:20
mini_llvm::mc::Module::remove
void remove(const_iterator pos)
mini_llvm::mc::Module::const_reverse_iterator
GlobalValueList::const_reverse_iterator const_reverse_iterator
Definition
Module.h:23
GlobalValue.h
mini_llvm::mc
Definition
Directive.h:8
mini_llvm
Definition
GraphColoringAllocator.h:13
std::formatter< mini_llvm::mc::Module >::parse
constexpr auto parse(std::format_parse_context &ctx)
Definition
Module.h:95
std::formatter< mini_llvm::mc::Module >::format
auto format(const mini_llvm::mc::Module &I, FormatContext &ctx) const
Definition
Module.h:100
include
mini-llvm
mc
Module.h
Generated by
1.17.0