prepare_for_register_allocation.h revision 729645a937eb9f04a311b3c22471dcf3ebe9bcec
126a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray/* 226a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * Copyright (C) 2014 The Android Open Source Project 326a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * 426a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * Licensed under the Apache License, Version 2.0 (the "License"); 526a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * you may not use this file except in compliance with the License. 626a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * You may obtain a copy of the License at 726a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * 826a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * http://www.apache.org/licenses/LICENSE-2.0 926a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * 1026a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * Unless required by applicable law or agreed to in writing, software 1126a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * distributed under the License is distributed on an "AS IS" BASIS, 1226a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1326a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * See the License for the specific language governing permissions and 1426a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * limitations under the License. 1526a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray */ 1626a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 1726a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray#ifndef ART_COMPILER_OPTIMIZING_PREPARE_FOR_REGISTER_ALLOCATION_H_ 1826a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray#define ART_COMPILER_OPTIMIZING_PREPARE_FOR_REGISTER_ALLOCATION_H_ 1926a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 2026a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray#include "nodes.h" 2126a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 2226a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffraynamespace art { 2326a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 2426a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray/** 2526a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * A simplification pass over the graph before doing register allocation. 2626a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * For example it changes uses of null checks and bounds checks to the original 2726a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray * objects, to avoid creating a live range for these checks. 2826a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray */ 29360231a056e796c36ffe62348507e904dc9efb9bNicolas Geoffrayclass PrepareForRegisterAllocation : public HGraphDelegateVisitor { 3026a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray public: 31360231a056e796c36ffe62348507e904dc9efb9bNicolas Geoffray explicit PrepareForRegisterAllocation(HGraph* graph) : HGraphDelegateVisitor(graph) {} 3226a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 3326a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray void Run(); 3426a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 3526a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray private: 362ed20afc6a1032e9e0cf919cb8d1b2b41e147182Alexandre Rames void VisitNullCheck(HNullCheck* check) OVERRIDE; 372ed20afc6a1032e9e0cf919cb8d1b2b41e147182Alexandre Rames void VisitDivZeroCheck(HDivZeroCheck* check) OVERRIDE; 382ed20afc6a1032e9e0cf919cb8d1b2b41e147182Alexandre Rames void VisitBoundsCheck(HBoundsCheck* check) OVERRIDE; 392ed20afc6a1032e9e0cf919cb8d1b2b41e147182Alexandre Rames void VisitBoundType(HBoundType* bound_type) OVERRIDE; 402ed20afc6a1032e9e0cf919cb8d1b2b41e147182Alexandre Rames void VisitClinitCheck(HClinitCheck* check) OVERRIDE; 412ed20afc6a1032e9e0cf919cb8d1b2b41e147182Alexandre Rames void VisitCondition(HCondition* condition) OVERRIDE; 424c0eb42259d790fddcd9978b66328dbb3ab65615Roland Levillain void VisitInvokeStaticOrDirect(HInvokeStaticOrDirect* invoke) OVERRIDE; 43729645a937eb9f04a311b3c22471dcf3ebe9bcecNicolas Geoffray void VisitNewInstance(HNewInstance* instruction) OVERRIDE; 4426a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 45fbb184a1c6df22d9302b32b55206396c8278edcfVladimir Marko bool CanMoveClinitCheck(HInstruction* input, HInstruction* user); 46fbb184a1c6df22d9302b32b55206396c8278edcfVladimir Marko 4726a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray DISALLOW_COPY_AND_ASSIGN(PrepareForRegisterAllocation); 4826a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray}; 4926a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 5026a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray} // namespace art 5126a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray 5226a25ef62a13f409f941aa39825a51b4d6f0f047Nicolas Geoffray#endif // ART_COMPILER_OPTIMIZING_PREPARE_FOR_REGISTER_ALLOCATION_H_ 53