From 76d519b039fcdebf58e05dd42df4dc6cc08251e5 Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Mon, 3 Apr 2023 12:34:45 +0100 Subject: Inline unimplemented intrinsics There are intrinsics that are unimplemented i.e. we didn't hand-craft code for them. Allow the inliner to inline those. Since our optimizations expect InvokeVirtual, I stopped the de-virtualization of intrinsics. That could be re-added if we modify optimizations like TryReplaceStringBuilderAppend. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: art/test/testrunner/testrunner.py --target --64 --optimizing Test: compiling the APK in the bug and seeing the inline Bug: 262585898 Fixes: 262585898 Change-Id: I501b69c4ffd9082ca8ffacb1cd1cd5d1ab3668a8 --- compiler/optimizing/code_generator.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/code_generator.h') diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index ee80357791..9872efaa4a 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -304,6 +304,12 @@ class CodeGenerator : public DeletableArenaObject { // Returns whether we should split long moves in parallel moves. virtual bool ShouldSplitLongMoves() const { return false; } + // Returns true if `invoke` is an implemented intrinsic in this codegen's arch. + bool IsImplementedIntrinsic(HInvoke* invoke) const { + return invoke->IsIntrinsic() && + !unimplemented_intrinsics_[static_cast(invoke->GetIntrinsic())]; + } + size_t GetNumberOfCoreCalleeSaveRegisters() const { return POPCOUNT(core_callee_save_mask_); } @@ -749,7 +755,8 @@ class CodeGenerator : public DeletableArenaObject { uint32_t core_callee_save_mask, uint32_t fpu_callee_save_mask, const CompilerOptions& compiler_options, - OptimizingCompilerStats* stats); + OptimizingCompilerStats* stats, + const art::ArrayRef& unimplemented_intrinsics); virtual HGraphVisitor* GetLocationBuilder() = 0; virtual HGraphVisitor* GetInstructionVisitor() = 0; @@ -893,6 +900,9 @@ class CodeGenerator : public DeletableArenaObject { // CodeGenerator::Compile() and remains alive until the CodeGenerator is destroyed. std::unique_ptr code_generation_data_; + // Which intrinsics we don't have handcrafted code for. + art::ArrayRef unimplemented_intrinsics_; + friend class OptimizingCFITest; ART_FRIEND_TEST(CodegenTest, ARM64FrameSizeSIMD); ART_FRIEND_TEST(CodegenTest, ARM64FrameSizeNoSIMD); -- cgit v1.2.3-59-g8ed1b