| // Copyright 2017 the V8 project authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef V8_CODEGEN_REGLIST_H_ |
| #define V8_CODEGEN_REGLIST_H_ |
| #include "src/base/bits.h" |
| #include "src/base/template-utils.h" |
| // Register configurations. |
| using RegList = uint64_t; |
| using RegList = uint32_t; |
| // Get the number of registers in a given register list. |
| constexpr int NumRegs(RegList list) { |
| return base::bits::CountPopulation(list); |
| // Combine two RegLists by building the union of the contained registers. |
| // TODO(clemensb): Replace by constexpr lambda once we have C++17. |
| constexpr RegList CombineRegListsHelper(RegList list1, RegList list2) { |
| // Combine several RegLists by building the union of the contained registers. |
| template <typename... RegLists> |
| constexpr RegList CombineRegLists(RegLists... lists) { |
| return base::fold(detail::CombineRegListsHelper, 0, lists...); |
| #endif // V8_CODEGEN_REGLIST_H_ |