blob: 033a644f345788bde14ff82f5af99580b50e4e07 [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
20#include "intrinsics.h"
21
22namespace vixl {
Scott Wakeling97c72b72016-06-24 16:19:36 +010023namespace aarch64 {
Andreas Gampe878d58c2015-01-15 23:24:00 -080024
25class MacroAssembler;
26
Andreas Gampedeae7db2017-05-30 09:56:41 -070027} // namespace aarch64
28} // namespace vixl
Andreas Gampe878d58c2015-01-15 23:24:00 -080029
30namespace art {
31
32class ArenaAllocator;
33class HInvokeStaticOrDirect;
34class HInvokeVirtual;
35
36namespace arm64 {
37
38class CodeGeneratorARM64;
39
40class IntrinsicLocationsBuilderARM64 FINAL : public IntrinsicVisitor {
41 public:
Vladimir Markoca6fff82017-10-03 14:49:14 +010042 explicit IntrinsicLocationsBuilderARM64(ArenaAllocator* allocator, CodeGeneratorARM64* codegen)
43 : allocator_(allocator), codegen_(codegen) {}
Andreas Gampe878d58c2015-01-15 23:24:00 -080044
45 // Define visitor methods.
46
Nicolas Geoffray762869d2016-07-15 15:28:35 +010047#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Andreas Gampe878d58c2015-01-15 23:24:00 -080048 void Visit ## Name(HInvoke* invoke) OVERRIDE;
49#include "intrinsics_list.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070050 INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
Andreas Gampe878d58c2015-01-15 23:24:00 -080051#undef INTRINSICS_LIST
52#undef OPTIMIZING_INTRINSICS
53
54 // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether
55 // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to
56 // the invoke.
57 bool TryDispatch(HInvoke* invoke);
58
59 private:
Vladimir Marko69d310e2017-10-09 14:12:23 +010060 ArenaAllocator* const allocator_;
61 CodeGeneratorARM64* const codegen_;
Andreas Gampe878d58c2015-01-15 23:24:00 -080062
63 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARM64);
64};
65
66class IntrinsicCodeGeneratorARM64 FINAL : public IntrinsicVisitor {
67 public:
68 explicit IntrinsicCodeGeneratorARM64(CodeGeneratorARM64* codegen) : codegen_(codegen) {}
69
70 // Define visitor methods.
71
Nicolas Geoffray762869d2016-07-15 15:28:35 +010072#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Andreas Gampe878d58c2015-01-15 23:24:00 -080073 void Visit ## Name(HInvoke* invoke) OVERRIDE;
74#include "intrinsics_list.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070075 INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
Andreas Gampe878d58c2015-01-15 23:24:00 -080076#undef INTRINSICS_LIST
77#undef OPTIMIZING_INTRINSICS
78
79 private:
Scott Wakeling97c72b72016-06-24 16:19:36 +010080 vixl::aarch64::MacroAssembler* GetVIXLAssembler();
Andreas Gampe878d58c2015-01-15 23:24:00 -080081
82 ArenaAllocator* GetAllocator();
83
Vladimir Marko69d310e2017-10-09 14:12:23 +010084 CodeGeneratorARM64* const codegen_;
Andreas Gampe878d58c2015-01-15 23:24:00 -080085
86 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARM64);
87};
88
89} // namespace arm64
90} // namespace art
91
92#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM64_H_