blob: e134cb882e37a159900506e94317003956813abb [file] [log] [blame]
Chris Larsen701566a2015-10-27 15:29:13 -07001/*
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_MIPS_H_
18#define ART_COMPILER_OPTIMIZING_INTRINSICS_MIPS_H_
19
20#include "intrinsics.h"
21
22namespace art {
23
24class ArenaAllocator;
25class HInvokeStaticOrDirect;
26class HInvokeVirtual;
27
28namespace mips {
29
30class CodeGeneratorMIPS;
31class MipsAssembler;
32
33class IntrinsicLocationsBuilderMIPS FINAL : public IntrinsicVisitor {
34 public:
35 explicit IntrinsicLocationsBuilderMIPS(CodeGeneratorMIPS* codegen);
36
37 // Define visitor methods.
38
Nicolas Geoffray762869d2016-07-15 15:28:35 +010039#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Chris Larsen701566a2015-10-27 15:29:13 -070040 void Visit ## Name(HInvoke* invoke) OVERRIDE;
41#include "intrinsics_list.h"
42INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
43#undef INTRINSICS_LIST
44#undef OPTIMIZING_INTRINSICS
45
46 // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether
47 // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to
48 // the invoke.
49 bool TryDispatch(HInvoke* invoke);
50
51 private:
52 ArenaAllocator* arena_;
53
54 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderMIPS);
55};
56
57class IntrinsicCodeGeneratorMIPS FINAL : public IntrinsicVisitor {
58 public:
59 explicit IntrinsicCodeGeneratorMIPS(CodeGeneratorMIPS* codegen) : codegen_(codegen) {}
60
61 // Define visitor methods.
62
Nicolas Geoffray762869d2016-07-15 15:28:35 +010063#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Chris Larsen701566a2015-10-27 15:29:13 -070064 void Visit ## Name(HInvoke* invoke) OVERRIDE;
65#include "intrinsics_list.h"
66INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
67#undef INTRINSICS_LIST
68#undef OPTIMIZING_INTRINSICS
69
Alexey Frunzebb9863a2016-01-11 15:51:16 -080070 bool IsR2OrNewer() const;
71 bool IsR6() const;
72 bool Is32BitFPU() const;
Chris Larsene16ce5a2015-11-18 12:30:20 -080073
Chris Larsen701566a2015-10-27 15:29:13 -070074 private:
75 MipsAssembler* GetAssembler();
76
77 ArenaAllocator* GetAllocator();
78
79 CodeGeneratorMIPS* codegen_;
80
81 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorMIPS);
82};
83
84} // namespace mips
85} // namespace art
86
87#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_MIPS_H_