blob: 28e41cb086e5fa280d033d4affcdfe9128401b95 [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
Scott Wakeling97c72b72016-06-24 16:19:36 +010027}} // namespace vixl::aarch64
Andreas Gampe878d58c2015-01-15 23:24:00 -080028
29namespace art {
30
31class ArenaAllocator;
32class HInvokeStaticOrDirect;
33class HInvokeVirtual;
34
35namespace arm64 {
36
37class CodeGeneratorARM64;
38
39class IntrinsicLocationsBuilderARM64 FINAL : public IntrinsicVisitor {
40 public:
41 explicit IntrinsicLocationsBuilderARM64(ArenaAllocator* arena) : arena_(arena) {}
42
43 // Define visitor methods.
44
Nicolas Geoffray762869d2016-07-15 15:28:35 +010045#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Andreas Gampe878d58c2015-01-15 23:24:00 -080046 void Visit ## Name(HInvoke* invoke) OVERRIDE;
47#include "intrinsics_list.h"
48INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
49#undef INTRINSICS_LIST
50#undef OPTIMIZING_INTRINSICS
51
52 // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether
53 // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to
54 // the invoke.
55 bool TryDispatch(HInvoke* invoke);
56
57 private:
58 ArenaAllocator* arena_;
59
60 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARM64);
61};
62
63class IntrinsicCodeGeneratorARM64 FINAL : public IntrinsicVisitor {
64 public:
65 explicit IntrinsicCodeGeneratorARM64(CodeGeneratorARM64* codegen) : codegen_(codegen) {}
66
67 // Define visitor methods.
68
Nicolas Geoffray762869d2016-07-15 15:28:35 +010069#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Andreas Gampe878d58c2015-01-15 23:24:00 -080070 void Visit ## Name(HInvoke* invoke) OVERRIDE;
71#include "intrinsics_list.h"
72INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
73#undef INTRINSICS_LIST
74#undef OPTIMIZING_INTRINSICS
75
76 private:
Scott Wakeling97c72b72016-06-24 16:19:36 +010077 vixl::aarch64::MacroAssembler* GetVIXLAssembler();
Andreas Gampe878d58c2015-01-15 23:24:00 -080078
79 ArenaAllocator* GetAllocator();
80
81 CodeGeneratorARM64* codegen_;
82
83 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARM64);
84};
85
86} // namespace arm64
87} // namespace art
88
89#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM64_H_