修复IR函数参数输出,变量命名

This commit is contained in:
rain2133
2025-06-24 16:39:42 +08:00
parent 73dd8eba22
commit d50f76a770
2 changed files with 7 additions and 4 deletions

View File

@@ -128,12 +128,15 @@ void SysYPrinter::printFunction(Function *function) {
std::cout << " @" << function->getName() << "(";
auto entryBlock = function->getEntryBlock();
const auto &args_types = function->getParamTypes();
auto &args = entryBlock->getArguments();
for (size_t i = 0; i < args.size(); i++) {
int i = 0;
for (const auto &args_type : args_types) {
if (i > 0) std::cout << ", ";
printType(args[i]->getType());
printType(args_type);
std::cout << " %" << args[i]->getName();
i++;
}
std::cout << ") {" << std::endl;