deploy-20250820-3 #1

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

View File

@@ -408,7 +408,7 @@ std::any SysYIRGenerator::visitFuncDef(SysYParser::FuncDefContext *ctx){
// 在处理函数体之前,创建一个新的基本块作为函数体的实际入口
// 这样 entryBB 就可以在完成初始化后跳转到这里
BasicBlock* funcBodyEntry = function->addBasicBlock("funcBodyEntry");
BasicBlock* funcBodyEntry = function->addBasicBlock("funcBodyEntry_" + name);
// 从 entryBB 无条件跳转到 funcBodyEntry
builder.createUncondBrInst(funcBodyEntry, {});

View File

@@ -150,9 +150,7 @@ void SysYPrinter::printFunction(Function *function) {
for (const auto &blockIter : function->getBasicBlocks()) {
// Basic block label
BasicBlock* blockPtr = blockIter.get();
if (blockPtr == function->getEntryBlock()) {
std::cout << "entry:" << std::endl;
} else if (!blockPtr->getName().empty()) {
if (!blockPtr->getName().empty()) {
std::cout << blockPtr->getName() << ":" << std::endl;
}

View File

@@ -1248,7 +1248,7 @@ class Function : public Value {
friend class Module;
protected:
Function(Module *parent, Type *type, const std::string &name) : Value(type, name), parent(parent) {
blocks.emplace_back(new BasicBlock(this));
blocks.emplace_back(new BasicBlock(this, "entry_" + name)); ///< 创建一个入口基本块
}
public: