1
0
mirror of https://github.com/exaloop/codon.git synced 2025-06-03 15:03:52 +08:00
codon/compiler/sir/dsl/codegen.h
Mark Henderson d010f889dd
Namespace update to codon (#2)
* namespace seq to codon

* using namespace seq -> codon

* seq:: to codon::

Co-authored-by: ‘markhend’ <‘markhend@gmail.com’>
2021-10-04 13:10:59 -04:00

60 lines
1.3 KiB
C++

#pragma once
#include <unordered_map>
#include "sir/types/types.h"
#include "sir/llvm/llvm.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