• 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 
16 #ifndef MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_OPERAND_H
17 #define MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_OPERAND_H
18 
19 #include <limits>
20 #include <string>
21 #include <iomanip>
22 #include "aarch64_isa.h"
23 #include "operand.h"
24 #include "cg.h"
25 #include "emit.h"
26 #include "common_utils.h"
27 
28 namespace std {
29 template <> /* function-template-specialization */
30 class std::hash<maplebe::MemOperand> {
31 public:
operator()32     size_t operator()(const maplebe::MemOperand &x) const
33     {
34         std::size_t seed = 0;
35         hash_combine<uint8_t>(seed, x.GetAddrMode());
36         hash_combine<uint32_t>(seed, x.GetSize());
37         maplebe::RegOperand *xb = x.GetBaseRegister();
38         maplebe::RegOperand *xi = x.GetIndexRegister();
39         if (xb != nullptr) {
40             hash_combine<uint32_t>(seed, xb->GetRegisterNumber());
41             hash_combine<uint32_t>(seed, xb->GetSize());
42         }
43         if (xi != nullptr) {
44             hash_combine<uint32_t>(seed, xi->GetRegisterNumber());
45             hash_combine<uint32_t>(seed, xi->GetSize());
46         }
47         return seed;
48     }
49 };
50 }  // namespace std
51 #endif /* MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_OPERAND_H */
52