diff --git a/src/mapleall/maple_ipa/src/ipa_phase_manager.cpp b/src/mapleall/maple_ipa/src/ipa_phase_manager.cpp index 164f7bad5cc2d851f1b35d946ab02881edad443d..9ce4533efa1570abd6ccdbcef7bd5286540f64f6 100644 --- a/src/mapleall/maple_ipa/src/ipa_phase_manager.cpp +++ b/src/mapleall/maple_ipa/src/ipa_phase_manager.cpp @@ -207,7 +207,7 @@ bool SCCProfile::PhaseRun(SCCNode &scc) { AddPhase("splitcriticaledge", true); AddPhase("profileGen", true); } - AddPhase("emitforipa", true); + AddPhase("profgenEmit", true); // Not like other phasemanager which use temp mempool to hold analysis results generated from the sub phases. // Here we use GetManagerMemPool which lives longer than this phase(manager) itself to hold all the analysis result. // So the following phase can access the result in this phase. diff --git a/src/mapleall/maple_me/include/me_autovec.h b/src/mapleall/maple_me/include/me_autovec.h index 0612469db7cfd52d1361f30178af2b901071bd4c..537dea2e1098315b1802dfc9245c2fc0c99e66b2 100644 --- a/src/mapleall/maple_me/include/me_autovec.h +++ b/src/mapleall/maple_me/include/me_autovec.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2021] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2021] Futurewei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. diff --git a/src/mapleall/maple_me/include/me_emit.h b/src/mapleall/maple_me/include/me_emit.h index 421d9bbe772a66dee39ba12ef8dcc532eafaae8e..4775981f4a97b38a6ed6f7987acd2fec62738a89 100644 --- a/src/mapleall/maple_me/include/me_emit.h +++ b/src/mapleall/maple_me/include/me_emit.h @@ -20,5 +20,6 @@ // emit ir to specified file namespace maple { MAPLE_FUNC_PHASE_DECLARE(MEEmit, MeFunction) +MAPLE_FUNC_PHASE_DECLARE(ProfileGenEmit, MeFunction) } // namespace maple #endif // MAPLE_ME_INCLUDE_ME_EMIT_H diff --git a/src/mapleall/maple_me/src/me_emit.cpp b/src/mapleall/maple_me/src/me_emit.cpp index 80fd11f30944fb006d938139805ccf264f1ac598..7e7ad4e76db82bcdd686ddb752a58f8749763934 100644 --- a/src/mapleall/maple_me/src/me_emit.cpp +++ b/src/mapleall/maple_me/src/me_emit.cpp @@ -148,4 +148,35 @@ bool MEEmit::PhaseRun(maple::MeFunction &f) { } return false; } + +void ProfileGenEmit::GetAnalysisDependence(maple::AnalysisDep &aDep) const { + aDep.SetPreservedAll(); +} + +// emit IR for profileGen +bool ProfileGenEmit::PhaseRun(maple::MeFunction &f) { + if (f.GetCfg()->NumBBs() > 0) { + CHECK_FATAL(f.GetIRMap(), "sanity check"); + // emit after hssa + MIRFunction *mirFunction = f.GetMirFunc(); + mirFunction->ReleaseCodeMemory(); + mirFunction->SetMemPool(new ThreadLocalMemPool(memPoolCtrler, "IR from IRMap::Emit()")); + mirFunction->SetBody(mirFunction->GetCodeMempool()->New()); + // initialize is_deleted field to true; will reset when emitting Maple IR + for (size_t k = 1; k < mirFunction->GetSymTab()->GetSymbolTableSize(); ++k) { + MIRSymbol *sym = mirFunction->GetSymTab()->GetSymbolFromStIdx(k); + if (sym->GetSKind() == kStVar) { + sym->SetIsDeleted(); + } + } + for (BB *bb : f.GetCfg()->GetAllBBs()) { + if (bb == nullptr) { + continue; + } + bb->EmitBB(*mirFunction->GetBody(), false); + } + ResetDependentedSymbolLive(mirFunction); + } + return false; +} } // namespace maple diff --git a/src/mapleall/maple_me/src/me_phase_manager.cpp b/src/mapleall/maple_me/src/me_phase_manager.cpp index 77a16dae13390901390ea74186fbc3d82c4768cd..a9b2f6072c06441ffe8eeeead4f63d9c50a9011f 100644 --- a/src/mapleall/maple_me/src/me_phase_manager.cpp +++ b/src/mapleall/maple_me/src/me_phase_manager.cpp @@ -278,4 +278,5 @@ MAPLE_TRANSFORM_PHASE_REGISTER_CANSKIP(MEPlacementRC, placementrc) MAPLE_TRANSFORM_PHASE_REGISTER_CANSKIP(MEDse, dse) MAPLE_TRANSFORM_PHASE_REGISTER_CANSKIP(MEABCOpt, abcopt) MAPLE_TRANSFORM_PHASE_REGISTER(MEEmit, meemit) +MAPLE_TRANSFORM_PHASE_REGISTER_CANSKIP(ProfileGenEmit, profgenEmit); } // namespace maple