1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef MAPLE_ME_INCLUDE_ME_IRMAP_H 17 #define MAPLE_ME_INCLUDE_ME_IRMAP_H 18 #include "me_option.h" 19 #include "ssa_tab.h" 20 #include "me_function.h" 21 #include "irmap.h" 22 #include "me_cfg.h" 23 24 namespace maple { 25 class MeIRMap : public IRMap { 26 public: 27 static const uint32 kHmapHashLength = 5107; MeIRMap(MeFunction & f,MemPool & memPool)28 MeIRMap(MeFunction &f, MemPool &memPool) 29 : IRMap(*f.GetMeSSATab(), memPool, kHmapHashLength), func(f), cfg(f.GetCfg()) 30 { 31 SetDumpStmtNum(MeOption::stmtNum); 32 } 33 34 ~MeIRMap() = default; 35 GetBB(BBId id)36 BB *GetBB(BBId id) override 37 { 38 return cfg->GetBBFromID(id); 39 } 40 GetBBForLabIdx(LabelIdx lidx,PUIdx)41 BB *GetBBForLabIdx(LabelIdx lidx, PUIdx) override 42 { 43 return cfg->GetLabelBBAt(lidx); 44 } 45 46 void Dump() override; 47 GetFunc()48 MeFunction &GetFunc() const 49 { 50 return func; 51 } 52 53 private: 54 MeFunction &func; 55 MeCFG *cfg; 56 }; 57 } // namespace maple 58 #endif // MAPLE_ME_INCLUDE_ME_IRMAP_H 59