1 /** 2 * Copyright (c) 2021-2022 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 COMPILER_OPTIMIZER_OPTIMIZATIONS_REGALLOC_REG_ALLOC_STAT_H 17 #define COMPILER_OPTIMIZER_OPTIMIZATIONS_REGALLOC_REG_ALLOC_STAT_H 18 19 #include "optimizer/analysis/liveness_analyzer.h" 20 21 namespace panda::compiler { 22 class RegAllocStat { 23 public: 24 explicit RegAllocStat(const ArenaVector<LifeIntervals *> &intervals); GetRegCount()25 size_t GetRegCount() const 26 { 27 return regs_; 28 } GetVRegCount()29 size_t GetVRegCount() const 30 { 31 return vregs_; 32 } GetSlotCount()33 size_t GetSlotCount() const 34 { 35 return slots_; 36 } GetVSlotCount()37 size_t GetVSlotCount() const 38 { 39 return vslots_; 40 } 41 42 private: 43 size_t regs_ = 0; 44 size_t vregs_ = 0; 45 size_t slots_ = 0; 46 size_t vslots_ = 0; 47 }; 48 } // namespace panda::compiler 49 50 #endif // COMPILER_OPTIMIZER_OPTIMIZATIONS_REGALLOC_REG_ALLOC_STAT_H 51