blob: 436ce69b7b58991916590143d2b628c118574053 [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
Vladimir Markoe2727152019-10-10 10:46:42 +010020#include "base/macros.h"
Chris Larsen3039e382015-08-26 07:54:08 -070021#include "intrinsics.h"
22
Vladimir Markoe2727152019-10-10 10:46:42 +010023namespace art HIDDEN {
Chris Larsen3039e382015-08-26 07:54:08 -070024
25class ArenaAllocator;
26class HInvokeStaticOrDirect;
27class HInvokeVirtual;
28
29namespace mips64 {
30
31class CodeGeneratorMIPS64;
32class Mips64Assembler;
33
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010034class IntrinsicLocationsBuilderMIPS64 final : public IntrinsicVisitor {
Chris Larsen3039e382015-08-26 07:54:08 -070035 public:
36 explicit IntrinsicLocationsBuilderMIPS64(CodeGeneratorMIPS64* codegen);
37
38 // Define visitor methods.
39
Nicolas Geoffray762869d2016-07-15 15:28:35 +010040#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010041 void Visit ## Name(HInvoke* invoke) override;
Chris Larsen3039e382015-08-26 07:54:08 -070042#include "intrinsics_list.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070043 INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
Chris Larsen3039e382015-08-26 07:54:08 -070044#undef INTRINSICS_LIST
45#undef OPTIMIZING_INTRINSICS
46
47 // Check whether an invoke is an intrinsic, and if so, create a location summary. Returns whether
48 // a corresponding LocationSummary with the intrinsified_ flag set was generated and attached to
49 // the invoke.
50 bool TryDispatch(HInvoke* invoke);
51
52 private:
Vladimir Marko69d310e2017-10-09 14:12:23 +010053 CodeGeneratorMIPS64* const codegen_;
54 ArenaAllocator* const allocator_;
Chris Larsen3039e382015-08-26 07:54:08 -070055
56 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderMIPS64);
57};
58
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010059class IntrinsicCodeGeneratorMIPS64 final : public IntrinsicVisitor {
Chris Larsen3039e382015-08-26 07:54:08 -070060 public:
61 explicit IntrinsicCodeGeneratorMIPS64(CodeGeneratorMIPS64* codegen) : codegen_(codegen) {}
62
63 // Define visitor methods.
64
Nicolas Geoffray762869d2016-07-15 15:28:35 +010065#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010066 void Visit ## Name(HInvoke* invoke) override;
Chris Larsen3039e382015-08-26 07:54:08 -070067#include "intrinsics_list.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070068 INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
Chris Larsen3039e382015-08-26 07:54:08 -070069#undef INTRINSICS_LIST
70#undef OPTIMIZING_INTRINSICS
71
Lena Djokic0d2cab52018-03-06 15:20:45 +010072 bool HasMsa() const;
73
Chris Larsen3039e382015-08-26 07:54:08 -070074 private:
75 Mips64Assembler* GetAssembler();
76
77 ArenaAllocator* GetAllocator();
78
Vladimir Marko69d310e2017-10-09 14:12:23 +010079 CodeGeneratorMIPS64* const codegen_;
Chris Larsen3039e382015-08-26 07:54:08 -070080
81 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorMIPS64);
82};
83
84} // namespace mips64
85} // namespace art
86
87#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_MIPS64_H_