diff --git a/Makefile b/Makefile index e5e8d5e5694b5c04d63f8f7cfd4d98b5f86cca0c..0f13696858cdb3bdc1d35b3af3ed3a02e034c5e4 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ clean: define build_gn mkdir -p ${INSTALL_DIR}; \ - $(GN) gen ${INSTALL_DIR} --args='$(1)'; \ + $(GN) gen ${INSTALL_DIR} --args='$(1)' --export-compile-commands; \ cd ${INSTALL_DIR}; \ $(NINJA) -v $(2); endef diff --git a/src/bin/jbc2mpl b/src/bin/jbc2mpl index dcd7679c7368efec9bd6cb2f5e77881b0d6b0874..486d303897764f83aa44f7d0d064f8775c476b4a 100755 Binary files a/src/bin/jbc2mpl and b/src/bin/jbc2mpl differ diff --git a/src/bin/maple b/src/bin/maple index 8804d2c34b8c3f296f4984117a03fe3d2dbf8363..a2fa7707ed662a61f741e18022677da2ab80196f 100755 Binary files a/src/bin/maple and b/src/bin/maple differ diff --git a/src/deplibs/libmplphase.a b/src/deplibs/libmplphase.a index 3948955a14d609c1ab3234140e4df415018f77e1..129c7d577b4c51496661e1037ce41fc8b6c5f603 100644 Binary files a/src/deplibs/libmplphase.a and b/src/deplibs/libmplphase.a differ diff --git a/src/deplibs/libmplutil.a b/src/deplibs/libmplutil.a index 87ca3e6fbb4f3f331ebc32da081cc729dccca0f4..290717c1fa09514939724c735844a3b9ab509677 100644 Binary files a/src/deplibs/libmplutil.a and b/src/deplibs/libmplutil.a differ diff --git a/src/maple_driver/include/compiler.h b/src/maple_driver/include/compiler.h index 3e392f5587112a9d0867f42e73aa5a0f7ad7de2c..58a598ef6dcc3defcfc8b8801c73ef22c6872a4b 100644 --- a/src/maple_driver/include/compiler.h +++ b/src/maple_driver/include/compiler.h @@ -39,13 +39,13 @@ class Compiler { virtual ErrorCode Compile(const MplOptions &options, MIRModulePtr &theModule); - virtual void GetTmpFilesToDelete(const MplOptions &mplOptions, std::vector &tempFiles) const {} + virtual void GetTmpFilesToDelete(const MplOptions&, std::vector&) const {} - virtual std::unordered_set GetFinalOutputs(const MplOptions &mplOptions) const { + virtual std::unordered_set GetFinalOutputs(const MplOptions&) const { return std::unordered_set(); } - virtual void PrintCommand(const MplOptions &options) const {} + virtual void PrintCommand(const MplOptions&) const {} protected: virtual std::string GetBinPath(const MplOptions &mplOptions) const; @@ -61,11 +61,11 @@ class Compiler { return stream.str(); } - virtual DefaultOption GetDefaultOptions(const MplOptions &options) const { + virtual DefaultOption GetDefaultOptions(const MplOptions&) const { return DefaultOption(); } - virtual std::string AppendSpecialOption(const MplOptions &options, const std::string &optionStr) const { + virtual std::string AppendSpecialOption(const MplOptions&, const std::string &optionStr) const { return optionStr; } diff --git a/src/maple_driver/include/compiler_selector.h b/src/maple_driver/include/compiler_selector.h index 60ade7ccd7bed278c84ffbe1f970817e613b9c39..42dba2a27583c063d96d59dc2dd14036326f3b08 100644 --- a/src/maple_driver/include/compiler_selector.h +++ b/src/maple_driver/include/compiler_selector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -27,8 +27,7 @@ class CompilerSelector { virtual ~CompilerSelector() = default; - virtual ErrorCode Select(const SupportedCompilers &supportedCompilers, const MplOptions &mplOptions, - std::vector &selected) const { + virtual ErrorCode Select(const SupportedCompilers&, const MplOptions&, std::vector&) const { return kErrorToolNotFound; } }; diff --git a/src/maple_driver/src/compiler.cpp b/src/maple_driver/src/compiler.cpp index 72d09f00ddd5ce9fff11ae52db9f9d94a97e3aac..1d8b171fc07593f5cba2f27b0d0444599d174863 100644 --- a/src/maple_driver/src/compiler.cpp +++ b/src/maple_driver/src/compiler.cpp @@ -42,7 +42,7 @@ std::string Compiler::GetBinPath(const MplOptions &mplOptions) const { return binPath; } -ErrorCode Compiler::Compile(const MplOptions &options, MIRModulePtr &theModule) { +ErrorCode Compiler::Compile(const MplOptions &options, MIRModulePtr&) { MPLTimer timer = MPLTimer(); LogInfo::MapleLogger() << "Starting " << GetName() << '\n'; timer.Start(); diff --git a/src/maple_driver/src/driver_runner.cpp b/src/maple_driver/src/driver_runner.cpp index 0f82d396a34f18aaf4392095f56bfd413f324399..b2be28e6e00f0eece657261005a465b40609ffcf 100644 --- a/src/maple_driver/src/driver_runner.cpp +++ b/src/maple_driver/src/driver_runner.cpp @@ -130,7 +130,7 @@ ErrorCode DriverRunner::ParseInput(const std::string &outputFile, const std::str void DriverRunner::ProcessMpl2mplAndMePhases(const std::string &outputFile, const std::string &vtableImplFile) const { CHECK_MODULE(); - + theMIRModule = theModule; if (mpl2mplOptions != nullptr || meOptions != nullptr) { LogInfo::MapleLogger() << "Processing mpl2mpl&mplme" << '\n'; MPLTimer timer; diff --git a/src/maple_driver/src/jbc2mpl_compiler.cpp b/src/maple_driver/src/jbc2mpl_compiler.cpp index ddb9488f50ba883456e8fb03ce82b409d3c091e9..56e60214692992ec4fc5820ddc5f9e2fb1e7f318 100644 --- a/src/maple_driver/src/jbc2mpl_compiler.cpp +++ b/src/maple_driver/src/jbc2mpl_compiler.cpp @@ -21,7 +21,7 @@ const std::string &Jbc2MplCompiler::GetBinName() const { return kBinNameJbc2mpl; } -DefaultOption Jbc2MplCompiler::GetDefaultOptions(const MplOptions &options) const { +DefaultOption Jbc2MplCompiler::GetDefaultOptions(const MplOptions&) const { DefaultOption defaultOptions = { nullptr, 0 }; return defaultOptions; } diff --git a/src/maple_driver/src/mpl_options.cpp b/src/maple_driver/src/mpl_options.cpp index 37cea78321fe6b0c78027e6d9abf75e000cd95e2..6f5a0ffe80090a69fee9494c81f93c6a7d7363b4 100644 --- a/src/maple_driver/src/mpl_options.cpp +++ b/src/maple_driver/src/mpl_options.cpp @@ -41,7 +41,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, "USAGE: maple [options]\n\n Options:", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kHelp, 0, "h", @@ -53,7 +53,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyOptional, " -h --help [command] \tPrint usage and exit.\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kVersion, 0, nullptr, @@ -65,7 +65,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyOptional, " --version [command] \tPrint version and exit.\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kInFile, 0, nullptr, @@ -77,7 +77,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --infile file1,file2,file3 \tInput files.\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kInMplt, 0, nullptr, @@ -103,7 +103,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " -O0 \tNo optimization.\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMeOpt, 0, nullptr, @@ -115,7 +115,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " --me-opt \tSet options for me\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplOpt, 0, nullptr, @@ -127,7 +127,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " --mpl2mpl-opt \tSet options for mpl2mpl\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kSaveTemps, 0, nullptr, @@ -142,7 +142,7 @@ const mapleOption::Descriptor USAGES[] = { " \t--save-temps=file1,file2,file3 Save the\n" " \ttarget files.\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kRun, 0, nullptr, @@ -159,7 +159,7 @@ const mapleOption::Descriptor USAGES[] = { " \tInput file must match the tool can\n" " \thandle\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kOption, 0, nullptr, @@ -174,7 +174,7 @@ const mapleOption::Descriptor USAGES[] = { " \tThe sequence must match the sequence in\n" " \t--run.\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kTimePhases, 0, "time-phases", @@ -186,7 +186,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " -time-phases \tTiming phases and print percentages\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kGenMeMpl, 0, nullptr, @@ -198,7 +198,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " --genmempl \tGenerate me.mpl file\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kGenVtableImpl, 0, nullptr, @@ -210,7 +210,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " --genVtableImpl \tGenerate VtableImpl.mpl file\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kVerify, 0, nullptr, @@ -222,7 +222,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " --verify \tVerify mpl file\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kAllDebug, 0, nullptr, @@ -234,7 +234,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " --debug \tPrint debug info.\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, // jbc2mpl { kUseStringFactory, 0, @@ -247,7 +247,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, " -use-string-factory \tReplace String. by StringFactory call\n", "jbc2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kJbc2mplOutMpl, 0, "o", @@ -259,7 +259,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " -o, -out=output.mpl \toutput mpl name\n", "jbc2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, // me { kMeHelp, 0, @@ -273,7 +273,7 @@ const mapleOption::Descriptor USAGES[] = { " -h-me --help-me \tPrint usage and exit.Available command names:\n" " \tme\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMeRange, 0, nullptr, @@ -286,7 +286,7 @@ const mapleOption::Descriptor USAGES[] = { " --range \tOptimize only functions in the range [NUM0, NUM1]\n" " \t--range=NUM0,NUM1\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMeDumpPhases, 0, nullptr, @@ -299,7 +299,7 @@ const mapleOption::Descriptor USAGES[] = { " --dump-phases \tEnable debug trace for specified phases in the comma separated list\n" " \t--dump-phases=PHASENAME,...\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMeSkipPhases, 0, nullptr, @@ -312,7 +312,7 @@ const mapleOption::Descriptor USAGES[] = { " --skip-phases \tSkip the phases specified in the comma separated list\n" " \t--skip-phases=PHASENAME,...\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMeDumpFunc, 0, nullptr, @@ -326,7 +326,7 @@ const mapleOption::Descriptor USAGES[] = { " \t(can only specify once)\n" " \t--dump-func=FUNCNAME\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMeQuiet, kEnable, nullptr, @@ -339,7 +339,7 @@ const mapleOption::Descriptor USAGES[] = { " --quiet \tDisable brief trace messages with phase/function names\n" " --no-quiet \tEnable brief trace messages with phase/function names\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMeNoDot, kEnable, nullptr, @@ -352,7 +352,7 @@ const mapleOption::Descriptor USAGES[] = { " --nodot \tDisable dot file generation from cfg\n" " --no-nodot \tEnable dot file generation from cfg\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kSetCalleeHasSideEffect, kEnable, nullptr, @@ -365,7 +365,7 @@ const mapleOption::Descriptor USAGES[] = { " --setCalleeHasSideEffect \tSet all the callees have side effect\n" " --no-setCalleeHasSideEffect \tNot set all the callees have side effect\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kNoSteensgaard, kEnable, nullptr, @@ -378,7 +378,7 @@ const mapleOption::Descriptor USAGES[] = { " --noSteensgaard \tDisable Steensgaard-style alias analysis\n" " --no-noSteensgaard \tEnable Steensgaard-style alias analysis\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kNoTBAA, kEnable, nullptr, @@ -391,7 +391,7 @@ const mapleOption::Descriptor USAGES[] = { " --noTBAA \tDisable type-based alias analysis\n" " --no-noTBAA \tEnable type-based alias analysis\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kAliasAnalysisLevel, 0, nullptr, @@ -407,7 +407,7 @@ const mapleOption::Descriptor USAGES[] = { " \t3: Steensgaard-style and type-based alias analysis\n" " \t--aliasAnalysisLevel=NUM\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kStmtNum, kEnable, nullptr, @@ -420,7 +420,7 @@ const mapleOption::Descriptor USAGES[] = { " --stmtnum \tPrint MeStmt index number in IR dump\n" " --no-stmtnum \tDon't print MeStmt index number in IR dump\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMeDumpAfter, kEnable, nullptr, @@ -433,7 +433,7 @@ const mapleOption::Descriptor USAGES[] = { " --dump-after \tDo extra IR dump after the specified phase in me\n" " --no-dump-after \tDo not extra IR dump after the specified phase in me\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kLessThrowAlias, kEnable, nullptr, @@ -446,7 +446,7 @@ const mapleOption::Descriptor USAGES[] = { " --lessthrowalias \tHandle aliases at java throw statements more accurately\n" " --no-lessthrowalias \tDisable lessthrowalias\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kRegReadAtReturn, kEnable, nullptr, @@ -459,7 +459,7 @@ const mapleOption::Descriptor USAGES[] = { " --regreadatreturn \tAllow register promotion to promote the operand of return statements\n" " --no-regreadatreturn \tDisable regreadatreturn\n", "me", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, // mpl2mpl { kMpl2MplHelp, 0, @@ -473,7 +473,7 @@ const mapleOption::Descriptor USAGES[] = { " -h-mpl2mpl --help-mpl2mpl \tPrint usage and exit.Available command names:\n" " \tmpl2mpl\n", "all", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplDumpPhase, 0, nullptr, @@ -486,7 +486,7 @@ const mapleOption::Descriptor USAGES[] = { " --dump-phase \tEnable debug trace for specified phase (can only specify once)\n" " \t--dump-phase=PHASENAME\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplSkipPhase, 0, nullptr, @@ -499,7 +499,7 @@ const mapleOption::Descriptor USAGES[] = { " --skip-phase \tSkip the phase when adding it to phase manager\n" " \t--skip-phase=PHASENAME\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplSkipFrom, 0, nullptr, @@ -512,7 +512,7 @@ const mapleOption::Descriptor USAGES[] = { " --skip-from \tSkip all remaining phases including PHASENAME\n" " \t--skip-from=PHASENAME\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplSkipAfter, 0, nullptr, @@ -525,7 +525,7 @@ const mapleOption::Descriptor USAGES[] = { " --skip-after \tSkip all remaining phases after PHASENAME\n" " \t--skip-after=PHASENAME\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplDumpFunc, 0, nullptr, @@ -539,7 +539,7 @@ const mapleOption::Descriptor USAGES[] = { " \t(can only specify once)\n" " \t--dump-func=FUNCNAME\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplQuiet, kEnable, nullptr, @@ -552,7 +552,7 @@ const mapleOption::Descriptor USAGES[] = { " --quiet \tDisable brief trace messages with phase/function names\n" " --no-quiet \tEnable brief trace messages with phase/function names\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplMapleLinker, kEnable, nullptr, @@ -565,7 +565,7 @@ const mapleOption::Descriptor USAGES[] = { " --maplelinker \tGenerate MUID symbol tables and references\n" " --no-maplelinker \tDon't Generate MUID symbol tables and references\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplStubJniFunc, kEnable, nullptr, @@ -578,7 +578,7 @@ const mapleOption::Descriptor USAGES[] = { " --regnativefunc \tGenerate native stub function to support JNI registration and calling\n" " --no-regnativefunc \tDisable regnativefunc\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kInlineWithProfile, kEnable, nullptr, @@ -591,7 +591,7 @@ const mapleOption::Descriptor USAGES[] = { " --inline-with-profile \tEnable profile-based inlining\n" " --no-inline-with-profile \tDisable profile-based inlining\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplUseInline, kEnable, nullptr, @@ -604,7 +604,7 @@ const mapleOption::Descriptor USAGES[] = { " --inline \tEnable function inlining\n" " --no-inline \tDisable function inlining\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplNoInlineFuncList, 0, nullptr, @@ -616,7 +616,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --no-inlinefunclist=list \tDo not inline function in this list\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplUseCrossModuleInline, kEnable, nullptr, @@ -629,7 +629,7 @@ const mapleOption::Descriptor USAGES[] = { " --cross-module-inline \tEnable cross-module inlining\n" " --no-cross-module-inline \tDisable cross-module inlining\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kInlineSmallFunctionThreshold, 0, nullptr, @@ -641,7 +641,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --inline-small-function-threshold=15 \tThreshold for inlining small function\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kInlineHotFunctionThreshold, 0, nullptr, @@ -653,7 +653,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --inline-hot-function-threshold=30 \tThreshold for inlining hot function\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kInlineModuleGrowth, 0, nullptr, @@ -665,7 +665,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --inline-module-growth=100000 \tThreshold for maxmium code size growth rate (10%)\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kInlineColdFunctionThreshold, 0, nullptr, @@ -677,7 +677,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --inline-cold-function-threshold=3 \tThreshold for inlining hot function\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kProfileHotCount, 0, nullptr, @@ -689,7 +689,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --profile-hot-count=1000 \tA count is regarded as hot if it exceeds this number\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kProfileColdCount, 0, nullptr, @@ -701,7 +701,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --profile-cold-count=10 \tA count is regarded as cold if it is below this number\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kProfileHotRate, 0, nullptr, @@ -713,7 +713,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --profile-hot-rate=500000 \tA count is regarded as hot if it is in the largest 50%\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kProfileColdRate, 0, nullptr, @@ -725,7 +725,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyRequired, " --profile-cold-rate=900000 \tA count is regarded as cold if it is in the smallest 10%\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kNativeWrapper, kEnable, nullptr, @@ -737,7 +737,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyBool, " --nativewrapper \tGenerate native wrappers [default]\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kRegNativeDynamicOnly, kEnable, nullptr, @@ -750,7 +750,7 @@ const mapleOption::Descriptor USAGES[] = { " --regnative-dynamic-only \tOnly Generate dynamic register code, Report Fatal Msg if no implemented\n" " --no-regnative-dynamic-only \tDisable regnative-dynamic-only\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kRegNativeStaticBindingList, 0, nullptr, @@ -763,7 +763,7 @@ const mapleOption::Descriptor USAGES[] = { " --static-bindig-list \tOnly Generate static binding function in file configure list\n" " \t--static-bindig-list=file\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplDumpBefore, kEnable, nullptr, @@ -776,7 +776,7 @@ const mapleOption::Descriptor USAGES[] = { " --dump-before \tDo extra IR dump before the specified phase\n" " --no-dump-before \tDon't extra IR dump before the specified phase\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMpl2MplDumpAfter, kEnable, nullptr, @@ -789,7 +789,7 @@ const mapleOption::Descriptor USAGES[] = { " --dump-after \tDo extra IR dump after the specified phase\n" " --no-dump-after \tDon't extra IR dump after the specified phase\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kMplnkDumpMuid, kEnable, nullptr, @@ -802,7 +802,7 @@ const mapleOption::Descriptor USAGES[] = { " --dump-muid \tDump MUID def information into a .muid file\n" " --no-dump-muid \tDon't dump MUID def information into a .muid file\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kEmitVtableImpl, kEnable, nullptr, @@ -815,7 +815,7 @@ const mapleOption::Descriptor USAGES[] = { " --emitVtableImpl \tgenerate VtableImpl file\n" " --no-emitVtableImpl \tDon't generate VtableImpl file\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, #if MIR_JAVA { kMpl2MplSkipVirtual, kEnable, @@ -829,7 +829,7 @@ const mapleOption::Descriptor USAGES[] = { " --skipvirtual\n" " --no-skipvirtual\n", "mpl2mpl", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, #endif // mplcg { kPie, @@ -843,7 +843,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyBool, " --pie \tGenerate position-independent executable\n", "mplcg", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kPic, kEnable, nullptr, @@ -855,7 +855,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyBool, " --fpic \tGenerate position-independent shared library\n", "mplcg", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kVerbose, kEnable, nullptr, @@ -867,7 +867,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyBool, " --verbose-asm \tAdd comments to asm output\n", "mplcg", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kCGMapleLinker, kEnable, nullptr, @@ -879,7 +879,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyBool, " --maplelinker \tGenerate the MapleLinker .s format\n", "mplcg", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kCGQuiet, kEnable, nullptr, @@ -891,7 +891,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyBool, " --quiet \tBe quiet (don't output debug messages)\n", "mplcg", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kDuplicateToDelPlt, 0, nullptr, @@ -904,7 +904,7 @@ const mapleOption::Descriptor USAGES[] = { " --duplicate_asm_list \tDuplicate asm functions to delete plt call\n" " \t--duplicate_asm_list=list_file\n", "mplcg", - { { nullptr } } }, + { { nullptr, nullptr, nullptr, nullptr } } }, { kUnknown, 0, @@ -917,7 +917,7 @@ const mapleOption::Descriptor USAGES[] = { mapleOption::ArgCheckPolicy::kArgCheckPolicyNone, nullptr, "", - { { nullptr } } } + { { nullptr, nullptr, nullptr, nullptr } } } }; } // namepsace diff --git a/src/maple_driver/src/option_parser.cpp b/src/maple_driver/src/option_parser.cpp index a9135de5d0d29878b7c763ec25950c0d3925cee7..bbd4031073ac4cf78fab77e2c6f8eba2818ddf7e 100644 --- a/src/maple_driver/src/option_parser.cpp +++ b/src/maple_driver/src/option_parser.cpp @@ -56,7 +56,7 @@ void OptionParser::InsertExtraUsage(const Descriptor &usage) { usage.checkPolicy, usage.help, usage.extras[index].exeName, - { { nullptr } } }; + { { nullptr, nullptr, nullptr, nullptr } } }; if (usage.shortOption != nullptr) { InsertOption(std::string(usage.shortOption), tempUsage); } diff --git a/src/maple_ir/include/bin_mpl_export.h b/src/maple_ir/include/bin_mpl_export.h index 54279d0b396f90e13415ebdafb8fc9cad36b085e..f0837a3ebb720bebbe29dfba593595ecac5c6168 100644 --- a/src/maple_ir/include/bin_mpl_export.h +++ b/src/maple_ir/include/bin_mpl_export.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/maple_ir/include/bin_mpl_import.h b/src/maple_ir/include/bin_mpl_import.h index d2fa50296a7d86579c332d8e7df7030e37af381d..b9c9e2cae0fec0dc196bf83b8c775653a9290f79 100644 --- a/src/maple_ir/include/bin_mpl_import.h +++ b/src/maple_ir/include/bin_mpl_import.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/maple_ir/include/global_tables.h b/src/maple_ir/include/global_tables.h index ab84ee8c92a7291455be542c177223cd0b8d2fe3..e6619dd38bc6132f1a8fe3e3df6b3edae4cfd7f5 100644 --- a/src/maple_ir/include/global_tables.h +++ b/src/maple_ir/include/global_tables.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -371,7 +371,7 @@ class StringTable { U GetOrCreateStrIdxFromName(const T &str) { U strIdx = GetStrIdxFromName(str); - if (strIdx == 0) { + if (strIdx == 0u) { strIdx.reset(stringTable.size()); T *newStr = new T(str); stringTable.push_back(newStr); diff --git a/src/maple_ir/include/ir_safe_cast_traits.def b/src/maple_ir/include/ir_safe_cast_traits.def index 44819a552801cb887e18df5c6bc1d28a178ddb08..41df471f718a12b12cbb7eaafc80b8f741cc0df3 100644 --- a/src/maple_ir/include/ir_safe_cast_traits.def +++ b/src/maple_ir/include/ir_safe_cast_traits.def @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -237,7 +237,7 @@ REGISTER_SAFE_CAST(CallinstantNode, from.GetOpCode() == OP_callinstant || from.GetOpCode() == OP_virtualcallinstantassigned || from.GetOpCode() == OP_superclasscallinstantassigned || from.GetOpCode() == OP_interfacecallinstantassigned); -REGISTER_SAFE_CAST(AssertStmtNode, false); +// None of the base can be casted to AssertStmtNode REGISTER_SAFE_CAST(LabelNode, from.GetOpCode() == OP_label); REGISTER_SAFE_CAST(CommentNode, from.GetOpCode() == OP_comment); #endif diff --git a/src/maple_ir/include/mir_builder.h b/src/maple_ir/include/mir_builder.h index 8203754f277f928d9e206df5fac1cb551e4cb612..a54a66b35b0435c18d41746ab77dc353d71ca7ef 100644 --- a/src/maple_ir/include/mir_builder.h +++ b/src/maple_ir/include/mir_builder.h @@ -135,7 +135,7 @@ class MIRBuilder { MIRFunction *CreateFunction(const std::string &name, const MIRType &returnType, const ArgVector &arguments, bool isVarg = false, bool createBody = true) const; MIRFunction *CreateFunction(StIdx stIdx, bool addToTable = true) const; - virtual void UpdateFunction(MIRFunction &func, const MIRType *returnType, const ArgVector &arguments) {} + virtual void UpdateFunction(MIRFunction&, const MIRType*, const ArgVector&) {} MIRSymbol *GetSymbolFromEnclosingScope(StIdx stIdx) const; virtual MIRSymbol *GetOrCreateLocalDecl(const std::string &str, const MIRType &type); diff --git a/src/maple_ir/include/mir_function.h b/src/maple_ir/include/mir_function.h index d98b82ced7b85987dd6dbec0c6fc53bc78085184..0e2c130afd7764d781ed4d1f37fea6f3e80ad515 100644 --- a/src/maple_ir/include/mir_function.h +++ b/src/maple_ir/include/mir_function.h @@ -367,7 +367,7 @@ class MIRFunction { // tell whether this function is a Java method bool IsJava() const { - return classTyIdx != 0; + return classTyIdx != 0u; } const MIRType *GetNodeType(const BaseNode &node) const; diff --git a/src/maple_ir/include/mir_nodes.h b/src/maple_ir/include/mir_nodes.h index 1190b8bfac9f70f514ef22944291315b936b9c11..1e491385421d4cc938d78899ecf96209ef52e370 100644 --- a/src/maple_ir/include/mir_nodes.h +++ b/src/maple_ir/include/mir_nodes.h @@ -95,14 +95,14 @@ class BaseNode { return allocator.GetMemPool()->New(*this); } - virtual void DumpBase(const MIRModule &mod, int32 indent) const; + virtual void DumpBase(int32 indent) const; - virtual void Dump(const MIRModule &mod, int32 indent) const { - DumpBase(mod, indent); + virtual void Dump(int32 indent) const { + DumpBase(indent); } - void Dump(const MIRModule &mod) const { - Dump(mod, 0); + void Dump() const { + Dump(0); LogInfo::MapleLogger() << '\n'; } @@ -207,7 +207,7 @@ class UnaryNode : public BaseNode { virtual ~UnaryNode() override = default; void DumpOpnd(const MIRModule &mod, int32 indent) const; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; UnaryNode *CloneTree(MapleAllocator &allocator) const override { @@ -252,7 +252,7 @@ class TypeCvtNode : public UnaryNode { virtual ~TypeCvtNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; TypeCvtNode *CloneTree(MapleAllocator &allocator) const override { @@ -284,9 +284,9 @@ class RetypeNode : public TypeCvtNode { : TypeCvtNode(OP_retype, typ, fromtyp, expr), tyIdx(idx) {} virtual ~RetypeNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; + void Dump(int32 indent) const override; - RetypeNode *CloneTree(MapleAllocator &allocator) const { + RetypeNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetOpnd(Opnd()->CloneTree(allocator)); return node; @@ -319,7 +319,7 @@ class ExtractbitsNode : public UnaryNode { virtual ~ExtractbitsNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; ExtractbitsNode *CloneTree(MapleAllocator &allocator) const override { @@ -357,7 +357,7 @@ class GCMallocNode : public BaseNode { virtual ~GCMallocNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; GCMallocNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); @@ -393,7 +393,7 @@ class JarrayMallocNode : public UnaryNode { virtual ~JarrayMallocNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; JarrayMallocNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); @@ -426,7 +426,7 @@ class IreadNode : public UnaryNode { : UnaryNode(o, typ, expr), tyIdx(typeIdx), fieldID(fid) {} virtual ~IreadNode() = default; - virtual void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; IreadNode *CloneTree(MapleAllocator &allocator) const override { @@ -478,10 +478,10 @@ class IreadoffNode : public UnaryNode { virtual ~IreadoffNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; + void Dump(int32 indent) const override; + bool Verify() const override; - IreadoffNode *CloneTree(MapleAllocator &allocator) const { + IreadoffNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetOpnd(Opnd()->CloneTree(allocator)); return node; @@ -507,7 +507,7 @@ class IreadFPoffNode : public BaseNode { virtual ~IreadFPoffNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; IreadFPoffNode *CloneTree(MapleAllocator &allocator) const override { @@ -531,7 +531,7 @@ class BinaryOpnds { public: virtual ~BinaryOpnds() = default; - virtual void Dump(const MIRModule &mod, int32 indent) const; + virtual void Dump(int32 indent) const; BaseNode *GetBOpnd(int32 i) const { CHECK_FATAL(i >= 0 && i < kOperandNumBinary, "Invalid operand idx in BinaryOpnds"); @@ -560,8 +560,8 @@ class BinaryNode : public BaseNode, public BinaryOpnds { virtual ~BinaryNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; - void Dump(const MIRModule &mod) const; + void Dump(int32 indent) const override; + void Dump() const; bool Verify() const override; BinaryNode *CloneTree(MapleAllocator &allocator) const override { @@ -620,11 +620,11 @@ class CompareNode : public BinaryNode { virtual ~CompareNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - void Dump(const MIRModule &mod) const; - bool Verify() const; + void Dump(int32 indent) const override; + void Dump() const; + bool Verify() const override; - CompareNode *CloneTree(MapleAllocator &allocator) const { + CompareNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetBOpnd(GetBOpnd(0)->CloneTree(allocator), 0); node->SetBOpnd(GetBOpnd(1)->CloneTree(allocator), 1); @@ -654,7 +654,7 @@ class DepositbitsNode : public BinaryNode { virtual ~DepositbitsNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; DepositbitsNode *CloneTree(MapleAllocator &allocator) const override { @@ -701,9 +701,9 @@ class ResolveFuncNode : public BinaryNode { virtual ~ResolveFuncNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; + void Dump(int32 indent) const override; - ResolveFuncNode *CloneTree(MapleAllocator &allocator) const { + ResolveFuncNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetBOpnd(GetBOpnd(0)->CloneTree(allocator), 0); node->SetBOpnd(GetBOpnd(1)->CloneTree(allocator), 1); @@ -744,7 +744,7 @@ class TernaryNode : public BaseNode { virtual ~TernaryNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; TernaryNode *CloneTree(MapleAllocator &allocator) const override { @@ -787,7 +787,7 @@ class NaryOpnds { virtual ~NaryOpnds() = default; - virtual void Dump(const MIRModule &mod, int32 indent) const; + virtual void Dump(int32 indent) const; bool VerifyOpnds() const; const MapleVector &GetNopnd() const { @@ -839,7 +839,7 @@ class NaryNode : public BaseNode, public NaryOpnds { NaryNode &operator=(const NaryNode &node) = delete; virtual ~NaryNode() = default; - virtual void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; NaryNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); @@ -900,10 +900,10 @@ class IntrinsicopNode : public NaryNode { IntrinsicopNode &operator=(const IntrinsicopNode &node) = delete; virtual ~IntrinsicopNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; + void Dump(int32 indent) const override; + bool Verify() const override; - IntrinsicopNode *CloneTree(MapleAllocator &allocator) const { + IntrinsicopNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); for (size_t i = 0; i < GetNopndSize(); ++i) { node->GetNopnd().push_back(GetNopndAt(i)->CloneTree(allocator)); @@ -948,7 +948,7 @@ class ConstvalNode : public BaseNode { ConstvalNode(PrimType typ, MIRConst *constv) : BaseNode(OP_constval, typ, 0), constVal(constv) {} virtual ~ConstvalNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; ConstvalNode *CloneTree(MapleAllocator &allocator) const override { return allocator.GetMemPool()->New(*this); @@ -980,7 +980,7 @@ class ConststrNode : public BaseNode { virtual ~ConststrNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; ConststrNode *CloneTree(MapleAllocator &allocator) const override { return allocator.GetMemPool()->New(*this); @@ -1008,7 +1008,7 @@ class Conststr16Node : public BaseNode { virtual ~Conststr16Node() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; Conststr16Node *CloneTree(MapleAllocator &allocator) const override { return allocator.GetMemPool()->New(*this); @@ -1036,7 +1036,7 @@ class SizeoftypeNode : public BaseNode { virtual ~SizeoftypeNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; SizeoftypeNode *CloneTree(MapleAllocator &allocator) const override { @@ -1066,7 +1066,7 @@ class FieldsDistNode : public BaseNode { virtual ~FieldsDistNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; FieldsDistNode *CloneTree(MapleAllocator &allocator) const override { return allocator.GetMemPool()->New(*this); @@ -1128,16 +1128,16 @@ class ArrayNode : public NaryNode { ArrayNode &operator=(const ArrayNode &node) = delete; virtual ~ArrayNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; + void Dump(int32 indent) const override; + bool Verify() const override; bool IsSameBase(ArrayNode*); - uint8 NumOpnds() const { + uint8 NumOpnds() const override { ASSERT(numOpnds == GetNopndSize(), "ArrayNode has wrong numOpnds field"); return GetNopndSize(); } - ArrayNode *CloneTree(MapleAllocator &allocator) const { + ArrayNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); for (size_t i = 0; i < GetNopndSize(); ++i) { node->GetNopnd().push_back(GetNopndAt(i)->CloneTree(allocator)); @@ -1192,7 +1192,7 @@ class AddrofNode : public BaseNode { virtual ~AddrofNode() = default; - virtual void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; bool CheckNode(const MIRModule &mod) const; @@ -1240,7 +1240,7 @@ class RegreadNode : public BaseNode { virtual ~RegreadNode() = default; - virtual void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; RegreadNode *CloneTree(MapleAllocator &allocator) const override { @@ -1266,7 +1266,7 @@ class AddroffuncNode : public BaseNode { virtual ~AddroffuncNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; AddroffuncNode *CloneTree(MapleAllocator &allocator) const override { @@ -1293,7 +1293,7 @@ class AddroflabelNode : public BaseNode { virtual ~AddroflabelNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; AddroflabelNode *CloneTree(MapleAllocator &allocator) const override { @@ -1408,9 +1408,9 @@ class StmtNode : public BaseNode, public PtrListNodeBase { virtual ~StmtNode() = default; - void DumpBase(const MIRModule &mod, int32 indent) const override; - void Dump(const MIRModule &mod, int32 indent) const override; - void Dump(const MIRModule &mod) const; + void DumpBase(int32 indent) const override; + void Dump(int32 indent) const override; + void Dump() const; void InsertAfterThis(StmtNode &pos); void InsertBeforeThis(StmtNode &pos); @@ -1503,7 +1503,7 @@ class IassignNode : public StmtNode { } } - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; IassignNode *CloneTree(MapleAllocator &allocator) const override { @@ -1551,7 +1551,7 @@ class GotoNode : public StmtNode { virtual ~GotoNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; GotoNode *CloneTree(MapleAllocator &allocator) const override { auto *g = allocator.GetMemPool()->New(*this); @@ -1581,7 +1581,7 @@ class JsTryNode : public StmtNode { virtual ~JsTryNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; JsTryNode *CloneTree(MapleAllocator &allocator) const override { auto *t = allocator.GetMemPool()->New(*this); @@ -1623,8 +1623,8 @@ class TryNode : public StmtNode { TryNode &operator=(const TryNode &node) = delete; virtual ~TryNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; - void Dump(const MIRModule &mod) const; + void Dump(int32 indent) const override; + void Dump() const; LabelIdx GetOffset(size_t i) const { ASSERT(i < offsets.size(), "array index out of range"); @@ -1692,8 +1692,8 @@ class CatchNode : public StmtNode { CatchNode &operator=(const CatchNode &node) = delete; virtual ~CatchNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; - void Dump(const MIRModule &mod) const; + void Dump(int32 indent) const override; + void Dump() const; TyIdx GetExceptionTyIdxVecElement(size_t i) const { CHECK_FATAL(i < exceptionTyIdxVec.size(), "array index out of range"); @@ -1761,7 +1761,7 @@ class SwitchNode : public StmtNode { SwitchNode &operator=(const SwitchNode &node) = delete; virtual ~SwitchNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; SwitchNode *CloneTree(MapleAllocator &allocator) const override { @@ -1854,7 +1854,7 @@ class MultiwayNode : public StmtNode { MultiwayNode &operator=(const MultiwayNode &node) = delete; virtual ~MultiwayNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; MultiwayNode *CloneTree(MapleAllocator &allocator) const override { auto *nd = allocator.GetMemPool()->New(allocator, *this); @@ -1908,8 +1908,8 @@ class UnaryStmtNode : public StmtNode { virtual ~UnaryStmtNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; - void Dump(const MIRModule &mod) const; + void Dump(int32 indent) const override; + void Dump() const; void DumpOpnd(const MIRModule &mod, int32 indent) const; bool Verify() const override { @@ -1965,7 +1965,7 @@ class DassignNode : public UnaryStmtNode { virtual ~DassignNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; DassignNode *CloneTree(MapleAllocator &allocator) const override { @@ -2025,7 +2025,7 @@ class RegassignNode : public UnaryStmtNode { virtual ~RegassignNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; RegassignNode *CloneTree(MapleAllocator &allocator) const override { @@ -2065,8 +2065,8 @@ class CondGotoNode : public UnaryStmtNode { virtual ~CondGotoNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; + void Dump(int32 indent) const override; + bool Verify() const override; uint32 GetOffset() const { return offset; @@ -2076,7 +2076,7 @@ class CondGotoNode : public UnaryStmtNode { offset = offsetValue; } - CondGotoNode *CloneTree(MapleAllocator &allocator) const { + CondGotoNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetStmtID(stmtIDNext++); node->SetOpnd(Opnd()->CloneTree(allocator)); @@ -2108,9 +2108,9 @@ class RangeGotoNode : public UnaryStmtNode { RangeGotoNode &operator=(const RangeGotoNode &node) = delete; virtual ~RangeGotoNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; - RangeGotoNode *CloneTree(MapleAllocator &allocator) const { + void Dump(int32 indent) const override; + bool Verify() const override; + RangeGotoNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); node->SetOpnd(Opnd()->CloneTree(allocator)); for (size_t i = 0; i < rangegotoTable.size(); ++i) { @@ -2166,12 +2166,12 @@ class BlockNode : public StmtNode { void InsertAfter(StmtNode *stmtNode1, StmtNode *stmtNode2); // Insert ss2 after ss1 in current block. // insert all the stmts in inblock to the current block after stmt1 void InsertBlockAfter(BlockNode &inblock, StmtNode *stmt1); - void Dump(const MIRModule &mod, int32 indent, const MIRSymbolTable *theSymTab, MIRPregTable *thePregTab, + void Dump(int32 indent, const MIRSymbolTable *theSymTab, MIRPregTable *thePregTab, bool withInfo, bool isFuncbody) const; bool Verify() const override; - void Dump(const MIRModule &mod, int32 indent) const override { - Dump(mod, indent, nullptr, nullptr, false, false); + void Dump(int32 indent) const override { + Dump(indent, nullptr, nullptr, false, false); } BlockNode *CloneTree(MapleAllocator &allocator) const override { @@ -2254,10 +2254,10 @@ class IfStmtNode : public UnaryStmtNode { virtual ~IfStmtNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; + void Dump(int32 indent) const override; + bool Verify() const override; - IfStmtNode *CloneTree(MapleAllocator &allocator) const { + IfStmtNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetStmtID(stmtIDNext++); node->SetOpnd(Opnd()->CloneTree(allocator)); @@ -2268,7 +2268,7 @@ class IfStmtNode : public UnaryStmtNode { return node; } - BaseNode *Opnd(size_t i = 0) const { + BaseNode *Opnd(size_t i = 0) const override { if (i == 0) { return UnaryStmtNode::Opnd(); } else if (i == 1) { @@ -2298,7 +2298,7 @@ class IfStmtNode : public UnaryStmtNode { elsePart = node; } - uint8 NumOpnds() const { + uint8 NumOpnds() const override { return numOpnds; } @@ -2316,10 +2316,10 @@ class WhileStmtNode : public UnaryStmtNode { virtual ~WhileStmtNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; + void Dump(int32 indent) const override; + bool Verify() const override; - WhileStmtNode *CloneTree(MapleAllocator &allocator) const { + WhileStmtNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetStmtID(stmtIDNext++); node->SetOpnd(Opnd()->CloneTree(allocator)); @@ -2355,7 +2355,7 @@ class DoloopNode : public StmtNode { virtual ~DoloopNode() = default; void DumpDoVar(const MIRModule &mod) const; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; bool Verify() const override; DoloopNode *CloneTree(MapleAllocator &allocator) const override { @@ -2493,17 +2493,17 @@ class ForeachelemNode : public StmtNode { loopBody = loopBodyValue; } - BaseNode *Opnd(size_t i = 0) const { + BaseNode *Opnd(size_t i = 0) const override { return loopBody; } - uint8 NumOpnds() const { + uint8 NumOpnds() const override { return numOpnds; } - void Dump(const MIRModule &mod, int32 indent) const; + void Dump(int32 indent) const override; - ForeachelemNode *CloneTree(MapleAllocator &allocator) const { + ForeachelemNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetStmtID(stmtIDNext++); node->SetLoopBody(loopBody->CloneTree(allocator)); @@ -2523,9 +2523,9 @@ class BinaryStmtNode : public StmtNode, public BinaryOpnds { virtual ~BinaryStmtNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - virtual bool Verify() const; - BinaryStmtNode *CloneTree(MapleAllocator &allocator) const { + void Dump(int32 indent) const override; + bool Verify() const override; + BinaryStmtNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetStmtID(stmtIDNext++); node->SetBOpnd(GetBOpnd(0)->CloneTree(allocator), 0); @@ -2533,21 +2533,21 @@ class BinaryStmtNode : public StmtNode, public BinaryOpnds { return node; } - BaseNode *Opnd(size_t i) const { + BaseNode *Opnd(size_t i) const override { ASSERT(i < kOperandNumBinary, "Invalid operand idx in BinaryStmtNode"); ASSERT(i >= 0, "Invalid operand idx in BinaryStmtNode"); return GetBOpnd(i); } - uint8 NumOpnds() const { + uint8 NumOpnds() const override { return kOperandNumBinary; } - void SetOpnd(BaseNode *node, size_t i) { + void SetOpnd(BaseNode *node, size_t i) override { SetBOpnd(node, i); } - bool IsLeaf() const { + bool IsLeaf() const override { return false; } }; @@ -2566,10 +2566,10 @@ class IassignoffNode : public BinaryStmtNode { virtual ~IassignoffNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; + void Dump(int32 indent) const override; + bool Verify() const override; - IassignoffNode *CloneTree(MapleAllocator &allocator) const { + IassignoffNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetStmtID(stmtIDNext++); node->SetBOpnd(GetBOpnd(0)->CloneTree(allocator), 0); @@ -2602,10 +2602,10 @@ class IassignFPoffNode : public UnaryStmtNode { virtual ~IassignFPoffNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; - bool Verify() const; + void Dump(int32 indent) const override; + bool Verify() const override; - IassignFPoffNode *CloneTree(MapleAllocator &allocator) const { + IassignFPoffNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(*this); node->SetStmtID(stmtIDNext++); node->SetOpnd(Opnd()->CloneTree(allocator)); @@ -2641,8 +2641,8 @@ class NaryStmtNode : public StmtNode, public NaryOpnds { NaryStmtNode &operator=(const NaryStmtNode &node) = delete; virtual ~NaryStmtNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; - virtual bool Verify() const override; + void Dump(int32 indent) const override; + bool Verify() const override; NaryStmtNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); @@ -2720,12 +2720,12 @@ class CallNode : public NaryStmtNode { CallNode(CallNode &node) = delete; CallNode &operator=(const CallNode &node) = delete; virtual ~CallNode() = default; - virtual void Dump(const MIRModule &mod, int32 indent, bool newline) const; - bool Verify() const; - MIRType *GetCallReturnType(); + virtual void Dump(int32 indent, bool newline) const; + bool Verify() const override; + MIRType *GetCallReturnType() override ; const MIRSymbol *GetCallReturnSymbol(const MIRModule &mod) const; - CallNode *CloneTree(MapleAllocator &allocator) const { + CallNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); for (size_t i = 0; i < GetNopndSize(); ++i) { node->GetNopnd().push_back(GetNopndAt(i)->CloneTree(allocator)); @@ -2780,16 +2780,16 @@ class CallNode : public NaryStmtNode { returnValues = vec; } - uint8 NumOpnds() const { + uint8 NumOpnds() const override { ASSERT(numOpnds == GetNopndSize(), "CallNode has wrong numOpnds field"); return GetNopndSize(); } - virtual void Dump(const MIRModule &mod, int32 indent) const { - Dump(mod, indent, true); + void Dump(int32 indent) const override { + Dump(indent, true); } - CallReturnVector *GetCallReturnVector() { + CallReturnVector *GetCallReturnVector() override { return &returnValues; } @@ -2824,10 +2824,10 @@ class IcallNode : public NaryStmtNode { IcallNode &operator=(const IcallNode &node) = delete; virtual ~IcallNode() = default; - virtual void Dump(const MIRModule &mod, int32 indent, bool newline) const; - bool Verify() const; - MIRType *GetCallReturnType(); - IcallNode *CloneTree(MapleAllocator &allocator) const { + virtual void Dump(int32 indent, bool newline) const; + bool Verify() const override; + MIRType *GetCallReturnType() override ; + IcallNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); for (size_t i = 0; i < GetNopndSize(); ++i) { node->GetNopnd().push_back(GetNopndAt(i)->CloneTree(allocator)); @@ -2859,16 +2859,16 @@ class IcallNode : public NaryStmtNode { returnValues = vec; } - uint8 NumOpnds() const { + uint8 NumOpnds() const override { ASSERT(numOpnds == GetNopndSize(), "IcallNode has wrong numOpnds field"); return GetNopndSize(); } - virtual void Dump(const MIRModule &mod, int32 indent) const { - Dump(mod, indent, true); + void Dump(int32 indent) const override { + Dump(indent, true); } - CallReturnVector *GetCallReturnVector() { + CallReturnVector *GetCallReturnVector() override { return &returnValues; } @@ -2905,11 +2905,11 @@ class IntrinsiccallNode : public NaryStmtNode { IntrinsiccallNode &operator=(const IntrinsiccallNode &node) = delete; virtual ~IntrinsiccallNode() = default; - virtual void Dump(const MIRModule &mod, int32 indent, bool newline) const; - bool Verify() const; - MIRType *GetCallReturnType(); + virtual void Dump(int32 indent, bool newline) const; + bool Verify() const override; + MIRType *GetCallReturnType() override; - IntrinsiccallNode *CloneTree(MapleAllocator &allocator) const { + IntrinsiccallNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); for (size_t i = 0; i < GetNopndSize(); ++i) { node->GetNopnd().push_back(GetNopndAt(i)->CloneTree(allocator)); @@ -2949,16 +2949,16 @@ class IntrinsiccallNode : public NaryStmtNode { returnValues = vec; } - uint8 NumOpnds() const { + uint8 NumOpnds() const override { ASSERT(numOpnds == GetNopndSize(), "IntrinsiccallNode has wrong numOpnds field"); return GetNopndSize(); } - virtual void Dump(const MIRModule &mod, int32 indent) const { - Dump(mod, indent, true); + void Dump(int32 indent) const override { + Dump(indent, true); } - CallReturnVector *GetCallReturnVector() { + CallReturnVector *GetCallReturnVector() override { return &returnValues; } @@ -2994,12 +2994,12 @@ class CallinstantNode : public CallNode { CallinstantNode &operator=(const CallinstantNode &node) = delete; virtual ~CallinstantNode() = default; - virtual void Dump(const MIRModule &mod, int32 indent, bool newline) const; - virtual void Dump(const MIRModule &mod, int32 indent) const { - Dump(mod, indent, true); + void Dump(int32 indent, bool newline) const override; + void Dump(int32 indent) const override { + Dump(indent, true); } - CallinstantNode *CloneTree(MapleAllocator &allocator) const { + CallinstantNode *CloneTree(MapleAllocator &allocator) const override { auto *node = allocator.GetMemPool()->New(allocator, *this); for (size_t i = 0; i < GetNopndSize(); ++i) { node->GetNopnd().push_back(GetNopndAt(i)->CloneTree(allocator)); @@ -3011,7 +3011,7 @@ class CallinstantNode : public CallNode { return node; } - CallReturnVector *GetCallReturnVector() { + CallReturnVector *GetCallReturnVector() override { return &GetReturnVec(); } @@ -3028,7 +3028,7 @@ class AssertStmtNode : public BinaryStmtNode { virtual ~AssertStmtNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; + void Dump(int32 indent) const override; private: bool isLt; @@ -3042,7 +3042,7 @@ class LabelNode : public StmtNode { virtual ~LabelNode() = default; - void Dump(const MIRModule &mod, int32 indent) const override; + void Dump(int32 indent) const override; LabelNode *CloneTree(MapleAllocator &allocator) const override { auto *l = allocator.GetMemPool()->New(*this); @@ -3083,9 +3083,9 @@ class CommentNode : public StmtNode { CommentNode &operator=(const CommentNode &node) = delete; virtual ~CommentNode() = default; - void Dump(const MIRModule &mod, int32 indent) const; + void Dump(int32 indent) const override; - CommentNode *CloneTree(MapleAllocator &allocator) const { + CommentNode *CloneTree(MapleAllocator &allocator) const override { auto *c = allocator.GetMemPool()->New(allocator, *this); return c; } diff --git a/src/maple_ir/include/mir_parser.h b/src/maple_ir/include/mir_parser.h index 3ade4ca106fed86ec961d0a7bd17b6ac2a431864..da6d05c23f0fa62c913673d7ff03928c8b8747ba 100644 --- a/src/maple_ir/include/mir_parser.h +++ b/src/maple_ir/include/mir_parser.h @@ -55,7 +55,7 @@ class MIRParser { PrimType GetPrimitiveType(TokenKind tk) const; MIRIntrinsicID GetIntrinsicID(TokenKind tk) const; bool ParseScalarValue(MIRConstPtr&, MIRType&); - bool ParseConstAddrLeafExpr(MIRConstPtr&, MIRType&); + bool ParseConstAddrLeafExpr(MIRConstPtr&); bool ParseInitValue(MIRConstPtr&, TyIdx, bool allowEmpty = false); bool ParseDeclaredSt(StIdx&); bool ParseDeclaredFunc(PUIdx&); diff --git a/src/maple_ir/include/mir_symbol.h b/src/maple_ir/include/mir_symbol.h index 84fbe5e8c592c2d5cd823178096c347862f5f3ea..7bf7c4ee89b7886090a19224c207cc2c6c1b3e03 100644 --- a/src/maple_ir/include/mir_symbol.h +++ b/src/maple_ir/include/mir_symbol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -348,7 +348,7 @@ class MIRSymbol { bool IsPrimordialObject() const; bool IgnoreRC() const; void Dump(bool isLocal, int32 indent, bool suppressinit = false) const; - void DumpAsLiteralVar(int32 indent) const; + void DumpAsLiteralVar() const; bool operator==(const MIRSymbol &msym) const { return nameStrIdx == msym.nameStrIdx; } @@ -486,7 +486,7 @@ class MIRLabelTable { return labelIdx; } - LabelIdx GetStIdxFromStrIdx(GStrIdx idx) const { + LabelIdx GetLabelIdxFromStrIdx(GStrIdx idx) const { auto it = strIdxToLabIdxMap.find(idx); if (it == strIdxToLabIdxMap.end()) { return LabelIdx(); diff --git a/src/maple_ir/include/mir_type.h b/src/maple_ir/include/mir_type.h index ff5dfb79835e73ddb13976caec732219ff9daadf..1c83404ac34149020ffcc7200b99a0d4d8302b93 100644 --- a/src/maple_ir/include/mir_type.h +++ b/src/maple_ir/include/mir_type.h @@ -402,6 +402,7 @@ class MIRType { virtual bool IsStructType() { return false; } + virtual MIRType *CopyMIRTypeNode() const { return new MIRType(*this); } @@ -965,7 +966,7 @@ class MIRStructType : public MIRType { CHECK_FATAL(false, "can not use GetStaticValue"); } - virtual void PushbackMIRInfo(const MIRInfoPair &pair) { + virtual void PushbackMIRInfo(const MIRInfoPair&) { CHECK_FATAL(false, "can not use PushbackMIRInfo"); } @@ -977,7 +978,7 @@ class MIRStructType : public MIRType { CHECK_FATAL(false, "can not use PushbackStaticValue"); } - virtual void PushbackIsString(bool isString) { + virtual void PushbackIsString(bool) { CHECK_FATAL(false, "can not use PushbackIsString"); } @@ -1032,14 +1033,14 @@ class MIRJarrayType : public MIRFarrayType { const std::string &GetJavaName(); bool IsPrimitiveArray() { - if (javaNameStrIdx == 0) { + if (javaNameStrIdx == 0u) { DetermineName(); } return fromPrimitive; } int GetDim() { - if (javaNameStrIdx == 0) { + if (javaNameStrIdx == 0u) { DetermineName(); } return dim; diff --git a/src/maple_ir/include/option.h b/src/maple_ir/include/option.h index b7ff05e34b0a129280fc9f739db1f9b524ab6f72..102d7e4f438ca451e259b32a72ee2bf736124571 100644 --- a/src/maple_ir/include/option.h +++ b/src/maple_ir/include/option.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/maple_ir/src/bin_mpl_export.cpp b/src/maple_ir/src/bin_mpl_export.cpp index 95d238ca0631e70699acc8d2b58b69958598ebc2..0d74a1ae7c7517182ec75acf551e22591bba962e 100644 --- a/src/maple_ir/src/bin_mpl_export.cpp +++ b/src/maple_ir/src/bin_mpl_export.cpp @@ -49,7 +49,7 @@ void OutputConstAddrofFunc(const MIRConst &constVal, BinaryMplExport &mplExport) mplExport.OutputFunction(newConst.GetValue()); } -void OutputConstLbl(const MIRConst &constVal, BinaryMplExport &mplExport) { +void OutputConstLbl(const MIRConst&, BinaryMplExport&) { ASSERT(false, "NYI"); } @@ -261,7 +261,7 @@ void OutputTypeInterface(const MIRType &ty, BinaryMplExport &mplExport) { } } -void OutputTypeConstString(const MIRType &ty, BinaryMplExport &mplExport) { +void OutputTypeConstString(const MIRType &ty, BinaryMplExport&) { ASSERT(false, "Type's kind not yet implemented: %d", ty.GetKind()); } @@ -389,7 +389,7 @@ void BinaryMplExport::OutputConst(MIRConst *constVal) { } void BinaryMplExport::OutputStr(const GStrIdx &gstr) { - if (gstr == 0) { + if (gstr == 0u) { WriteNum(0); return; } @@ -408,7 +408,7 @@ void BinaryMplExport::OutputStr(const GStrIdx &gstr) { } void BinaryMplExport::OutputUsrStr(UStrIdx ustr) { - if (ustr == 0) { + if (ustr == 0u) { WriteNum(0); return; } @@ -741,7 +741,7 @@ void BinaryMplExport::OutputTypeAttrs(const TypeAttrs &ta) { void BinaryMplExport::OutputType(TyIdx tyIdx) { MIRType *ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); - if (tyIdx == 0) { + if (tyIdx == 0u) { WriteNum(0); return; } diff --git a/src/maple_ir/src/bin_mpl_import.cpp b/src/maple_ir/src/bin_mpl_import.cpp index ff1ea3dbb5516177a1a953b05144d19a2fc2a7ac..328530d04c94136ebf82d81077ec022940f9cfdb 100644 --- a/src/maple_ir/src/bin_mpl_import.cpp +++ b/src/maple_ir/src/bin_mpl_import.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -407,7 +407,7 @@ void BinaryMplImport::ImportPragmaOfStructType(MIRStructType &type) { } void BinaryMplImport::SetClassTyidxOfMethods(MIRStructType &type) { - if (type.GetTypeIndex() != 0) { + if (type.GetTypeIndex() != 0u) { // set up classTyIdx for methods for (size_t i = 0; i < type.GetMethods().size(); ++i) { StIdx stidx = type.GetMethodsElement(i).first; @@ -422,7 +422,7 @@ void BinaryMplImport::SetClassTyidxOfMethods(MIRStructType &type) { void BinaryMplImport::ImportClassTypeData(MIRClassType &type) { TyIdx tempType = ImportType(); // Keep the parent_tyidx we first met. - if (type.GetParentTyIdx() == 0) { + if (type.GetParentTyIdx() == 0u) { type.SetParentTyIdx(tempType); } ImportInterfacesOfClassType(type.GetInterfaceImplemented()); @@ -697,7 +697,7 @@ inline static bool IsObject(const MIRType &type) { MIRType &BinaryMplImport::InsertInTypeTables(MIRType &type) { MIRType *resultTypePtr = &type; TyIdx prevTyIdx = mod.GetTypeNameTab()->GetTyIdxFromGStrIdx(type.GetNameStrIdx()); - if (prevTyIdx != 0 && !type.IsNameIsLocal()) { + if (prevTyIdx != 0u && !type.IsNameIsLocal()) { MIRType *prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(prevTyIdx); if ((IsIncomplete(*prevType) && IsIncomplete(type)) || (!IsIncomplete(*prevType) && !IsIncomplete(type)) || (!IsIncomplete(*prevType) && IsIncomplete(type))) { @@ -744,12 +744,12 @@ MIRType &BinaryMplImport::InsertInTypeTables(MIRType &type) { void BinaryMplImport::SetupEHRootType() { // setup eh root type with most recent Ljava_2Flang_2FObject_3B GStrIdx gStrIdx = GlobalTables::GetStrTable().GetStrIdxFromName(NameMangler::kJavaLangObjectStr); - if (gStrIdx == 0) { + if (gStrIdx == 0u) { return; } TyIdx tyIdx = GlobalTables::GetTypeNameTable().GetTyIdxFromGStrIdx(gStrIdx); - if (tyIdx != 0) { + if (tyIdx != 0u) { mod.SetThrowableTyIdx(tyIdx); } } diff --git a/src/maple_ir/src/global_tables.cpp b/src/maple_ir/src/global_tables.cpp index c7968ca4b45fc52a2d2765579251b97f68b27a60..e423470c3063443ea1f70e9489f1f32444c19649 100644 --- a/src/maple_ir/src/global_tables.cpp +++ b/src/maple_ir/src/global_tables.cpp @@ -166,7 +166,7 @@ MIRType *TypeTable::GetOrCreateClassOrInterface(const std::string &name, MIRModu } module.PushbackTypeDefOrder(strIdx); module.GetTypeNameTab()->SetGStrIdxToTyIdx(strIdx, tyIdx); - if (typeTable[tyIdx]->GetNameStrIdx() == 0) { + if (typeTable[tyIdx]->GetNameStrIdx() == 0u) { typeTable[tyIdx]->SetNameStrIdx(strIdx); } } diff --git a/src/maple_ir/src/mir_builder.cpp b/src/maple_ir/src/mir_builder.cpp index 99ec983fec8068fd2901b59f9f29ab413ab2ed72..9d099dc2b438d92e290d08fd544db7ed756253eb 100644 --- a/src/maple_ir/src/mir_builder.cpp +++ b/src/maple_ir/src/mir_builder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -77,7 +77,7 @@ void MIRBuilder::TraverseToNamedFieldWithType(MIRStructType &structType, GStrIdx TyIdx fieldTyIdx = structType.GetFieldsElemt(fieldIdx).second.first; MIRType *fieldType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(fieldTyIdx); if (structType.GetFieldsElemt(fieldIdx).first == nameIdx) { - if (typeIdx == 0 || fieldTyIdx == typeIdx) { + if (typeIdx == 0u || fieldTyIdx == typeIdx) { idx = fieldID; continue; } @@ -138,7 +138,7 @@ bool MIRBuilder::TraverseToNamedFieldWithTypeAndMatchStyle(MIRStructType &struct MIRType *fieldType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(fieldTyIdx); ASSERT(fieldType != nullptr, "fieldType is null"); if (matchStyle && structType.GetFieldsElemt(fieldIdx).first == nameIdx) { - if (typeIdx == 0 || fieldTyIdx == typeIdx || + if (typeIdx == 0u || fieldTyIdx == typeIdx || fieldType->IsOfSameType(*GlobalTables::GetTypeTable().GetTypeFromTyIdx(typeIdx))) { return true; } @@ -196,7 +196,7 @@ void MIRBuilder::SetStructFieldIDFromFieldName(MIRStructType &structType, const GStrIdx strIdx = GetStringIndex(name); while (true) { if (structType.GetElemStrIdx(fieldID) == strIdx) { - if (newStrIdx != 0) { + if (newStrIdx != 0u) { structType.SetElemStrIdx(fieldID, newStrIdx); } structType.SetElemtTyIdx(fieldID, newFieldType.GetTypeIndex()); @@ -210,7 +210,7 @@ void MIRBuilder::SetStructFieldIDFromFieldName(MIRStructType &structType, const MIRFunction *MIRBuilder::GetOrCreateFunction(const std::string &str, TyIdx retTyIdx) { GStrIdx strIdx = GetStringIndex(str); MIRSymbol *funcSt = nullptr; - if (strIdx != 0) { + if (strIdx != 0u) { funcSt = GlobalTables::GetGsymTable().GetSymbolFromStrIdx(strIdx); if (funcSt == nullptr) { funcSt = CreateSymbol(TyIdx(0), strIdx, kStFunc, kScText, nullptr, kScopeGlobal); @@ -303,7 +303,7 @@ MIRFunction *MIRBuilder::CreateFunction(StIdx stIdx, bool addToTable) const { MIRSymbol *MIRBuilder::GetOrCreateGlobalDecl(const std::string &str, TyIdx tyIdx, bool &created) const { GStrIdx strIdx = GetStringIndex(str); - if (strIdx != 0) { + if (strIdx != 0u) { StIdx stIdx = GlobalTables::GetGsymTable().GetStIdxFromStrIdx(strIdx); if (stIdx.Idx() != 0) { created = false; @@ -322,7 +322,7 @@ MIRSymbol *MIRBuilder::GetOrCreateGlobalDecl(const std::string &str, TyIdx tyIdx MIRSymbol *MIRBuilder::GetOrCreateLocalDecl(const std::string &str, TyIdx tyIdx, MIRSymbolTable &symbolTable, bool &created) const { GStrIdx strIdx = GetStringIndex(str); - if (strIdx != 0) { + if (strIdx != 0u) { StIdx stIdx = symbolTable.GetStIdxFromStrIdx(strIdx); if (stIdx.Idx() != 0) { created = false; @@ -375,7 +375,7 @@ MIRSymbol *MIRBuilder::GetLocalDecl(const std::string &str) { MIRSymbol *MIRBuilder::GetDecl(const std::string &str) { GStrIdx strIdx = GetStringIndex(str); MIRSymbol *sym = nullptr; - if (strIdx != 0) { + if (strIdx != 0u) { // try to find the decl in local scope first MIRFunction *currentFunctionInner = GetCurrentFunction(); if (currentFunctionInner != nullptr) { @@ -768,7 +768,7 @@ IcallNode *MIRBuilder::CreateStmtIcall(const MapleVector &args) { IntrinsiccallNode *MIRBuilder::CreateStmtIntrinsicCall(MIRIntrinsicID idx, const MapleVector &arguments, TyIdx tyIdx) { auto *stmt = GetCurrentFuncCodeMp()->New( - *GetCurrentFuncCodeMpAllocator(), tyIdx == 0 ? OP_intrinsiccall : OP_intrinsiccallwithtype, idx); + *GetCurrentFuncCodeMpAllocator(), tyIdx == 0u ? OP_intrinsiccall : OP_intrinsiccallwithtype, idx); stmt->SetTyIdx(tyIdx); stmt->SetOpnds(arguments); return stmt; @@ -839,7 +839,7 @@ IntrinsiccallNode *MIRBuilder::CreateStmtIntrinsicCallAssigned(MIRIntrinsicID id IntrinsiccallNode *MIRBuilder::CreateStmtIntrinsicCallAssigned(MIRIntrinsicID idx, const MapleVector &args, const MIRSymbol *ret, TyIdx tyIdx) { auto *stmt = GetCurrentFuncCodeMp()->New( - *GetCurrentFuncCodeMpAllocator(), tyIdx == 0 ? OP_intrinsiccallassigned : OP_intrinsiccallwithtypeassigned, idx); + *GetCurrentFuncCodeMpAllocator(), tyIdx == 0u ? OP_intrinsiccallassigned : OP_intrinsiccallwithtypeassigned, idx); stmt->SetTyIdx(tyIdx); stmt->SetOpnds(args); CallReturnVector nrets(GetCurrentFuncCodeMpAllocator()->Adapter()); @@ -931,7 +931,7 @@ GotoNode *MIRBuilder::CreateStmtGoto(Opcode o, LabelIdx labIdx) { return GetCurrentFuncCodeMp()->New(o, labIdx); } -JsTryNode *MIRBuilder::CreateStmtJsTry(Opcode o, LabelIdx cLabIdx, LabelIdx fLabIdx) { +JsTryNode *MIRBuilder::CreateStmtJsTry(Opcode, LabelIdx cLabIdx, LabelIdx fLabIdx) { return GetCurrentFuncCodeMp()->New(static_cast(cLabIdx), static_cast(fLabIdx)); } @@ -966,7 +966,7 @@ CondGotoNode *MIRBuilder::CreateStmtCondGoto(BaseNode *cond, Opcode op, LabelIdx LabelIdx MIRBuilder::GetOrCreateMIRLabel(const std::string &name) { GStrIdx strIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(name); MIRFunction *currentFunctionInner = GetCurrentFunctionNotNull(); - LabelIdx lableIdx = currentFunctionInner->GetLabelTab()->GetStIdxFromStrIdx(strIdx); + LabelIdx lableIdx = currentFunctionInner->GetLabelTab()->GetLabelIdxFromStrIdx(strIdx); if (lableIdx == 0) { lableIdx = currentFunctionInner->GetLabelTab()->CreateLabel(); currentFunctionInner->GetLabelTab()->SetSymbolFromStIdx(lableIdx, strIdx); diff --git a/src/maple_ir/src/mir_function.cpp b/src/maple_ir/src/mir_function.cpp index fb0d24b3e212dba7da6e0ac58c126b239067bbb0..24963e717e84b9e48f740140556d102f1f7624e0 100644 --- a/src/maple_ir/src/mir_function.cpp +++ b/src/maple_ir/src/mir_function.cpp @@ -95,7 +95,7 @@ MIRType *MIRFunction::GetNthParamType(size_t i) { LabelIdx MIRFunction::GetOrCreateLableIdxFromName(const std::string &name) { GStrIdx strIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(name); - LabelIdx labelIdx = GetLabelTab()->GetStIdxFromStrIdx(strIdx); + LabelIdx labelIdx = GetLabelTab()->GetLabelIdxFromStrIdx(strIdx); if (labelIdx == 0) { labelIdx = GetLabelTab()->CreateLabel(); GetLabelTab()->SetSymbolFromStIdx(labelIdx, strIdx); @@ -244,7 +244,7 @@ void MIRFunction::Dump(bool withoutBody) { MIRSymbol *symbol = GlobalTables::GetGsymTable().GetSymbolFromStidx(symbolTableIdx.Idx()); ASSERT(symbol != nullptr, "symbol MIRSymbol is null"); LogInfo::MapleLogger() << "func " << "&" << symbol->GetName(); - + theMIRModule = module; funcAttrs.DumpAttributes(); if (module->GetFlavor() < kMmpl) { @@ -257,7 +257,7 @@ void MIRFunction::Dump(bool withoutBody) { LogInfo::MapleLogger() << "# [WARNING] skipped dumping because codeMemPool is nullptr " << '\n'; } else if (GetBody() != nullptr && !withoutBody && symbol->GetStorageClass() != kScExtern) { ResetInfoPrinted(); // this ensures funcinfo will be printed - GetBody()->Dump(*module, 0, module->GetFlavor() < kMmpl ? GetSymTab() : nullptr, + GetBody()->Dump(0, module->GetFlavor() < kMmpl ? GetSymTab() : nullptr, module->GetFlavor() < kMmpl ? GetPregTab() : nullptr, false, true); // Dump body } else { LogInfo::MapleLogger() << '\n'; @@ -417,7 +417,7 @@ void MIRFunction::OverrideBaseClassFuncNames(GStrIdx strIdx) { // there are two ways to represent the delimiter: '|' or "_7C" // where 7C is the ascii value of char '|' in hex void MIRFunction::SetBaseClassFuncNames(GStrIdx strIdx) { - if (baseClassStrIdx != 0 || baseFuncStrIdx != 0) { + if (baseClassStrIdx != 0u || baseFuncStrIdx != 0u) { return; } const std::string name = GlobalTables::GetStrTable().GetStringFromStrIdx(strIdx); diff --git a/src/maple_ir/src/mir_module.cpp b/src/maple_ir/src/mir_module.cpp index f2325ed0ae08c9b460788a8ae598ff48d161f6c9..64f00f124009aa49fde7202ffd4ba7fe2ef09e0a 100644 --- a/src/maple_ir/src/mir_module.cpp +++ b/src/maple_ir/src/mir_module.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/maple_ir/src/mir_nodes.cpp b/src/maple_ir/src/mir_nodes.cpp index 863844c9bf833fd7005e0cb76d50cd83cb79d9f3..b36d093c3a9cf6a4f04da73282398d83d06399a0 100644 --- a/src/maple_ir/src/mir_nodes.cpp +++ b/src/maple_ir/src/mir_nodes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -94,7 +94,7 @@ bool AddrofNode::CheckNode(const MIRModule &mod) const { return (subKind == kTypeBitField && VerifyPrimType(subType->GetPrimType(), GetPrimType())) || (subKind == kTypeScalar && IsPrimitiveScalar(GetPrimType())) || (subKind == kTypePointer && IsPrimitivePoint(GetPrimType())) || - (subKind == kTypeStruct && GetPrimType() == PTY_agg) || (fTyIdx != 0 && GetPrimType() == PTY_agg); + (subKind == kTypeStruct && GetPrimType() == PTY_agg) || (fTyIdx != 0u && GetPrimType() == PTY_agg); } case kTypeClass: case kTypeClassIncomplete: { @@ -195,12 +195,12 @@ void BlockNode::InsertBlockAfter(BlockNode &inblock, StmtNode *stmt1) { stmtNodeList.splice(stmt1, inblock.GetStmtNodes()); } -void BaseNode::DumpBase(const MIRModule &mod, int32 indent) const { +void BaseNode::DumpBase(int32 indent) const { PrintIndentation(indent); LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); } -void CatchNode::Dump(const MIRModule &mod, int32 indent) const { +void CatchNode::Dump(int32 indent) const { PrintIndentation(indent); LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " {"; size_t size = exceptionTyIdxVec.size(); @@ -211,28 +211,28 @@ void CatchNode::Dump(const MIRModule &mod, int32 indent) const { LogInfo::MapleLogger() << " }\n"; } -void CatchNode::Dump(const MIRModule &mod) const { - this->BaseNode::Dump(mod); +void CatchNode::Dump() const { + this->BaseNode::Dump(); } void UnaryNode::DumpOpnd(const MIRModule &mod, int indent) const { LogInfo::MapleLogger() << " ("; - uOpnd->Dump(mod, indent); + uOpnd->Dump(indent); LogInfo::MapleLogger() << ")"; } -void UnaryNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); - DumpOpnd(mod, indent); +void UnaryNode::Dump(int32 indent) const { + BaseNode::DumpBase(0); + DumpOpnd(*theMIRModule, indent); } -void TypeCvtNode::Dump(const MIRModule &mod, int32 indent) const { +void TypeCvtNode::Dump(int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " "; LogInfo::MapleLogger() << GetPrimTypeName(GetPrimType()) << " " << GetPrimTypeName(FromType()); - DumpOpnd(mod, indent); + DumpOpnd(*theMIRModule, indent); } -void RetypeNode::Dump(const MIRModule &mod, int32 indent) const { +void RetypeNode::Dump(int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " "; LogInfo::MapleLogger() << GetPrimTypeName(GetPrimType()) << " "; MIRType *ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); @@ -243,130 +243,130 @@ void RetypeNode::Dump(const MIRModule &mod, int32 indent) const { } else { ty->Dump(indent + 1); } - DumpOpnd(mod, indent); + DumpOpnd(*theMIRModule, indent); } -void ExtractbitsNode::Dump(const MIRModule &mod, int32 indent) const { +void ExtractbitsNode::Dump(int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); if (GetOpCode() == OP_extractbits) { LogInfo::MapleLogger() << " " << static_cast(bitsOffset) << " " << static_cast(bitsSize); } else { LogInfo::MapleLogger() << " " << static_cast(bitsSize); } - DumpOpnd(mod, indent); + DumpOpnd(*theMIRModule, indent); } -void IreadNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void IreadNode::Dump(int32 indent) const { + BaseNode::DumpBase(0); LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(0); LogInfo::MapleLogger() << " " << fieldID; - DumpOpnd(mod, indent); + DumpOpnd(*theMIRModule, indent); } -void IreadoffNode::Dump(const MIRModule &mod, int32 indent) const { +void IreadoffNode::Dump(int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); LogInfo::MapleLogger() << " " << offset; - DumpOpnd(mod, indent); + DumpOpnd(*theMIRModule, indent); } -void IreadFPoffNode::Dump(const MIRModule &mod, int32 indent) const { +void IreadFPoffNode::Dump(int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); LogInfo::MapleLogger() << " " << offset; } -void BinaryNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); - BinaryOpnds::Dump(mod, indent); +void BinaryNode::Dump(int32 indent) const { + BaseNode::DumpBase(0); + BinaryOpnds::Dump(indent); } -void BinaryNode::Dump(const MIRModule &mod) const { - this->BaseNode::Dump(mod); +void BinaryNode::Dump() const { + this->BaseNode::Dump(); } -void BinaryOpnds::Dump(const MIRModule &mod, int32 indent) const { +void BinaryOpnds::Dump(int32 indent) const { LogInfo::MapleLogger() << " ("; if (bOpnd[0]->IsLeaf() && bOpnd[1]->IsLeaf()) { - bOpnd[0]->Dump(mod, 0); + bOpnd[0]->Dump(0); LogInfo::MapleLogger() << ", "; - bOpnd[1]->Dump(mod, 0); + bOpnd[1]->Dump(0); } else { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent + 1); - bOpnd[0]->Dump(mod, indent + 1); + bOpnd[0]->Dump(indent + 1); LogInfo::MapleLogger() << ",\n"; PrintIndentation(indent + 1); - bOpnd[1]->Dump(mod, indent + 1); + bOpnd[1]->Dump(indent + 1); } LogInfo::MapleLogger() << ")"; } -void ResolveFuncNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void ResolveFuncNode::Dump(int32 indent) const { + BaseNode::DumpBase(0); MIRFunction *func = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(puIdx); LogInfo::MapleLogger() << " &" << func->GetName(); - BinaryOpnds::Dump(mod, indent); + BinaryOpnds::Dump(indent); } -void CompareNode::Dump(const MIRModule &mod, int32 indent) const { +void CompareNode::Dump(int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); LogInfo::MapleLogger() << " " << GetPrimTypeName(opndType); - BinaryOpnds::Dump(mod, indent); + BinaryOpnds::Dump(indent); } -void CompareNode::Dump(const MIRModule &mod) const { - this->BaseNode::Dump(mod); +void CompareNode::Dump() const { + this->BaseNode::Dump(); } -void DepositbitsNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void DepositbitsNode::Dump(int32 indent) const { + BaseNode::DumpBase(0); LogInfo::MapleLogger() << " " << static_cast(bitsOffset) << " " << static_cast(bitsSize) << " ("; if (GetBOpnd(0)->IsLeaf() && GetBOpnd(1)->IsLeaf()) { - GetBOpnd(0)->Dump(mod, 0); + GetBOpnd(0)->Dump(0); LogInfo::MapleLogger() << ", "; - GetBOpnd(1)->Dump(mod, 0); + GetBOpnd(1)->Dump(0); } else { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent + 1); - GetBOpnd(0)->Dump(mod, indent + 1); + GetBOpnd(0)->Dump(indent + 1); LogInfo::MapleLogger() << ",\n"; PrintIndentation(indent + 1); - GetBOpnd(1)->Dump(mod, indent + 1); + GetBOpnd(1)->Dump(indent + 1); } LogInfo::MapleLogger() << ")"; } -void TernaryNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void TernaryNode::Dump(int32 indent) const { + BaseNode::DumpBase(0); LogInfo::MapleLogger() << " ("; if (topnd[0]->IsLeaf() && topnd[1]->IsLeaf() && topnd[2]->IsLeaf()) { - topnd[0]->Dump(mod, 0); + topnd[0]->Dump(0); LogInfo::MapleLogger() << ", "; - topnd[1]->Dump(mod, 0); + topnd[1]->Dump(0); LogInfo::MapleLogger() << ", "; - topnd[2]->Dump(mod, 0); + topnd[2]->Dump(0); } else { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent + 1); - topnd[0]->Dump(mod, indent + 1); + topnd[0]->Dump(indent + 1); LogInfo::MapleLogger() << ",\n"; PrintIndentation(indent + 1); - topnd[1]->Dump(mod, indent + 1); + topnd[1]->Dump(indent + 1); LogInfo::MapleLogger() << ",\n"; PrintIndentation(indent + 1); - topnd[2]->Dump(mod, indent + 1); + topnd[2]->Dump(indent + 1); } LogInfo::MapleLogger() << ")"; } -void NaryOpnds::Dump(const MIRModule &mod, int32 indent) const { +void NaryOpnds::Dump(int32 indent) const { LogInfo::MapleLogger() << " ("; if (GetNopndSize() == 0) { LogInfo::MapleLogger() << ")"; return; } if (GetNopndSize() == 1) { - GetNopndAt(0)->Dump(mod, indent); + GetNopndAt(0)->Dump(indent); } else { bool allisLeaf = true; for (size_t i = 0; i < GetNopndSize(); ++i) @@ -375,19 +375,19 @@ void NaryOpnds::Dump(const MIRModule &mod, int32 indent) const { break; } if (allisLeaf) { - GetNopndAt(0)->Dump(mod, 0); + GetNopndAt(0)->Dump(0); for (size_t i = 1; i < GetNopndSize(); ++i) { LogInfo::MapleLogger() << ", "; - GetNopndAt(i)->Dump(mod, 0); + GetNopndAt(i)->Dump(0); } } else { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent + 1); - GetNopndAt(0)->Dump(mod, indent + 1); + GetNopndAt(0)->Dump(indent + 1); for (size_t i = 1; i < GetNopndSize(); ++i) { LogInfo::MapleLogger() << ",\n"; PrintIndentation(indent + 1); - GetNopndAt(i)->Dump(mod, indent + 1); + GetNopndAt(i)->Dump(indent + 1); } } } @@ -405,9 +405,9 @@ bool NaryOpnds::VerifyOpnds() const { return nOpndsVerify; } -void NaryNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); - NaryOpnds::Dump(mod, indent); +void NaryNode::Dump(int32 indent) const { + BaseNode::DumpBase(0); + NaryOpnds::Dump(indent); } const MIRType *ArrayNode::GetArrayType(const TypeTable &tt) const { @@ -429,7 +429,7 @@ BaseNode *ArrayNode::GetDim(const MIRModule &mod, TypeTable &tt, int i) { return const_cast(const_cast(this)->GetDim(mod, tt, i)); } -void ArrayNode::Dump(const MIRModule &mod, int32 indent) const { +void ArrayNode::Dump(int32 indent) const { PrintIndentation(0); LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " "; if (boundsCheck) { @@ -440,7 +440,7 @@ void ArrayNode::Dump(const MIRModule &mod, int32 indent) const { LogInfo::MapleLogger() << GetPrimTypeName(GetPrimType()); LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(0); - NaryOpnds::Dump(mod, indent); + NaryOpnds::Dump(indent); } bool ArrayNode::IsSameBase(ArrayNode *arry) { @@ -455,32 +455,32 @@ bool ArrayNode::IsSameBase(ArrayNode *arry) { return static_cast(curBase)->GetStIdx() == static_cast(otherBase)->GetStIdx(); } -void IntrinsicopNode::Dump(const MIRModule &mod, int32 indent) const { +void IntrinsicopNode::Dump(int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); if (GetOpCode() == OP_intrinsicopwithtype) { LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(indent + 1); } LogInfo::MapleLogger() << " " << GetIntrinsicName(GetIntrinsic()); - NaryOpnds::Dump(mod, indent); + NaryOpnds::Dump(indent); } -void ConstvalNode::Dump(const MIRModule &mod, int32 indent) const { +void ConstvalNode::Dump(int32) const { if (GetConstVal()->GetType().GetKind() != kTypePointer) { - BaseNode::DumpBase(mod, 0); + BaseNode::DumpBase(0); LogInfo::MapleLogger() << " "; } GetConstVal()->Dump(); } -void ConststrNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void ConststrNode::Dump(int32) const { + BaseNode::DumpBase(0); const std::string kStr = GlobalTables::GetUStrTable().GetStringFromStrIdx(UStrIdx(strIdx)); PrintString(kStr); } -void Conststr16Node::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void Conststr16Node::Dump(int32) const { + BaseNode::DumpBase(0); const std::u16string kStr16 = GlobalTables::GetU16StrTable().GetStringFromStrIdx(U16StrIdx(strIdx)); // UTF-16 string are dumped as UTF-8 string in mpl to keep the printable chars in ascii form std::string str; @@ -488,22 +488,22 @@ void Conststr16Node::Dump(const MIRModule &mod, int32 indent) const { PrintString(str); } -void SizeoftypeNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void SizeoftypeNode::Dump(int32) const { + BaseNode::DumpBase(0); LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(0); } -void FieldsDistNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void FieldsDistNode::Dump(int32) const { + BaseNode::DumpBase(0); LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(0); LogInfo::MapleLogger() << " " << fieldID1 << " " << fieldID2; } -void AddrofNode::Dump(const MIRModule &mod, int32 indent) const { +void AddrofNode::Dump(int32) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); - const MIRSymbol *st = mod.CurFunction()->GetLocalOrGlobalSymbol(GetStIdx()); + const MIRSymbol *st = theMIRModule->CurFunction()->GetLocalOrGlobalSymbol(GetStIdx()); LogInfo::MapleLogger() << (GetStIdx().Islocal() ? " %" : " $"); LogInfo::MapleLogger() << st->GetName(); if (fieldID != 0) { @@ -511,11 +511,11 @@ void AddrofNode::Dump(const MIRModule &mod, int32 indent) const { } } -void RegreadNode::Dump(const MIRModule &mod, int32 indent) const { +void RegreadNode::Dump(int32) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); if (regIdx >= 0) { LogInfo::MapleLogger() - << " %" << mod.CurFunction()->GetPregTab()->PregFromPregIdx(static_cast(regIdx))->GetPregNo(); + << " %" << theMIRModule->CurFunction()->GetPregTab()->PregFromPregIdx(static_cast(regIdx))->GetPregNo(); return; } LogInfo::MapleLogger() << " %%"; @@ -542,20 +542,20 @@ void RegreadNode::Dump(const MIRModule &mod, int32 indent) const { } } -void AddroffuncNode::Dump(const MIRModule &mod, int32 indent) const { +void AddroffuncNode::Dump(int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); MIRFunction *func = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(puIdx); LogInfo::MapleLogger() << " &" << GlobalTables::GetGsymTable().GetSymbolFromStidx(func->GetStIdx().Idx())->GetName(); } -void AddroflabelNode::Dump(const MIRModule &mod, int32 indent) const { +void AddroflabelNode::Dump(int32) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name << " " << GetPrimTypeName(GetPrimType()); - LogInfo::MapleLogger() << " @" << mod.CurFunction()->GetLabelName((LabelIdx)offset); + LogInfo::MapleLogger() << " @" << theMIRModule->CurFunction()->GetLabelName((LabelIdx)offset); } -void StmtNode::DumpBase(const MIRModule &mod, int32 indent) const { +void StmtNode::DumpBase(int32 indent) const { if (srcPosition.FileNum() != 0 && srcPosition.LineNum() != 0 && srcPosition.LineNum() != lastPrintedLineNum && - mod.CurFunction()->WithLocInfo()) { + theMIRModule->CurFunction()->WithLocInfo()) { LogInfo::MapleLogger() << "LOC " << srcPosition.FileNum() << " " << srcPosition.LineNum() << '\n'; lastPrintedLineNum = srcPosition.LineNum(); } @@ -563,13 +563,13 @@ void StmtNode::DumpBase(const MIRModule &mod, int32 indent) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOpCode()).name; } -void StmtNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void StmtNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << '\n'; } -void StmtNode::Dump(const MIRModule &mod) const { - this->BaseNode::Dump(mod); +void StmtNode::Dump() const { + this->BaseNode::Dump(); } // Get the next stmt skip the comment stmt. @@ -604,26 +604,26 @@ void StmtNode::InsertBeforeThis(StmtNode &pos) { pos.SetNext(this); } -void DassignNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); - const MIRSymbol *st = mod.CurFunction()->GetLocalOrGlobalSymbol(stIdx); +void DassignNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); + const MIRSymbol *st = theMIRModule->CurFunction()->GetLocalOrGlobalSymbol(stIdx); LogInfo::MapleLogger() << (st->IsLocal() ? " %" : " $"); LogInfo::MapleLogger() << st->GetName() << " " << fieldID; LogInfo::MapleLogger() << " ("; if (GetRHS() != nullptr) { - GetRHS()->Dump(mod, indent + 1); + GetRHS()->Dump(indent + 1); } else { LogInfo::MapleLogger() << "/*empty-rhs*/"; } LogInfo::MapleLogger() << ")\n"; } -void RegassignNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void RegassignNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " " << GetPrimTypeName(GetPrimType()); if (regIdx >= 0) { LogInfo::MapleLogger() - << " %" << mod.CurFunction()->GetPregTab()->PregFromPregIdx(static_cast(regIdx))->GetPregNo(); + << " %" << theMIRModule->CurFunction()->GetPregTab()->PregFromPregIdx(static_cast(regIdx))->GetPregNo(); } else { LogInfo::MapleLogger() << " %%"; switch (regIdx) { @@ -651,205 +651,205 @@ void RegassignNode::Dump(const MIRModule &mod, int32 indent) const { } } LogInfo::MapleLogger() << " ("; - UnaryStmtNode::Opnd()->Dump(mod, indent + 1); + UnaryStmtNode::Opnd()->Dump(indent + 1); LogInfo::MapleLogger() << ")\n"; } -void IassignNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void IassignNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(0); LogInfo::MapleLogger() << " " << fieldID; LogInfo::MapleLogger() << " ("; if (addrExpr->IsLeaf() && rhs->IsLeaf()) { - addrExpr->Dump(mod, 0); + addrExpr->Dump(0); LogInfo::MapleLogger() << ", "; - rhs->Dump(mod, 0); + rhs->Dump(0); } else { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent + 1); - addrExpr->Dump(mod, indent + 1); + addrExpr->Dump(indent + 1); LogInfo::MapleLogger() << ", \n"; PrintIndentation(indent + 1); - rhs->Dump(mod, indent + 1); + rhs->Dump(indent + 1); } LogInfo::MapleLogger() << ")\n"; } -void IassignoffNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void IassignoffNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " " << GetPrimTypeName(GetPrimType()) << " " << offset; - BinaryOpnds::Dump(mod, indent); + BinaryOpnds::Dump(indent); LogInfo::MapleLogger() << '\n'; } -void IassignFPoffNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void IassignFPoffNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " " << GetPrimTypeName(GetPrimType()) << " " << offset; - DumpOpnd(mod, indent); + DumpOpnd(*theMIRModule, indent); LogInfo::MapleLogger() << '\n'; } -void GotoNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void GotoNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); if (offset == 0) { LogInfo::MapleLogger() << '\n'; } else { - LogInfo::MapleLogger() << " @" << mod.CurFunction()->GetLabelName((LabelIdx)offset) << '\n'; + LogInfo::MapleLogger() << " @" << theMIRModule->CurFunction()->GetLabelName((LabelIdx)offset) << '\n'; } } -void JsTryNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void JsTryNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); if (catchOffset == 0) { LogInfo::MapleLogger() << " 0"; } else { - LogInfo::MapleLogger() << " @" << mod.CurFunction()->GetLabelName((LabelIdx)catchOffset); + LogInfo::MapleLogger() << " @" << theMIRModule->CurFunction()->GetLabelName((LabelIdx)catchOffset); } if (finallyOffset == 0) { LogInfo::MapleLogger() << " 0\n"; } else { - LogInfo::MapleLogger() << " @" << mod.CurFunction()->GetLabelName((LabelIdx)finallyOffset) << '\n'; + LogInfo::MapleLogger() << " @" << theMIRModule->CurFunction()->GetLabelName((LabelIdx)finallyOffset) << '\n'; } } -void TryNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void TryNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " {"; for (size_t i = 0; i < offsets.size(); ++i) { int64 offset = offsets[i]; - LogInfo::MapleLogger() << " @" << mod.CurFunction()->GetLabelName((LabelIdx)offset); + LogInfo::MapleLogger() << " @" << theMIRModule->CurFunction()->GetLabelName((LabelIdx)offset); } LogInfo::MapleLogger() << " }\n"; } -void TryNode::Dump(const MIRModule &mod) const { - this->BaseNode::Dump(mod); +void TryNode::Dump() const { + this->BaseNode::Dump(); } -void CondGotoNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); - LogInfo::MapleLogger() << " @" << mod.CurFunction()->GetLabelName((LabelIdx)offset); +void CondGotoNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); + LogInfo::MapleLogger() << " @" << theMIRModule->CurFunction()->GetLabelName((LabelIdx)offset); LogInfo::MapleLogger() << " ("; - Opnd()->Dump(mod, indent); + Opnd()->Dump(indent); LogInfo::MapleLogger() << ")\n"; } -void SwitchNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void SwitchNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " ("; - switchOpnd->Dump(mod, indent); + switchOpnd->Dump(indent); if (defaultLabel == 0) { LogInfo::MapleLogger() << ") 0 {"; } else { - LogInfo::MapleLogger() << ") @" << mod.CurFunction()->GetLabelName(defaultLabel) << " {"; + LogInfo::MapleLogger() << ") @" << theMIRModule->CurFunction()->GetLabelName(defaultLabel) << " {"; } for (auto it = switchTable.begin(); it != switchTable.end(); it++) { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent + 1); LogInfo::MapleLogger() << std::hex << "0x" << it->first << std::dec; - LogInfo::MapleLogger() << ": goto @" << mod.CurFunction()->GetLabelName(it->second); + LogInfo::MapleLogger() << ": goto @" << theMIRModule->CurFunction()->GetLabelName(it->second); } LogInfo::MapleLogger() << " }\n"; } -void RangeGotoNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void RangeGotoNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " ("; - Opnd()->Dump(mod, indent); + Opnd()->Dump(indent); LogInfo::MapleLogger() << ") " << tagOffset << " {"; for (auto it = rangegotoTable.begin(); it != rangegotoTable.end(); it++) { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent + 1); LogInfo::MapleLogger() << std::hex << "0x" << it->first << std::dec; - LogInfo::MapleLogger() << ": goto @" << mod.CurFunction()->GetLabelName(it->second); + LogInfo::MapleLogger() << ": goto @" << theMIRModule->CurFunction()->GetLabelName(it->second); } LogInfo::MapleLogger() << " }\n"; } -void MultiwayNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void MultiwayNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " ("; - multiWayOpnd->Dump(mod, indent); + multiWayOpnd->Dump(indent); if (defaultLabel == 0) { LogInfo::MapleLogger() << ") 0 {"; } else { - LogInfo::MapleLogger() << ") @" << mod.CurFunction()->GetLabelName(defaultLabel) << " {"; + LogInfo::MapleLogger() << ") @" << theMIRModule->CurFunction()->GetLabelName(defaultLabel) << " {"; } for (auto it = multiWayTable.begin(); it != multiWayTable.end(); it++) { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent); LogInfo::MapleLogger() << " ("; - it->first->Dump(mod, indent + 1); - LogInfo::MapleLogger() << "): goto @" << mod.CurFunction()->GetLabelName(it->second); + it->first->Dump(indent + 1); + LogInfo::MapleLogger() << "): goto @" << theMIRModule->CurFunction()->GetLabelName(it->second); } LogInfo::MapleLogger() << " }\n"; } void UnaryStmtNode::DumpOpnd(const MIRModule &mod, int indent) const { LogInfo::MapleLogger() << " ("; - uOpnd->Dump(mod, indent); + uOpnd->Dump(indent); LogInfo::MapleLogger() << ")"; } -void UnaryStmtNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void UnaryStmtNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " ("; if (uOpnd) { - uOpnd->Dump(mod, indent); + uOpnd->Dump(indent); } LogInfo::MapleLogger() << ")\n"; } -void UnaryStmtNode::Dump(const MIRModule &mod) const { - this->BaseNode::Dump(mod); +void UnaryStmtNode::Dump() const { + this->BaseNode::Dump(); } -void GCMallocNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void GCMallocNode::Dump(int32) const { + BaseNode::DumpBase(0); LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(0); } -void JarrayMallocNode::Dump(const MIRModule &mod, int32 indent) const { - BaseNode::DumpBase(mod, 0); +void JarrayMallocNode::Dump(int32 indent) const { + BaseNode::DumpBase(0); LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(0, false); - DumpOpnd(mod, indent); + DumpOpnd(*theMIRModule, indent); } -void IfStmtNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void IfStmtNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); LogInfo::MapleLogger() << " ("; - Opnd()->Dump(mod, indent); + Opnd()->Dump(indent); LogInfo::MapleLogger() << ")"; - thenPart->Dump(mod, indent); + thenPart->Dump(indent); if (elsePart) { PrintIndentation(indent); LogInfo::MapleLogger() << "else {\n"; for (auto &stmt : elsePart->GetStmtNodes()) { - stmt.Dump(mod, indent + 1); + stmt.Dump(indent + 1); } PrintIndentation(indent); LogInfo::MapleLogger() << "}\n"; } } -void WhileStmtNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); +void WhileStmtNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); if (GetOpCode() == OP_while) { LogInfo::MapleLogger() << " ("; - Opnd()->Dump(mod, indent); + Opnd()->Dump(indent); LogInfo::MapleLogger() << ")"; - body->Dump(mod, indent); + body->Dump(indent); } else { // OP_dowhile LogInfo::MapleLogger() << " {\n"; for (auto &stmt : body->GetStmtNodes()) { - stmt.Dump(mod, indent + 1); + stmt.Dump(indent + 1); } PrintIndentation(indent); LogInfo::MapleLogger() << "} ("; - Opnd()->Dump(mod, indent); + Opnd()->Dump(indent); LogInfo::MapleLogger() << ")\n"; } } @@ -865,46 +865,46 @@ void DoloopNode::DumpDoVar(const MIRModule &mod) const { } } -void DoloopNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); - DumpDoVar(mod); +void DoloopNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); + DumpDoVar(*theMIRModule); PrintIndentation(indent + 1); - startExpr->Dump(mod, indent + 1); + startExpr->Dump(indent + 1); LogInfo::MapleLogger() << ",\n"; PrintIndentation(indent + 1); - condExpr->Dump(mod, indent + 1); + condExpr->Dump(indent + 1); LogInfo::MapleLogger() << ",\n"; PrintIndentation(indent + 1); - incrExpr->Dump(mod, indent + 1); + incrExpr->Dump(indent + 1); LogInfo::MapleLogger() << ")"; - doBody->Dump(mod, indent + 1); + doBody->Dump(indent + 1); } -void ForeachelemNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); - const MIRSymbol *st = mod.CurFunction()->GetLocalOrGlobalSymbol(elemStIdx); +void ForeachelemNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); + const MIRSymbol *st = theMIRModule->CurFunction()->GetLocalOrGlobalSymbol(elemStIdx); ASSERT(st != nullptr, "null ptr check"); LogInfo::MapleLogger() << " %" << st->GetName(); - st = mod.CurFunction()->GetLocalOrGlobalSymbol(arrayStIdx); + st = theMIRModule->CurFunction()->GetLocalOrGlobalSymbol(arrayStIdx); ASSERT(st != nullptr, "null ptr check"); LogInfo::MapleLogger() << (arrayStIdx.Islocal() ? " %" : " $"); LogInfo::MapleLogger() << st->GetName(); - loopBody->Dump(mod, indent + 1); + loopBody->Dump(indent + 1); } -void BinaryStmtNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); - BinaryOpnds::Dump(mod, indent); +void BinaryStmtNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); + BinaryOpnds::Dump(indent); LogInfo::MapleLogger() << '\n'; } -void AssertStmtNode::Dump(const MIRModule &mod, int32 indent) const { - BinaryStmtNode::Dump(mod, indent); +void AssertStmtNode::Dump(int32 indent) const { + BinaryStmtNode::Dump(indent); } -void NaryStmtNode::Dump(const MIRModule &mod, int32 indent) const { - StmtNode::DumpBase(mod, indent); - NaryOpnds::Dump(mod, indent); +void NaryStmtNode::Dump(int32 indent) const { + StmtNode::DumpBase(indent); + NaryOpnds::Dump(indent); LogInfo::MapleLogger() << '\n'; } @@ -985,18 +985,18 @@ const MIRSymbol *CallNode::GetCallReturnSymbol(const MIRModule &mod) const { } -void CallNode::Dump(const MIRModule &mod, int32 indent, bool newline) const { - StmtNode::DumpBase(mod, indent); - if (tyIdx != 0) { +void CallNode::Dump(int32 indent, bool newline) const { + StmtNode::DumpBase(indent); + if (tyIdx != 0u) { LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(indent + 1); } CHECK(puIdx < GlobalTables::GetFunctionTable().GetFuncTable().size(), "index out of range in CallNode::Dump"); MIRFunction *func = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(puIdx); LogInfo::MapleLogger() << " &" << func->GetName(); - NaryOpnds::Dump(mod, indent); + NaryOpnds::Dump(indent); if (kOpcodeInfo.IsCallAssigned(GetOpCode())) { - DumpCallReturns(mod, this->GetReturnVec(), indent); + DumpCallReturns(*theMIRModule, this->GetReturnVec(), indent); } else if (newline) { LogInfo::MapleLogger() << '\n'; } @@ -1006,11 +1006,11 @@ MIRType *IcallNode::GetCallReturnType() { return GlobalTables::GetTypeTable().GetTypeFromTyIdx(retTyIdx); } -void IcallNode::Dump(const MIRModule &mod, int32 indent, bool newline) const { - StmtNode::DumpBase(mod, indent); - NaryOpnds::Dump(mod, indent); +void IcallNode::Dump(int32 indent, bool newline) const { + StmtNode::DumpBase(indent); + NaryOpnds::Dump(indent); if (kOpcodeInfo.IsCallAssigned(GetOpCode())) { - DumpCallReturns(mod, this->returnValues, indent); + DumpCallReturns(*theMIRModule, this->returnValues, indent); } else if (newline) { LogInfo::MapleLogger() << '\n'; } @@ -1022,9 +1022,9 @@ MIRType *IntrinsiccallNode::GetCallReturnType() { return intrinDesc->GetReturnType(); } -void IntrinsiccallNode::Dump(const MIRModule &mod, int32 indent, bool newline) const { - StmtNode::DumpBase(mod, indent); - if (tyIdx != 0) { +void IntrinsiccallNode::Dump(int32 indent, bool newline) const { + StmtNode::DumpBase(indent); + if (tyIdx != 0u) { LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(indent + 1); } @@ -1034,16 +1034,16 @@ void IntrinsiccallNode::Dump(const MIRModule &mod, int32 indent, bool newline) c } else { LogInfo::MapleLogger() << " " << intrinsic; } - NaryOpnds::Dump(mod, indent); + NaryOpnds::Dump(indent); if (kOpcodeInfo.IsCallAssigned(GetOpCode())) { - DumpCallReturns(mod, this->GetReturnVec(), indent); + DumpCallReturns(*theMIRModule, this->GetReturnVec(), indent); } else if (newline) { LogInfo::MapleLogger() << '\n'; } } -void CallinstantNode::Dump(const MIRModule &mod, int32 indent, bool newline) const { - StmtNode::DumpBase(mod, indent); +void CallinstantNode::Dump(int32 indent, bool newline) const { + StmtNode::DumpBase(indent); MIRFunction *func = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(GetPUIdx()); LogInfo::MapleLogger() << " &" << func->GetName(); MIRType *ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(instVecTyIdx); @@ -1051,25 +1051,25 @@ void CallinstantNode::Dump(const MIRModule &mod, int32 indent, bool newline) con auto *instVecType = static_cast(ty); instVecType->Dump(indent); LogInfo::MapleLogger() << ">"; - NaryOpnds::Dump(mod, indent); + NaryOpnds::Dump(indent); if (kOpcodeInfo.IsCallAssigned(GetOpCode())) { - DumpCallReturns(mod, this->GetReturnVec(), indent); + DumpCallReturns(*theMIRModule, this->GetReturnVec(), indent); } else if (newline) { LogInfo::MapleLogger() << '\n'; } } -void BlockNode::Dump(const MIRModule &mod, int32 indent, const MIRSymbolTable *theSymTab, MIRPregTable *thePregTab, +void BlockNode::Dump(int32 indent, const MIRSymbolTable *theSymTab, MIRPregTable *thePregTab, bool withInfo, bool isFuncbody) const { if (!withInfo) { LogInfo::MapleLogger() << " {\n"; } // output puid for debugging purpose if (isFuncbody) { - mod.CurFunction()->DumpFuncBody(indent); + theMIRModule->CurFunction()->DumpFuncBody(indent); if (theSymTab != nullptr && thePregTab != nullptr) { // print the locally declared type names - for (auto it : mod.CurFunction()->GetGStrIdxToTyIdxMap()) { + for (auto it : theMIRModule->CurFunction()->GetGStrIdxToTyIdxMap()) { const std::string &name = GlobalTables::GetStrTable().GetStringFromStrIdx(it.first); MIRType *type = GlobalTables::GetTypeTable().GetTypeFromTyIdx(it.second); PrintIndentation(indent + 1); @@ -1086,7 +1086,7 @@ void BlockNode::Dump(const MIRModule &mod, int32 indent, const MIRSymbolTable *t thePregTab->DumpRef(indent + 1); } LogInfo::MapleLogger() << '\n'; - for (std::pair it : mod.CurFunction()->GetAliasVarMap()) { + for (std::pair it : theMIRModule->CurFunction()->GetAliasVarMap()) { LogInfo::MapleLogger() << "ALIAS %" << GlobalTables::GetStrTable().GetStringFromStrIdx(it.first) << " %" << GlobalTables::GetStrTable().GetStringFromStrIdx(it.second.memPoolStrIdx) << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(it.second.tyIdx)->Dump(0); @@ -1097,29 +1097,29 @@ void BlockNode::Dump(const MIRModule &mod, int32 indent, const MIRSymbolTable *t } } if (srcPosition.FileNum() != 0 && srcPosition.LineNum() != 0 && srcPosition.LineNum() != lastPrintedLineNum && - mod.CurFunction()->WithLocInfo()) { + theMIRModule->CurFunction()->WithLocInfo()) { LogInfo::MapleLogger() << "LOC " << srcPosition.FileNum() << " " << srcPosition.LineNum() << '\n'; lastPrintedLineNum = srcPosition.LineNum(); } for (auto &stmt : GetStmtNodes()) { - stmt.Dump(mod, indent + 1); + stmt.Dump(indent + 1); } PrintIndentation(indent); LogInfo::MapleLogger() << "}\n"; } -void LabelNode::Dump(const MIRModule &mod, int32 indent) const { +void LabelNode::Dump(int32) const { if (srcPosition.FileNum() != 0 && srcPosition.LineNum() != 0 && srcPosition.LineNum() != lastPrintedLineNum && - mod.CurFunction()->WithLocInfo()) { + theMIRModule->CurFunction()->WithLocInfo()) { LogInfo::MapleLogger() << "LOC " << srcPosition.FileNum() << " " << srcPosition.LineNum() << '\n'; lastPrintedLineNum = srcPosition.LineNum(); } - LogInfo::MapleLogger() << "@" << mod.CurFunction()->GetLabelName(labelIdx) << " "; + LogInfo::MapleLogger() << "@" << theMIRModule->CurFunction()->GetLabelName(labelIdx) << " "; } -void CommentNode::Dump(const MIRModule &mod, int32 indent) const { +void CommentNode::Dump(int32 indent) const { if (srcPosition.FileNum() != 0 && srcPosition.LineNum() != 0 && srcPosition.LineNum() != lastPrintedLineNum && - mod.CurFunction()->WithLocInfo()) { + theMIRModule->CurFunction()->WithLocInfo()) { LogInfo::MapleLogger() << "LOC " << srcPosition.FileNum() << " " << srcPosition.LineNum() << '\n'; lastPrintedLineNum = srcPosition.LineNum(); } @@ -1146,7 +1146,7 @@ bool ArithTypeVerify(const BaseNode &opnd) { bool verifyResult = ExcludeSmallIntTypeVerify(opnd); if (!verifyResult) { LogInfo::MapleLogger() << "\n#Error:u1,i8,u8,i16,u16 should not be used as types of arithmetic operations\n"; - opnd.Dump(*theMIRModule); + opnd.Dump(); } return verifyResult; } @@ -1156,7 +1156,7 @@ inline bool ReadTypeVerify(const BaseNode &opnd) { if (!verifyResult) { LogInfo::MapleLogger() << "\n#Error:u1,i8,u8,i16,u16 should not be used as result types for dread/iread/regread/ireadoff/ireadfpoff\n"; - opnd.Dump(*theMIRModule); + opnd.Dump(); } return verifyResult; } @@ -1285,8 +1285,8 @@ bool CompatibleTypeVerify(const BaseNode &opnd1, const BaseNode &opnd2) { } if (!verifyResult) { LogInfo::MapleLogger() << "\n#Error:incompatible operand types :\n"; - opnd1.Dump(*theMIRModule); - opnd2.Dump(*theMIRModule); + opnd1.Dump(); + opnd2.Dump(); } return verifyResult; } @@ -1340,7 +1340,7 @@ bool GetFieldType(MIRSrcLang srcLang, const MIRStructType *structType, FieldID t const auto *classType = static_cast(structType); std::stack inheritChain; TyIdx parentTyIdx = classType->GetParentTyIdx(); - while (parentTyIdx > 0) { + while (parentTyIdx > 0u) { auto *parentType = static_cast(GlobalTables::GetTypeTable().GetTypeFromTyIdx(parentTyIdx)); inheritChain.push(parentType); parentTyIdx = static_cast(parentType)->GetParentTyIdx(); @@ -1554,12 +1554,12 @@ bool BinaryNode::Verify() const { resTypeVerf = true; // don't print the same kind of error message twice if (GetOpCode() != OP_add && GetOpCode() != OP_sub) { LogInfo::MapleLogger() << "\n#Error: Only add and sub are allowed for pointer arithemetic\n"; - this->Dump(*theMIRModule); + this->Dump(); } else if (!IsAddress(GetPrimType())) { LogInfo::MapleLogger() << "\n#Error: Adding an offset to a pointer or subtracting one from a pointer should result in a pointer " "value\n"; - this->Dump(*theMIRModule); + this->Dump(); } } } @@ -1567,7 +1567,7 @@ bool BinaryNode::Verify() const { LogInfo::MapleLogger() << "\n#Error:result type of [add,div,sub,mul,max,min] and [ashr,band,bior,bxor,land,lior,lshr,shl,rem] must " "be in [i32,u32,i64,u64,f32,f64,dynamic-type]\n"; - this->Dump(*theMIRModule); + this->Dump(); } bool comp0Verf = CompatibleTypeVerify(*GetBOpnd(0), *this); bool comp1Verf = CompatibleTypeVerify(*GetBOpnd(1), *this); @@ -1591,7 +1591,7 @@ bool CompareNode::Verify() const { bool compVerf = CompatibleTypeVerify(*GetBOpnd(0), *GetBOpnd(1)); bool resTypeVerf = CompareTypeVerify(GetPrimType()); if (!resTypeVerf) { - this->Dump(*theMIRModule); + this->Dump(); } bool signVerf = true; bool typeVerf = compVerf && resTypeVerf; diff --git a/src/maple_ir/src/mir_parser.cpp b/src/maple_ir/src/mir_parser.cpp index 4d2810e998e366b01bf64e5535994b4fbca2bd0b..946e81470b4e4257f128be0cc39c70fb1e0f8b95 100644 --- a/src/maple_ir/src/mir_parser.cpp +++ b/src/maple_ir/src/mir_parser.cpp @@ -415,7 +415,7 @@ bool MIRParser::ParseStmtDowhile(StmtNodePtr &stmt) { bool MIRParser::ParseStmtLabel(StmtNodePtr &stmt) { GStrIdx strIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(lexer.GetName()); - LabelIdx labIdx = mod.CurFunction()->GetLabelTab()->GetStIdxFromStrIdx(strIdx); + LabelIdx labIdx = mod.CurFunction()->GetLabelTab()->GetLabelIdxFromStrIdx(strIdx); if (labIdx == 0) { labIdx = mod.CurFunction()->GetLabelTab()->CreateLabel(); mod.CurFunction()->GetLabelTab()->SetSymbolFromStIdx(labIdx, strIdx); @@ -447,7 +447,7 @@ bool MIRParser::ParseStmtGoto(StmtNodePtr &stmt) { return false; } GStrIdx strIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(lexer.GetName()); - LabelIdx labIdx = mod.CurFunction()->GetLabelTab()->GetStIdxFromStrIdx(strIdx); + LabelIdx labIdx = mod.CurFunction()->GetLabelTab()->GetLabelIdxFromStrIdx(strIdx); if (labIdx == 0) { labIdx = mod.CurFunction()->GetLabelTab()->CreateLabel(); mod.CurFunction()->GetLabelTab()->SetSymbolFromStIdx(labIdx, strIdx); @@ -471,7 +471,7 @@ bool MIRParser::ParseStmtBr(StmtNodePtr &stmt) { return false; } GStrIdx strIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(lexer.GetName()); - LabelIdx labIdx = mod.CurFunction()->GetLabelTab()->GetStIdxFromStrIdx(strIdx); + LabelIdx labIdx = mod.CurFunction()->GetLabelTab()->GetLabelIdxFromStrIdx(strIdx); if (labIdx == 0) { labIdx = mod.CurFunction()->GetLabelTab()->CreateLabel(); mod.CurFunction()->GetLabelTab()->SetSymbolFromStIdx(labIdx, strIdx); @@ -1041,7 +1041,7 @@ bool MIRParser::ParseCallReturns(CallReturnVector &retsvec) { Error("call ParsePrimType failed in ParseCallReturns"); return false; } - if (tyidx == 0) { + if (tyidx == 0u) { Error("expect primitive type but get "); return false; } @@ -1084,7 +1084,7 @@ bool MIRParser::ParseStmtJsTry(StmtNodePtr &stmt) { return false; } GStrIdx stridx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(lexer.GetName()); - LabelIdx labidx = mod.CurFunction()->GetLabelTab()->GetStIdxFromStrIdx(stridx); + LabelIdx labidx = mod.CurFunction()->GetLabelTab()->GetLabelIdxFromStrIdx(stridx); if (labidx == 0) { labidx = mod.CurFunction()->GetLabelTab()->CreateLabel(); mod.CurFunction()->GetLabelTab()->SetSymbolFromStIdx(labidx, stridx); @@ -1102,7 +1102,7 @@ bool MIRParser::ParseStmtJsTry(StmtNodePtr &stmt) { return false; } GStrIdx stridx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(lexer.GetName()); - LabelIdx labidx = mod.CurFunction()->GetLabelTab()->GetStIdxFromStrIdx(stridx); + LabelIdx labidx = mod.CurFunction()->GetLabelTab()->GetLabelIdxFromStrIdx(stridx); if (labidx == 0) { labidx = mod.CurFunction()->GetLabelTab()->CreateLabel(); mod.CurFunction()->GetLabelTab()->SetSymbolFromStIdx(labidx, stridx); @@ -1127,7 +1127,7 @@ bool MIRParser::ParseStmtTry(StmtNodePtr &stmt) { return false; } GStrIdx stridx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(lexer.GetName()); - LabelIdx labidx = mod.CurFunction()->GetLabelTab()->GetStIdxFromStrIdx(stridx); + LabelIdx labidx = mod.CurFunction()->GetLabelTab()->GetLabelIdxFromStrIdx(stridx); if (labidx == 0) { labidx = mod.CurFunction()->GetLabelTab()->CreateLabel(); mod.CurFunction()->GetLabelTab()->SetSymbolFromStIdx(labidx, stridx); @@ -1246,7 +1246,7 @@ bool MIRParser::ParseStmtGosub(StmtNodePtr &stmt) { return false; } GStrIdx stridx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(lexer.GetName()); - LabelIdx labidx = mod.CurFunction()->GetLabelTab()->GetStIdxFromStrIdx(stridx); + LabelIdx labidx = mod.CurFunction()->GetLabelTab()->GetLabelIdxFromStrIdx(stridx); if (labidx == 0) { labidx = mod.CurFunction()->GetLabelTab()->CreateLabel(); mod.CurFunction()->GetLabelTab()->SetSymbolFromStIdx(labidx, stridx); @@ -1342,7 +1342,7 @@ bool MIRParser::ParseNaryStmtSyncExit(StmtNodePtr &stmt) { return ParseNaryStmt(stmt, OP_syncexit); } -bool MIRParser::ParseLoc(StmtNodePtr &stmt) { +bool MIRParser::ParseLoc(StmtNodePtr&) { if (lexer.NextToken() != TK_intconst) { Error("expect intconst in LOC but get "); return false; @@ -1737,7 +1737,7 @@ bool MIRParser::ParseDeclaredSt(StIdx &stidx) { TokenKind varTk = lexer.GetTokenKind(); stidx.SetFullIdx(0); GStrIdx stridx = GlobalTables::GetStrTable().GetStrIdxFromName(lexer.GetName()); - if (stridx == 0) { + if (stridx == 0u) { Error("symbol not declared "); stidx.SetFullIdx(0); return false; @@ -1763,7 +1763,7 @@ bool MIRParser::ParseDeclaredSt(StIdx &stidx) { bool MIRParser::ParseDeclaredFunc(PUIdx &puidx) { GStrIdx stridx = GlobalTables::GetStrTable().GetStrIdxFromName(lexer.GetName()); - if (stridx == 0) { + if (stridx == 0u) { Error("symbol not declared "); return false; } @@ -1792,7 +1792,7 @@ bool MIRParser::ParseExprDread(BaseNodePtr &expr) { lexer.NextToken(); TyIdx tyidx(0); bool parseRet = ParsePrimType(tyidx); - if (tyidx == 0 || !parseRet) { + if (tyidx == 0u || !parseRet) { Error("expect primitive type but get "); return false; } @@ -1831,7 +1831,7 @@ bool MIRParser::ParseExprRegread(BaseNodePtr &expr) { if (!ParsePrimType(tyidx)) { return false; } - if (tyidx == 0) { + if (tyidx == 0u) { Error("expect primitive type but get "); return false; } @@ -2624,7 +2624,7 @@ bool MIRParser::ParseScalarValue(MIRConstPtr &stype, MIRType &type) { return true; } -bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr, MIRType &type) { +bool MIRParser::ParseConstAddrLeafExpr(MIRConstPtr &cexpr) { BaseNode *expr = nullptr; if (!ParseExpression(expr)) { return false; diff --git a/src/maple_ir/src/mir_pragma.cpp b/src/maple_ir/src/mir_pragma.cpp index d96f475ee9f9d3a0e765c603dbba01d52f61a0b3..7ae0d800d689845a8fd84573fe4002577053f9ca 100644 --- a/src/maple_ir/src/mir_pragma.cpp +++ b/src/maple_ir/src/mir_pragma.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -353,7 +353,7 @@ void MIRPragma::Dump(int indent) const { } LogInfo::MapleLogger() << GlobalTables::GetStrTable().GetStringFromStrIdx(strIdx) << " "; GStrIdx gStrIdx = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx(); - if (tyIdxEx != 0) { + if (tyIdxEx != 0u) { MIRType *typeEx = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdxEx); LogInfo::MapleLogger() << "\"" << typeEx->GetMplTypeName() << "\" "; } diff --git a/src/maple_ir/src/mir_symbol.cpp b/src/maple_ir/src/mir_symbol.cpp index 6e2e05286ca0a98bbb1863008a4feafdf855e5bf..25eb7c1167d5a72d4e5db80b43eaf878edf8d755 100644 --- a/src/maple_ir/src/mir_symbol.cpp +++ b/src/maple_ir/src/mir_symbol.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -275,7 +275,7 @@ bool MIRSymbol::IgnoreRC() const { // Ljava_2Flang_2Freflect_2FMethod_3B const auto *pType = static_cast(type); GStrIdx strIdx = GlobalTables::GetTypeTable().GetTypeFromTyIdx(pType->GetPointedTyIdx())->GetNameStrIdx(); - if (reflectClassNameIdx == 0) { + if (reflectClassNameIdx == 0u) { reflectClassNameIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName( NameMangler::GetInternalNameLiteral("Ljava_2Flang_2FClass_3B")); } @@ -315,7 +315,7 @@ void MIRSymbol::Dump(bool isLocal, int32 indent, bool suppressInit) const { } else if (GetStorageClass() == kScExtern) { LogInfo::MapleLogger() << "extern "; } - if (GetTyIdx() != 0) { + if (GetTyIdx() != 0u) { GlobalTables::GetTypeTable().GetTypeFromTyIdx(GetTyIdx())->Dump(indent + 1); } typeAttrs.DumpAttributes(); @@ -331,7 +331,7 @@ void MIRSymbol::Dump(bool isLocal, int32 indent, bool suppressInit) const { LogInfo::MapleLogger() << '\n'; } -void MIRSymbol::DumpAsLiteralVar(int32 indent) const { +void MIRSymbol::DumpAsLiteralVar() const { if (IsLiteral()) { LogInfo::MapleLogger() << GetName(); } @@ -370,7 +370,7 @@ const std::string &MIRLabelTable::GetName(LabelIdx labelIdx) const { bool MIRLabelTable::AddToStringLabelMap(LabelIdx labelIdx) { CHECK_FATAL(labelIdx < labelTable.size(), "index out of range in MIRLabelTable::AddToStringLabelMap"); - if (labelTable[labelIdx] == 0) { + if (labelTable[labelIdx] == 0u) { // generate a label name based on lab_idx std::ostringstream labelNameStream; labelNameStream << "@" << labelIdx; diff --git a/src/maple_ir/src/mir_symbol_builder.cpp b/src/maple_ir/src/mir_symbol_builder.cpp index 81b1c883457ae38dd22c72d131ff9e04ef4453bf..3e4850b718c909f9d690d3d3d7f48bef219fb7ed 100644 --- a/src/maple_ir/src/mir_symbol_builder.cpp +++ b/src/maple_ir/src/mir_symbol_builder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -18,7 +18,7 @@ namespace maple { MIRSymbol *MIRSymbolBuilder::GetLocalDecl(MIRSymbolTable &symbolTable, GStrIdx strIdx) const { - if (strIdx != 0) { + if (strIdx != 0u) { StIdx stIdx = symbolTable.GetStIdxFromStrIdx(strIdx); if (stIdx.FullIdx() != 0) { return symbolTable.GetSymbolFromStIdx(stIdx.Idx()); @@ -39,7 +39,7 @@ MIRSymbol *MIRSymbolBuilder::CreateLocalDecl(MIRSymbolTable &symbolTable, GStrId } MIRSymbol *MIRSymbolBuilder::GetGlobalDecl(GStrIdx strIdx) const { - if (strIdx != 0) { + if (strIdx != 0u) { StIdx stIdx = GlobalTables::GetGsymTable().GetStIdxFromStrIdx(strIdx); if (stIdx.FullIdx() != 0) { return GlobalTables::GetGsymTable().GetSymbolFromStidx(stIdx.Idx()); diff --git a/src/maple_ir/src/mir_type.cpp b/src/maple_ir/src/mir_type.cpp index cc96300b55ce62d94dd39073e5bab870a15c33a0..434e4dfabb34475b3a1e7e63bef559f3561836ad 100644 --- a/src/maple_ir/src/mir_type.cpp +++ b/src/maple_ir/src/mir_type.cpp @@ -310,7 +310,7 @@ const std::string &MIRType::GetName() const { bool MIRType::ValidateClassOrInterface(const std::string &className, bool noWarning) const { if (primType == maple::PTY_agg && (typeKind == maple::kTypeClass || typeKind == maple::kTypeInterface) && - nameStrIdx != 0) { + nameStrIdx != 0u) { return true; } if (!noWarning) { @@ -345,11 +345,11 @@ std::string MIRType::GetCompactMplTypeName() const { return ""; } -void MIRType::Dump(int indent, bool dontUseName) const { +void MIRType::Dump(int, bool) const { LogInfo::MapleLogger() << GetPrimTypeName(primType); } -void MIRType::DumpAsCxx(int indent) const { +void MIRType::DumpAsCxx(int) const { switch (primType) { case PTY_void: LogInfo::MapleLogger() << "void"; @@ -441,7 +441,7 @@ inline void DumpTypeName(GStrIdx strIdx, bool isLocal) { } static bool CheckAndDumpTypeName(GStrIdx strIdx, bool isLocal) { - if (strIdx == 0) { + if (strIdx == 0u) { return false; } LogInfo::MapleLogger() << "<"; @@ -509,24 +509,24 @@ std::string MIRFarrayType::GetCompactMplTypeName() const { } const std::string &MIRJarrayType::GetJavaName() { - if (javaNameStrIdx == 0) { + if (javaNameStrIdx == 0u) { DetermineName(); } return GlobalTables::GetStrTable().GetStringFromStrIdx(javaNameStrIdx); } MIRStructType *MIRJarrayType::GetParentType() { - if (parentTyIdx == 0) { + if (parentTyIdx == 0u) { GStrIdx jloStrIdx = GlobalTables::GetStrTable().GetStrIdxFromName( NameMangler::GetInternalNameLiteral(NameMangler::kJavaLangObjectStr)); parentTyIdx = GlobalTables::GetTypeNameTable().GetTyIdxFromGStrIdx(jloStrIdx); - ASSERT((parentTyIdx != 0), "cannot find type for java.lang.Object"); + ASSERT((parentTyIdx != 0u), "cannot find type for java.lang.Object"); } return static_cast(GlobalTables::GetTypeTable().GetTypeFromTyIdx(parentTyIdx)); } void MIRJarrayType::DetermineName() { - if (javaNameStrIdx != 0) { + if (javaNameStrIdx != 0u) { return; // already determined } MIRType *elemType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(GetElemTyIdx()); @@ -600,12 +600,12 @@ void MIRPtrType::Dump(int indent, bool dontUseName) const { } } -void MIRBitFieldType::Dump(int indent, bool dontUseName) const { +void MIRBitFieldType::Dump(int, bool) const { LogInfo::MapleLogger() << ":" << static_cast(fieldSize) << " " << GetPrimTypeName(primType); } size_t MIRClassType::GetSize() const { - if (parentTyIdx == 0) { + if (parentTyIdx == 0u) { return MIRStructType::GetSize(); } const auto *parentType = static_cast(GlobalTables::GetTypeTable().GetTypeFromTyIdx(parentTyIdx)); @@ -624,7 +624,7 @@ FieldID MIRClassType::GetFirstLocalFieldID() const { if (!IsLocal()) { return 0; } - if (parentTyIdx == 0) { + if (parentTyIdx == 0u) { return 1; } @@ -662,7 +662,7 @@ bool MIRClassType::IsExceptionType() const { FieldID MIRClassType::GetLastFieldID() const { FieldID fieldID = fields.size(); - if (parentTyIdx != 0) { + if (parentTyIdx != 0u) { const auto *parentClassType = static_cast(GlobalTables::GetTypeTable().GetTypeFromTyIdx(parentTyIdx)); if (parentClassType != nullptr) { @@ -1009,7 +1009,7 @@ void MIRClassType::Dump(int indent, bool dontUseName) const { return; } LogInfo::MapleLogger() << ((typeKind == kTypeClass) ? "Dump(indent + 1); LogInfo::MapleLogger() << " "; } @@ -1053,17 +1053,17 @@ void MIRInterfaceType::Dump(int indent, bool dontUseName) const { LogInfo::MapleLogger() << "}>"; } -void MIRTypeByName::Dump(int indent, bool dontUseName) const { +void MIRTypeByName::Dump(int, bool) const { const std::string &name = GlobalTables::GetStrTable().GetStringFromStrIdx(nameStrIdx); LogInfo::MapleLogger() << (nameIsLocal ? "<%" : "<$") << name << ">"; } -void MIRTypeParam::Dump(int indent, bool dontUseName) const { +void MIRTypeParam::Dump(int, bool) const { const std::string &name = GlobalTables::GetStrTable().GetStringFromStrIdx(nameStrIdx); LogInfo::MapleLogger() << ""; } -void MIRInstantVectorType::Dump(int indent, bool dontUseName) const { +void MIRInstantVectorType::Dump(int, bool) const { LogInfo::MapleLogger() << "{"; for (size_t i = 0; i < instantVec.size(); ++i) { TypePair typePair = instantVec[i]; @@ -1247,7 +1247,7 @@ FieldPair MIRStructType::TraverseToFieldRef(FieldID &fieldID) const { case kTypeInterfaceIncomplete: curFieldStructType = static_cast(curFieldType); curPair = curFieldStructType->TraverseToFieldRef(fieldID); - if (fieldID == 1 && curPair.second.first != 0) { + if (fieldID == 1 && curPair.second.first != 0u) { return curPair; } break; @@ -1325,7 +1325,7 @@ static bool ParentTypeHasVolatileField(const TyIdx parentTyIdx, bool &hasVolatil // go through all the fields to check if there is volatile attribute set; bool MIRClassType::HasVolatileField() const { return MIRStructType::HasVolatileField() || - (parentTyIdx != 0 && ParentTypeHasVolatileField(parentTyIdx, hasVolatileField)); + (parentTyIdx != 0u && ParentTypeHasVolatileField(parentTyIdx, hasVolatileField)); } // go through all the fields to check if there is volatile attribute set; @@ -1357,7 +1357,7 @@ bool MIRStructType::HasTypeParam() const { bool MIRClassType::HasTypeParam() const { return MIRStructType::HasTypeParam() || - (parentTyIdx != 0 && GlobalTables::GetTypeTable().GetTypeFromTyIdx(parentTyIdx)->HasTypeParam()); + (parentTyIdx != 0u && GlobalTables::GetTypeTable().GetTypeFromTyIdx(parentTyIdx)->HasTypeParam()); } bool MIRInterfaceType::HasTypeParam() const { @@ -1374,13 +1374,13 @@ bool MIRInterfaceType::HasTypeParam() const { } FieldPair MIRClassType::TraverseToFieldRef(FieldID &fieldID) const { - if (parentTyIdx != 0) { + if (parentTyIdx != 0u) { auto *parentClassType = static_cast(GlobalTables::GetTypeTable().GetTypeFromTyIdx(parentTyIdx)); if (parentClassType != nullptr) { --fieldID; const FieldPair &curPair = parentClassType->TraverseToFieldRef(fieldID); - if (fieldID == 1 && curPair.second.first != 0) { + if (fieldID == 1 && curPair.second.first != 0u) { return curPair; } } @@ -1389,7 +1389,7 @@ FieldPair MIRClassType::TraverseToFieldRef(FieldID &fieldID) const { } // fields in interface are all static and are global, won't be accessed through fields -FieldPair MIRInterfaceType::TraverseToFieldRef(FieldID &fieldID) const { +FieldPair MIRInterfaceType::TraverseToFieldRef(FieldID&) const { return { GStrIdx(0), TyIdxFieldAttrPair(TyIdx(0), FieldAttrs()) }; } diff --git a/src/maple_ir/src/option.cpp b/src/maple_ir/src/option.cpp index 6cd1f467ca27ab79a5ee72f1598f76fb90a5fb30..e6eeda9c9388eabf6825852c186d6b42aae663b1 100644 --- a/src/maple_ir/src/option.cpp +++ b/src/maple_ir/src/option.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/maple_ir/src/parser.cpp b/src/maple_ir/src/parser.cpp index a3c79ca9d20228274678a459886c1dfd5ad03849..059b4d6150bebfe6cbcfe2a65233466db66f89a0 100644 --- a/src/maple_ir/src/parser.cpp +++ b/src/maple_ir/src/parser.cpp @@ -314,7 +314,7 @@ bool MIRParser::ParseFarrayType(TyIdx &arrayTyIdx) { Error("unexpect token parsing flexible array element type "); return false; } - ASSERT(tyIdx != 0, "error encountered parsing flexible array element type "); + ASSERT(tyIdx != 0u, "error encountered parsing flexible array element type "); if (mod.IsJavaModule()) { MIRJarrayType jarrayType(tyIdx); arrayTyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&jarrayType); @@ -361,7 +361,7 @@ bool MIRParser::ParseArrayType(TyIdx &arrayTyIdx) { Error("unexpect token parsing array type after ] "); return false; } - ASSERT(tyIdx != 0, "something wrong with parsing element type "); + ASSERT(tyIdx != 0u, "something wrong with parsing element type "); MIRArrayType arrayType(tyIdx, vec); arrayTyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&arrayType); return true; @@ -682,7 +682,7 @@ bool MIRParser::ParseFields(MIRStructType &type) { Error("unexpected type parsing struct type at "); return false; } - ASSERT((fieldTyIdx != 0 || notaType), "something wrong parsing struct type"); + ASSERT((fieldTyIdx != 0u || notaType), "something wrong parsing struct type"); if (!notaType) { FieldAttrs tA; if (!ParseFieldAttrs(tA)) { @@ -798,7 +798,7 @@ bool MIRParser::ParseFields(MIRStructType &type) { std::string nameStr = lexer.GetName(); GStrIdx strIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(nameStr); TyIdx tyIdx = mod.GetTypeNameTab()->GetTyIdxFromGStrIdx(strIdx); - if (tyIdx == 0) { + if (tyIdx == 0u) { MIRInterfaceType interfaceType(kTypeInterfaceIncomplete); interfaceType.SetNameStrIdx(strIdx); tyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&interfaceType); @@ -843,7 +843,7 @@ bool MIRParser::ParseStructType(TyIdx &styIdx) { if (!ParseFields(structType)) { return false; } - if (styIdx != 0) { + if (styIdx != 0u) { MIRType *prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(styIdx); ASSERT(prevType->GetKind() == kTypeStruct || prevType->GetKind() == kTypeStructIncomplete, "type kind should be consistent."); @@ -874,7 +874,7 @@ bool MIRParser::ParseClassType(TyIdx &styidx) { if (!ParseFields(classType)) { return false; } - if (styidx != 0) { + if (styidx != 0u) { MIRType *prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(styidx); ASSERT(prevType->GetKind() == kTypeClass || prevType->GetKind() == kTypeClassIncomplete, "type kind should be consistent."); @@ -917,7 +917,7 @@ bool MIRParser::ParseInterfaceType(TyIdx &sTyIdx) { if (!ParseFields(interfaceType)) { return false; } - if (sTyIdx != 0) { + if (sTyIdx != 0u) { MIRType *prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(sTyIdx); ASSERT(prevType->GetKind() == kTypeInterface || prevType->GetKind() == kTypeInterfaceIncomplete, "type kind should be consistent."); @@ -1114,7 +1114,7 @@ bool MIRParser::ParseDefinedTypename(TyIdx &definedTyIdx, MIRTypeKind kind) { } if (tk == TK_gname) { definedTyIdx = mod.GetTypeNameTab()->GetTyIdxFromGStrIdx(strIdx); - if (definedTyIdx == 0) { + if (definedTyIdx == 0u) { if (kind == kTypeInterface || kind == kTypeInterfaceIncomplete) { MIRInterfaceType interfaceType(kTypeInterfaceIncomplete); interfaceType.SetNameStrIdx(strIdx); @@ -1137,14 +1137,14 @@ bool MIRParser::ParseDefinedTypename(TyIdx &definedTyIdx, MIRTypeKind kind) { } } else { definedTyIdx = mod.CurFunction()->GetTyIdxFromGStrIdx(strIdx); - if (definedTyIdx == 0) { + if (definedTyIdx == 0u) { MIRTypeByName nameType(strIdx); definedTyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&nameType); mod.GetTypeNameTab()->SetGStrIdxToTyIdx(strIdx, definedTyIdx); } } // replace prevTypeIdx with definedTyIdx - if (prevTypeIdx != 0 && prevTypeIdx != definedTyIdx) { + if (prevTypeIdx != 0u && prevTypeIdx != definedTyIdx) { // replace all uses of prevTypeIdx by tyIdx in type_table_ typeDefIdxMap[prevTypeIdx] = definedTyIdx; // remove prevTypeIdx from classlist @@ -1202,7 +1202,7 @@ bool MIRParser::ParsePointType(TyIdx &tyIdx) { Error("unexpect type "); return false; } - ASSERT(pointTypeIdx != 0, "something wrong with parsing element type "); + ASSERT(pointTypeIdx != 0u, "something wrong with parsing element type "); PrimType pty = mod.IsJavaModule() ? PTY_ref : PTY_ptr; if (pdtk == maple::TK_constStr) { pty = PTY_ptr; @@ -1462,7 +1462,7 @@ bool MIRParser::ParseTypedef() { return false; } prevTyIdx = mod.GetTypeNameTab()->GetTyIdxFromGStrIdx(strIdx); - if (prevTyIdx != 0) { + if (prevTyIdx != 0u) { MIRType *prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(prevTyIdx); CHECK_FATAL(prevType->IsStructType(), "type error"); prevStructType = static_cast(prevType); @@ -1488,7 +1488,7 @@ bool MIRParser::ParseTypedef() { return false; } prevTyIdx = mod.CurFunction()->GetTyIdxFromGStrIdx(strIdx); - if (prevTyIdx != 0) { + if (prevTyIdx != 0u) { MIRType *prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(prevTyIdx); if ((prevType->GetKind() != kTypeByName) && (prevType->IsStructType() && !prevType->IsIncomplete())) { Error("redefined local type name "); @@ -1509,7 +1509,7 @@ bool MIRParser::ParseTypedef() { Error("error passing derived type at "); return false; } - if (prevTyIdx != 0) { + if (prevTyIdx != 0u) { return true; } // for class/interface types, prev_tyidx could also be set during processing @@ -1518,7 +1518,7 @@ bool MIRParser::ParseTypedef() { prevTyIdx = mod.CurFunction()->GetTyIdxFromGStrIdx(strIdx); mod.CurFunction()->SetGStrIdxToTyIdx(strIdx, tyIdx); ASSERT(GlobalTables::GetTypeTable().GetTypeTable().empty() == false, "container check"); - if (GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx() == 0) { + if (GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx() == 0u) { GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->SetNameStrIdx(strIdx); GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->SetNameIsLocal(true); } @@ -1527,7 +1527,7 @@ bool MIRParser::ParseTypedef() { mod.GetTypeNameTab()->SetGStrIdxToTyIdx(strIdx, tyIdx); mod.PushbackTypeDefOrder(strIdx); ASSERT(GlobalTables::GetTypeTable().GetTypeTable().empty() == false, "container check"); - if (GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx() == 0) { + if (GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx() == 0u) { GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->SetNameStrIdx(strIdx); } } @@ -1537,12 +1537,12 @@ bool MIRParser::ParseTypedef() { if (!isLocal && (type->GetKind() == kTypeClass || type->GetKind() == kTypeClassIncomplete || type->GetKind() == kTypeInterface || type->GetKind() == kTypeInterfaceIncomplete)) { prevTyIdx = GlobalTables::GetTypeNameTable().GetTyIdxFromGStrIdx(strIdx); - if (prevTyIdx == 0) { + if (prevTyIdx == 0u) { GlobalTables::GetTypeNameTable().SetGStrIdxToTyIdx(strIdx, tyIdx); } // setup eh root type MIRType *ehType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); - if (mod.GetThrowableTyIdx() == 0 && + if (mod.GetThrowableTyIdx() == 0u && (ehType->GetKind() == kTypeClass || ehType->GetKind() == kTypeClassIncomplete)) { GStrIdx ehTypeNameIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName( NameMangler::GetInternalNameLiteral(NameMangler::kJavaLangObjectStr)); @@ -1724,7 +1724,8 @@ bool MIRParser::ParseDeclareVar(MIRSymbol &symbol) { bool allowEmpty = false; // allow empty initialization for vtable, itable, vtableOffsetTable and fieldOffsetTable if (symbolStrName.find(VTAB_PREFIX_STR) == 0 || symbolStrName.find(NameMangler::kVtabOffsetTabStr) == 0 || - symbolStrName.find(ITAB_PREFIX_STR) == 0 || symbolStrName.find(NameMangler::kFieldOffsetTabStr) == 0) { + symbolStrName.find(ITAB_PREFIX_STR) == 0 || symbolStrName.find(NameMangler::kFieldOffsetTabStr) == 0 || + symbolStrName.find(ITAB_CONFLICT_PREFIX_STR) == 0) { allowEmpty = true; } if (!ParseInitValue(mirConst, tyIdx, allowEmpty)) { @@ -1971,7 +1972,7 @@ bool MIRParser::ParseInitValue(MIRConstPtr &theConst, TyIdx tyIdx, bool allowEmp } lexer.NextToken(); } else if (IsConstAddrExpr(tokenKind)) { - if (!ParseConstAddrLeafExpr(mirConst, type)) { + if (!ParseConstAddrLeafExpr(mirConst)) { Error("ParseInitValue expect const addr expr"); return false; } @@ -2006,7 +2007,7 @@ bool MIRParser::ParseInitValue(MIRConstPtr &theConst, TyIdx tyIdx, bool allowEmp } lexer.NextToken(); } else if (IsConstAddrExpr(tokenKind)) { - if (!ParseConstAddrLeafExpr(subConst, type)) { + if (!ParseConstAddrLeafExpr(subConst)) { Error("ParseInitValue expect const addr expr"); return false; } @@ -2066,7 +2067,7 @@ bool MIRParser::ParseInitValue(MIRConstPtr &theConst, TyIdx tyIdx, bool allowEmp return false; } fieldTyIdx = static_cast(type).GetFieldTyIdx(theFieldID); - if (fieldTyIdx == 0) { + if (fieldTyIdx == 0u) { Error("field ID out of range at struct initialization at "); return false; } @@ -2079,7 +2080,7 @@ bool MIRParser::ParseInitValue(MIRConstPtr &theConst, TyIdx tyIdx, bool allowEmp } lexer.NextToken(); } else if (IsConstAddrExpr(tokenKind)) { - if (!ParseConstAddrLeafExpr(subConst, type)) { + if (!ParseConstAddrLeafExpr(subConst)) { Error("ParseInitValue expect const addr expr"); return false; } @@ -2152,7 +2153,7 @@ bool MIRParser::ParseFuncInfo() { return false; } -bool MIRParser::ParseAlias(StmtNodePtr &stmt) { +bool MIRParser::ParseAlias(StmtNodePtr&) { TokenKind nameTk = lexer.NextToken(); if (nameTk != TK_lname) { Error("expect local in ALIAS but get "); @@ -2217,7 +2218,7 @@ static void GenJStringType(MIRModule &module) { // Global module.GetTypeNameTab()->SetGStrIdxToTyIdx(strIdx, tyIdx); ASSERT(GlobalTables::GetTypeTable().GetTypeTable().empty() == false, "container check"); - if (GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx() == 0) { + if (GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx() == 0u) { GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->SetNameStrIdx(strIdx); } } @@ -2664,7 +2665,7 @@ bool MIRParser::ParseMIRForImport() { } } } - if (GlobalTables::GetStrTable().GetStrIdxFromName("__class_meta__") == 0) { + if (GlobalTables::GetStrTable().GetStrIdxFromName("__class_meta__") == 0u) { GenJStringType(mod); } GStrIdx strIdx = GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(importFileName); diff --git a/src/maple_me/include/alias_class.h b/src/maple_me/include/alias_class.h index 8f3737a29d7b545d6078ecbff41f2fb9f43c7f2d..aec1cae8f8bdae4fcca3f9c69cc98d96a00ed5ea 100644 --- a/src/maple_me/include/alias_class.h +++ b/src/maple_me/include/alias_class.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -32,7 +32,7 @@ class AliasElem { ~AliasElem() = default; - void Dump(const MIRModule &mod) const; + void Dump() const; uint32 GetClassID() const { return id; @@ -152,7 +152,7 @@ class AliasClass : public AnalysisResult { void CollectNotAllDefsSeenAes(); void CreateClassSets(); void DumpClassSets(); - void InsertMayDefUseCall(StmtNode &stmt, BBId bbID, bool hasSideEffect, bool hasNoPrivateDefEffect); + void InsertMayDefUseCall(StmtNode &stmt, bool hasSideEffect, bool hasNoPrivateDefEffect); void GenericInsertMayDefUse(StmtNode &stmt, BBId bbID); protected: @@ -179,7 +179,7 @@ class AliasClass : public AnalysisResult { void CollectMayDefForMustDefs(const StmtNode &stmt, std::set &mayDefOsts); void CollectMayUseForCallOpnd(const StmtNode &stmt, std::set &mayUseOsts); void InsertMayDefNodeForCall(std::set &mayDefOsts, MapleMap &mayDefNodes, - StmtNode &stmt, BBId bbID, bool hasNoPrivateDefEffect); + StmtNode &stmt, bool hasNoPrivateDefEffect); void InsertMayUseExpr(BaseNode &expr); void CollectMayUseFromGlobalsAffectedByCalls(std::set &mayUseOsts); void CollectMayUseFromNADS(std::set &mayUseOsts); diff --git a/src/maple_me/include/dse.h b/src/maple_me/include/dse.h index 4ba0681f655cc9698e013ede20c8f252c38bb76d..1a74163bd47e5ac53288c3754c7f43fe0dfe654f 100644 --- a/src/maple_me/include/dse.h +++ b/src/maple_me/include/dse.h @@ -28,7 +28,8 @@ class DSE { public: DSE(MIRModule &mod, std::vector &&bbVec, BB &commonEntryBB, BB &commonExitBB, SSATab &ssaTab, Dominance &postDom, bool enableDebug = false) - : enableDebug(enableDebug), mirModule(mod), bbVec(bbVec), commonEntryBB(commonEntryBB), + : enableDebug(enableDebug), + bbVec(bbVec), commonEntryBB(commonEntryBB), commonExitBB(commonExitBB), ssaTab(ssaTab), postDom(postDom), bbRequired(bbVec.size(), false) {} @@ -84,7 +85,7 @@ class DSE { void RemoveNotRequiredStmtsInBB(BB &bb); void OnRemoveBranchStmt(BB &bb, const StmtNode &stmt); - void CheckRemoveCallAssignedReturn(BB &bb, StmtNode &stmt); + void CheckRemoveCallAssignedReturn(StmtNode &stmt); bool IsStmtRequired(const utils::SafePtr &stmt) const { return stmtRequired.find(stmt) != stmtRequired.end(); @@ -106,7 +107,6 @@ class DSE { bool StmtMustRequired(const StmtNode &stmt, BB &bb); void DumpStmt(const StmtNode &stmt, const std::string &msg); - MIRModule &mirModule; std::vector bbVec; BB &commonEntryBB; BB &commonExitBB; diff --git a/src/maple_me/include/irmap.h b/src/maple_me/include/irmap.h index 15e6ee8ddcb9c095665a985d856e458044a4d7a9..5d45b76073bac58d96a2d965638170c8bad34e34 100644 --- a/src/maple_me/include/irmap.h +++ b/src/maple_me/include/irmap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -91,7 +91,7 @@ class IRMap : public AnalysisResult { MeVarPhiNode *CreateMeVarPhi(VarMeExpr&); virtual void Dump() = 0; - virtual void SetCurFunction(const BB &bb) {} + virtual void SetCurFunction(const BB&) {} MeExpr *CreateIntConstMeExpr(int64, PrimType); MeExpr *CreateConstMeExpr(PrimType, MIRConst&); diff --git a/src/maple_me/include/me_ir.h b/src/maple_me/include/me_ir.h index f621aca165e9ffc82c39dbea944c39f4a567502f..3085fb603669e780794b1923a92861a55dc6cd32 100644 --- a/src/maple_me/include/me_ir.h +++ b/src/maple_me/include/me_ir.h @@ -110,7 +110,9 @@ class MeExpr { this->numOpnds = static_cast(numOpnds); } - virtual void Dump(IRMap*, int32 indent = 0) const {} + virtual void Dump(IRMap*, int32 indent = 0) const { + (void)indent; + } virtual bool IsZero() const { return false; @@ -136,15 +138,15 @@ class MeExpr { bool IsTheSameWorkcand(const MeExpr&) const; virtual void SetDefByStmt(MeStmt&) {} - virtual MeExpr *GetOpnd(size_t i) const { + virtual MeExpr *GetOpnd(size_t) const { return nullptr; } - virtual void SetOpnd(size_t idx, MeExpr *opndsVal) { + virtual void SetOpnd(size_t, MeExpr*) { ASSERT(false, "Should not reach here"); } - virtual MeExpr *GetIdenticalExpr(MeExpr &expr) const { + virtual MeExpr *GetIdenticalExpr(MeExpr&) const { ASSERT(false, "Should not reach here"); return nullptr; } @@ -1136,7 +1138,7 @@ class MeStmt { return nullptr; } - virtual void SetOpnd(uint32 idx, MeExpr *val) {} + virtual void SetOpnd(uint32, MeExpr*) {} bool IsAssertBce() const { return op == OP_assertlt || op == OP_assertge; @@ -1222,7 +1224,7 @@ class MeStmt { return nullptr; } - virtual MeExpr *GetLHSRef(SSATab &ssaTab, bool excludeLocalRefVar) { + virtual MeExpr *GetLHSRef(SSATab&, bool) { return nullptr; } @@ -1447,8 +1449,9 @@ class MustDefMeNode { class PiassignMeStmt : public MeStmt { public: - explicit PiassignMeStmt(MapleAllocator *alloc) - : MeStmt(OP_piassign) {} + explicit PiassignMeStmt(MapleAllocator*) + : MeStmt(OP_piassign) { + } ~PiassignMeStmt() = default; void SetLHS(VarMeExpr &l) { @@ -1518,7 +1521,7 @@ class DassignMeStmt : public MeStmt { return rhs; } - void SetOpnd(uint32 idx, MeExpr *val) { + void SetOpnd(uint32, MeExpr *val) { rhs = val; } @@ -1643,7 +1646,7 @@ class RegassignMeStmt : public MeStmt { return rhs; } - void SetOpnd(uint32 idx, MeExpr *val) { + void SetOpnd(uint32, MeExpr *val) { rhs = val; } @@ -1704,7 +1707,7 @@ class MaydassignMeStmt : public MeStmt { return rhs; } - void SetOpnd(uint32 idx, MeExpr *val) { + void SetOpnd(uint32, MeExpr *val) { rhs = val; } @@ -1791,14 +1794,15 @@ class IassignMeStmt : public MeStmt { : MeStmt(stt), chiList(std::less(), alloc->Adapter()) {} - IassignMeStmt(MapleAllocator *alloc, const IassignMeStmt &iss) + IassignMeStmt(MapleAllocator*, const IassignMeStmt &iss) : MeStmt(iss), tyIdx(iss.tyIdx), lhsVar(iss.lhsVar), rhs(iss.rhs), - chiList(iss.chiList) {} + chiList(iss.chiList) { + } - IassignMeStmt(MapleAllocator *alloc, TyIdx tidx, IvarMeExpr *l, MeExpr *r, const MapleMap *clist) + IassignMeStmt(MapleAllocator*, TyIdx tidx, IvarMeExpr *l, MeExpr *r, const MapleMap *clist) : MeStmt(OP_iassign), tyIdx(tidx), lhsVar(l), rhs(r), chiList(*clist) { l->SetDefStmt(this); } @@ -2325,11 +2329,11 @@ class UnaryMeStmt : public MeStmt { return kOperandNumUnary; } - MeExpr *GetOpnd(size_t idx) const { + MeExpr *GetOpnd(size_t) const { return opnd; } - void SetOpnd(uint32 idx, MeExpr *val) { + void SetOpnd(uint32, MeExpr *val) { opnd = val; } @@ -2536,11 +2540,11 @@ class ThrowMeStmt : public WithMuMeStmt { return kOperandNumUnary; } - MeExpr *GetOpnd(size_t idx) const { + MeExpr *GetOpnd(size_t) const { return opnd; } - void SetOpnd(uint32 idx, MeExpr *val) { + void SetOpnd(uint32, MeExpr *val) { opnd = val; } @@ -2640,7 +2644,7 @@ class AssertMeStmt : public MeStmt { }; MapleMap *GenericGetChiListFromVarMeExpr(VarMeExpr &expr); -void DumpMuList(IRMap *irMap, const MapleMap &muList, int32 indent); +void DumpMuList(IRMap *irMap, const MapleMap &muList); void DumpChiList(IRMap *irMap, const MapleMap &chiList); class DumpOptions { public: diff --git a/src/maple_me/include/me_irmap.h b/src/maple_me/include/me_irmap.h index 8b633a0256338feffde49008ccb572a5561d0d62..410a4b0a5d3cdecdd8ef17e800caf9c7f2d696bb 100644 --- a/src/maple_me/include/me_irmap.h +++ b/src/maple_me/include/me_irmap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -33,7 +33,7 @@ class MeIRMap : public IRMap { return func.GetBBFromID(id); } - BB *GetBBForLabIdx(LabelIdx lidx, PUIdx pidx = 0) override { + BB *GetBBForLabIdx(LabelIdx lidx, PUIdx) override { return func.GetLabelBBAt(lidx); } diff --git a/src/maple_me/include/prop.h b/src/maple_me/include/prop.h index bffb0e5f87872b2f1a58bd9d70669245515fa13f..ce798b8909444d9d6bbfe1d39e873b8fb5a807ee 100644 --- a/src/maple_me/include/prop.h +++ b/src/maple_me/include/prop.h @@ -43,9 +43,10 @@ class Prop { protected: Dominance &dom; - virtual void UpdateCurFunction(BB &bb) {} + virtual void UpdateCurFunction(BB&) { + } - virtual bool LocalToDifferentPU(StIdx stidx, const BB &bb) const { + virtual bool LocalToDifferentPU(StIdx, const BB&) const { return false; } diff --git a/src/maple_me/include/ssa_mir_nodes.h b/src/maple_me/include/ssa_mir_nodes.h index 207a88a2abe42bef672bb9731a9fed15ddf1e403..8f2239883ffa0a393a21f1208471200981224e74 100644 --- a/src/maple_me/include/ssa_mir_nodes.h +++ b/src/maple_me/include/ssa_mir_nodes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -165,23 +165,23 @@ class AccessSSANodes { CHECK_FATAL(false, "No ssaVar"); } - virtual void SetSSAVar(VersionSt &vst) { + virtual void SetSSAVar(VersionSt&) { CHECK_FATAL(false, "No ssaVar"); } - virtual void DumpMayDefNodes(const MIRModule &mod) const { + virtual void DumpMayDefNodes(const MIRModule&) const { for (const auto &mayDefNode : GetMayDefNodes()) { mayDefNode.second.Dump(); } } - virtual void DumpMayUseNodes(const MIRModule &mod) const { + virtual void DumpMayUseNodes(const MIRModule&) const { for (const auto &mapItem : GetMayUseNodes()) { mapItem.second.Dump(); } } - virtual void DumpMustDefNodes(const MIRModule &mod) const { + virtual void DumpMustDefNodes(const MIRModule&) const { for (const auto &mustDefNode : GetMustDefNodes()) { mustDefNode.Dump(); } @@ -480,8 +480,8 @@ class AddrofSSANode : public SSANode { ~AddrofSSANode() override = default; - void Dump(const MIRModule &mod, int32 indent) const override { - addrofNode->Dump(mod, indent); + void Dump(int32 indent) const override { + addrofNode->Dump(indent); if (GetSSAVar() != nullptr) { GetSSAVar()->Dump(true); } @@ -505,11 +505,11 @@ class IreadSSANode : public SSANode { ~IreadSSANode() override = default; - void Dump(const MIRModule &mod, int32 indent) const override { + void Dump(int32 indent) const override { if (GetSSAVar() != nullptr) { GetSSAVar()->Dump(true); } - ireadNode->Dump(mod, indent); + ireadNode->Dump(indent); } FieldID GetFieldID() const { @@ -538,8 +538,8 @@ class RegreadSSANode : public SSANode { ~RegreadSSANode() override = default; - void Dump(const MIRModule &mod, int32 indent) const override { - regreadNode->Dump(mod, indent); + void Dump(int32 indent) const override { + regreadNode->Dump(indent); if (GetSSAVar() != nullptr) { GetSSAVar()->Dump(true); } diff --git a/src/maple_me/include/ssa_tab.h b/src/maple_me/include/ssa_tab.h index 405559c78d6903ee24182061430407e5abf9b98c..da2e7e094635f1b0e8101fd02bdf6715e7e348cd 100644 --- a/src/maple_me/include/ssa_tab.h +++ b/src/maple_me/include/ssa_tab.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -34,7 +34,7 @@ class SSATab : public AnalysisResult { ~SSATab() = default; BaseNode *CreateSSAExpr(BaseNode &expr); - void CreateSSAStmt(StmtNode &stmt, const BB &curbb); + void CreateSSAStmt(StmtNode &stmt); VersionSt *GetVerSt(size_t verIdx) { return versionStTable.GetVersionStFromID(verIdx); } diff --git a/src/maple_me/src/alias_analysis_table.cpp b/src/maple_me/src/alias_analysis_table.cpp index 325cd4a3a23024ce4dc11ab8c91c2ce174cb2b12..11c2d358a7de40f23dcb04935fa58c216c3974d6 100644 --- a/src/maple_me/src/alias_analysis_table.cpp +++ b/src/maple_me/src/alias_analysis_table.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -80,8 +80,8 @@ OriginalSt *AliasAnalysisTable::FindOrCreateExtraLevSymOrRegOriginalSt(OriginalS CHECK_FATAL(ost.GetIndirectLev() < INT8_MAX, "boundary check"); nextLevOst->SetIndirectLev(ost.GetIndirectLev() + 1); prevLevelNode.insert(std::make_pair(nextLevOst->GetIndex(), &ost)); - tyIdx = (tyIdx == 0) ? ost.GetTyIdx() : tyIdx; - if (tyIdx != 0) { + tyIdx = (tyIdx == 0u) ? ost.GetTyIdx() : tyIdx; + if (tyIdx != 0u) { // use the tyIdx info from the instruction const MIRType *mirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); if (mirType->GetKind() == kTypePointer) { diff --git a/src/maple_me/src/alias_class.cpp b/src/maple_me/src/alias_class.cpp index 3cf87a6a921542c87d79829e31592234cd43a339..150b53ac910e5840813f306a75a381da874c51e6 100644 --- a/src/maple_me/src/alias_class.cpp +++ b/src/maple_me/src/alias_class.cpp @@ -57,7 +57,7 @@ bool AliasClass::CallHasNoPrivateDefEffect(const CallNode &stmt) const { // here starts pass 1 code AliasElem *AliasClass::FindOrCreateAliasElem(OriginalSt &ost) { OStIdx ostIdx = ost.GetIndex(); - CHECK_FATAL(ostIdx > 0, "Invalid ost index"); + CHECK_FATAL(ostIdx > 0u, "Invalid ost index"); CHECK_FATAL(ostIdx < osym2Elem.size(), "Index out of range"); AliasElem *aliasElem = osym2Elem[ostIdx]; if (aliasElem != nullptr) { @@ -299,12 +299,12 @@ void AliasClass::DumpAssignSets() { if (aliasElem->GetAssignSet() == nullptr) { LogInfo::MapleLogger() << "Alone: "; - aliasElem->Dump(mirModule); + aliasElem->Dump(); LogInfo::MapleLogger() << '\n'; } else { LogInfo::MapleLogger() << "Members of assign set " << aliasElem->GetClassID() << ": "; for (unsigned int elemID : *(aliasElem->GetAssignSet())) { - id2Elem[elemID]->Dump(mirModule); + id2Elem[elemID]->Dump(); } LogInfo::MapleLogger() << '\n'; } @@ -581,7 +581,7 @@ void AliasClass::CreateClassSets() { #endif } -void AliasElem::Dump(const MIRModule &mod) const { +void AliasElem::Dump() const { ost.Dump(); LogInfo::MapleLogger() << "id" << id << ((notAllDefsSeen) ? "? " : " "); } @@ -595,12 +595,12 @@ void AliasClass::DumpClassSets() { if (aliaselem->GetClassSet() == nullptr) { LogInfo::MapleLogger() << "Alone: "; - aliaselem->Dump(mirModule); + aliaselem->Dump(); LogInfo::MapleLogger() << '\n'; } else { LogInfo::MapleLogger() << "Members of alias class " << aliaselem->GetClassID() << ": "; for (unsigned int elemID : *(aliaselem->GetClassSet())) { - id2Elem[elemID]->Dump(mirModule); + id2Elem[elemID]->Dump(); } LogInfo::MapleLogger() << '\n'; } @@ -913,7 +913,7 @@ void AliasClass::CollectMayUseForCallOpnd(const StmtNode &stmt, std::set &mayDefOsts, MapleMap &mayDefNodes, - StmtNode &stmt, BBId bbID, bool hasNoPrivateDefEffect) { + StmtNode &stmt, bool hasNoPrivateDefEffect) { for (OriginalSt *mayDefOst : mayDefOsts) { if (!hasNoPrivateDefEffect || !mayDefOst->IsPrivate()) { mayDefNodes.insert(std::make_pair( @@ -926,7 +926,7 @@ void AliasClass::InsertMayDefNodeForCall(std::set &mayDefOsts, Mapl // Insert mayDefs and mayUses for the callees. // Four kinds of mayDefs and mayUses are inserted, which are caused by callee // opnds, not_all_def_seen_ae, globalsAffectedByCalls, and mustDefs. -void AliasClass::InsertMayDefUseCall(StmtNode &stmt, BBId bbID, bool hasSideEffect, bool hasNoPrivateDefEffect) { +void AliasClass::InsertMayDefUseCall(StmtNode &stmt, bool hasSideEffect, bool hasNoPrivateDefEffect) { auto *theSSAPart = static_cast(ssaTab.GetStmtsSSAPart().SSAPartOf(stmt)); std::set mayDefUseOstsA; // 1. collect mayDefs and mayUses caused by callee-opnds @@ -936,7 +936,7 @@ void AliasClass::InsertMayDefUseCall(StmtNode &stmt, BBId bbID, bool hasSideEffe InsertMayUseNode(mayDefUseOstsA, theSSAPart->GetMayUseNodes()); // insert may def node, if the callee has side-effect. if (hasSideEffect) { - InsertMayDefNodeForCall(mayDefUseOstsA, theSSAPart->GetMayDefNodes(), stmt, bbID, hasNoPrivateDefEffect); + InsertMayDefNodeForCall(mayDefUseOstsA, theSSAPart->GetMayDefNodes(), stmt, hasNoPrivateDefEffect); } // 3. insert mayDefs and mayUses caused by globalsAffectedByCalls std::set mayDefUseOstsB; @@ -1050,7 +1050,7 @@ void AliasClass::GenericInsertMayDefUse(StmtNode &stmt, BBId bbID) { case OP_customcall: case OP_polymorphiccall: case OP_icall: { - InsertMayDefUseCall(stmt, bbID, CallHasSideEffect(static_cast(stmt)), + InsertMayDefUseCall(stmt, CallHasSideEffect(static_cast(stmt)), CallHasNoPrivateDefEffect(static_cast(stmt))); return; } diff --git a/src/maple_me/src/bb.cpp b/src/maple_me/src/bb.cpp index ad5d167308051881c017862229421583b447ccd6..8a26c3e8e5cef10c59f3f8f94e1e57c76b600732 100644 --- a/src/maple_me/src/bb.cpp +++ b/src/maple_me/src/bb.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -88,7 +88,7 @@ void BB::DumpHeader(MIRModule *mod) const { if (bbLabel != 0) { static LabelNode lblNode; lblNode.SetLabelIdx(bbLabel); - lblNode.Dump(*mod, 0); + lblNode.Dump(0); mod->GetOut() << '\n'; } } @@ -97,7 +97,7 @@ void BB::Dump(MIRModule *mod) { DumpHeader(mod); DumpPhi(); for (auto &stmt : stmtNodeList) { - stmt.Dump(*mod, 1); + stmt.Dump(1); } } diff --git a/src/maple_me/src/dse.cpp b/src/maple_me/src/dse.cpp index 7a68c8e7bb7492b36b734c9428877e2bcc444f75..d8e75afa623f380be93486d53ba11f47387d4399 100644 --- a/src/maple_me/src/dse.cpp +++ b/src/maple_me/src/dse.cpp @@ -125,11 +125,11 @@ bool DSE::StmtMustRequired(const StmtNode &stmt, BB &bb) { void DSE::DumpStmt(const StmtNode &stmt, const std::string &msg) { if (enableDebug) { LogInfo::MapleLogger() << msg; - stmt.Dump(mirModule); + stmt.Dump(); } } -void DSE::CheckRemoveCallAssignedReturn(BB &bb, StmtNode &stmt) { +void DSE::CheckRemoveCallAssignedReturn(StmtNode &stmt) { if (kOpcodeInfo.IsCallAssigned(stmt.GetOpCode())) { MapleVector &mustDefs = ssaTab.GetStmtMustDefNodes(stmt); for (auto &node : mustDefs) { @@ -174,7 +174,7 @@ void DSE::RemoveNotRequiredStmtsInBB(BB &bb) { continue; } - CheckRemoveCallAssignedReturn(bb, stmt); + CheckRemoveCallAssignedReturn(stmt); } } diff --git a/src/maple_me/src/irmap.cpp b/src/maple_me/src/irmap.cpp index 210103dbfd632c136eaa50c20697bf98dd11d55a..eb2e59e627285b1d1c861453a04e3bf0a2270f25 100644 --- a/src/maple_me/src/irmap.cpp +++ b/src/maple_me/src/irmap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -243,7 +243,7 @@ RegMeExpr *IRMap::CreateRegRefMeExpr(MeExpr &meExpr) { case kMeOpVar: { auto &varMeExpr = static_cast(meExpr); const OriginalSt *ost = ssaTab.GetOriginalStFromID(varMeExpr.GetOStIdx()); - ASSERT(ost->GetTyIdx() != 0, "expect ost->tyIdx to be initialized"); + ASSERT(ost->GetTyIdx() != 0u, "expect ost->tyIdx to be initialized"); mirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(ost->GetTyIdx()); break; } @@ -267,7 +267,7 @@ RegMeExpr *IRMap::CreateRegRefMeExpr(MeExpr &meExpr) { case kMeOpOp: if (meExpr.GetOp() == OP_retype) { auto &opMeExpr = static_cast(meExpr); - ASSERT(opMeExpr.GetTyIdx() != 0, "expect opMeExpr.tyIdx to be initialized"); + ASSERT(opMeExpr.GetTyIdx() != 0u, "expect opMeExpr.tyIdx to be initialized"); mirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(opMeExpr.GetTyIdx()); break; } @@ -893,7 +893,7 @@ MeExpr *IRMap::CreateMeExprTypeCvt(PrimType pType, PrimType opndptyp, MeExpr &op IntrinsiccallMeStmt *IRMap::CreateIntrinsicCallMeStmt(MIRIntrinsicID idx, std::vector &opnds, TyIdx tyIdx) { auto *meStmt = - NewInPool(tyIdx == 0 ? OP_intrinsiccall : OP_intrinsiccallwithtype, idx, tyIdx); + NewInPool(tyIdx == 0u ? OP_intrinsiccall : OP_intrinsiccallwithtype, idx, tyIdx); for (MeExpr *opnd : opnds) { meStmt->GetOpnds().push_back(opnd); } @@ -903,7 +903,7 @@ IntrinsiccallMeStmt *IRMap::CreateIntrinsicCallMeStmt(MIRIntrinsicID idx, std::v IntrinsiccallMeStmt *IRMap::CreateIntrinsicCallAssignedMeStmt(MIRIntrinsicID idx, std::vector &opnds, MeExpr *ret, TyIdx tyIdx) { auto *meStmt = NewInPool( - tyIdx == 0 ? OP_intrinsiccallassigned : OP_intrinsiccallwithtypeassigned, idx, tyIdx); + tyIdx == 0u ? OP_intrinsiccallassigned : OP_intrinsiccallwithtypeassigned, idx, tyIdx); for (MeExpr *opnd : opnds) { meStmt->GetOpnds().push_back(opnd); } diff --git a/src/maple_me/src/me_bb_layout.cpp b/src/maple_me/src/me_bb_layout.cpp index bc219fb99eed975c1c63106f7b2d4f61bf55a7cf..e53e9994701fa4793d4939bc8c4957db27c52198 100644 --- a/src/maple_me/src/me_bb_layout.cpp +++ b/src/maple_me/src/me_bb_layout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -395,7 +395,7 @@ void BBLayout::RemoveUnreachable(BB &bb) { func.NullifyBBByID(bb.GetBBId()); } -AnalysisResult *MeDoBBLayout::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr *moduleResMgr) { +AnalysisResult *MeDoBBLayout::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr*) { // mempool used in analysisresult MemPool *layoutMp = NewMemPool(); auto *bbLayout = layoutMp->New(*layoutMp, *func, DEBUGFUNC(func)); diff --git a/src/maple_me/src/me_bypath_eh.cpp b/src/maple_me/src/me_bypath_eh.cpp index 74d985009aff7d26fafea25fc028624adc14b151..b345d6d14583e20b3d9f9fb3964e75ec101863b0 100644 --- a/src/maple_me/src/me_bypath_eh.cpp +++ b/src/maple_me/src/me_bypath_eh.cpp @@ -326,7 +326,7 @@ void MeDoBypathEH::BypathException(MeFunction *func, KlassHierarchy *kh) { } } -AnalysisResult *MeDoBypathEH::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr *mrm) { +AnalysisResult *MeDoBypathEH::Run(MeFunction *func, MeFuncResultMgr*, ModuleResultMgr *mrm) { auto *kh = static_cast(mrm->GetAnalysisResult(MoPhase_CHA, &func->GetMIRModule())); CHECK_NULL_FATAL(kh); BypathException(func, kh); diff --git a/src/maple_me/src/me_cfg.cpp b/src/maple_me/src/me_cfg.cpp index 8ccdc6429b5a6937941652f43f082996aa37525a..751461fd8735ba7ea8ec00493d75e2b0f2029773 100644 --- a/src/maple_me/src/me_cfg.cpp +++ b/src/maple_me/src/me_cfg.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -788,7 +788,7 @@ void MeCFG::DumpToFileInStrs(std::ofstream &cfgFile) const { if (ContainsConststr(stmt)) { continue; } - stmt.Dump(func.GetMIRModule(), 1); + stmt.Dump(1); } cfgFile << "}\"];\n"; } diff --git a/src/maple_me/src/me_dominance.cpp b/src/maple_me/src/me_dominance.cpp index 248d240f35a2352a0586ea8d85583a00a0982ee3..175c73e1a901b12469bedf5f358709b07f686cf7 100644 --- a/src/maple_me/src/me_dominance.cpp +++ b/src/maple_me/src/me_dominance.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -22,7 +22,7 @@ // the reverse CFG(The CFG with its edges reversed) is always useful, // so we also generates the above two structures on the reverse CFG. namespace maple { -AnalysisResult *MeDoDominance::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr *moduleResMgr) { +AnalysisResult *MeDoDominance::Run(MeFunction *func, MeFuncResultMgr*, ModuleResultMgr*) { MemPool *memPool = NewMemPool(); auto *dom = memPool->New(*memPool, *NewMemPool(), func->GetAllBBs(), *func->GetCommonEntryBB(), *func->GetCommonExitBB()); diff --git a/src/maple_me/src/me_dse.cpp b/src/maple_me/src/me_dse.cpp index cd0144645a69603bf670e9767a54625be5b09fa5..edbe45fd15b92937f8ec924fba1c7b426ed3bcb6 100644 --- a/src/maple_me/src/me_dse.cpp +++ b/src/maple_me/src/me_dse.cpp @@ -59,7 +59,7 @@ void MeDSE::RunDSE() { } } -AnalysisResult *MeDoDSE::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr *mrm) { +AnalysisResult *MeDoDSE::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr*) { CHECK_NULL_FATAL(func); auto *postDom = static_cast(m->GetAnalysisResult(MeFuncPhase_DOMINANCE, func)); CHECK_NULL_FATAL(postDom); diff --git a/src/maple_me/src/me_emit.cpp b/src/maple_me/src/me_emit.cpp index 2432a2d228dfc5dc18471fc50a95521c3065ae9b..eb61da7f0c96f39b891ce1e223ba9e5ab2915c38 100644 --- a/src/maple_me/src/me_emit.cpp +++ b/src/maple_me/src/me_emit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -19,7 +19,7 @@ namespace maple { // emit IR to specified file -AnalysisResult *MeDoEmit::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr *moduleResMgr) { +AnalysisResult *MeDoEmit::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr*) { bool emitHssaOrAfter = (func->GetIRMap() != nullptr); if (func->NumBBs() > 0) { // generate bblist after layout (bb physical position) diff --git a/src/maple_me/src/me_function.cpp b/src/maple_me/src/me_function.cpp index eb4857fa550e3903fb4409ae790c5f1b926299c3..955ce19a2674b4e63c090011254a38db5d1f1836 100644 --- a/src/maple_me/src/me_function.cpp +++ b/src/maple_me/src/me_function.cpp @@ -489,7 +489,7 @@ void MeFunction::CloneBasicBlock(BB &newBB, const BB &orig) { newStmt->SetPrev(nullptr); newBB.AddStmtNode(newStmt); if (meSSATab != nullptr) { - meSSATab->CreateSSAStmt(*newStmt, newBB); + meSSATab->CreateSSAStmt(*newStmt); } } } @@ -504,7 +504,7 @@ void MeFunction::SplitBBPhysically(BB &bb, StmtNode &splitPoint, BB &newBB) { StmtNode *nextStmt = stmt->GetNext(); newBB.AddStmtNode(stmt); if (meSSATab != nullptr) { - meSSATab->CreateSSAStmt(*stmt, newBB); + meSSATab->CreateSSAStmt(*stmt); } stmt = nextStmt; } diff --git a/src/maple_me/src/me_hdse.cpp b/src/maple_me/src/me_hdse.cpp index 6db84071708f54ef4e14ef0b2ca23720d8bae8b9..528eb5a2296b5f0b4d5689a3482072fd817bcec9 100644 --- a/src/maple_me/src/me_hdse.cpp +++ b/src/maple_me/src/me_hdse.cpp @@ -112,7 +112,7 @@ void MeHDSE::RunHDSE() { DoHDSE(); } -AnalysisResult *MeDoHDSE::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr *mrm) { +AnalysisResult *MeDoHDSE::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr*) { auto *postDom = static_cast(m->GetAnalysisResult(MeFuncPhase_DOMINANCE, func)); CHECK_NULL_FATAL(postDom); auto *hMap = static_cast(m->GetAnalysisResult(MeFuncPhase_IRMAP, func)); diff --git a/src/maple_me/src/me_ir.cpp b/src/maple_me/src/me_ir.cpp index 74e30a0db204f5f695bf5d06fc59911397bfb833..3de43c41837064a505f47c29543204bccd8cac51 100644 --- a/src/maple_me/src/me_ir.cpp +++ b/src/maple_me/src/me_ir.cpp @@ -731,7 +731,7 @@ void MeRegPhiNode::Dump(IRMap *irMap) const { LogInfo::MapleLogger() << "}" << '\n'; } -void VarMeExpr::Dump(IRMap *irMap, int32 indent) const { +void VarMeExpr::Dump(IRMap *irMap, int32) const { LogInfo::MapleLogger() << "VAR "; irMap->GetSSATab().GetOriginalStFromID(ostIdx)->Dump(); LogInfo::MapleLogger() << " (field)" << fieldID; @@ -741,7 +741,7 @@ void VarMeExpr::Dump(IRMap *irMap, int32 indent) const { } } -void RegMeExpr::Dump(IRMap *irMap, int32 indent) const { +void RegMeExpr::Dump(IRMap *irMap, int32) const { LogInfo::MapleLogger() << "REGINDX:" << regIdx; LogInfo::MapleLogger() << " %" @@ -749,13 +749,13 @@ void RegMeExpr::Dump(IRMap *irMap, int32 indent) const { LogInfo::MapleLogger() << " mx" << GetExprID(); } -void AddroffuncMeExpr::Dump(IRMap *irMap, int32 indent) const { +void AddroffuncMeExpr::Dump(IRMap*, int32) const { LogInfo::MapleLogger() << "ADDROFFUNC:"; LogInfo::MapleLogger() << GlobalTables::GetFunctionTable().GetFunctionFromPuidx(puIdx)->GetName(); LogInfo::MapleLogger() << " mx" << GetExprID(); } -void GcmallocMeExpr::Dump(IRMap *irMap, int32 indent) const { +void GcmallocMeExpr::Dump(IRMap*, int32) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOp()).name << " " << GetPrimTypeName(GetPrimType()); LogInfo::MapleLogger() << " "; GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->Dump(0); @@ -763,28 +763,28 @@ void GcmallocMeExpr::Dump(IRMap *irMap, int32 indent) const { LogInfo::MapleLogger() << " "; } -void ConstMeExpr::Dump(IRMap *irMap, int32 indent) const { +void ConstMeExpr::Dump(IRMap*, int32) const { LogInfo::MapleLogger() << "CONST"; LogInfo::MapleLogger() << " "; constVal->Dump(); LogInfo::MapleLogger() << " mx" << GetExprID(); } -void ConststrMeExpr::Dump(IRMap *irMap, int32 indent) const { +void ConststrMeExpr::Dump(IRMap*, int32) const { LogInfo::MapleLogger() << "CONSTSTR"; LogInfo::MapleLogger() << " "; LogInfo::MapleLogger() << strIdx; LogInfo::MapleLogger() << " mx" << GetExprID(); } -void Conststr16MeExpr::Dump(IRMap *irMap, int32 indent) const { +void Conststr16MeExpr::Dump(IRMap*, int32) const { LogInfo::MapleLogger() << "CONSTSTR16"; LogInfo::MapleLogger() << " "; LogInfo::MapleLogger() << strIdx; LogInfo::MapleLogger() << " mx" << GetExprID(); } -void SizeoftypeMeExpr::Dump(IRMap *irMap, int32 indent) const { +void SizeoftypeMeExpr::Dump(IRMap*, int32) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOp()).name << " " << GetPrimTypeName(GetPrimType()); LogInfo::MapleLogger() << " TYIDX:" << tyIdx; MIRType *mirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); @@ -792,7 +792,7 @@ void SizeoftypeMeExpr::Dump(IRMap *irMap, int32 indent) const { LogInfo::MapleLogger() << " mx" << GetExprID(); } -void FieldsDistMeExpr::Dump(IRMap *irMap, int32 indent) const { +void FieldsDistMeExpr::Dump(IRMap*, int32) const { LogInfo::MapleLogger() << kOpcodeInfo.GetTableItemAt(GetOp()).name << " " << GetPrimTypeName(GetPrimType()); LogInfo::MapleLogger() << " TYIDX:" << tyIdx; MIRType *mirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); @@ -802,7 +802,7 @@ void FieldsDistMeExpr::Dump(IRMap *irMap, int32 indent) const { LogInfo::MapleLogger() << " mx" << GetExprID(); } -void AddrofMeExpr::Dump(IRMap *irMap, int32 indent) const { +void AddrofMeExpr::Dump(IRMap *irMap, int32) const { LogInfo::MapleLogger() << "ADDROF:"; irMap->GetSSATab().GetOriginalStFromID(ostIdx)->Dump(); LogInfo::MapleLogger() << " (field)" << fieldID; @@ -905,7 +905,7 @@ MeExpr *MaydassignMeStmt::GetLHSRef(SSATab &ssaTab, bool excludeLocalRefVar) { return lhs; } -MeExpr *IassignMeStmt::GetLHSRef(SSATab &ssaTab, bool excludeLocalRefVar) { +MeExpr *IassignMeStmt::GetLHSRef(SSATab&, bool) { MIRType *baseType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(lhsVar->GetTyIdx()); ASSERT(baseType != nullptr, "null ptr check"); auto *pType = static_cast(baseType)->GetPointedType(); @@ -1049,7 +1049,7 @@ void ChiMeNode::Dump(IRMap *irMap) const { LogInfo::MapleLogger() << "mx" << meRHS->GetExprID() << "}"; } -void DumpMuList(IRMap *irMap, const MapleMap &muList, int32 indent) { +void DumpMuList(IRMap *irMap, const MapleMap &muList) { if (muList.empty()) { return; } @@ -1147,7 +1147,7 @@ void AssignedPart::DumpAssignedPart(IRMap *irMap) const { void CallMeStmt::Dump(IRMap *irMap) const { LogInfo::MapleLogger() << "||MEIR|| " << kOpcodeInfo.GetTableItemAt(GetOp()).name << " "; - if (tyIdx != 0) { + if (tyIdx != 0u) { LogInfo::MapleLogger() << " TYIDX:" << tyIdx; MIRType *mirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); mirType->Dump(0); @@ -1156,7 +1156,7 @@ void CallMeStmt::Dump(IRMap *irMap) const { MIRFunction *func = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(puIdx); LogInfo::MapleLogger() << NameMangler::DecodeName(func->GetName()) << '\n'; DumpOpnds(irMap); - DumpMuList(irMap, muList, 0); + DumpMuList(irMap, muList); DumpChiList(irMap, chiList); DumpAssignedPart(irMap); } @@ -1165,7 +1165,7 @@ void IcallMeStmt::Dump(IRMap *irMap) const { LogInfo::MapleLogger() << "||MEIR|| " << kOpcodeInfo.GetTableItemAt(GetOp()).name << " "; LogInfo::MapleLogger() << " TYIDX:" << retTyIdx; DumpOpnds(irMap); - DumpMuList(irMap, muList, 0); + DumpMuList(irMap, muList); DumpChiList(irMap, chiList); DumpAssignedPart(irMap); } @@ -1179,7 +1179,7 @@ void IntrinsiccallMeStmt::Dump(IRMap *irMap) const { } LogInfo::MapleLogger() << GetIntrinsicName(intrinsic) << '\n'; DumpOpnds(irMap); - DumpMuList(irMap, muList, 0); + DumpMuList(irMap, muList); DumpChiList(irMap, chiList); DumpAssignedPart(irMap); } @@ -1187,7 +1187,7 @@ void IntrinsiccallMeStmt::Dump(IRMap *irMap) const { void RetMeStmt::Dump(IRMap *irMap) const { LogInfo::MapleLogger() << "||MEIR|| " << kOpcodeInfo.GetTableItemAt(GetOp()).name << '\n'; DumpOpnds(irMap); - DumpMuList(irMap, muList, 1); + DumpMuList(irMap, muList); } void CondGotoMeStmt::Dump(IRMap *irMap) const { @@ -1216,7 +1216,7 @@ void SwitchMeStmt::Dump(IRMap *irMap) const { void GosubMeStmt::Dump(IRMap *irMap) const { LogInfo::MapleLogger() << "||MEIR|| " << kOpcodeInfo.GetTableItemAt(GetOp()).name << '\n'; - DumpMuList(irMap, *GetMuList(), 0); + DumpMuList(irMap, *GetMuList()); LogInfo::MapleLogger() << '\n'; } @@ -1226,13 +1226,13 @@ void ThrowMeStmt::Dump(IRMap *irMap) const { LogInfo::MapleLogger() << "throwopnd: "; opnd->Dump(irMap, kDefaultPrintIndentNum); LogInfo::MapleLogger() << '\n'; - DumpMuList(irMap, *GetMuList(), 0); + DumpMuList(irMap, *GetMuList()); } void SyncMeStmt::Dump(IRMap *irMap) const { LogInfo::MapleLogger() << "||MEIR|| " << kOpcodeInfo.GetTableItemAt(GetOp()).name << '\n'; DumpOpnds(irMap); - DumpMuList(irMap, muList, 0); + DumpMuList(irMap, muList); DumpChiList(irMap, chiList); } diff --git a/src/maple_me/src/me_irmap.cpp b/src/maple_me/src/me_irmap.cpp index 836bb75e1b4a2f5f65210509775b609c17f007c8..0461bab1c4d01e30fb374bb4c48770c6d544c175 100644 --- a/src/maple_me/src/me_irmap.cpp +++ b/src/maple_me/src/me_irmap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -48,7 +48,7 @@ void MeIRMap::Dump() { LogInfo::MapleLogger() << "(" << i++ << ") "; } if (meStmt.GetOp() != OP_piassign) { - meStmt.EmitStmt(GetSSATab()).Dump(GetMIRModule(), 0); + meStmt.EmitStmt(GetSSATab()).Dump(0); } meStmt.Dump(this); } @@ -90,7 +90,7 @@ void MeIRMap::EmitBB(BB &bb, BlockNode &curblk) { } } -AnalysisResult *MeDoIRMap::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr *moduleResMgr) { +AnalysisResult *MeDoIRMap::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr*) { auto *dom = static_cast(funcResMgr->GetAnalysisResult(MeFuncPhase_DOMINANCE, func)); ASSERT(dom != nullptr, "dominance phase has problem"); MemPool *irMapMemPool = NewMemPool(); diff --git a/src/maple_me/src/me_loop_analysis.cpp b/src/maple_me/src/me_loop_analysis.cpp index 4fca50cf1c3aad818eca70f1934675ffd199a13d..5cbc740814541dd840f2d8cd4867e32870526b4d 100644 --- a/src/maple_me/src/me_loop_analysis.cpp +++ b/src/maple_me/src/me_loop_analysis.cpp @@ -97,7 +97,7 @@ void IdentifyLoops::MarkBB() { } } -AnalysisResult *MeDoMeLoop::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr *mrm) { +AnalysisResult *MeDoMeLoop::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr*) { auto *dom = static_cast(m->GetAnalysisResult(MeFuncPhase_DOMINANCE, func)); ASSERT(dom, "dominance phase has problem"); MemPool *meLoopMp = NewMemPool(); diff --git a/src/maple_me/src/me_loop_canon.cpp b/src/maple_me/src/me_loop_canon.cpp index 138b62d5ae23142d789f4ba58d21418b40e92255..9161bcc1c8f98a71833902aa5dea5fcb89425da0 100644 --- a/src/maple_me/src/me_loop_canon.cpp +++ b/src/maple_me/src/me_loop_canon.cpp @@ -184,7 +184,7 @@ void MeDoLoopCanon::Convert(MeFunction *func, BB *bb, BB *pred, MapleMap(m->GetAnalysisResult(MeFuncPhase_DOMINANCE, func)); ASSERT(dom != nullptr, "dom is null in MeDoLoopCanon::Run"); // set MeCFG's has_do_while flag diff --git a/src/maple_me/src/me_prop.cpp b/src/maple_me/src/me_prop.cpp index 967f96254690113d4d2ef5477a168e8f2ec93b6a..9695f08ab26023ec4ce583d67b44da7ee2c8c315 100644 --- a/src/maple_me/src/me_prop.cpp +++ b/src/maple_me/src/me_prop.cpp @@ -25,7 +25,7 @@ // its assigned value and try to do the substitution. namespace maple { -AnalysisResult *MeDoMeProp::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr *mrm) { +AnalysisResult *MeDoMeProp::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResultMgr*) { CHECK_NULL_FATAL(func); auto *dom = static_cast(m->GetAnalysisResult(MeFuncPhase_DOMINANCE, func)); CHECK_NULL_FATAL(dom); diff --git a/src/maple_me/src/me_rename2preg.cpp b/src/maple_me/src/me_rename2preg.cpp index 5bcaff6d34daa49acfdc4daf8ef7aa88dc188597..b727d4c3ddb6d776cd4868d7d3685801bdbb59ec 100644 --- a/src/maple_me/src/me_rename2preg.cpp +++ b/src/maple_me/src/me_rename2preg.cpp @@ -206,7 +206,7 @@ class SSARename2Preg { LogInfo::MapleLogger() << " working on phi part of BB" << bb.GetBBId() << '\n'; } for (auto &varPhi : bb.GetMevarPhiList()) { - Rename2PregPhi(aliasClass, utils::ToRef(varPhi.second), irMap, bb.GetMeRegPhiList()); + Rename2PregPhi(aliasClass, utils::ToRef(varPhi.second), irMap); } if (enabledDebug) { @@ -236,7 +236,7 @@ class SSARename2Preg { for (size_t i = 0; i < stmt.NumMeStmtOpnds(); ++i) { Rename2PregExpr(aliasClass, irMap, stmt, utils::ToRef(stmt.GetOpnd(i))); } - Rename2PregCallReturn(aliasClass, irMap, utils::ToRef(stmt.GetMustDefList())); + Rename2PregCallReturn(aliasClass, utils::ToRef(stmt.GetMustDefList())); } else if (auto *iAssignStmt = safe_cast(stmt)) { Rename2PregExpr(aliasClass, irMap, stmt, utils::ToRef(iAssignStmt->GetRHS())); Rename2PregExpr(aliasClass, irMap, stmt, utils::ToRef(utils::ToRef(iAssignStmt->GetLHSVal()).GetBase())); @@ -247,8 +247,7 @@ class SSARename2Preg { } } - void Rename2PregCallReturn(const AliasClass &aliasClass, MeIRMap &irMap, - MapleVector &mustDefNodes) { + void Rename2PregCallReturn(const AliasClass &aliasClass, MapleVector &mustDefNodes) { if (mustDefNodes.empty()) { return; } @@ -261,7 +260,7 @@ class SSARename2Preg { } OriginalSt &ost = utils::ToRef(utils::ToRef(ssaTab).GetOriginalStFromID(lhs->GetOStIdx())); - RegMeExpr *regExpr = RenameVar(aliasClass, *lhs, irMap); + RegMeExpr *regExpr = RenameVar(aliasClass, *lhs); if (regExpr != nullptr) { mustDefNode.UpdateLHS(*regExpr); } else { @@ -291,7 +290,7 @@ class SSARename2Preg { } void Rename2PregLeafRHS(const AliasClass &aliasClass, MeIRMap &irMap, MeStmt &stmt, VarMeExpr &varExpr) { - RegMeExpr *regExpr = RenameVar(aliasClass, varExpr, irMap); + RegMeExpr *regExpr = RenameVar(aliasClass, varExpr); if (regExpr != nullptr) { irMap.ReplaceMeExprStmt(stmt, varExpr, *regExpr); } @@ -301,7 +300,7 @@ class SSARename2Preg { const VarMeExpr &varExpr, MeStmt &stmt, MeIRMap &irMap) { - RegMeExpr *regExpr = RenameVar(aliasClass, varExpr, irMap); + RegMeExpr *regExpr = RenameVar(aliasClass, varExpr); if (regExpr != nullptr) { MeExpr *oldRhs = nullptr; if (auto *dAStmt = safe_cast(stmt)) { @@ -319,32 +318,24 @@ class SSARename2Preg { } } - void Rename2PregPhi(const AliasClass &aliasClass, - MeVarPhiNode &varPhiNode, - MeIRMap &irMap, - MapleMap ®PhiNodes) { + void Rename2PregPhi(const AliasClass &aliasClass, MeVarPhiNode &varPhiNode, MeIRMap &irMap) { VarMeExpr &varExpr = utils::ToRef(varPhiNode.GetLHS()); - RegMeExpr *pRegExpr = RenameVar(aliasClass, varExpr, irMap); + RegMeExpr *pRegExpr = RenameVar(aliasClass, varExpr); if (pRegExpr == nullptr) { return; } - RegMeExpr ®Expr = *pRegExpr; MeRegPhiNode ®PhiNode = utils::ToRef(irMap.CreateMeRegPhi(regExpr)); regPhiNode.SetDefBB(varPhiNode.GetDefBB()); - UpdateRegPhi(regExpr, varExpr.GetOStIdx(), varPhiNode.GetOpnds(), irMap, regPhiNode); + UpdateRegPhi(regExpr, varPhiNode.GetOpnds(), regPhiNode); } // update regphinode operands - void UpdateRegPhi(const RegMeExpr &curRegExpr, - const OStIdx &lhsOStIdx, - const MapleVector &phiNodeOpnds, - MeIRMap &irMap, + void UpdateRegPhi(const RegMeExpr &curRegExpr, const MapleVector &phiNodeOpnds, MeRegPhiNode ®PhiNode) { PregCache &pregCache = cacheProxy.Preg(); for (VarMeExpr *phiOpnd : phiNodeOpnds) { const VarMeExpr &varExpr = utils::ToRef(phiOpnd); - ASSERT(varExpr.GetOStIdx() == lhsOStIdx, "phi is not correct"); RegMeExpr ®Expr = pregCache.CloneRegExprIfNotExist(varExpr, [&curRegExpr](MeIRMap &irMap) { return irMap.CreateRegMeExprVersion(curRegExpr); }); @@ -353,7 +344,7 @@ class SSARename2Preg { } } - RegMeExpr *RenameVar(const AliasClass &aliasClass, const VarMeExpr &varExpr, MeIRMap &irMap) { + RegMeExpr *RenameVar(const AliasClass &aliasClass, const VarMeExpr &varExpr) { const OriginalSt &ost = utils::ToRef(utils::ToRef(ssaTab).GetOriginalStFromID(varExpr.GetOStIdx())); formal.MarkUsed(ost); diff --git a/src/maple_me/src/me_ssa.cpp b/src/maple_me/src/me_ssa.cpp index e042bbfa2ca8ec68b9e9e108954f0ea1da46c871..5bbc320d091d6969fa23954d8115f552c2f3d54d 100644 --- a/src/maple_me/src/me_ssa.cpp +++ b/src/maple_me/src/me_ssa.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -216,7 +216,7 @@ void MeSSA::VerifySSA() const { } } -AnalysisResult *MeDoSSA::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr *moduleResMgr) { +AnalysisResult *MeDoSSA::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr*) { auto *dom = static_cast(funcResMgr->GetAnalysisResult(MeFuncPhase_DOMINANCE, func)); CHECK_FATAL(dom != nullptr, "dominance phase has problem"); auto *ssaTab = static_cast(funcResMgr->GetAnalysisResult(MeFuncPhase_SSATAB, func)); diff --git a/src/maple_me/src/me_ssa_tab.cpp b/src/maple_me/src/me_ssa_tab.cpp index 3554b15964450f86667d6b8e83834a58dedb4caa..a0c9c4e4c8f09e7fc7daf6289cf7d0b374fd559e 100644 --- a/src/maple_me/src/me_ssa_tab.cpp +++ b/src/maple_me/src/me_ssa_tab.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -18,7 +18,7 @@ // allocate the data structure to store SSA information namespace maple { -AnalysisResult *MeDoSSATab::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, ModuleResultMgr *moduleResMgr) { +AnalysisResult *MeDoSSATab::Run(MeFunction *func, MeFuncResultMgr*, ModuleResultMgr*) { MPLTimer timer; timer.Start(); if (DEBUGFUNC(func)) { @@ -35,7 +35,7 @@ AnalysisResult *MeDoSSATab::Run(MeFunction *func, MeFuncResultMgr *funcResMgr, M for (auto bIt = func->valid_begin(); bIt != func->valid_end(); ++bIt) { auto *bb = *bIt; for (auto &stmt : bb->GetStmtNodes()) { - ssaTab->CreateSSAStmt(stmt, *bb); // this adds the SSANodes for exprs + ssaTab->CreateSSAStmt(stmt); // this adds the SSANodes for exprs } } if (DEBUGFUNC(func)) { diff --git a/src/maple_me/src/ssa_mir_nodes.cpp b/src/maple_me/src/ssa_mir_nodes.cpp index 083f8510f7f43bebd57bbd3b0578cd211015c13f..afa2bc0396eb39b4b550e961bb04f6cb2bdb8b9a 100644 --- a/src/maple_me/src/ssa_mir_nodes.cpp +++ b/src/maple_me/src/ssa_mir_nodes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -20,7 +20,7 @@ namespace maple { void GenericSSAPrint(MIRModule &mod, const StmtNode &stmtNode, int32 indent, StmtsSSAPart &stmtsSSAPart) { - stmtNode.Dump(mod, indent); + stmtNode.Dump(indent); // print SSAPart Opcode op = stmtNode.GetOpCode(); AccessSSANodes *ssaPart = stmtsSSAPart.SSAPartOf(stmtNode); diff --git a/src/maple_me/src/ssa_tab.cpp b/src/maple_me/src/ssa_tab.cpp index ec86524d952e0ad3849e3af128ea335d7f94d1fc..c13c3763aca0702d10552c93a7f0efb8a2f06fa7 100644 --- a/src/maple_me/src/ssa_tab.cpp +++ b/src/maple_me/src/ssa_tab.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -63,7 +63,7 @@ BaseNode *SSATab::CreateSSAExpr(BaseNode &expr) { return nullptr; } -void SSATab::CreateSSAStmt(StmtNode &stmt, const BB &curbb) { +void SSATab::CreateSSAStmt(StmtNode &stmt) { for (size_t i = 0; i < stmt.NumOpnds(); ++i) { BaseNode *newOpnd = CreateSSAExpr(*stmt.Opnd(i)); if (newOpnd != nullptr) { diff --git a/src/maple_me/src/ver_symbol.cpp b/src/maple_me/src/ver_symbol.cpp index 582d0ffd9624be1864d127694594c4db865282f2..fab15a05021b843654ca259529d2ac56bd6678d7 100644 --- a/src/maple_me/src/ver_symbol.cpp +++ b/src/maple_me/src/ver_symbol.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -25,7 +25,7 @@ void VersionSt::DumpDefStmt(const MIRModule *mod) const { } switch (defType) { case kAssign: - defStmt.assign->Dump(*mod, 0); + defStmt.assign->Dump(0); return; case kPhi: defStmt.phi->Dump(); diff --git a/src/maple_phase/include/phase_impl.h b/src/maple_phase/include/phase_impl.h index 2454e8227266e824f3a550d695b5a7b244caedba..47a5f37e1bcc53c6bf2538b74acb7a03be4a23cc 100644 --- a/src/maple_phase/include/phase_impl.h +++ b/src/maple_phase/include/phase_impl.h @@ -46,7 +46,7 @@ class FuncOptimizeImpl : public MplTaskParam { virtual void ProcessBlock(StmtNode &stmt); // Each phase needs to implement its own ProcessStmt - virtual void ProcessStmt(StmtNode &stmt) {} + virtual void ProcessStmt(StmtNode&) {} KlassHierarchy *klassHierarchy = nullptr; MIRFunction *currFunc = nullptr; diff --git a/src/maple_util/include/literal_str_name.h b/src/maple_util/include/literal_str_name.h index 623a5e6f45d1d153cb959b972916eb37c4c183b2..6705d693c0df1769c569e5c2c3e04c5a8d67a5fa 100644 --- a/src/maple_util/include/literal_str_name.h +++ b/src/maple_util/include/literal_str_name.h @@ -27,7 +27,7 @@ const std::string kConstString = "_C_STR_"; const std::string kConstStringPtr = "_PTR_C_STR_"; -constexpr int kConstStringLen = 7; +constexpr int kConstStringLen = 7; const std::string kLocalStringPrefix = "L_STR_"; union DigestHash { diff --git a/src/maple_util/include/mpl_scheduler.h b/src/maple_util/include/mpl_scheduler.h index 7953c870ec6f63d9897b7352e100cf6fe13bcaae..eafdf5e448b7189460426916bbe2069908640401 100644 --- a/src/maple_util/include/mpl_scheduler.h +++ b/src/maple_util/include/mpl_scheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -44,11 +44,11 @@ class MplTask { virtual ~MplTask() {} - virtual int Run(MplTaskParam *param = nullptr) { + virtual int Run(MplTaskParam*) { return 0; } - virtual int Finish(MplTaskParam *param = nullptr) { + virtual int Finish(MplTaskParam*) { return 0; } @@ -77,17 +77,17 @@ class MplScheduler { virtual void AddTask(MplTask *task); virtual int RunTask(uint32 nthreads, bool seq = false); - virtual MplSchedulerParam *EncodeThreadMainEnvironment(uint32 threadId) { + virtual MplSchedulerParam *EncodeThreadMainEnvironment(uint32) { return nullptr; } - virtual void DecodeThreadMainEnvironment(MplSchedulerParam *env) {} + virtual void DecodeThreadMainEnvironment(MplSchedulerParam*) {} virtual MplSchedulerParam *EncodeThreadFinishEnvironment() { return nullptr; } - virtual void DecodeThreadFinishEnvironment(MplSchedulerParam *env) {} + virtual void DecodeThreadFinishEnvironment(MplSchedulerParam*) {} void GlobalLock() { pthread_mutex_lock(&mutexGlobal); diff --git a/src/maple_util/include/safe_ptr.h b/src/maple_util/include/safe_ptr.h index 42f970458c5b54881a0e925ee74f64bdc932eca3..3ac970ea280e099fc6574d23533b02e07e189aa8 100644 --- a/src/maple_util/include/safe_ptr.h +++ b/src/maple_util/include/safe_ptr.h @@ -14,10 +14,8 @@ */ #ifndef MAPLE_UTIL_SAFE_PTR_H #define MAPLE_UTIL_SAFE_PTR_H -#include #include #include "ptr.h" -#include "mir_nodes.h" namespace maple { namespace utils { diff --git a/src/mpl2mpl/include/muid_replacement.h b/src/mpl2mpl/include/muid_replacement.h index 307d1e95534d1f1bc31fa9def86261dc9b3dbd6e..2c7f3d44d638f4bf5e3e0d9fab8b7439fa87c5b2 100644 --- a/src/mpl2mpl/include/muid_replacement.h +++ b/src/mpl2mpl/include/muid_replacement.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/mpl2mpl/include/reflection_analysis.h b/src/mpl2mpl/include/reflection_analysis.h index 624a60a0d05f503c99849b2126c0bcb55dbaaf4b..52ba34e6a61e0df07a61a9c9bcf10de029134f62 100644 --- a/src/mpl2mpl/include/reflection_analysis.h +++ b/src/mpl2mpl/include/reflection_analysis.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -187,7 +187,7 @@ class ReflectionAnalysis : public AnalysisResult { uint32 GetMethodFlag(const MIRFunction &func) const; void GenFieldOffsetConst(MIRAggConst &newConst, const Klass &klass, const MIRStructType &type, std::pair &fieldInfo, uint32 metaFieldID); - MIRSymbol *GenMethodAddrData(const Klass &klass, const MIRSymbol &funcSym); + MIRSymbol *GenMethodAddrData(const MIRSymbol &funcSym); static void GenMetadataType(MIRModule &mirModule); static MIRType *GetRefFieldType(); static TyIdx GenMetaStructType(MIRModule &mirModule, MIRStructType &metaType, const std::string &str); diff --git a/src/mpl2mpl/src/class_hierarchy.cpp b/src/mpl2mpl/src/class_hierarchy.cpp index 2e7c3c36f1111d25ffd2472e4294c3558b32dc78..4272534aea1db2a2dc4af91b28b3375128831b15 100644 --- a/src/mpl2mpl/src/class_hierarchy.cpp +++ b/src/mpl2mpl/src/class_hierarchy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/mpl2mpl/src/class_init.cpp b/src/mpl2mpl/src/class_init.cpp index a16b039a24a40bbe63b8c453ecc1ed86127bd395..ff7b31e31074a5db4632210a74576dc7c9277df7 100644 --- a/src/mpl2mpl/src/class_init.cpp +++ b/src/mpl2mpl/src/class_init.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -36,12 +36,9 @@ bool ClassInit::CanRemoveClinitCheck(const std::string &clinitClassname) const { return false; } -#undef CLINIT_CHECK void ClassInit::GenClassInitCheckProfile(MIRFunction &func, const MIRSymbol &classInfo, StmtNode *clinit) const { -#ifdef CLINIT_CHECK GenPreClassInitCheck(func, classInfo, clinit); GenPostClassInitCheck(func, classInfo, clinit); -#endif // CLINIT_CHECK } void ClassInit::GenPreClassInitCheck(MIRFunction &func, const MIRSymbol &classInfo, StmtNode *clinit) const { @@ -112,7 +109,9 @@ void ClassInit::ProcessFunc(MIRFunction *func) { StmtNode *intrinsicCall = builder->CreateStmtIntrinsicCall(INTRN_MPL_CLINIT_CHECK, args); func->GetBody()->InsertFirst(intrinsicCall); ASSERT(classInfo != nullptr, "null ptr check!"); +#ifdef CLINIT_CHECK GenClassInitCheckProfile(*func, *classInfo, intrinsicCall); +#endif // CLINIT_CHECK } } } @@ -129,7 +128,7 @@ void ClassInit::ProcessFunc(MIRFunction *func) { "index out of range"); MIRType *classType = GlobalTables::GetTypeTable().GetTypeTable()[intrinsicCall->GetTyIdx()]; ASSERT(classType != nullptr, "null ptr check!"); - CHECK_FATAL(classType->GetNameStrIdx() != 0, "symbol name is null for type index %d", + CHECK_FATAL(classType->GetNameStrIdx() != 0u, "symbol name is null for type index %d", static_cast(intrinsicCall->GetTyIdx())); const std::string &className = GlobalTables::GetStrTable().GetStringFromStrIdx(classType->GetNameStrIdx()); Klass *klass = klassHierarchy->GetKlassFromName(className); @@ -152,7 +151,9 @@ void ClassInit::ProcessFunc(MIRFunction *func) { << func->GetName() << "()\n"; } ASSERT(classInfo != nullptr, "null ptr check!"); +#ifdef CLINIT_CHECK GenClassInitCheckProfile(*func, *classInfo, mplIntrinsicCall); +#endif // CLINIT_CHECK } else { func->GetBody()->RemoveStmt(stmt); } diff --git a/src/mpl2mpl/src/muid_replacement.cpp b/src/mpl2mpl/src/muid_replacement.cpp index a9cb22d969dfb1d98042eef8d257528e49485dc4..2dd2094664fc0a003407fb1b8e8e1aad862e3d89 100644 --- a/src/mpl2mpl/src/muid_replacement.cpp +++ b/src/mpl2mpl/src/muid_replacement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. diff --git a/src/mpl2mpl/src/reflection_analysis.cpp b/src/mpl2mpl/src/reflection_analysis.cpp index ac2e9480903be1366c287e14846a4fdd04bb1919..06d581943cab3334129f920ac7fa5cfcff181341 100644 --- a/src/mpl2mpl/src/reflection_analysis.cpp +++ b/src/mpl2mpl/src/reflection_analysis.cpp @@ -741,7 +741,7 @@ void ReflectionAnalysis::GenMethodMeta(const Klass &klass, MIRStructType &method mirBuilder.AddAddrofFieldConst(methodsInfoType, newConst, fieldID++, *dklassSt); // @addr : Function address or point function addr if lazyBinding or decouple if (isLazyBindingOrDecouple) { - MIRSymbol *methodAddrSt = GenMethodAddrData(klass, funcSym); + MIRSymbol *methodAddrSt = GenMethodAddrData(funcSym); if (methodAddrSt != nullptr) { mirBuilder.AddAddrofFieldConst(methodsInfoType, newConst, fieldID++, *methodAddrSt); } else { @@ -807,7 +807,7 @@ MIRSymbol *ReflectionAnalysis::GenMethodsMeta(const Klass &klass, return methodsArraySt; } -MIRSymbol *ReflectionAnalysis::GenMethodAddrData(const Klass &klass, const MIRSymbol &funcSym) { +MIRSymbol *ReflectionAnalysis::GenMethodAddrData(const MIRSymbol &funcSym) { MIRModule &module = *mirModule; MIRStructType &methodAddrType = static_cast(*GlobalTables::GetTypeTable().GetTypeFromTyIdx(methodAddrDataTyIdx)); @@ -1494,7 +1494,7 @@ void ReflectionAnalysis::GenClassMetaData(Klass &klass) { #endif // USE_32BIT_REF // @itab GStrIdx strIdx = GlobalTables::GetStrTable().GetStrIdxFromName(ITAB_PREFIX_STR + klass.GetKlassName()); - if (strIdx != 0) { + if (strIdx != 0u) { MIRSymbol *itableSymbolType = GlobalTables::GetGsymTable().GetSymbolFromStrIdx(strIdx); mirBuilder.AddAddrofFieldConst(classMetadataType, *newConst, fieldID++, *itableSymbolType); } else { @@ -1502,7 +1502,7 @@ void ReflectionAnalysis::GenClassMetaData(Klass &klass) { } // @vtab strIdx = GlobalTables::GetStrTable().GetStrIdxFromName(VTAB_PREFIX_STR + klass.GetKlassName()); - if (strIdx != 0) { + if (strIdx != 0u) { MIRSymbol *vtableSymbolType = GlobalTables::GetGsymTable().GetSymbolFromStrIdx(strIdx); mirBuilder.AddAddrofFieldConst(classMetadataType, *newConst, fieldID++, *vtableSymbolType); } else { @@ -1572,7 +1572,7 @@ TyIdx ReflectionAnalysis::GenMetaStructType(MIRModule &mirModule, MIRStructType // Global? mirModule.GetTypeNameTab()->SetGStrIdxToTyIdx(strIdx, tyIdx); mirModule.PushbackTypeDefOrder(strIdx); - if (GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx() == 0) { + if (GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx() == 0u) { GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->SetNameStrIdx(strIdx); } return tyIdx; @@ -1587,7 +1587,7 @@ MIRType *ReflectionAnalysis::GetRefFieldType() { } void ReflectionAnalysis::GenMetadataType(MIRModule &mirModule) { - if (classMetadataTyIdx != 0) { // Types have been generated. + if (classMetadataTyIdx != 0u) { // Types have been generated. return; } // ClassMetaType