• 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 MAPLEIR_INCLUDE_MIRSYMBOLBUILDER_H
17 #define MAPLEIR_INCLUDE_MIRSYMBOLBUILDER_H
18 #include <string>
19 #include <utility>
20 #include <vector>
21 #include <map>
22 #include "opcodes.h"
23 #include "prim_types.h"
24 #include "mir_type.h"
25 #include "mir_const.h"
26 #include "mir_symbol.h"
27 #include "mir_nodes.h"
28 #include "mir_module.h"
29 #include "mir_preg.h"
30 #include "mir_function.h"
31 #include "printing.h"
32 #include "intrinsic_op.h"
33 #include "opcode_info.h"
34 #include "global_tables.h"
35 
36 namespace maple {
37 class MIRSymbolBuilder {
38 public:
Instance()39     static MIRSymbolBuilder &Instance()
40     {
41         static MIRSymbolBuilder builder;
42         return builder;
43     }
44 
45     MIRSymbol *GetLocalDecl(const MIRSymbolTable &symbolTable, const GStrIdx &strIdx) const;
46     MIRSymbol *CreateSymbol(TyIdx tyIdx, GStrIdx strIdx, MIRSymKind mClass, MIRStorageClass sClass, MIRFunction *func,
47                             uint8 scpID) const;
48     MIRSymbol *CreatePregFormalSymbol(TyIdx tyIdx, PregIdx pRegIdx, MIRFunction &func) const;
49 
50 private:
51     MIRSymbolBuilder() = default;
52     ~MIRSymbolBuilder() = default;
53     MIRSymbolBuilder(const MIRSymbolBuilder &) = delete;
54     MIRSymbolBuilder(const MIRSymbolBuilder &&) = delete;
55     MIRSymbolBuilder &operator=(const MIRSymbolBuilder &) = delete;
56     MIRSymbolBuilder &operator=(const MIRSymbolBuilder &&) = delete;
57 };
58 }  // namespace maple
59 #endif  // MAPLEIR_INCLUDE_MIRSYMBOLBUILDER_H
60