MLIR  20.0.0git
CanonicalizeGLPass.cpp
Go to the documentation of this file.
1 //===- CanonicalizeGLPass.cpp - GLSL Related Canonicalization Pass ------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
13 #include "mlir/Pass/Pass.h"
15 
16 namespace mlir {
17 namespace spirv {
18 #define GEN_PASS_DEF_SPIRVCANONICALIZEGLPASS
19 #include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
20 } // namespace spirv
21 } // namespace mlir
22 
23 using namespace mlir;
24 
25 namespace {
26 class CanonicalizeGLPass final
27  : public spirv::impl::SPIRVCanonicalizeGLPassBase<CanonicalizeGLPass> {
28 public:
29  void runOnOperation() override {
32  if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
33  return signalPassFailure();
34  }
35 };
36 } // namespace
static MLIRContext * getContext(OpFoldResult val)
void populateSPIRVGLCanonicalizationPatterns(RewritePatternSet &results)
Populates patterns to run canoncalization that involves GL ops.
Include the generated interface declarations.
LogicalResult applyPatternsGreedily(Region &region, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config=GreedyRewriteConfig(), bool *changed=nullptr)
Rewrite ops in the given region, which must be isolated from above, by repeatedly applying the highes...
const FrozenRewritePatternSet & patterns