blob: e01b6fffb8f9cee85f1b3f67849798218a8af85f [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:
Nicolas Geoffray5bd05a52015-10-13 09:48:30 +010036 IntrinsicLocationsBuilderARM(ArenaAllocator* arena,
37 ArmAssembler* assembler,
38 const ArmInstructionSetFeatures& features)
39 : arena_(arena), assembler_(assembler), features_(features) {}
Andreas Gampe2bcf9bf2015-01-29 09:56:07 -080040
41 // Define visitor methods.
42
Aart Bik5d75afe2015-12-14 11:57:01 -080043#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions) \
Andreas Gampe2bcf9bf2015-01-29 09:56:07 -080044 void Visit ## Name(HInvoke* invoke) OVERRIDE;
45#include "intrinsics_list.h"
46INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
47#undef INTRINSICS_LIST
48#undef OPTIMIZING_INTRINSICS
49
50 // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether
51 // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to
52 // the invoke.
53 bool TryDispatch(HInvoke* invoke);
54
55 private:
56 ArenaAllocator* arena_;
Nicolas Geoffray5bd05a52015-10-13 09:48:30 +010057 ArmAssembler* assembler_;
Andreas Gampe2bcf9bf2015-01-29 09:56:07 -080058
59 const ArmInstructionSetFeatures& features_;
60
61 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderARM);
62};
63
64class IntrinsicCodeGeneratorARM FINAL : public IntrinsicVisitor {
65 public:
66 explicit IntrinsicCodeGeneratorARM(CodeGeneratorARM* codegen) : codegen_(codegen) {}
67
68 // Define visitor methods.
69
Aart Bik5d75afe2015-12-14 11:57:01 -080070#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions) \
Andreas Gampe2bcf9bf2015-01-29 09:56:07 -080071 void Visit ## Name(HInvoke* invoke) OVERRIDE;
72#include "intrinsics_list.h"
73INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
74#undef INTRINSICS_LIST
75#undef OPTIMIZING_INTRINSICS
76
77 private:
78 ArmAssembler* GetAssembler();
79
80 ArenaAllocator* GetAllocator();
81
82 CodeGeneratorARM* codegen_;
83
84 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorARM);
85};
86
87} // namespace arm
88} // namespace art
89
90#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_ARM_H_