blob: 1909a5e8736416b7d4054d9ab4fee607bee11a56 [file] [log] [blame]
Vladimir Markodc151b22015-10-15 18:02:30 +01001/*
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_SHARPENING_H_
18#define ART_COMPILER_OPTIMIZING_SHARPENING_H_
19
Vladimir Markoe2727152019-10-10 10:46:42 +010020#include "base/macros.h"
Nicolas Geoffray83c8e272017-01-31 14:36:37 +000021#include "nodes.h"
Vladimir Markodc151b22015-10-15 18:02:30 +010022#include "optimization.h"
23
Vladimir Markoe2727152019-10-10 10:46:42 +010024namespace art HIDDEN {
Vladimir Markodc151b22015-10-15 18:02:30 +010025
26class CodeGenerator;
Vladimir Markodc151b22015-10-15 18:02:30 +010027class DexCompilationUnit;
Vladimir Markodc151b22015-10-15 18:02:30 +010028
Nicolas Geoffraybdb2ecc2018-09-18 14:33:55 +010029// Utility methods that try to improve the way we dispatch methods, and access
30// types and strings.
31class HSharpening {
Vladimir Markodc151b22015-10-15 18:02:30 +010032 public:
Nicolas Geoffraybdb2ecc2018-09-18 14:33:55 +010033 // Used by the builder and InstructionSimplifier.
34 static HInvokeStaticOrDirect::DispatchInfo SharpenInvokeStaticOrDirect(
35 ArtMethod* callee, CodeGenerator* codegen);
Vladimir Marko28e012a2017-12-07 11:22:59 +000036
Nicolas Geoffray83c8e272017-01-31 14:36:37 +000037 // Used by the builder and the inliner.
Nicolas Geoffrayc4aa82c2017-03-06 14:38:52 +000038 static HLoadClass::LoadKind ComputeLoadClassKind(HLoadClass* load_class,
39 CodeGenerator* codegen,
Nicolas Geoffrayc4aa82c2017-03-06 14:38:52 +000040 const DexCompilationUnit& dex_compilation_unit)
Vladimir Marko28e012a2017-12-07 11:22:59 +000041 REQUIRES_SHARED(Locks::mutator_lock_);
Nicolas Geoffray56876342016-12-16 16:09:08 +000042
Vladimir Marko175e7862018-03-27 09:03:13 +000043 // Used by the builder.
44 static TypeCheckKind ComputeTypeCheckKind(ObjPtr<mirror::Class> klass,
45 CodeGenerator* codegen,
Vladimir Marko175e7862018-03-27 09:03:13 +000046 bool needs_access_check)
47 REQUIRES_SHARED(Locks::mutator_lock_);
48
49 // Used by the builder.
50 static void ProcessLoadString(HLoadString* load_string,
51 CodeGenerator* codegen,
Vladimir Marko175e7862018-03-27 09:03:13 +000052 const DexCompilationUnit& dex_compilation_unit,
53 VariableSizedHandleScope* handles);
Vladimir Markodc151b22015-10-15 18:02:30 +010054};
55
56} // namespace art
57
58#endif // ART_COMPILER_OPTIMIZING_SHARPENING_H_