MLIR  19.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 {
30  RewritePatternSet patterns(&getContext());
32  if (failed(
33  applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
34  return signalPassFailure();
35  }
36 };
37 } // 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 applyPatternsAndFoldGreedily(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...
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
Definition: LogicalResult.h:72