定义了两个空函数getint,putint,但不打印其定义

main
wqz 3 years ago
parent d2e2830f06
commit 22fd5c5bb8

@ -541,7 +541,8 @@ namespace sysy
void Module::print(std::ostream &os) const
{
for (auto &value : children)
os << *value << '\n';
if (value->getName() != "getint" && value->getName() != "putint")
os << *value << '\n';
}
// ArrayValue *ArrayValue::get(Type *type, const vector<Value *> &values) {

@ -18,6 +18,14 @@ namespace sysy
auto pModule = new Module();
assert(pModule);
module.reset(pModule);
// create function:getint
auto getint_type = Type::getFunctionType(Type::getIntType());
auto f_getint = pModule->createFunction("getint", getint_type);
symbols.insert("getint", f_getint);
// create function:putint
auto putint_type = Type::getFunctionType(Type::getVoidType(), vector<Type *>({Type::getIntType()}));
auto f_putint = pModule->createFunction("putint", putint_type);
symbols.insert("putint", f_putint);
// generates globals and functions
visitChildren(ctx);
// return the IR module

Loading…
Cancel
Save