From d1de94d651a7158065ed19de580ac7d69c8c4657 Mon Sep 17 00:00:00 2001 From: linma Date: Tue, 27 Apr 2021 12:03:52 -0700 Subject: [PATCH] use module memory pool to store const value in MIR parser --- src/mapleall/maple_ir/src/mir_parser.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mapleall/maple_ir/src/mir_parser.cpp b/src/mapleall/maple_ir/src/mir_parser.cpp index 30a7cd60f4..0ad20b3a42 100644 --- a/src/mapleall/maple_ir/src/mir_parser.cpp +++ b/src/mapleall/maple_ir/src/mir_parser.cpp @@ -2664,7 +2664,7 @@ bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr) { } lexer.NextToken(); } - cexpr = mod.CurFuncCodeMemPool()->New(anode->GetStIdx(), anode->GetFieldID(), *exprTy, ofst); + cexpr = mod.GetMemPool()->New(anode->GetStIdx(), anode->GetFieldID(), *exprTy, ofst); } else if (expr->GetOpCode() == OP_addroffunc) { auto *aof = static_cast(expr); MIRFunction *f = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(aof->GetPUIdx()); @@ -2673,11 +2673,11 @@ bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr) { MIRPtrType ptrType(ptyIdx); ptyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); MIRType *exprTy = GlobalTables::GetTypeTable().GetTypeFromTyIdx(ptyIdx); - cexpr = mod.CurFuncCodeMemPool()->New(aof->GetPUIdx(), *exprTy); + cexpr = mod.GetMemPool()->New(aof->GetPUIdx(), *exprTy); } else if (expr->op == OP_addroflabel) { AddroflabelNode *aol = static_cast(expr); MIRType *mirtype = GlobalTables::GetTypeTable().GetTypeFromTyIdx(TyIdx(PTY_ptr)); - cexpr = mod.CurFuncCodeMemPool()->New(aol->GetOffset(), mod.CurFunction()->GetPuidx(), *mirtype); + cexpr = mod.GetMemPool()->New(aol->GetOffset(), mod.CurFunction()->GetPuidx(), *mirtype); } else if (expr->GetOpCode() == OP_conststr) { auto *cs = static_cast(expr); UStrIdx stridx = cs->GetStrIdx(); @@ -2685,7 +2685,7 @@ bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr) { MIRPtrType ptrtype(ptyIdx); ptyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrtype); MIRType *exprty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(ptyIdx); - cexpr = mod.CurFuncCodeMemPool()->New(stridx, *exprty); + cexpr = mod.GetMemPool()->New(stridx, *exprty); } else { auto *cs = static_cast(expr); U16StrIdx stridx = cs->GetStrIdx(); @@ -2693,7 +2693,7 @@ bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr) { MIRPtrType ptrType(ptyIdx); ptyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); MIRType *exprTy = GlobalTables::GetTypeTable().GetTypeFromTyIdx(ptyIdx); - cexpr = mod.CurFuncCodeMemPool()->New(stridx, *exprTy); + cexpr = mod.GetMemPool()->New(stridx, *exprTy); } return true; } -- Gitee