1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ART_COMPILER_OPTIMIZING_INTRINSICS_ARM_VIXL_H_ 18 #define ART_COMPILER_OPTIMIZING_INTRINSICS_ARM_VIXL_H_ 19 20 #include "base/macros.h" 21 #include "intrinsics.h" 22 #include "utils/arm/assembler_arm_vixl.h" 23 24 namespace art HIDDEN { 25 26 namespace arm { 27 28 class ArmVIXLAssembler; 29 class CodeGeneratorARMVIXL; 30 31 class IntrinsicLocationsBuilderARMVIXL final : public IntrinsicVisitor { 32 public: 33 explicit IntrinsicLocationsBuilderARMVIXL(CodeGeneratorARMVIXL* codegen); 34 35 // Define visitor methods. 36 37 #define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ 38 void Visit ## Name(HInvoke* invoke) override; 39 #include "intrinsics_list.h" 40 INTRINSICS_LIST(OPTIMIZING_INTRINSICS) 41 #undef INTRINSICS_LIST 42 #undef OPTIMIZING_INTRINSICS 43 44 // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether 45 // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to 46 // the invoke. 47 bool TryDispatch(HInvoke* invoke); 48 49 private: 50 ArenaAllocator* const allocator_; 51 CodeGeneratorARMVIXL* const codegen_; 52 ArmVIXLAssembler* const assembler_; 53 const ArmInstructionSetFeatures& features_; 54 55 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARMVIXL); 56 }; 57 58 class IntrinsicCodeGeneratorARMVIXL final : public IntrinsicVisitor { 59 public: IntrinsicCodeGeneratorARMVIXL(CodeGeneratorARMVIXL * codegen)60 explicit IntrinsicCodeGeneratorARMVIXL(CodeGeneratorARMVIXL* codegen) : codegen_(codegen) {} 61 62 // Define visitor methods. 63 64 #define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ 65 void Visit ## Name(HInvoke* invoke) override; 66 #include "intrinsics_list.h" 67 INTRINSICS_LIST(OPTIMIZING_INTRINSICS) 68 #undef INTRINSICS_LIST 69 #undef OPTIMIZING_INTRINSICS 70 71 private: 72 ArenaAllocator* GetAllocator(); 73 ArmVIXLAssembler* GetAssembler(); 74 75 CodeGeneratorARMVIXL* const codegen_; 76 77 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARMVIXL); 78 }; 79 80 } // namespace arm 81 } // namespace art 82 83 #endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM_VIXL_H_ 84