Files
revng-revng/include/revng/CliftTransforms/PatternRewriter.h
Lauri Vasama c835baf65a Add PatternRewriter.h
Contains APIs from upstream LLVM that are not yet present in the current
version, as well as helpers not present in upstream.

See upstream commit 42c31d8302ff8f716601df9c276a5cd9ace6b158.
2025-12-05 19:53:41 +02:00

32 lines
944 B
C++

#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "mlir/IR/PatternMatch.h"
namespace mlir::clift {
//===------------------ Future PatternRewriter functions ------------------===//
void inlineBlockBefore(mlir::PatternRewriter &Rewriter,
mlir::Block *Src,
mlir::Block *Dst,
mlir::Block::iterator Pos);
//===------------------------------- Helpers ------------------------------===//
inline void inlineRegionAtEnd(mlir::PatternRewriter &Rewriter,
mlir::Region &Source,
mlir::Region &Destination) {
Rewriter.inlineRegionBefore(Source, Destination, Destination.end());
}
inline void clearRegion(mlir::PatternRewriter &Rewriter, mlir::Region &Region) {
while (not Region.empty())
Rewriter.eraseBlock(&Region.front());
}
} // namespace mlir::clift