mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
c835baf65a
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.
29 lines
865 B
C++
29 lines
865 B
C++
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "revng/CliftTransforms/PatternRewriter.h"
|
|
|
|
void mlir::clift::inlineBlockBefore(mlir::PatternRewriter &Rewriter,
|
|
mlir::Block *Src,
|
|
mlir::Block *Dst,
|
|
mlir::Block::iterator Pos) {
|
|
mlir::Operation *SrcOp = Src->getParentOp();
|
|
mlir::Operation *DstOp = Dst->getParentOp();
|
|
|
|
bool UpdateSrcOp = SrcOp != nullptr;
|
|
bool UpdateDstOp = DstOp != nullptr and DstOp != SrcOp;
|
|
|
|
if (UpdateSrcOp)
|
|
Rewriter.startRootUpdate(SrcOp);
|
|
if (UpdateDstOp)
|
|
Rewriter.startRootUpdate(DstOp);
|
|
|
|
Dst->getOperations().splice(Pos, Src->getOperations());
|
|
|
|
if (UpdateDstOp)
|
|
Rewriter.finalizeRootUpdate(DstOp);
|
|
if (UpdateSrcOp)
|
|
Rewriter.finalizeRootUpdate(SrcOp);
|
|
}
|