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_IR_INCLUDE_BIN_MPLT_H 17 #define MAPLE_IR_INCLUDE_BIN_MPLT_H 18 #include "mir_module.h" 19 #include "mir_nodes.h" 20 #include "mir_preg.h" 21 #include "parser_opt.h" 22 #include "bin_mpl_export.h" 23 #include "bin_mpl_import.h" 24 25 namespace maple { 26 class BinaryMplt { 27 public: BinaryMplt(MIRModule & md)28 explicit BinaryMplt(MIRModule &md) : mirModule(md), binImport(md), binExport(md) {} 29 30 virtual ~BinaryMplt() = default; 31 32 void Export(const std::string &suffix, std::unordered_set<std::string> *dumpFuncSet = nullptr) 33 { 34 binExport.Export(suffix, dumpFuncSet); 35 } 36 GetMod()37 const MIRModule &GetMod() const 38 { 39 return mirModule; 40 } 41 GetBinImport()42 BinaryMplImport &GetBinImport() 43 { 44 return binImport; 45 } 46 GetBinExport()47 BinaryMplExport &GetBinExport() 48 { 49 return binExport; 50 } 51 GetImportFileName()52 std::string &GetImportFileName() 53 { 54 return importFileName; 55 } 56 SetImportFileName(const std::string & fileName)57 void SetImportFileName(const std::string &fileName) 58 { 59 importFileName = fileName; 60 } 61 62 private: 63 MIRModule &mirModule; 64 BinaryMplImport binImport; 65 BinaryMplExport binExport; 66 std::string importFileName; 67 }; 68 } // namespace maple 69 #endif // MAPLE_IR_INCLUDE_BIN_MPLT_H 70