Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [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_MIPS_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_INTRINSICS_MIPS_H_ |
| 19 | |
| 20 | #include "intrinsics.h" |
| 21 | |
| 22 | namespace art { |
| 23 | |
| 24 | class ArenaAllocator; |
| 25 | class HInvokeStaticOrDirect; |
| 26 | class HInvokeVirtual; |
| 27 | |
| 28 | namespace mips { |
| 29 | |
| 30 | class CodeGeneratorMIPS; |
| 31 | class MipsAssembler; |
| 32 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 33 | class IntrinsicLocationsBuilderMIPS final : public IntrinsicVisitor { |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 34 | public: |
| 35 | explicit IntrinsicLocationsBuilderMIPS(CodeGeneratorMIPS* codegen); |
| 36 | |
| 37 | // Define visitor methods. |
| 38 | |
Nicolas Geoffray | 762869d | 2016-07-15 15:28:35 +0100 | [diff] [blame] | 39 | #define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 40 | void Visit ## Name(HInvoke* invoke) override; |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 41 | #include "intrinsics_list.h" |
Andreas Gampe | 8cf9cb3 | 2017-07-19 09:28:38 -0700 | [diff] [blame] | 42 | INTRINSICS_LIST(OPTIMIZING_INTRINSICS) |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 43 | #undef INTRINSICS_LIST |
| 44 | #undef OPTIMIZING_INTRINSICS |
| 45 | |
| 46 | // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether |
| 47 | // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to |
| 48 | // the invoke. |
| 49 | bool TryDispatch(HInvoke* invoke); |
| 50 | |
| 51 | private: |
Vladimir Marko | 69d310e | 2017-10-09 14:12:23 +0100 | [diff] [blame] | 52 | CodeGeneratorMIPS* const codegen_; |
| 53 | ArenaAllocator* const allocator_; |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 54 | |
| 55 | DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderMIPS); |
| 56 | }; |
| 57 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 58 | class IntrinsicCodeGeneratorMIPS final : public IntrinsicVisitor { |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 59 | public: |
| 60 | explicit IntrinsicCodeGeneratorMIPS(CodeGeneratorMIPS* codegen) : codegen_(codegen) {} |
| 61 | |
| 62 | // Define visitor methods. |
| 63 | |
Nicolas Geoffray | 762869d | 2016-07-15 15:28:35 +0100 | [diff] [blame] | 64 | #define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 65 | void Visit ## Name(HInvoke* invoke) override; |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 66 | #include "intrinsics_list.h" |
Andreas Gampe | 8cf9cb3 | 2017-07-19 09:28:38 -0700 | [diff] [blame] | 67 | INTRINSICS_LIST(OPTIMIZING_INTRINSICS) |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 68 | #undef INTRINSICS_LIST |
| 69 | #undef OPTIMIZING_INTRINSICS |
| 70 | |
Alexey Frunze | bb9863a | 2016-01-11 15:51:16 -0800 | [diff] [blame] | 71 | bool IsR2OrNewer() const; |
| 72 | bool IsR6() const; |
| 73 | bool Is32BitFPU() const; |
Lena Djokic | 0d2cab5 | 2018-03-06 15:20:45 +0100 | [diff] [blame] | 74 | bool HasMsa() const; |
Chris Larsen | e16ce5a | 2015-11-18 12:30:20 -0800 | [diff] [blame] | 75 | |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 76 | private: |
| 77 | MipsAssembler* GetAssembler(); |
| 78 | |
| 79 | ArenaAllocator* GetAllocator(); |
| 80 | |
Vladimir Marko | 69d310e | 2017-10-09 14:12:23 +0100 | [diff] [blame] | 81 | CodeGeneratorMIPS* const codegen_; |
Chris Larsen | 701566a | 2015-10-27 15:29:13 -0700 | [diff] [blame] | 82 | |
| 83 | DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorMIPS); |
| 84 | }; |
| 85 | |
| 86 | } // namespace mips |
| 87 | } // namespace art |
| 88 | |
| 89 | #endif // ART_COMPILER_OPTIMIZING_INTRINSICS_MIPS_H_ |