deploy-20250820-3 #1

Merged
gh0s7 merged 352 commits from deploy-20250820-3 into master 2025-08-20 21:20:33 +08:00
2 changed files with 3 additions and 1 deletions
Showing only changes of commit a231267fc5 - Show all commits

View File

@@ -408,7 +408,7 @@ std::any SysYIRGenerator::visitFuncDef(SysYParser::FuncDefContext *ctx){
auto funcArgs = function->getArguments();
std::vector<AllocaInst *> allocas;
for (int i = 0; i < paramActualTypes.size(); ++i) {
AllocaInst *alloca = builder.createAllocaInst(paramActualTypes[i], {}, paramNames[i]);
AllocaInst *alloca = builder.createAllocaInst(Type::getPointerType(paramActualTypes[i]), {}, paramNames[i]);
allocas.push_back(alloca);
module->addVariable(paramNames[i], alloca);
}

View File

@@ -72,6 +72,8 @@ std::string SysYPrinter::getValueName(Value *value) {
return std::to_string(constVal->getInt());
} else if (auto constVar = dynamic_cast<ConstantVariable*>(value)) {
return constVar->getName(); // 假设ConstantVariable有自己的名字或通过getByIndices获取值
} else if (auto argVar = dynamic_cast<Argument*>(value)) {
return "%" + argVar->getName(); // 假设ArgumentVariable有自己的名字
}
assert(false && "Unknown value type or unable to get value name");
return "";