-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextEmitter.h
More file actions
47 lines (40 loc) · 1.04 KB
/
Copy pathTextEmitter.h
File metadata and controls
47 lines (40 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef RAT_PASS_EMIT_TEXTEMITTER_H
#define RAT_PASS_EMIT_TEXTEMITTER_H
#include "Core.h"
#include "Pass/Pass.h"
namespace rat {
struct Function;
struct Module;
struct Node;
struct TextEmitterPass : Pass {
static constexpr const C8* Reset = "\033[0m";
static constexpr const C8* Green = "\033[32m";
static constexpr const C8* TempColors[] = {
"\033[31m",
"\033[33m",
"\033[34m",
"\033[35m",
"\033[36m",
"\033[91m",
"\033[93m",
"\033[94m",
"\033[95m",
"\033[96m",
};
static constexpr U32 TempColorCount = sizeof(TempColors) / sizeof(TempColors[0]);
explicit TextEmitterPass(std::ostream& os);
const C8* name() const override;
B32 run(Module& module) override;
private:
void emitModule(const Module& module);
void emitFunction(const Function& fn);
void emitNode(const Node* node);
void emitOperands(const Node* node);
String comment(const String& text);
String quoteBytes(const List<U8>& bytes);
String ref(const Node* node);
private:
std::ostream* os;
};
} // namespace rat
#endif