blob: a0ccf87f7be4c75d505b9d07271d6101ac69b10e [file] [log] [blame]
Andreas Gampe878d58c2015-01-15 23:24:00 -08001/*
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 Markoe2727152019-10-10 10:46:42 +010020#include "base/macros.h"
Andreas Gampe878d58c2015-01-15 23:24:00 -080021#include "intrinsics.h"
22
23namespace vixl {
Scott Wakeling97c72b72016-06-24 16:19:36 +010024namespace aarch64 {
Andreas Gampe878d58c2015-01-15 23:24:00 -080025
26class MacroAssembler;
27
Andreas Gampedeae7db2017-05-30 09:56:41 -070028} // namespace aarch64
29} // namespace vixl
Andreas Gampe878d58c2015-01-15 23:24:00 -080030
Vladimir Markoe2727152019-10-10 10:46:42 +010031namespace art HIDDEN {
Andreas Gampe878d58c2015-01-15 23:24:00 -080032
33class ArenaAllocator;
34class HInvokeStaticOrDirect;
35class HInvokeVirtual;
36
37namespace arm64 {
38
39class CodeGeneratorARM64;
40
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010041class IntrinsicLocationsBuilderARM64 final : public IntrinsicVisitor {
Andreas Gampe878d58c2015-01-15 23:24:00 -080042 public:
Vladimir Markoca6fff82017-10-03 14:49:14 +010043 explicit IntrinsicLocationsBuilderARM64(ArenaAllocator* allocator, CodeGeneratorARM64* codegen)
44 : allocator_(allocator), codegen_(codegen) {}
Andreas Gampe878d58c2015-01-15 23:24:00 -080045
46 // Define visitor methods.
47
Nicolas Geoffray762869d2016-07-15 15:28:35 +010048#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010049 void Visit ## Name(HInvoke* invoke) override;
Andreas Gampe878d58c2015-01-15 23:24:00 -080050#include "intrinsics_list.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070051 INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
Andreas Gampe878d58c2015-01-15 23:24:00 -080052#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 Marko69d310e2017-10-09 14:12:23 +010061 ArenaAllocator* const allocator_;
62 CodeGeneratorARM64* const codegen_;
Andreas Gampe878d58c2015-01-15 23:24:00 -080063
64 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARM64);
65};
66
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010067class IntrinsicCodeGeneratorARM64 final : public IntrinsicVisitor {
Andreas Gampe878d58c2015-01-15 23:24:00 -080068 public:
69 explicit IntrinsicCodeGeneratorARM64(CodeGeneratorARM64* codegen) : codegen_(codegen) {}
70
71 // Define visitor methods.
72
Nicolas Geoffray762869d2016-07-15 15:28:35 +010073#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010074 void Visit ## Name(HInvoke* invoke) override;
Andreas Gampe878d58c2015-01-15 23:24:00 -080075#include "intrinsics_list.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070076 INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
Andreas Gampe878d58c2015-01-15 23:24:00 -080077#undef INTRINSICS_LIST
78#undef OPTIMIZING_INTRINSICS
79
80 private:
Scott Wakeling97c72b72016-06-24 16:19:36 +010081 vixl::aarch64::MacroAssembler* GetVIXLAssembler();
Andreas Gampe878d58c2015-01-15 23:24:00 -080082
83 ArenaAllocator* GetAllocator();
84
Vladimir Marko69d310e2017-10-09 14:12:23 +010085 CodeGeneratorARM64* const codegen_;
Andreas Gampe878d58c2015-01-15 23:24:00 -080086
87 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARM64);
88};
89
90} // namespace arm64
91} // namespace art
92
93#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM64_H_