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_ME_OPTION_H 17 #define MAPLE_ME_INCLUDE_ME_OPTION_H 18 #include <vector> 19 #include <string> 20 #include "mempool.h" 21 #include "mempool_allocator.h" 22 #include "mpl_options.h" 23 #include "types_def.h" 24 25 namespace maple { 26 class MeOption { 27 public: 28 static MeOption &GetInstance(); 29 30 ~MeOption() = default; 31 IsSkipPhase(const std::string & phaseName)32 static bool IsSkipPhase(const std::string &phaseName) 33 { 34 return !(skipPhases.find(phaseName) == skipPhases.end()); 35 } 36 37 static std::unordered_set<std::string> dumpPhases; 38 static std::unordered_set<std::string> skipPhases; 39 static std::string dumpFunc; 40 static bool quiet; 41 static bool noDot; 42 static bool stmtNum; 43 static bool rcLowering; 44 static bool noRC; 45 static bool optForSize; 46 static uint8 optLevel; 47 static bool enableLFO; 48 static bool unifyRets; 49 // safety check option begin 50 static SafetyCheckMode npeCheckMode; 51 static SafetyCheckMode boundaryCheckMode; 52 }; 53 #ifndef DEBUGFUNC_NEWPM 54 #define DEBUGFUNC_NEWPM(f) \ 55 (!MeOption::dumpPhases.empty() && MeOption::dumpPhases.find(PhaseName()) != MeOption::dumpPhases.end() && \ 56 (MeOption::dumpFunc.compare("*") == 0 || (f).GetName() == MeOption::dumpFunc)) 57 #endif 58 } // namespace maple 59 #endif // MAPLE_ME_INCLUDE_ME_OPTION_H 60