1 /*
2  * Copyright (C) 2015 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 "pass_manager.h"
18 
19 #include "base/stl_util.h"
20 #include "pass_me.h"
21 
22 namespace art {
23 
PassManager(const PassManagerOptions & options)24 PassManager::PassManager(const PassManagerOptions& options) : options_(options) {
25 }
26 
~PassManager()27 PassManager::~PassManager() {
28   STLDeleteElements(&passes_);
29 }
30 
CreateDefaultPassList()31 void PassManager::CreateDefaultPassList() {
32   default_pass_list_.clear();
33   // Add each pass which isn't disabled into default_pass_list_.
34   for (const auto* pass : passes_) {
35     if (options_.GetDisablePassList().find(pass->GetName()) != std::string::npos) {
36       VLOG(compiler) << "Skipping disabled pass " << pass->GetName();
37     } else {
38       default_pass_list_.push_back(pass);
39     }
40   }
41 }
42 
PrintPassNames() const43 void PassManager::PrintPassNames() const {
44   LOG(INFO) << "Loop Passes are:";
45   for (const Pass* cur_pass : default_pass_list_) {
46     LOG(INFO) << "\t-" << cur_pass->GetName();
47   }
48 }
49 
50 }  // namespace art
51