• 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 MAPLE_ME_INCLUDE_PME_MIR_EXTENSION_H_
17 #define MAPLE_ME_INCLUDE_PME_MIR_EXTENSION_H_
18 #include "me_ir.h"
19 #include "mir_nodes.h"
20 
21 namespace maple {
22 class PreMeMIRExtension {
23 public:
24     BaseNode *parent;
25     union {
26         MeExpr *meexpr;
27         MeStmt *mestmt;
28     };
29 
PreMeMIRExtension(BaseNode * p)30     explicit PreMeMIRExtension(BaseNode *p) : parent(p), meexpr(nullptr) {}
PreMeMIRExtension(BaseNode * p,MeExpr * expr)31     PreMeMIRExtension(BaseNode *p, MeExpr *expr) : parent(p), meexpr(expr) {}
PreMeMIRExtension(BaseNode * p,MeStmt * stmt)32     PreMeMIRExtension(BaseNode *p, MeStmt *stmt) : parent(p), mestmt(stmt) {}
33     virtual ~PreMeMIRExtension() = default;
GetParent()34     BaseNode *GetParent()
35     {
36         return parent;
37     }
GetMeExpr()38     MeExpr *GetMeExpr()
39     {
40         return meexpr;
41     }
GetMeStmt()42     MeStmt *GetMeStmt()
43     {
44         return mestmt;
45     }
SetParent(BaseNode * p)46     void SetParent(BaseNode *p)
47     {
48         parent = p;
49     }
50 };
51 }  // namespace maple
52 #endif  // MAPLE_ME_INCLUDE_PME_MIR_EXTENSION_H_
53