Andreas Gampe | 2bcf9bf | 2015-01-29 09:56:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_INTRINSICS_ARM_H_ |
| 19 | |
| 20 | #include "intrinsics.h" |
| 21 | |
| 22 | namespace art { |
| 23 | |
| 24 | class ArenaAllocator; |
| 25 | class ArmInstructionSetFeatures; |
| 26 | class HInvokeStaticOrDirect; |
| 27 | class HInvokeVirtual; |
| 28 | |
| 29 | namespace arm { |
| 30 | |
| 31 | class ArmAssembler; |
| 32 | class CodeGeneratorARM; |
| 33 | |
| 34 | class IntrinsicLocationsBuilderARM FINAL : public IntrinsicVisitor { |
| 35 | public: |
Vladimir Marko | 68c981f | 2016-08-26 13:13:33 +0100 | [diff] [blame] | 36 | explicit IntrinsicLocationsBuilderARM(CodeGeneratorARM* codegen); |
Andreas Gampe | 2bcf9bf | 2015-01-29 09:56:07 -0800 | [diff] [blame] | 37 | |
| 38 | // Define visitor methods. |
| 39 | |
Nicolas Geoffray | 762869d | 2016-07-15 15:28:35 +0100 | [diff] [blame] | 40 | #define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ |
Andreas Gampe | 2bcf9bf | 2015-01-29 09:56:07 -0800 | [diff] [blame] | 41 | void Visit ## Name(HInvoke* invoke) OVERRIDE; |
| 42 | #include "intrinsics_list.h" |
| 43 | INTRINSICS_LIST(OPTIMIZING_INTRINSICS) |
| 44 | #undef INTRINSICS_LIST |
| 45 | #undef OPTIMIZING_INTRINSICS |
| 46 | |
| 47 | // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether |
| 48 | // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to |
| 49 | // the invoke. |
| 50 | bool TryDispatch(HInvoke* invoke); |
| 51 | |
| 52 | private: |
| 53 | ArenaAllocator* arena_; |
Nicolas Geoffray | 331605a | 2017-03-01 11:01:41 +0000 | [diff] [blame] | 54 | CodeGenerator* codegen_; |
Nicolas Geoffray | 5bd05a5 | 2015-10-13 09:48:30 +0100 | [diff] [blame] | 55 | ArmAssembler* assembler_; |
Andreas Gampe | 2bcf9bf | 2015-01-29 09:56:07 -0800 | [diff] [blame] | 56 | |
| 57 | const ArmInstructionSetFeatures& features_; |
| 58 | |
| 59 | DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARM); |
| 60 | }; |
| 61 | |
| 62 | class IntrinsicCodeGeneratorARM FINAL : public IntrinsicVisitor { |
| 63 | public: |
| 64 | explicit IntrinsicCodeGeneratorARM(CodeGeneratorARM* codegen) : codegen_(codegen) {} |
| 65 | |
| 66 | // Define visitor methods. |
| 67 | |
Nicolas Geoffray | 762869d | 2016-07-15 15:28:35 +0100 | [diff] [blame] | 68 | #define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ |
Andreas Gampe | 2bcf9bf | 2015-01-29 09:56:07 -0800 | [diff] [blame] | 69 | void Visit ## Name(HInvoke* invoke) OVERRIDE; |
| 70 | #include "intrinsics_list.h" |
| 71 | INTRINSICS_LIST(OPTIMIZING_INTRINSICS) |
| 72 | #undef INTRINSICS_LIST |
| 73 | #undef OPTIMIZING_INTRINSICS |
| 74 | |
| 75 | private: |
| 76 | ArmAssembler* GetAssembler(); |
| 77 | |
| 78 | ArenaAllocator* GetAllocator(); |
| 79 | |
| 80 | CodeGeneratorARM* codegen_; |
| 81 | |
| 82 | DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARM); |
| 83 | }; |
| 84 | |
| 85 | } // namespace arm |
| 86 | } // namespace art |
| 87 | |
| 88 | #endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM_H_ |