instruction_simplifier_arm64.h revision e6dbf48d7a549e58a3d798bbbdc391e4d091b432
144b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames/* 244b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * Copyright (C) 2015 The Android Open Source Project 344b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * 444b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * Licensed under the Apache License, Version 2.0 (the "License"); 544b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * you may not use this file except in compliance with the License. 644b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * You may obtain a copy of the License at 744b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * 844b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * http://www.apache.org/licenses/LICENSE-2.0 944b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * 1044b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * Unless required by applicable law or agreed to in writing, software 1144b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * distributed under the License is distributed on an "AS IS" BASIS, 1244b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1344b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * See the License for the specific language governing permissions and 1444b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames * limitations under the License. 1544b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames */ 1644b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 1744b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames#ifndef ART_COMPILER_OPTIMIZING_INSTRUCTION_SIMPLIFIER_ARM64_H_ 1844b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames#define ART_COMPILER_OPTIMIZING_INSTRUCTION_SIMPLIFIER_ARM64_H_ 1944b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 2044b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames#include "nodes.h" 2144b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames#include "optimization.h" 2244b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 2344b9cf937836bb33139123e15ca8b586b5853268Alexandre Ramesnamespace art { 2444b9cf937836bb33139123e15ca8b586b5853268Alexandre Ramesnamespace arm64 { 2544b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 2644b9cf937836bb33139123e15ca8b586b5853268Alexandre Ramesclass InstructionSimplifierArm64Visitor : public HGraphVisitor { 2744b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames public: 2844b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames InstructionSimplifierArm64Visitor(HGraph* graph, OptimizingCompilerStats* stats) 2944b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames : HGraphVisitor(graph), stats_(stats) {} 3044b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 3144b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames private: 3244b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames void RecordSimplification() { 3344b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames if (stats_ != nullptr) { 3444b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames stats_->RecordStat(kInstructionSimplificationsArch); 3544b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames } 3644b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames } 3744b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 38e6dbf48d7a549e58a3d798bbbdc391e4d091b432Alexandre Rames void TryExtractArrayAccessAddress(HInstruction* access, 39e6dbf48d7a549e58a3d798bbbdc391e4d091b432Alexandre Rames HInstruction* array, 40e6dbf48d7a549e58a3d798bbbdc391e4d091b432Alexandre Rames HInstruction* index, 41e6dbf48d7a549e58a3d798bbbdc391e4d091b432Alexandre Rames int access_size); 42e6dbf48d7a549e58a3d798bbbdc391e4d091b432Alexandre Rames 43e6dbf48d7a549e58a3d798bbbdc391e4d091b432Alexandre Rames void VisitArrayGet(HArrayGet* instruction) OVERRIDE; 44e6dbf48d7a549e58a3d798bbbdc391e4d091b432Alexandre Rames void VisitArraySet(HArraySet* instruction) OVERRIDE; 45e6dbf48d7a549e58a3d798bbbdc391e4d091b432Alexandre Rames 4644b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames OptimizingCompilerStats* stats_; 4744b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames}; 4844b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 4944b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 5044b9cf937836bb33139123e15ca8b586b5853268Alexandre Ramesclass InstructionSimplifierArm64 : public HOptimization { 5144b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames public: 5244b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames InstructionSimplifierArm64(HGraph* graph, OptimizingCompilerStats* stats) 5344b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames : HOptimization(graph, "instruction_simplifier_arm64", stats) {} 5444b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 5544b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames void Run() OVERRIDE { 5644b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames InstructionSimplifierArm64Visitor visitor(graph_, stats_); 5744b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames visitor.VisitReversePostOrder(); 5844b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames } 5944b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames}; 6044b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 6144b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames} // namespace arm64 6244b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames} // namespace art 6344b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames 6444b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames#endif // ART_COMPILER_OPTIMIZING_INSTRUCTION_SIMPLIFIER_ARM64_H_ 65