blob: 3743cb13719657aa81d34dfad77ff4698d25bbfe [file] [log] [blame]
Mark Mendell09ed1a32015-03-25 08:30:06 -04001/*
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_X86_H_
18#define ART_COMPILER_OPTIMIZING_INTRINSICS_X86_H_
19
20#include "intrinsics.h"
21
22namespace art {
23
24class ArenaAllocator;
25class HInvokeStaticOrDirect;
26class HInvokeVirtual;
27
28namespace x86 {
29
30class CodeGeneratorX86;
31class X86Assembler;
32
33class IntrinsicLocationsBuilderX86 FINAL : public IntrinsicVisitor {
34 public:
Mark Mendellfb8d2792015-03-31 22:16:59 -040035 explicit IntrinsicLocationsBuilderX86(CodeGeneratorX86* codegen);
Mark Mendell09ed1a32015-03-25 08:30:06 -040036
37 // Define visitor methods.
38
Nicolas Geoffray762869d2016-07-15 15:28:35 +010039#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \
Mark Mendell09ed1a32015-03-25 08:30:06 -040040 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_;
Mark Mendellfb8d2792015-03-31 22:16:59 -040053 CodeGeneratorX86* codegen_;
Mark Mendell09ed1a32015-03-25 08:30:06 -040054
55 DISALLOW_COPY_AND_ASSIGN(IntrinsicLocationsBuilderX86);
56};
57
58class IntrinsicCodeGeneratorX86 FINAL : public IntrinsicVisitor {
59 public:
60 explicit IntrinsicCodeGeneratorX86(CodeGeneratorX86* 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, ...) \
Mark Mendell09ed1a32015-03-25 08:30:06 -040065 void Visit ## Name(HInvoke* invoke) OVERRIDE;
66#include "intrinsics_list.h"
67INTRINSICS_LIST(OPTIMIZING_INTRINSICS)
68#undef INTRINSICS_LIST
69#undef OPTIMIZING_INTRINSICS
70
71 private:
72 X86Assembler* GetAssembler();
73
74 ArenaAllocator* GetAllocator();
75
76 CodeGeneratorX86* codegen_;
77
78 DISALLOW_COPY_AND_ASSIGN(IntrinsicCodeGeneratorX86);
79};
80
81} // namespace x86
82} // namespace art
83
84#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_X86_H_