Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -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_ARM64_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_INTRINSICS_ARM64_H_ |
| 19 | |
| 20 | #include "intrinsics.h" |
| 21 | |
| 22 | namespace vixl { |
Scott Wakeling | 97c72b7 | 2016-06-24 16:19:36 +0100 | [diff] [blame] | 23 | namespace aarch64 { |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 24 | |
| 25 | class MacroAssembler; |
| 26 | |
Scott Wakeling | 97c72b7 | 2016-06-24 16:19:36 +0100 | [diff] [blame] | 27 | }} // namespace vixl::aarch64 |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 28 | |
| 29 | namespace art { |
| 30 | |
| 31 | class ArenaAllocator; |
| 32 | class HInvokeStaticOrDirect; |
| 33 | class HInvokeVirtual; |
| 34 | |
| 35 | namespace arm64 { |
| 36 | |
| 37 | class CodeGeneratorARM64; |
| 38 | |
| 39 | class IntrinsicLocationsBuilderARM64 FINAL : public IntrinsicVisitor { |
| 40 | public: |
Nicolas Geoffray | 331605a | 2017-03-01 11:01:41 +0000 | [diff] [blame^] | 41 | explicit IntrinsicLocationsBuilderARM64(ArenaAllocator* arena, CodeGeneratorARM64* codegen) |
| 42 | : arena_(arena), codegen_(codegen) {} |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 43 | |
| 44 | // Define visitor methods. |
| 45 | |
Nicolas Geoffray | 762869d | 2016-07-15 15:28:35 +0100 | [diff] [blame] | 46 | #define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 47 | void Visit ## Name(HInvoke* invoke) OVERRIDE; |
| 48 | #include "intrinsics_list.h" |
| 49 | INTRINSICS_LIST(OPTIMIZING_INTRINSICS) |
| 50 | #undef INTRINSICS_LIST |
| 51 | #undef OPTIMIZING_INTRINSICS |
| 52 | |
| 53 | // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether |
| 54 | // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to |
| 55 | // the invoke. |
| 56 | bool TryDispatch(HInvoke* invoke); |
| 57 | |
| 58 | private: |
| 59 | ArenaAllocator* arena_; |
Nicolas Geoffray | 331605a | 2017-03-01 11:01:41 +0000 | [diff] [blame^] | 60 | CodeGeneratorARM64* codegen_; |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 61 | |
| 62 | DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARM64); |
| 63 | }; |
| 64 | |
| 65 | class IntrinsicCodeGeneratorARM64 FINAL : public IntrinsicVisitor { |
| 66 | public: |
| 67 | explicit IntrinsicCodeGeneratorARM64(CodeGeneratorARM64* codegen) : codegen_(codegen) {} |
| 68 | |
| 69 | // Define visitor methods. |
| 70 | |
Nicolas Geoffray | 762869d | 2016-07-15 15:28:35 +0100 | [diff] [blame] | 71 | #define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 72 | void Visit ## Name(HInvoke* invoke) OVERRIDE; |
| 73 | #include "intrinsics_list.h" |
| 74 | INTRINSICS_LIST(OPTIMIZING_INTRINSICS) |
| 75 | #undef INTRINSICS_LIST |
| 76 | #undef OPTIMIZING_INTRINSICS |
| 77 | |
| 78 | private: |
Scott Wakeling | 97c72b7 | 2016-06-24 16:19:36 +0100 | [diff] [blame] | 79 | vixl::aarch64::MacroAssembler* GetVIXLAssembler(); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 80 | |
| 81 | ArenaAllocator* GetAllocator(); |
| 82 | |
| 83 | CodeGeneratorARM64* codegen_; |
| 84 | |
| 85 | DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARM64); |
| 86 | }; |
| 87 | |
| 88 | } // namespace arm64 |
| 89 | } // namespace art |
| 90 | |
| 91 | #endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM64_H_ |