Home | History | Annotate | Download | only in dex
      1 /*
      2  * Copyright (C) 2014 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 #include "base/macros.h"
     18 #include "post_opt_passes.h"
     19 #include "compiler_internals.h"
     20 #include "pass_driver_me_post_opt.h"
     21 
     22 namespace art {
     23 
     24 /*
     25  * Create the pass list. These passes are immutable and are shared across the threads.
     26  *
     27  * Advantage is that there will be no race conditions here.
     28  * Disadvantage is the passes can't change their internal states depending on CompilationUnit:
     29  *   - This is not yet an issue: no current pass would require it.
     30  */
     31 // The initial list of passes to be used by the PassDriveMEPostOpt.
     32 template<>
     33 const Pass* const PassDriver<PassDriverMEPostOpt>::g_passes[] = {
     34   GetPassInstance<InitializeData>(),
     35   GetPassInstance<ClearPhiInstructions>(),
     36   GetPassInstance<CalculatePredecessors>(),
     37   GetPassInstance<DFSOrders>(),
     38   GetPassInstance<BuildDomination>(),
     39   GetPassInstance<TopologicalSortOrders>(),
     40   GetPassInstance<DefBlockMatrix>(),
     41   GetPassInstance<CreatePhiNodes>(),
     42   GetPassInstance<ClearVisitedFlag>(),
     43   GetPassInstance<SSAConversion>(),
     44   GetPassInstance<PhiNodeOperands>(),
     45   GetPassInstance<ConstantPropagation>(),
     46   GetPassInstance<PerformInitRegLocations>(),
     47   GetPassInstance<MethodUseCount>(),
     48   GetPassInstance<FreeData>(),
     49 };
     50 
     51 // The number of the passes in the initial list of Passes (g_passes).
     52 template<>
     53 uint16_t const PassDriver<PassDriverMEPostOpt>::g_passes_size =
     54     arraysize(PassDriver<PassDriverMEPostOpt>::g_passes);
     55 
     56 // The default pass list is used by the PassDriverME instance of PassDriver
     57 // to initialize pass_list_.
     58 template<>
     59 std::vector<const Pass*> PassDriver<PassDriverMEPostOpt>::g_default_pass_list(
     60     PassDriver<PassDriverMEPostOpt>::g_passes,
     61     PassDriver<PassDriverMEPostOpt>::g_passes +
     62     PassDriver<PassDriverMEPostOpt>::g_passes_size);
     63 
     64 // By default, do not have a dump pass list.
     65 template<>
     66 std::string PassDriver<PassDriverMEPostOpt>::dump_pass_list_ = std::string();
     67 
     68 // By default, do not have a print pass list.
     69 template<>
     70 std::string PassDriver<PassDriverMEPostOpt>::print_pass_list_ = std::string();
     71 
     72 // By default, we do not print the pass' information.
     73 template<>
     74 bool PassDriver<PassDriverMEPostOpt>::default_print_passes_ = false;
     75 
     76 }  // namespace art
     77