Merge branch 'DCE' into backend

This commit is contained in:
Lixuanwang
2025-06-25 16:04:42 +08:00
13 changed files with 2347 additions and 5 deletions

View File

@@ -438,14 +438,15 @@ void SysYPrinter::printInst(Instruction *pInst) {
case Kind::kPhi: {
auto phiInst = dynamic_cast<PhiInst *>(pInst);
std::cout << "%" << phiInst->getName() << " = phi ";
printValue(phiInst->getOperand(0));
std::cout << " = phi ";
printType(phiInst->getType());
for (unsigned i = 0; i < phiInst->getNumOperands(); i += 2) {
for (unsigned i = 1; i < phiInst->getNumOperands(); i++) {
if (i > 0) std::cout << ", ";
std::cout << "[ ";
printValue(phiInst->getOperand(i));
std::cout << ", %" << dynamic_cast<BasicBlock*>(phiInst->getOperand(i+1))->getName() << " ]";
std::cout << " ]";
}
std::cout << std::endl;
} break;