blob: 748b0b02b2e8d2ab0f23a54e26ee1fbe1b9e9928 [file] [log] [blame]
Chris Larsen3039e382015-08-26 07:54:08 -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_MIPS64_H_
18#define ART_COMPILER_OPTIMIZING_INTRINSICS_MIPS64_H_
19
20#include "intrinsics.h"
21
22namespace art {
23
24class ArenaAllocator;
25class HInvokeStaticOrDirect;
26class HInvokeVirtual;
27
28namespace mips64 {
29
30class CodeGeneratorMIPS64;
31class Mips64Assembler;
32
33class IntrinsicLocationsBuilderMIPS64 FINAL : public IntrinsicVisitor {
34 public:
35 explicit IntrinsicLocationsBuilderMIPS64(CodeGeneratorMIPS64* codegen);
36
37 // Define visitor methods.
38
Nicolas Geoffray762869d2016-07-15 15:28:35 +010039#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Chris Larsen3039e382015-08-26 07:54:08 -070040 void Visit ## Name(HInvoke* invoke) OVERRIDE;
41#include "intrinsics_list.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070042 INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
Chris Larsen3039e382015-08-26 07:54:08 -070043#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:
Vladimir Marko69d310e2017-10-09 14:12:23 +010052 CodeGeneratorMIPS64* const codegen_;
53 ArenaAllocator* const allocator_;
Chris Larsen3039e382015-08-26 07:54:08 -070054
55 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderMIPS64);
56};
57
58class IntrinsicCodeGeneratorMIPS64 FINAL : public IntrinsicVisitor {
59 public:
60 explicit IntrinsicCodeGeneratorMIPS64(CodeGeneratorMIPS64* codegen) : codegen_(codegen) {}
61
62 // Define visitor methods.
63
Nicolas Geoffray762869d2016-07-15 15:28:35 +010064#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Chris Larsen3039e382015-08-26 07:54:08 -070065 void Visit ## Name(HInvoke* invoke) OVERRIDE;
66#include "intrinsics_list.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070067 INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
Chris Larsen3039e382015-08-26 07:54:08 -070068#undef INTRINSICS_LIST
69#undef OPTIMIZING_INTRINSICS
70
Lena Djokic0d2cab52018-03-06 15:20:45 +010071 bool HasMsa() const;
72
Chris Larsen3039e382015-08-26 07:54:08 -070073 private:
74 Mips64Assembler* GetAssembler();
75
76 ArenaAllocator* GetAllocator();
77
Vladimir Marko69d310e2017-10-09 14:12:23 +010078 CodeGeneratorMIPS64* const codegen_;
Chris Larsen3039e382015-08-26 07:54:08 -070079
80 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorMIPS64);
81};
82
83} // namespace mips64
84} // namespace art
85
86#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_MIPS64_H_