-
Notifications
You must be signed in to change notification settings - Fork 497
/
codegen.h
60 lines (46 loc) · 1.33 KB
/
codegen.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (C) 2022-2024 Exaloop Inc. <https://exaloop.io>
#pragma once
#include <unordered_map>
#include "codon/cir/llvm/llvm.h"
#include "codon/cir/types/types.h"
namespace codon {
namespace ir {
namespace analyze {
namespace dataflow {
class CFVisitor;
} // namespace dataflow
} // namespace analyze
class LLVMVisitor;
namespace dsl {
namespace codegen {
/// Builder for LLVM types.
struct TypeBuilder {
virtual ~TypeBuilder() noexcept = default;
/// Construct the LLVM type.
/// @param the LLVM visitor
/// @return the LLVM type
virtual llvm::Type *buildType(LLVMVisitor *visitor) = 0;
/// Construct the LLVM debug type.
/// @param the LLVM visitor
/// @return the LLVM debug type
virtual llvm::DIType *buildDebugType(LLVMVisitor *visitor) = 0;
};
/// Builder for LLVM values.
struct ValueBuilder {
virtual ~ValueBuilder() noexcept = default;
/// Construct the LLVM value.
/// @param the LLVM visitor
/// @return the LLVM value
virtual llvm::Value *buildValue(LLVMVisitor *visitor) = 0;
};
/// Builder for control flow graphs.
struct CFBuilder {
virtual ~CFBuilder() noexcept = default;
/// Construct the control-flow nodes.
/// @param graph the graph
virtual void buildCFNodes(analyze::dataflow::CFVisitor *visitor) = 0;
};
} // namespace codegen
} // namespace dsl
} // namespace ir
} // namespace codon