diff --git a/pl0/pl0.cc b/pl0/pl0.cc index 5b8b7b4..8cd8b4f 100644 --- a/pl0/pl0.cc +++ b/pl0/pl0.cc @@ -1,7 +1,7 @@ // // pl0.cc - PL/0 language (https://en.wikipedia.org/wiki/PL/0) // -// Copyright (c) 2015 Yuji Hirose. All rights reserved. +// Copyright (c) 2018 Yuji Hirose. All rights reserved. // MIT License // @@ -177,7 +177,8 @@ struct SymbolTable { static void constants(const shared_ptr ast, shared_ptr scope) { - // const <- ('CONST' __ ident '=' _ number(',' _ ident '=' _ number)* ';' _)? + // const <- ('CONST' __ ident '=' _ number(',' _ ident '=' _ number)* ';' + // _)? const auto& nodes = ast->nodes; for (auto i = 0u; i < nodes.size(); i += 2) { const auto& ident = nodes[i + 0]->token; @@ -532,7 +533,7 @@ struct LLVM { compile(ast); } - void dump() { module_->dump(); } + void dump() { module_->print(llvm::errs(), nullptr); } void exec() { unique_ptr ee(EngineBuilder(std::move(module_)).create()); @@ -603,7 +604,7 @@ struct LLVM { PointerType::get(builder_.getInt8Ty(), 0), true)); auto outF = cast(module_->getOrInsertFunction( - "out", builder_.getVoidTy(), builder_.getInt32Ty(), nullptr)); + "out", builder_.getVoidTy(), builder_.getInt32Ty())); { auto BB = BasicBlock::Create(context_, "entry", outF); builder_.SetInsertPoint(BB); @@ -619,8 +620,8 @@ struct LLVM { } void compile_program(const shared_ptr ast) { - auto fn = cast(module_->getOrInsertFunction( - "main", builder_.getVoidTy(), nullptr)); + auto fn = cast( + module_->getOrInsertFunction("main", builder_.getVoidTy())); { auto BB = BasicBlock::Create(context_, "entry", fn); builder_.SetInsertPoint(BB);