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 { |
| 23 | |
| 24 | class MacroAssembler; |
| 25 | |
| 26 | } // namespace vixl |
| 27 | |
| 28 | namespace art { |
| 29 | |
| 30 | class ArenaAllocator; |
| 31 | class HInvokeStaticOrDirect; |
| 32 | class HInvokeVirtual; |
| 33 | |
| 34 | namespace arm64 { |
| 35 | |
| 36 | class CodeGeneratorARM64; |
| 37 | |
| 38 | class IntrinsicLocationsBuilderARM64 FINAL : public IntrinsicVisitor { |
| 39 | public: |
| 40 | explicit IntrinsicLocationsBuilderARM64(ArenaAllocator* arena) : arena_(arena) {} |
| 41 | |
| 42 | // Define visitor methods. |
| 43 | |
| 44 | #define OPTIMIZING_INTRINSICS(Name, IsStatic) \ |
| 45 | void Visit ## Name(HInvoke* invoke) OVERRIDE; |
| 46 | #include "intrinsics_list.h" |
| 47 | INTRINSICS_LIST(OPTIMIZING_INTRINSICS) |
| 48 | #undef INTRINSICS_LIST |
| 49 | #undef OPTIMIZING_INTRINSICS |
| 50 | |
| 51 | // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether |
| 52 | // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to |
| 53 | // the invoke. |
| 54 | bool TryDispatch(HInvoke* invoke); |
| 55 | |
| 56 | private: |
| 57 | ArenaAllocator* arena_; |
| 58 | |
| 59 | DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARM64); |
| 60 | }; |
| 61 | |
| 62 | class IntrinsicCodeGeneratorARM64 FINAL : public IntrinsicVisitor { |
| 63 | public: |
| 64 | explicit IntrinsicCodeGeneratorARM64(CodeGeneratorARM64* codegen) : codegen_(codegen) {} |
| 65 | |
| 66 | // Define visitor methods. |
| 67 | |
| 68 | #define OPTIMIZING_INTRINSICS(Name, IsStatic) \ |
| 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 | vixl::MacroAssembler* GetVIXLAssembler(); |
| 77 | |
| 78 | ArenaAllocator* GetAllocator(); |
| 79 | |
| 80 | CodeGeneratorARM64* codegen_; |
| 81 | |
| 82 | DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARM64); |
| 83 | }; |
| 84 | |
| 85 | } // namespace arm64 |
| 86 | } // namespace art |
| 87 | |
| 88 | #endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM64_H_ |