From 0aa8287d171d0518cb3e87b1c05aa4bbcd4022ec Mon Sep 17 00:00:00 2001 From: Frederick Chow Date: Thu, 11 Feb 2021 18:57:29 -0800 Subject: [PATCH] Support OP_igoto and OP_addroflabel in MIR parser and in maple_me Support parsing of address constants with offsets in iniitializations --- src/mapleall/maple_ir/include/mir_parser.h | 1 + src/mapleall/maple_ir/include/opcodes.h | 2 +- src/mapleall/maple_ir/src/mir_parser.cpp | 32 +++++++++++++++++-- src/mapleall/maple_me/include/bb.h | 1 + src/mapleall/maple_me/include/irmap_build.h | 1 + src/mapleall/maple_me/include/me_ir.h | 2 +- src/mapleall/maple_me/include/me_loop_canon.h | 2 +- src/mapleall/maple_me/src/bb.cpp | 4 ++- src/mapleall/maple_me/src/hdse.cpp | 4 +-- src/mapleall/maple_me/src/irmap.cpp | 3 ++ src/mapleall/maple_me/src/irmap_build.cpp | 7 ++++ src/mapleall/maple_me/src/irmap_emit.cpp | 7 ++++ src/mapleall/maple_me/src/me_cfg.cpp | 7 ++++ .../maple_me/src/me_critical_edge.cpp | 2 +- src/mapleall/maple_me/src/me_function.cpp | 11 +++++++ src/mapleall/maple_me/src/me_ir.cpp | 6 ++++ src/mapleall/maple_me/src/me_loop_canon.cpp | 10 ++++-- src/mapleall/maple_me/src/me_ssa_lpre.cpp | 1 + src/mapleall/maple_me/src/me_stmt_pre.cpp | 1 + src/mapleall/maple_me/src/occur.cpp | 1 + src/mapleall/maple_me/src/ssa_devirtual.cpp | 2 ++ src/mapleall/maple_me/src/ssa_epre.cpp | 1 + src/mapleall/maple_me/src/ssa_pre.cpp | 1 + src/mapleall/mpl2mpl/src/constantfold.cpp | 1 + 24 files changed, 98 insertions(+), 12 deletions(-) diff --git a/src/mapleall/maple_ir/include/mir_parser.h b/src/mapleall/maple_ir/include/mir_parser.h index a6927c2938..d427a9107e 100644 --- a/src/mapleall/maple_ir/include/mir_parser.h +++ b/src/mapleall/maple_ir/include/mir_parser.h @@ -142,6 +142,7 @@ class MIRParser { bool ParseUnaryStmtDecRef(StmtNodePtr&); bool ParseUnaryStmtIncRef(StmtNodePtr&); bool ParseUnaryStmtDecRefReset(StmtNodePtr&); + bool ParseUnaryStmtIGoto(StmtNodePtr&); bool ParseUnaryStmtEval(StmtNodePtr&); bool ParseUnaryStmtFree(StmtNodePtr&); bool ParseUnaryStmtAssertNonNull(StmtNodePtr&); diff --git a/src/mapleall/maple_ir/include/opcodes.h b/src/mapleall/maple_ir/include/opcodes.h index 59d07c8c8b..17f3e3e533 100644 --- a/src/mapleall/maple_ir/include/opcodes.h +++ b/src/mapleall/maple_ir/include/opcodes.h @@ -39,7 +39,7 @@ inline constexpr bool IsCallAssigned(Opcode code) { } inline constexpr bool IsBranch(Opcode opcode) { - return (opcode == OP_goto || opcode == OP_brtrue || opcode == OP_brfalse || opcode == OP_switch); + return (opcode == OP_goto || opcode == OP_brtrue || opcode == OP_brfalse || opcode == OP_switch || opcode == OP_igoto); } constexpr bool IsCommutative(Opcode opcode) { diff --git a/src/mapleall/maple_ir/src/mir_parser.cpp b/src/mapleall/maple_ir/src/mir_parser.cpp index 4c928e8450..6db91aa6d7 100644 --- a/src/mapleall/maple_ir/src/mir_parser.cpp +++ b/src/mapleall/maple_ir/src/mir_parser.cpp @@ -1184,6 +1184,10 @@ bool MIRParser::ParseUnaryStmtDecRefReset(StmtNodePtr &stmt) { return ParseUnaryStmt(OP_decrefreset, stmt); } +bool MIRParser::ParseUnaryStmtIGoto(StmtNodePtr &stmt) { + return ParseUnaryStmt(OP_igoto, stmt); +} + bool MIRParser::ParseUnaryStmtEval(StmtNodePtr &stmt) { return ParseUnaryStmt(OP_eval, stmt); } @@ -2267,6 +2271,7 @@ bool MIRParser::ParseExprAddroflabel(BaseNodePtr &expr) { } LabelIdx lblIdx = mod.CurFunction()->GetOrCreateLableIdxFromName(lexer.GetName()); addrOfLabelNode->SetOffset(lblIdx); + mod.CurFunction()->GetLabelTab()->GetAddrTakenLabels().insert(lblIdx); lexer.NextToken(); return true; } @@ -2628,8 +2633,8 @@ bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr) { return false; } CHECK_FATAL(expr != nullptr, "null ptr check"); - if (expr->GetOpCode() != OP_addrof && expr->GetOpCode() != OP_addroffunc && expr->GetOpCode() != OP_conststr && - expr->GetOpCode() != OP_conststr16) { + if (expr->GetOpCode() != OP_addrof && expr->GetOpCode() != OP_addroffunc && expr->GetOpCode() != OP_addroflabel && + expr->GetOpCode() != OP_conststr && expr->GetOpCode() != OP_conststr16) { Error("ParseConstAddrLeafExpr expects one of OP_addrof, OP_addroffunc, OP_conststr and OP_conststr16"); return false; } @@ -2643,7 +2648,23 @@ bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr) { MIRPtrType ptrType(ptyIdx, (mod.IsJavaModule() ? PTY_ref : PTY_ptr)); ptyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); MIRType *exprTy = GlobalTables::GetTypeTable().GetTypeFromTyIdx(ptyIdx); - cexpr = mod.CurFuncCodeMemPool()->New(anode->GetStIdx(), anode->GetFieldID(), *exprTy); + int32 ofst = 0; + if (lexer.GetTokenKind() == TK_lparen) { + lexer.NextToken(); + if (lexer.GetTokenKind() != TK_intconst) { + Error("ParseConstAddrLeafExpr: wrong offset specification for addrof"); + return false; + } else { + ofst = lexer.GetTheIntVal(); + } + lexer.NextToken(); + if (lexer.GetTokenKind() != TK_rparen) { + Error("ParseConstAddrLeafExpr expects closing paren after offset value for addrof"); + return false; + } + lexer.NextToken(); + } + cexpr = mod.CurFuncCodeMemPool()->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()); @@ -2653,6 +2674,10 @@ bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr) { ptyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); MIRType *exprTy = GlobalTables::GetTypeTable().GetTypeFromTyIdx(ptyIdx); cexpr = mod.CurFuncCodeMemPool()->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); } else if (expr->GetOpCode() == OP_conststr) { auto *cs = static_cast(expr); UStrIdx stridx = cs->GetStrIdx(); @@ -2819,6 +2844,7 @@ std::map MIRParser::InitFuncPtrMapForPar funcPtrMap[TK_decref] = &MIRParser::ParseUnaryStmtDecRef; funcPtrMap[TK_incref] = &MIRParser::ParseUnaryStmtIncRef; funcPtrMap[TK_decrefreset] = &MIRParser::ParseUnaryStmtDecRefReset; + funcPtrMap[TK_igoto] = &MIRParser::ParseUnaryStmtIGoto; funcPtrMap[TK_jscatch] = &MIRParser::ParseStmtMarker; funcPtrMap[TK_finally] = &MIRParser::ParseStmtMarker; funcPtrMap[TK_cleanuptry] = &MIRParser::ParseStmtMarker; diff --git a/src/mapleall/maple_me/include/bb.h b/src/mapleall/maple_me/include/bb.h index 4b1ce8df7b..a51c239f1e 100755 --- a/src/mapleall/maple_me/include/bb.h +++ b/src/mapleall/maple_me/include/bb.h @@ -35,6 +35,7 @@ enum BBKind { kBBReturn, kBBAfterGosub, // the BB that follows a gosub, as it is an entry point kBBSwitch, + kBBIgoto, kBBInvalid }; diff --git a/src/mapleall/maple_me/include/irmap_build.h b/src/mapleall/maple_me/include/irmap_build.h index 1b72df86c3..799805ad01 100644 --- a/src/mapleall/maple_me/include/irmap_build.h +++ b/src/mapleall/maple_me/include/irmap_build.h @@ -52,6 +52,7 @@ class IRMapBuild { } MeExpr *BuildAddrofMeExpr(BaseNode &mirNode) const; MeExpr *BuildAddroffuncMeExpr(BaseNode &mirNode) const; + MeExpr *BuildAddroflabelMeExpr(BaseNode &mirNode) const; MeExpr *BuildGCMallocMeExpr(BaseNode &mirNode) const; MeExpr *BuildSizeoftypeMeExpr(BaseNode &mirNode) const; MeExpr *BuildFieldsDistMeExpr(BaseNode &mirNode) const; diff --git a/src/mapleall/maple_me/include/me_ir.h b/src/mapleall/maple_me/include/me_ir.h index 4ef064ba4e..46325f15b0 100755 --- a/src/mapleall/maple_me/include/me_ir.h +++ b/src/mapleall/maple_me/include/me_ir.h @@ -2353,7 +2353,7 @@ class RetMeStmt : public NaryMeStmt { MapleMap muList; }; -// eval, free, decref, incref, decrefreset, assertnonnull +// eval, free, decref, incref, decrefreset, assertnonnull, igoto class UnaryMeStmt : public MeStmt { public: explicit UnaryMeStmt(const StmtNode *stt) : MeStmt(stt) {} diff --git a/src/mapleall/maple_me/include/me_loop_canon.h b/src/mapleall/maple_me/include/me_loop_canon.h index d97e1d7091..5623e6e46c 100644 --- a/src/mapleall/maple_me/include/me_loop_canon.h +++ b/src/mapleall/maple_me/include/me_loop_canon.h @@ -35,7 +35,7 @@ class MeDoLoopCanon : public MeFuncPhase { using Key = std::pair; std::map> heads; void Convert(MeFunction &func, BB &bb, BB &pred, MapleMap &swapSuccs); - bool NeedConvert(BB &bb, BB &pred, MapleAllocator &alloc, MapleMap &swapSuccs) const; + bool NeedConvert(MeFunction *func, BB &bb, BB &pred, MapleAllocator &alloc, MapleMap &swapSuccs) const; void FindHeadBBs(MeFunction &func, Dominance &dom, const BB *bb); bool IsDoWhileLoop(MeFunction &func, const LoopDesc &loop) const; void Merge(MeFunction &func); diff --git a/src/mapleall/maple_me/src/bb.cpp b/src/mapleall/maple_me/src/bb.cpp index e48ed431ae..71125e0086 100755 --- a/src/mapleall/maple_me/src/bb.cpp +++ b/src/mapleall/maple_me/src/bb.cpp @@ -35,6 +35,8 @@ std::string BB::StrAttribute() const { return "aftergosub"; case kBBSwitch: return "switch"; + case kBBIgoto: + return "igoto"; case kBBInvalid: return "invalid"; default: @@ -331,7 +333,7 @@ void BB::InsertMeStmtLastBr(MeStmt *inStmt) { MeStmt *brStmt = meStmtList.rbegin().base().d(); Opcode op = brStmt->GetOp(); if (brStmt->IsCondBr() || op == OP_goto || op == OP_switch || op == OP_throw || op == OP_return || op == OP_gosub || - op == OP_retsub) { + op == OP_retsub || op == OP_igoto) { InsertMeStmtBefore(brStmt, inStmt); } else { AddMeStmtLast(inStmt); diff --git a/src/mapleall/maple_me/src/hdse.cpp b/src/mapleall/maple_me/src/hdse.cpp index afaf8aa96a..dc44ffd440 100755 --- a/src/mapleall/maple_me/src/hdse.cpp +++ b/src/mapleall/maple_me/src/hdse.cpp @@ -43,7 +43,7 @@ void HDSE::RemoveNotRequiredStmtsInBB(BB &bb) { mirModule.GetOut() << "========== HSSA DSE is deleting this stmt: "; meStmt.Dump(&irMap); } - if (meStmt.GetOp() != OP_dassign && (meStmt.IsCondBr() || meStmt.GetOp() == OP_switch)) { + if (meStmt.GetOp() != OP_dassign && (meStmt.IsCondBr() || meStmt.GetOp() == OP_switch || meStmt.GetOp() == OP_igoto)) { // update CFG while (bb.GetSucc().size() != 1) { BB *succ = bb.GetSucc().back(); @@ -378,7 +378,7 @@ void HDSE::MarkLastStmtInPDomBBRequired(const BB &bb) { } auto &lastStmt = cdBB->GetMeStmts().back(); Opcode op = lastStmt.GetOp(); - CHECK_FATAL((lastStmt.IsCondBr() || op == OP_switch || op == OP_retsub || op == OP_throw || + CHECK_FATAL((lastStmt.IsCondBr() || op == OP_switch || op == OP_igoto || op == OP_retsub || op == OP_throw || cdBB->GetAttributes(kBBAttrIsTry) || cdBB->GetAttributes(kBBAttrWontExit)), "HDSE::MarkLastStmtInPDomBBRequired: control dependent on unexpected statement"); if ((IsBranch(op) || op == OP_retsub || op == OP_throw)) { diff --git a/src/mapleall/maple_me/src/irmap.cpp b/src/mapleall/maple_me/src/irmap.cpp index b0ba280370..69a56d9973 100644 --- a/src/mapleall/maple_me/src/irmap.cpp +++ b/src/mapleall/maple_me/src/irmap.cpp @@ -288,6 +288,9 @@ MeExpr *IRMap::HashMeExpr(MeExpr &meExpr) { case kMeOpAddroffunc: resultExpr = New(exprID, static_cast(meExpr).GetPuIdx()); break; + case kMeOpAddroflabel: + resultExpr = New(exprID, static_cast(meExpr).labelIdx); + break; case kMeOpGcmalloc: resultExpr = New(exprID, meExpr.GetOp(), meExpr.GetPrimType(), static_cast(meExpr).GetTyIdx()); break; diff --git a/src/mapleall/maple_me/src/irmap_build.cpp b/src/mapleall/maple_me/src/irmap_build.cpp index 0b34fdb9c9..7cf01d7aa5 100644 --- a/src/mapleall/maple_me/src/irmap_build.cpp +++ b/src/mapleall/maple_me/src/irmap_build.cpp @@ -169,6 +169,11 @@ MeExpr *IRMapBuild::BuildAddroffuncMeExpr(BaseNode &mirNode) const { return meExpr; } +MeExpr *IRMapBuild::BuildAddroflabelMeExpr(BaseNode &mirNode) const { + AddroflabelMeExpr *meExpr = new AddroflabelMeExpr(kInvalidExprID, static_cast(mirNode).GetOffset()); + return meExpr; +} + MeExpr *IRMapBuild::BuildGCMallocMeExpr(BaseNode &mirNode) const { GcmallocMeExpr *meExpr = new GcmallocMeExpr(kInvalidExprID, mirNode.GetOpCode(), mirNode.GetPrimType(), static_cast(mirNode).GetTyIdx()); return meExpr; @@ -325,6 +330,7 @@ MeExpr *IRMapBuild::BuildExpr(BaseNode &mirNode) { void IRMapBuild::InitMeExprBuildFactory() { RegisterFactoryFunction(OP_addrof, &IRMapBuild::BuildAddrofMeExpr); RegisterFactoryFunction(OP_addroffunc, &IRMapBuild::BuildAddroffuncMeExpr); + RegisterFactoryFunction(OP_addroflabel, &IRMapBuild::BuildAddroflabelMeExpr); RegisterFactoryFunction(OP_gcmalloc, &IRMapBuild::BuildGCMallocMeExpr); RegisterFactoryFunction(OP_gcpermalloc, &IRMapBuild::BuildGCMallocMeExpr); RegisterFactoryFunction(OP_sizeoftype, &IRMapBuild::BuildSizeoftypeMeExpr); @@ -422,6 +428,7 @@ MeStmt *IRMapBuild::BuildMeStmtWithNoSSAPart(StmtNode &stmt) { } case OP_assertnonnull: case OP_eval: + case OP_igoto: case OP_free: case OP_switch: { auto &unaryStmt = static_cast(stmt); diff --git a/src/mapleall/maple_me/src/irmap_emit.cpp b/src/mapleall/maple_me/src/irmap_emit.cpp index 5804bdd17e..a5e4127080 100755 --- a/src/mapleall/maple_me/src/irmap_emit.cpp +++ b/src/mapleall/maple_me/src/irmap_emit.cpp @@ -104,6 +104,13 @@ BaseNode &AddroffuncMeExpr::EmitExpr(SSATab &ssaTab) { return *addroffuncNode; } +BaseNode &AddroflabelMeExpr::EmitExpr(SSATab &ssaTab) { + auto *addroflabelNode = + ssaTab.GetModule().CurFunction()->GetCodeMempool()->New(labelIdx); + addroflabelNode->SetPrimType(PTY_ptr); + return *addroflabelNode; +} + BaseNode &GcmallocMeExpr::EmitExpr(SSATab &ssaTab) { auto *gcMallocNode = ssaTab.GetModule().CurFunction()->GetCodeMempool()->New( Opcode(GetOp()), PrimType(GetPrimType()), tyIdx); diff --git a/src/mapleall/maple_me/src/me_cfg.cpp b/src/mapleall/maple_me/src/me_cfg.cpp index f8d31e659d..c433247521 100755 --- a/src/mapleall/maple_me/src/me_cfg.cpp +++ b/src/mapleall/maple_me/src/me_cfg.cpp @@ -219,6 +219,13 @@ void MeCFG::BuildMirCFG() { } break; } + case kBBIgoto: { + for (LabelIdx lidx : func.GetMirFunc()->GetLabelTab()->GetAddrTakenLabels()) { + BB *mebb = func.GetLabelBBAt(lidx); + bb->AddSucc(*mebb); + } + break; + } case kBBReturn: break; default: { diff --git a/src/mapleall/maple_me/src/me_critical_edge.cpp b/src/mapleall/maple_me/src/me_critical_edge.cpp index 6542b5bfce..7aa2a81882 100644 --- a/src/mapleall/maple_me/src/me_critical_edge.cpp +++ b/src/mapleall/maple_me/src/me_critical_edge.cpp @@ -140,7 +140,7 @@ AnalysisResult *MeDoSplitCEdge::Run(MeFunction *func, MeFuncResultMgr *m, Module } // current BB is a merge for (BB *pred : preds) { - if (pred->GetKind() == kBBGoto) { + if (pred->GetKind() == kBBGoto || pred->GetKind() == kBBIgoto) { continue; } if (pred->GetSucc().size() > 1) { diff --git a/src/mapleall/maple_me/src/me_function.cpp b/src/mapleall/maple_me/src/me_function.cpp index 3603db736d..1fabc1ae63 100755 --- a/src/mapleall/maple_me/src/me_function.cpp +++ b/src/mapleall/maple_me/src/me_function.cpp @@ -171,6 +171,17 @@ void MeFunction::CreateBasicBlocks() { } break; } + case OP_igoto: { + if (curBB->IsEmpty()) { + curBB->SetFirst(stmt); + } + curBB->SetLast(stmt); + curBB->SetKind(kBBIgoto); + if (nextStmt != nullptr) { + curBB = NewBasicBlock(); + } + break; + } case OP_dassign: { if (curBB->IsEmpty()) { curBB->SetFirst(stmt); diff --git a/src/mapleall/maple_me/src/me_ir.cpp b/src/mapleall/maple_me/src/me_ir.cpp index 53063c7941..b15580e8cc 100755 --- a/src/mapleall/maple_me/src/me_ir.cpp +++ b/src/mapleall/maple_me/src/me_ir.cpp @@ -785,6 +785,12 @@ void AddroffuncMeExpr::Dump(const IRMap*, int32) const { LogInfo::MapleLogger() << " mx" << GetExprID(); } +void AddroflabelMeExpr::Dump(const IRMap *irMap, int32) const { + LogInfo::MapleLogger() << "ADDROFLABEL:"; + LogInfo::MapleLogger() << " @" << irMap->GetMIRModule().CurFunction()->GetLabelName(labelIdx); + LogInfo::MapleLogger() << " mx" << GetExprID(); +} + void GcmallocMeExpr::Dump(const IRMap*, int32) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOp()).name << " " << GetPrimTypeName(GetPrimType()); LogInfo::MapleLogger() << " "; diff --git a/src/mapleall/maple_me/src/me_loop_canon.cpp b/src/mapleall/maple_me/src/me_loop_canon.cpp index 39037cb541..3ed948c1f2 100644 --- a/src/mapleall/maple_me/src/me_loop_canon.cpp +++ b/src/mapleall/maple_me/src/me_loop_canon.cpp @@ -49,7 +49,7 @@ static bool CompareBackedge(const std::pair &a, const std::pairGetBBId() < (b.first)->GetBBId(); } -bool MeDoLoopCanon::NeedConvert(BB &bb, BB &pred, MapleAllocator &localAlloc, MapleMap &swapSuccs) const { +bool MeDoLoopCanon::NeedConvert(MeFunction *func, BB &bb, BB &pred, MapleAllocator &localAlloc, MapleMap &swapSuccs) const { bb.SetAttributes(kBBAttrIsInLoop); pred.SetAttributes(kBBAttrIsInLoop); // do not convert do-while loop @@ -57,6 +57,12 @@ bool MeDoLoopCanon::NeedConvert(BB &bb, BB &pred, MapleAllocator &localAlloc, Ma bb.GetAttributes(kBBAttrIsCatch)) { return false; } + if (bb.GetBBLabel() != 0) { + const MapleUnorderedSet &addrTakenLabels = func->GetMirFunc()->GetLabelTab()->GetAddrTakenLabels(); + if (addrTakenLabels.find(bb.GetBBLabel()) != addrTakenLabels.end()) { + return false; // target of igoto cannot be cloned + } + } ASSERT(bb.GetSucc().size() == 2, "the number of bb's successors must equal 2"); // if both succs are equal, return false if (bb.GetSucc().front() == bb.GetSucc().back()) { @@ -221,7 +227,7 @@ void MeDoLoopCanon::ExecuteLoopCanon(MeFunction &func, MeFuncResultMgr &m, Domin ASSERT_NOT_NULL(pred); // bb is reachable from entry && bb dominator pred if (dom.Dominate(*func.GetCommonEntryBB(), *bb) && dom.Dominate(*bb, *pred) && - !pred->GetAttributes(kBBAttrWontExit) && (NeedConvert(*bb, *pred, localAlloc, swapSuccs))) { + !pred->GetAttributes(kBBAttrWontExit) && (NeedConvert(&func, *bb, *pred, localAlloc, swapSuccs))) { if (DEBUGFUNC(&func)) { LogInfo::MapleLogger() << "find backedge " << bb->GetBBId() << " <-- " << pred->GetBBId() << '\n'; } diff --git a/src/mapleall/maple_me/src/me_ssa_lpre.cpp b/src/mapleall/maple_me/src/me_ssa_lpre.cpp index a66b027639..4739688509 100755 --- a/src/mapleall/maple_me/src/me_ssa_lpre.cpp +++ b/src/mapleall/maple_me/src/me_ssa_lpre.cpp @@ -325,6 +325,7 @@ void MeSSALPre::BuildWorkListExpr(MeStmt &meStmt, int32 seqStmt, MeExpr &meExpr, BuildWorkListExpr(meStmt, seqStmt, *ivarMeExpr->GetBase(), false, nullptr, false); break; } + case kMeOpAddroflabel: default: break; } diff --git a/src/mapleall/maple_me/src/me_stmt_pre.cpp b/src/mapleall/maple_me/src/me_stmt_pre.cpp index bc5af520f8..3c6552cdc6 100755 --- a/src/mapleall/maple_me/src/me_stmt_pre.cpp +++ b/src/mapleall/maple_me/src/me_stmt_pre.cpp @@ -850,6 +850,7 @@ void MeStmtPre::BuildWorkListBB(BB *bb) { case OP_brtrue: case OP_brfalse: case OP_switch: + case OP_igoto: break; case OP_membaracquire: case OP_membarrelease: diff --git a/src/mapleall/maple_me/src/occur.cpp b/src/mapleall/maple_me/src/occur.cpp index db5bae2b69..61e3fe5aaf 100755 --- a/src/mapleall/maple_me/src/occur.cpp +++ b/src/mapleall/maple_me/src/occur.cpp @@ -203,6 +203,7 @@ uint32 PreWorkCandHashTable::ComputeWorkCandHashIndex(const MeExpr &meExpr) { switch (meOp) { case kMeOpAddrof: case kMeOpAddroffunc: + case kMeOpAddroflabel: case kMeOpGcmalloc: case kMeOpConst: case kMeOpConststr: diff --git a/src/mapleall/maple_me/src/ssa_devirtual.cpp b/src/mapleall/maple_me/src/ssa_devirtual.cpp index 24237ed91f..2046d7856a 100755 --- a/src/mapleall/maple_me/src/ssa_devirtual.cpp +++ b/src/mapleall/maple_me/src/ssa_devirtual.cpp @@ -403,6 +403,7 @@ void SSADevirtual::VisitMeExpr(MeExpr *meExpr) const { } case kMeOpAddrof: case kMeOpAddroffunc: + case kMeOpAddroflabel: case kMeOpGcmalloc: case kMeOpConst: case kMeOpConststr: @@ -476,6 +477,7 @@ void SSADevirtual::TraversalMeStmt(MeStmt &meStmt) { } case OP_assertnonnull: case OP_eval: + case OP_igoto: case OP_free: { auto *unaryStmt = static_cast(&meStmt); VisitMeExpr(unaryStmt->GetOpnd()); diff --git a/src/mapleall/maple_me/src/ssa_epre.cpp b/src/mapleall/maple_me/src/ssa_epre.cpp index ca895efa6a..e74d01da57 100755 --- a/src/mapleall/maple_me/src/ssa_epre.cpp +++ b/src/mapleall/maple_me/src/ssa_epre.cpp @@ -377,6 +377,7 @@ void SSAEPre::BuildWorkListExpr(MeStmt &meStmt, int32 seqStmt, MeExpr &meExpr, b case kMeOpReg: case kMeOpAddrof: case kMeOpAddroffunc: + case kMeOpAddroflabel: case kMeOpGcmalloc: case kMeOpConst: case kMeOpConststr: diff --git a/src/mapleall/maple_me/src/ssa_pre.cpp b/src/mapleall/maple_me/src/ssa_pre.cpp index 5ba5d4a9fe..6d5d57d382 100755 --- a/src/mapleall/maple_me/src/ssa_pre.cpp +++ b/src/mapleall/maple_me/src/ssa_pre.cpp @@ -1455,6 +1455,7 @@ void SSAPre::BuildWorkListStmt(MeStmt &stmt, uint32 seqStmt, bool isRebuilt, MeE case OP_incref: case OP_decrefreset: case OP_eval: + case OP_igoto: case OP_assertnonnull: case OP_free: { auto *unaryStmt = static_cast(meStmt); diff --git a/src/mapleall/mpl2mpl/src/constantfold.cpp b/src/mapleall/mpl2mpl/src/constantfold.cpp index b7c21d68e9..a2c225740e 100644 --- a/src/mapleall/mpl2mpl/src/constantfold.cpp +++ b/src/mapleall/mpl2mpl/src/constantfold.cpp @@ -119,6 +119,7 @@ StmtNode *ConstantFold::Simplify(StmtNode *node) { case OP_decrefreset: case OP_regassign: case OP_assertnonnull: + case OP_igoto: return SimplifyUnary(static_cast(node)); case OP_assertge: case OP_assertlt: -- Gitee