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