• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef MAPLEBE_INCLUDE_CG_LOCAL_SCHEDULE_H
16 #define MAPLEBE_INCLUDE_CG_LOCAL_SCHEDULE_H
17 
18 #include "base_schedule.h"
19 
20 namespace maplebe {
21 #define LOCAL_SCHEDULE_DUMP CG_DEBUG_FUNC(cgFunc)
22 
23 class LocalSchedule : public BaseSchedule {
24 public:
LocalSchedule(MemPool & mp,CGFunc & f,ControlDepAnalysis & cdAna,DataDepAnalysis & dda)25     LocalSchedule(MemPool &mp, CGFunc &f, ControlDepAnalysis &cdAna, DataDepAnalysis &dda)
26         : BaseSchedule(mp, f, cdAna), intraDDA(dda)
27     {
28     }
29     ~LocalSchedule() override = default;
30 
PhaseName()31     std::string PhaseName() const
32     {
33         return "localschedule";
34     }
35     void Run() override;
36     bool CheckCondition(CDGRegion &region) const;
37     void DoLocalScheduleForRegion(CDGRegion &region);
38     using BaseSchedule::DoLocalSchedule;
39     void DoLocalSchedule(CDGNode &cdgNode);
40 
41 protected:
42     void InitInCDGNode(CDGNode &cdgNode);
43     virtual void FinishScheduling(CDGNode &cdgNode) = 0;
44 
45     DataDepAnalysis &intraDDA;
46 };
47 
48 MAPLE_FUNC_PHASE_DECLARE_BEGIN(CgLocalSchedule, maplebe::CGFunc)
49 MAPLE_FUNC_PHASE_DECLARE_END
50 }  // namespace maplebe
51 
52 #endif  // MAPLEBE_INCLUDE_CG_LOCAL_SCHEDULE_H
53