[midend-mem2reg]修复assignstmt对lvalue的错误解析(lvaue会被exp解释为值,而被assign解释为地址)

This commit is contained in:
rain2133
2025-07-25 20:00:41 +08:00
parent e2c97fd171
commit 04c5c6b44d
3 changed files with 69 additions and 33 deletions

View File

@@ -647,7 +647,7 @@ Function * CallInst::getCallee() const { return dynamic_cast<Function *>(getOper
/**
* 获取变量指针
*/
auto SymbolTable::getVariable(const std::string &name) const -> User * {
auto SymbolTable::getVariable(const std::string &name) const -> Value * {
auto node = curNode;
while (node != nullptr) {
auto iter = node->varList.find(name);
@@ -662,8 +662,8 @@ auto SymbolTable::getVariable(const std::string &name) const -> User * {
/**
* 添加变量到符号表
*/
auto SymbolTable::addVariable(const std::string &name, User *variable) -> User * {
User *result = nullptr;
auto SymbolTable::addVariable(const std::string &name, Value *variable) -> Value * {
Value *result = nullptr;
if (curNode != nullptr) {
std::stringstream ss;
auto iter = variableIndex.find(name);