blob: 2abb605e6eb4e45f6dc5772dbd8e6b9716da87d5 [file] [log] [blame]
Andreas Gampe2bcf9bf2015-01-29 09:56:07 -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_ARM_H_
18#define ART_COMPILER_OPTIMIZING_INTRINSICS_ARM_H_
19
20#include "intrinsics.h"
21
22namespace art {
23
24class ArenaAllocator;
25class ArmInstructionSetFeatures;
26class HInvokeStaticOrDirect;
27class HInvokeVirtual;
28
29namespace arm {
30
31class ArmAssembler;
32class CodeGeneratorARM;
33
34class IntrinsicLocationsBuilderARM FINAL : public IntrinsicVisitor {
35 public:
Roland Levillain3887c462015-08-12 18:15:42 +010036 IntrinsicLocationsBuilderARM(ArenaAllocator* arena, const ArmInstructionSetFeatures& features)
Andreas Gampe2bcf9bf2015-01-29 09:56:07 -080037 : arena_(arena), features_(features) {}
38
39 // Define visitor methods.
40
Agi Csaki05f20562015-08-19 14:58:14 -070041#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache) \
Andreas Gampe2bcf9bf2015-01-29 09:56:07 -080042 void Visit ## Name(HInvoke* invoke) OVERRIDE;
43#include "intrinsics_list.h"
44INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
45#undef INTRINSICS_LIST
46#undef OPTIMIZING_INTRINSICS
47
48 // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether
49 // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to
50 // the invoke.
51 bool TryDispatch(HInvoke* invoke);
52
53 private:
54 ArenaAllocator* arena_;
55
56 const ArmInstructionSetFeatures& features_;
57
58 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARM);
59};
60
61class IntrinsicCodeGeneratorARM FINAL : public IntrinsicVisitor {
62 public:
63 explicit IntrinsicCodeGeneratorARM(CodeGeneratorARM* codegen) : codegen_(codegen) {}
64
65 // Define visitor methods.
66
Agi Csaki05f20562015-08-19 14:58:14 -070067#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache) \
Andreas Gampe2bcf9bf2015-01-29 09:56:07 -080068 void Visit ## Name(HInvoke* invoke) OVERRIDE;
69#include "intrinsics_list.h"
70INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
71#undef INTRINSICS_LIST
72#undef OPTIMIZING_INTRINSICS
73
74 private:
75 ArmAssembler* GetAssembler();
76
77 ArenaAllocator* GetAllocator();
78
79 CodeGeneratorARM* codegen_;
80
81 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARM);
82};
83
84} // namespace arm
85} // namespace art
86
87#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM_H_