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
9#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
10
11#include "mlir/Dialect/SPIRV/IR/SPIRVGLCanonicalization.h"
12#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
13#include "mlir/Pass/Pass.h"
14#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
15
16namespace mlir {
17namespace spirv {
18#define GEN_PASS_DEF_SPIRVCANONICALIZEGLPASS
19#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
20} // namespace spirv
21} // namespace mlir
22
23using namespace mlir;
24
25namespace {
26class CanonicalizeGLPass final
27 : public spirv::impl::SPIRVCanonicalizeGLPassBase<CanonicalizeGLPass> {
28public:
29 void runOnOperation() override {
30 RewritePatternSet patterns(&getContext());
31 spirv::populateSPIRVGLCanonicalizationPatterns(results&: patterns);
32 if (failed(
33 applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
34 return signalPassFailure();
35 }
36};
37} // namespace
38

source code of mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp