forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
563 B
22 lines
563 B
// 保存函数列表并提供模块级上下文访问。
|
|
|
|
#include "ir/IR.h"
|
|
|
|
namespace ir {
|
|
|
|
Context& Module::context() { return context_; }
|
|
|
|
const Context& Module::context() const { return context_; }
|
|
|
|
Function* Module::CreateFunction(const std::string& name,
|
|
std::shared_ptr<Type> ret_type) {
|
|
functions_.push_back(std::make_unique<Function>(name, std::move(ret_type)));
|
|
return functions_.back().get();
|
|
}
|
|
|
|
const std::vector<std::unique_ptr<Function>>& Module::functions() const {
|
|
return functions_;
|
|
}
|
|
|
|
} // namespace ir
|