• 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_VISITOR_COMMON_H
17 #define MAPLEBE_INCLUDE_CG_VISITOR_COMMON_H
18 namespace maplebe {
19 class OperandVisitorBase {
20 public:
21     virtual ~OperandVisitorBase() = default;
22 };
23 
24 template <typename Visitable>
25 class OperandVisitor {
26 public:
27     virtual ~OperandVisitor() = default;
28     virtual void Visit(Visitable *v) = 0;
29 };
30 
31 template <typename... V>
32 class OperandVisitors {
33 public:
34     virtual ~OperandVisitors() = default;
35 };
36 
37 template <typename OpV1, typename OpV2, typename... OpV3>
38 class OperandVisitors<OpV1, OpV2, OpV3...>
39     : public OperandVisitor<OpV1>, public OperandVisitor<OpV2>, public OperandVisitor<OpV3>... {
40 };
41 } /* namespace maplebe */
42 #endif /* MAPLEBE_INCLUDE_CG_VISITOR_COMMON_H */
43