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#ifndef GLOW_OPTIMIZER_GRAPHOPTIMIZER_FUNCTIONPASSPIPELINE_H
17#define GLOW_OPTIMIZER_GRAPHOPTIMIZER_FUNCTIONPASSPIPELINE_H
18
19#include "glow/Optimizer/GraphOptimizer/CompilationContext.h"
20#include "glow/Optimizer/GraphOptimizer/FunctionPass.h"
21#include "glow/PassManager/Pipeline.h"
22#include "glow/Support/Support.h"
23
24namespace glow {
25
26/// Define an enum to identify all FunctionPasses, used to declare inside a
27/// FunctionPassConfig for a Pipeline.
28enum class FunctionPassID {
29#define FUN_PASS(PASS_NAME) PASS_NAME,
30#include "glow/Optimizer/GraphOptimizer/FunctionPasses.def"
31};
32
33/// IR passes pipeline.
34using FunctionPassPipeline = PassPipeline<FunctionPass>;
35
36/// \returns the default, target-independent graph optimization pipeline
37std::unique_ptr<FunctionPassPipeline>
38createDefaultGraphOptimizationPassPipeline();
39
40/// \returns the fp16 specific optimization pipeline
41std::unique_ptr<FunctionPassPipeline> createFP16GraphOptimizationPassPipeline();
42
43/// \returns the default fold pipeline.
44std::unique_ptr<FunctionPassPipeline> createDefaultFoldPassPipeline();
45
46/// \returns a FunctionPassConfig for performing DCE.
47FunctionPassConfig getDCEPassConfig();
48
49/// \returns the name of a FunctionPass given its \p passID.
50llvm::StringRef getNameOfPass(FunctionPassID passID);
51
52} // namespace glow
53
54#endif // GLOW_OPTIMIZER_GRAPHOPTIMIZER_FUNCTIONPASSPIPELINE_H
55