diff --git a/src/mapleall/maple_ipa/src/inline.cpp b/src/mapleall/maple_ipa/src/inline.cpp index 575a994b07f7610768d89c43fa293f804014274d..fb9c4d9a54594830da49dbdebdb4413277e2885c 100644 --- a/src/mapleall/maple_ipa/src/inline.cpp +++ b/src/mapleall/maple_ipa/src/inline.cpp @@ -1379,6 +1379,7 @@ void MInline::MarkUnInlinableFunction() const { for (CGNode *node : (*it)->GetCGNodes()) { std::string name = node->GetMIRFunction()->GetName(); if (node->IsMustNotBeInlined() || + node->GetMIRFunction()->HasAsm() || StringUtils::StartsWith(name, kDalvikSystemStr) || StringUtils::StartsWith(name, kJavaLangThreadStr)) { node->SetMustNotBeInlined(); diff --git a/src/mapleall/maple_ir/include/mir_function.h b/src/mapleall/maple_ir/include/mir_function.h index c95a705fb7e642e8b64c8de9d777c4455251e9c6..0ccc68980305282d01c78e61668d1bf91a0ce628 100644 --- a/src/mapleall/maple_ir/include/mir_function.h +++ b/src/mapleall/maple_ir/include/mir_function.h @@ -390,6 +390,9 @@ class MIRFunction { void SetHasSetjmp(); bool HasSetjmp() const; + void SetHasAsm(); + bool HasAsm() const; + void SetReturnStruct(const MIRType *retType); bool IsEmpty() const; diff --git a/src/mapleall/maple_ir/src/bin_func_import.cpp b/src/mapleall/maple_ir/src/bin_func_import.cpp index 41c226782f34384ad03c1f4ec2b4dfd898423e46..9373500603db15199ce2588526a953a799adae90 100644 --- a/src/mapleall/maple_ir/src/bin_func_import.cpp +++ b/src/mapleall/maple_ir/src/bin_func_import.cpp @@ -775,6 +775,7 @@ BlockNode *BinaryMplImport::ImportBlockNode(MIRFunction *func) { } case OP_asm: { AsmNode *s = mod.CurFuncCodeMemPool()->New(&mod.GetCurFuncCodeMPAllocator()); + mod.CurFunction()->SetHasAsm(); s->qualifiers = ReadNum(); string str; ReadAsciiStr(str); diff --git a/src/mapleall/maple_ir/src/mir_function.cpp b/src/mapleall/maple_ir/src/mir_function.cpp index 83408f5fc893e574bce81cd8afb4076074a22182..1f12087a3d812d71c57647eda1d9a09101e19f15 100644 --- a/src/mapleall/maple_ir/src/mir_function.cpp +++ b/src/mapleall/maple_ir/src/mir_function.cpp @@ -31,6 +31,7 @@ enum FuncProp : uint32_t { // can only be printed at the beginning of a block kFuncPropNeverReturn = 1U << 4, // the function when called never returns kFuncPropHasSetjmp = 1U << 5, // the function contains call to setjmp + kFuncPropHasAsm = 1U << 6, // the function has use of inline asm }; } // namespace @@ -198,6 +199,14 @@ bool MIRFunction::HasSetjmp() const { return flag & kFuncPropHasSetjmp; } +void MIRFunction::SetHasAsm() { + flag |= kFuncPropHasAsm; +} + +bool MIRFunction::HasAsm() const { + return flag & kFuncPropHasAsm; +} + void MIRFunction::SetAttrsFromSe(uint8 specialEffect) { // NoPrivateDefEffect if ((specialEffect & kDefEffect) == kDefEffect) { diff --git a/src/mapleall/maple_ir/src/mir_parser.cpp b/src/mapleall/maple_ir/src/mir_parser.cpp index 2bc7f8d157a973152b6ba6f54d54f9b72ef3d1e8..52ea8dd4acf3f9f97bd5b871ddade996577e635b 100644 --- a/src/mapleall/maple_ir/src/mir_parser.cpp +++ b/src/mapleall/maple_ir/src/mir_parser.cpp @@ -1083,6 +1083,7 @@ bool MIRParser::ParseCallReturns(CallReturnVector &retsvec) { bool MIRParser::ParseStmtAsm(StmtNodePtr &stmt) { AsmNode *asmNode = mod.CurFuncCodeMemPool()->New(&mod.GetCurFuncCodeMPAllocator()); + mod.CurFunction()->SetHasAsm(); lexer.NextToken(); // parse qualifiers while (lexer.GetTokenKind() == TK_volatile || diff --git a/src/mapleall/maple_me/src/me_phase_manager.cpp b/src/mapleall/maple_me/src/me_phase_manager.cpp index f1ea55af1c710a0ba9c69828cee0f9a4bc1da4a1..b0fdc2ad42df8e6860b54deb1611cbb66b3cf3e9 100644 --- a/src/mapleall/maple_me/src/me_phase_manager.cpp +++ b/src/mapleall/maple_me/src/me_phase_manager.cpp @@ -210,6 +210,10 @@ void MeFuncPhaseManager::Run(MIRFunction *mirFunc, uint64 rangeNum, const std::s LogInfo::MapleLogger() << "Function < " << mirFunc->GetName() << " not optimized because it has setjmp\n"; return; } + if (mirFunc->HasAsm()) { + LogInfo::MapleLogger() << "Function < " << mirFunc->GetName() << " not optimized because it has inline asm\n"; + return; + } MPLTimer runPhasetimer; MPLTimer funcPrepareTimer; MPLTimer iteratorTimer;