diff --git a/src/IR.cpp b/src/IR.cpp index c86e529..1483bf3 100644 --- a/src/IR.cpp +++ b/src/IR.cpp @@ -598,11 +598,11 @@ auto SymbolTable::addVariable(const std::string &name, User *variable) -> User * std::stringstream ss; auto iter = variableIndex.find(name); if (iter != variableIndex.end()) { - ss << name << "(" << iter->second << ")"; + ss << name << iter->second ; iter->second += 1; } else { variableIndex.emplace(name, 1); - ss << name << "(" << 0 << ")"; + ss << name << 0 ; } variable->setName(ss.str()); diff --git a/src/SysYIRPrinter.cpp b/src/SysYIRPrinter.cpp index 4812106..04be4da 100644 --- a/src/SysYIRPrinter.cpp +++ b/src/SysYIRPrinter.cpp @@ -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;