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 MAPLEBE_INCLUDE_CG_RAOPT_H 17 #define MAPLEBE_INCLUDE_CG_RAOPT_H 18 19 #include "cgfunc.h" 20 #include "cg_phase.h" 21 #include "loop.h" 22 23 namespace maplebe { 24 class RaOpt { 25 public: RaOpt(CGFunc & func,MemPool & pool,DomAnalysis & dom,LoopAnalysis & loop)26 RaOpt(CGFunc &func, MemPool &pool, DomAnalysis &dom, LoopAnalysis &loop) 27 : cgFunc(&func), memPool(&pool), domInfo(dom), loopInfo(loop) 28 { 29 } 30 31 virtual ~RaOpt() = default; 32 Run()33 virtual void Run() {} 34 PhaseName()35 std::string PhaseName() const 36 { 37 return "raopt"; 38 } 39 GetCGFunc()40 const CGFunc *GetCGFunc() const 41 { 42 return cgFunc; 43 } GetMemPool()44 const MemPool *GetMemPool() const 45 { 46 return memPool; 47 } 48 49 protected: 50 CGFunc *cgFunc; 51 MemPool *memPool; 52 DomAnalysis &domInfo; 53 LoopAnalysis &loopInfo; 54 }; 55 56 MAPLE_FUNC_PHASE_DECLARE_BEGIN(CgRaOpt, maplebe::CGFunc) 57 OVERRIDE_DEPENDENCE 58 MAPLE_FUNC_PHASE_DECLARE_END 59 } /* namespace maplebe */ 60 61 #endif /* MAPLEBE_INCLUDE_CG_RAOPT_H */ 62