1/**
2 * Copyright (c) Glow Contributors. See CONTRIBUTORS file.
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#include "glow/PassManager/Pipeline.h"
17
18using namespace glow;
19
20static constexpr char const *tab = " ";
21
22void PassConfigBase::dump(llvm::raw_ostream &os,
23 llvm::StringRef passName) const {
24 os << tab << "PassName: " << passName << ",\n";
25
26 os << tab << "ConvergenceMode: ";
27 switch (getConvergenceMode()) {
28 case ConvergenceMode::OnePass:
29 os << "OnePass,";
30 break;
31 case ConvergenceMode::UntilFixedPoint:
32 os << "UntilFixedPoint,";
33 break;
34 }
35 os << "\n";
36
37 os << tab << "CompilationModes: {";
38 if (isEnabledForCompilationMode(CompilationMode::Infer)) {
39 os << "[Infer]";
40 }
41 if (isEnabledForCompilationMode(CompilationMode::Train)) {
42 os << "[Train]";
43 }
44 os << "},\n";
45}
46
47bool PassConfigBase::equals(const PassConfigBase &other) const {
48 return convergenceMode_ == other.convergenceMode_ &&
49 enabledCompModes_ == other.enabledCompModes_ &&
50 passID_ == other.passID_;
51}
52