1*795d594fSAndroid Build Coastguard Worker /* 2*795d594fSAndroid Build Coastguard Worker * Copyright (C) 2016 The Android Open Source Project 3*795d594fSAndroid Build Coastguard Worker * 4*795d594fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*795d594fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*795d594fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*795d594fSAndroid Build Coastguard Worker * 8*795d594fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*795d594fSAndroid Build Coastguard Worker * 10*795d594fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*795d594fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*795d594fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*795d594fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*795d594fSAndroid Build Coastguard Worker * limitations under the License. 15*795d594fSAndroid Build Coastguard Worker */ 16*795d594fSAndroid Build Coastguard Worker 17*795d594fSAndroid Build Coastguard Worker #ifndef ART_COMPILER_OPTIMIZING_SCHEDULER_ARM64_H_ 18*795d594fSAndroid Build Coastguard Worker #define ART_COMPILER_OPTIMIZING_SCHEDULER_ARM64_H_ 19*795d594fSAndroid Build Coastguard Worker 20*795d594fSAndroid Build Coastguard Worker #include "base/macros.h" 21*795d594fSAndroid Build Coastguard Worker #include "scheduler.h" 22*795d594fSAndroid Build Coastguard Worker 23*795d594fSAndroid Build Coastguard Worker namespace art HIDDEN { 24*795d594fSAndroid Build Coastguard Worker namespace arm64 { 25*795d594fSAndroid Build Coastguard Worker 26*795d594fSAndroid Build Coastguard Worker class HSchedulerARM64 : public HScheduler { 27*795d594fSAndroid Build Coastguard Worker public: HSchedulerARM64(SchedulingNodeSelector * selector)28*795d594fSAndroid Build Coastguard Worker explicit HSchedulerARM64(SchedulingNodeSelector* selector) 29*795d594fSAndroid Build Coastguard Worker : HScheduler(selector) {} ~HSchedulerARM64()30*795d594fSAndroid Build Coastguard Worker ~HSchedulerARM64() override {} 31*795d594fSAndroid Build Coastguard Worker 32*795d594fSAndroid Build Coastguard Worker bool IsSchedulable(const HInstruction* instruction) const override; 33*795d594fSAndroid Build Coastguard Worker 34*795d594fSAndroid Build Coastguard Worker // Treat as scheduling barriers those vector instructions whose live ranges exceed the vectorized 35*795d594fSAndroid Build Coastguard Worker // loop boundaries. This is a workaround for the lack of notion of SIMD register in the compiler; 36*795d594fSAndroid Build Coastguard Worker // around a call we have to save/restore all live SIMD&FP registers (only lower 64 bits of 37*795d594fSAndroid Build Coastguard Worker // SIMD&FP registers are callee saved) so don't reorder such vector instructions. 38*795d594fSAndroid Build Coastguard Worker // 39*795d594fSAndroid Build Coastguard Worker // TODO: remove this when a proper support of SIMD registers is introduced to the compiler. IsSchedulingBarrier(const HInstruction * instr)40*795d594fSAndroid Build Coastguard Worker bool IsSchedulingBarrier(const HInstruction* instr) const override { 41*795d594fSAndroid Build Coastguard Worker return HScheduler::IsSchedulingBarrier(instr) || 42*795d594fSAndroid Build Coastguard Worker instr->IsVecReduce() || 43*795d594fSAndroid Build Coastguard Worker instr->IsVecExtractScalar() || 44*795d594fSAndroid Build Coastguard Worker instr->IsVecSetScalars() || 45*795d594fSAndroid Build Coastguard Worker instr->IsVecReplicateScalar(); 46*795d594fSAndroid Build Coastguard Worker } 47*795d594fSAndroid Build Coastguard Worker 48*795d594fSAndroid Build Coastguard Worker protected: 49*795d594fSAndroid Build Coastguard Worker std::pair<SchedulingGraph, ScopedArenaVector<SchedulingNode*>> BuildSchedulingGraph( 50*795d594fSAndroid Build Coastguard Worker HBasicBlock* block, 51*795d594fSAndroid Build Coastguard Worker ScopedArenaAllocator* allocator, 52*795d594fSAndroid Build Coastguard Worker const HeapLocationCollector* heap_location_collector) override; 53*795d594fSAndroid Build Coastguard Worker 54*795d594fSAndroid Build Coastguard Worker private: 55*795d594fSAndroid Build Coastguard Worker DISALLOW_COPY_AND_ASSIGN(HSchedulerARM64); 56*795d594fSAndroid Build Coastguard Worker }; 57*795d594fSAndroid Build Coastguard Worker 58*795d594fSAndroid Build Coastguard Worker } // namespace arm64 59*795d594fSAndroid Build Coastguard Worker } // namespace art 60*795d594fSAndroid Build Coastguard Worker 61*795d594fSAndroid Build Coastguard Worker #endif // ART_COMPILER_OPTIMIZING_SCHEDULER_ARM64_H_ 62