• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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_SCHEDULER_ARM64_H_
18 #define ART_COMPILER_OPTIMIZING_SCHEDULER_ARM64_H_
19 
20 #include "base/macros.h"
21 #include "scheduler.h"
22 
23 namespace art HIDDEN {
24 namespace arm64 {
25 
26 class HSchedulerARM64 : public HScheduler {
27  public:
HSchedulerARM64(SchedulingNodeSelector * selector)28   explicit HSchedulerARM64(SchedulingNodeSelector* selector)
29       : HScheduler(selector) {}
~HSchedulerARM64()30   ~HSchedulerARM64() override {}
31 
32   bool IsSchedulable(const HInstruction* instruction) const override;
33 
34   // Treat as scheduling barriers those vector instructions whose live ranges exceed the vectorized
35   // loop boundaries. This is a workaround for the lack of notion of SIMD register in the compiler;
36   // around a call we have to save/restore all live SIMD&FP registers (only lower 64 bits of
37   // SIMD&FP registers are callee saved) so don't reorder such vector instructions.
38   //
39   // TODO: remove this when a proper support of SIMD registers is introduced to the compiler.
IsSchedulingBarrier(const HInstruction * instr)40   bool IsSchedulingBarrier(const HInstruction* instr) const override {
41     return HScheduler::IsSchedulingBarrier(instr) ||
42            instr->IsVecReduce() ||
43            instr->IsVecExtractScalar() ||
44            instr->IsVecSetScalars() ||
45            instr->IsVecReplicateScalar();
46   }
47 
48  protected:
49   std::pair<SchedulingGraph, ScopedArenaVector<SchedulingNode*>> BuildSchedulingGraph(
50       HBasicBlock* block,
51       ScopedArenaAllocator* allocator,
52       const HeapLocationCollector* heap_location_collector) override;
53 
54  private:
55   DISALLOW_COPY_AND_ASSIGN(HSchedulerARM64);
56 };
57 
58 }  // namespace arm64
59 }  // namespace art
60 
61 #endif  // ART_COMPILER_OPTIMIZING_SCHEDULER_ARM64_H_
62