• 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 #include "option.h"
17 
18 namespace maple {
19 
20 bool Options::dumpBefore = false;
21 bool Options::dumpAfter = false;
22 std::string Options::dumpPhase = "";
23 std::string Options::dumpFunc = "*";
24 std::string Options::skipPhase;
25 std::string Options::skipFrom;
26 std::string Options::skipAfter;
27 bool Options::quiet = false;
28 bool Options::regNativeFunc = false;
29 bool Options::nativeWrapper = true;  // Enabled by default
30 bool Options::inlineWithProfile = false;
31 bool Options::useInline = true;  // Enabled by default
32 bool Options::enableIPAClone = true;
33 bool Options::useCrossModuleInline = true;  // Enabled by default
34 std::string Options::noInlineFuncList = "";
35 std::string Options::importFileList = "";
36 uint32 Options::inlineSmallFunctionThreshold = 80;  // Only for srcLangC, value will be reset later for other srcLang
37 uint32 Options::inlineHotFunctionThreshold = 100;   // Only for srcLangC, value will be reset later for other srcLang
38 uint32 Options::inlineRecursiveFunctionThreshold = 15;
39 uint32 Options::inlineDepth = 8;
40 uint32 Options::inlineModuleGrowth = 10;
41 uint32 Options::inlineColdFunctionThreshold = 3;
42 uint32 Options::profileHotCount = 1000;
43 uint32 Options::profileColdCount = 10;
44 uint32 Options::numOfCloneVersions = 2;
45 uint32 Options::numOfImpExprLowBound = 2;
46 uint32 Options::numOfImpExprHighBound = 5;
47 uint32 Options::numOfCallSiteLowBound = 2;
48 uint32 Options::numOfCallSiteUpBound = 10;
49 uint32 Options::numOfConstpropValue = 2;
50 bool Options::profileHotCountSeted = false;
51 bool Options::profileColdCountSeted = false;
52 uint32 Options::profileHotRate = 500000;
53 uint32 Options::profileColdRate = 900000;
54 bool Options::regNativeDynamicOnly = false;
55 std::string Options::staticBindingList;
56 bool Options::usePreg = false;
57 bool Options::mapleLinker = false;
58 bool Options::dumpMuidFile = false;
59 bool Options::emitVtableImpl = false;
60 bool Options::profileGen = false;
61 bool Options::profileUse = false;
62 bool Options::genLMBC = false;
63 
64 // Ready to be deleted.
65 bool Options::noRC = false;
66 bool Options::analyzeCtor = true;
67 bool Options::strictNaiveRC = false;
68 bool Options::gcOnly = false;
69 bool Options::bigEndian = false;
70 bool Options::rcOpt1 = true;
71 bool Options::nativeOpt = true;
72 bool Options::optForSize = false;
73 bool Options::O2 = false;
74 bool Options::noDot = false;
75 bool Options::genIRProfile = false;
76 bool Options::profileTest = false;
77 std::string Options::criticalNativeFile = "maple/mrt/codetricks/profile.pv/criticalNative.list";
78 std::string Options::fastNativeFile = "maple/mrt/codetricks/profile.pv/fastNative.list";
79 bool Options::barrier = false;
80 std::string Options::nativeFuncPropertyFile = "maple/mrt/codetricks/native_binding/native_func_property.list";
81 bool Options::mapleLinkerTransformLocal = true;
82 bool Options::partialAot = false;
83 uint32 Options::decoupleInit = 0;
84 uint32 Options::buildApp = kNoDecouple;
85 std::string Options::sourceMuid = "";
86 bool Options::decoupleSuper = false;
87 bool Options::deferredVisit = false;
88 bool Options::deferredVisit2 = false;
89 bool Options::genVtabAndItabForDecouple = false;
90 bool Options::profileFunc = false;
91 uint32 Options::parserOpt = 0;
92 std::string Options::dumpDevirtualList = "";
93 std::string Options::readDevirtualList = "";
94 bool Options::usePreloadedClass = false;
95 std::string Options::profile = "";
96 std::string Options::appPackageName = "";
97 bool Options::profileStaticFields = false;
98 std::string Options::proFileData = "";
99 std::string Options::proFileFuncData = "";
100 std::string Options::proFileClassData = "";
101 std::string Options::classLoaderInvocationList = "";  // maple/mrt/codetricks/profile.pv/classloaderInvocation.list
102 bool Options::dumpClassLoaderInvocation = false;
103 unsigned int Options::warningLevel = 0;
104 bool Options::lazyBinding = false;
105 bool Options::hotFix = false;
106 bool Options::compactMeta = false;
107 bool Options::genPGOReport = false;
108 bool Options::verify = false;
109 uint32 Options::inlineCache = 0;
110 bool Options::checkArrayStore = false;
111 bool Options::noComment = false;
112 bool Options::rmNoUseFunc = true;  // default remove no-used static function
113 bool Options::sideEffect = true;
114 bool Options::dumpIPA = false;
115 bool Options::wpaa = false;  // whole program alias analysis
116 
GetInstance()117 Options &Options::GetInstance()
118 {
119     static Options instance;
120     return instance;
121 }
122 
DumpOptions() const123 void Options::DumpOptions() const
124 {
125     LogInfo::MapleLogger() << "phase sequence : \t";
126     if (phaseSeq.empty()) {
127         LogInfo::MapleLogger() << "default phase sequence\n";
128     } else {
129         for (size_t i = 0; i < phaseSeq.size(); ++i) {
130             LogInfo::MapleLogger() << " " << phaseSeq[i];
131         }
132     }
133     LogInfo::MapleLogger() << "\n";
134 }
135 };  // namespace maple
136