diff --git a/src/include/midend/IR.h b/src/include/midend/IR.h index 1335e97..43a3a89 100644 --- a/src/include/midend/IR.h +++ b/src/include/midend/IR.h @@ -1148,7 +1148,6 @@ public: Type* getAllocatedType() const { return getType()->as()->getBaseType(); } ///< 获取分配的类型 - int getNumDims() const { return getNumOperands(); } }; // class AllocaInst @@ -1203,12 +1202,7 @@ protected: } public: - int getNumIndices() const { return getNumOperands() - 1; } Value* getPointer() const { return getOperand(0); } - auto getIndices() const { - return make_range(std::next(operand_begin()), operand_end()); - } - Value* getIndex(int index) const { return getOperand(index + 1); } }; // class LoadInst @@ -1474,9 +1468,6 @@ class ConstantVariable : public Value { return getByIndex(index); } ///< 通过多维索引indices获取初始值 - // unsigned getNumDims() const { return numDims; } ///< 获取维度数量 - // Value* getDim(unsigned index) const { return getOperand(index); } ///< 获取位置为index的维度 - // auto getDims() const { return getOperands(); } ///< 获取维度列表 const ValueCounter& getInitValues() const { return initValues; } ///< 获取初始值 }; diff --git a/src/midend/IR.cpp b/src/midend/IR.cpp index e434ced..bee9968 100644 --- a/src/midend/IR.cpp +++ b/src/midend/IR.cpp @@ -462,9 +462,9 @@ Function * Function::clone(const std::string &suffix) const { newPointer = oldNewValueMap.at(oldPointer); std::vector newIndices; - for (const auto &index : oldLoadInst->getIndices()) { - newIndices.emplace_back(oldNewValueMap.at(index->getValue())); - } + // for (const auto &index : oldLoadInst->getIndices()) { + // newIndices.emplace_back(oldNewValueMap.at(index->getValue())); + // } ss << oldLoadInst->getName() << suffix; // TODO : 这里的newLoadInst的类型需要根据oldLoadInst的类型来推断 auto newLoadInst = new LoadInst(newPointer, oldNewBlockMap.at(oldLoadInst->getParent()), ss.str()); diff --git a/src/midend/SysYIRPrinter.cpp b/src/midend/SysYIRPrinter.cpp index e2c5e17..61b9a6f 100644 --- a/src/midend/SysYIRPrinter.cpp +++ b/src/midend/SysYIRPrinter.cpp @@ -411,17 +411,6 @@ void SysYPrinter::printInst(Instruction *pInst) { auto allocatedType = allocaInst->getAllocatedType(); printType(allocatedType); - // 仍然打印维度信息,如果存在的话 - if (allocaInst->getNumDims() > 0) { - std::cout << ", "; - for (size_t i = 0; i < allocaInst->getNumDims(); i++) { - if (i > 0) std::cout << ", "; - printType(Type::getIntType()); // 维度大小通常是 i32 类型 - std::cout << " "; - printValue(allocaInst->getDim(i)); - } - } - std::cout << ", align 4" << std::endl; } break; @@ -434,17 +423,6 @@ void SysYPrinter::printInst(Instruction *pInst) { std::cout << " "; printValue(loadInst->getPointer()); // 要加载的地址 - // 仍然打印索引信息,如果存在的话 - if (loadInst->getNumIndices() > 0) { - std::cout << ", indices "; // 或者其他分隔符,取决于你期望的格式 - for (size_t i = 0; i < loadInst->getNumIndices(); i++) { - if (i > 0) std::cout << ", "; - printType(loadInst->getIndex(i)->getType()); - std::cout << " "; - printValue(loadInst->getIndex(i)); - } - } - std::cout << ", align 4" << std::endl; } break; @@ -459,16 +437,6 @@ void SysYPrinter::printInst(Instruction *pInst) { std::cout << " "; printValue(storeInst->getPointer()); // 目标地址 - // 仍然打印索引信息,如果存在的话 - if (storeInst->getNumIndices() > 0) { - std::cout << ", indices "; // 或者其他分隔符 - for (size_t i = 0; i < storeInst->getNumIndices(); i++) { - if (i > 0) std::cout << ", "; - printType(storeInst->getIndex(i)->getType()); - std::cout << " "; - printValue(storeInst->getIndex(i)); - } - } std::cout << ", align 4" << std::endl; } break;