My Project
RegionUtils.h
Go to the documentation of this file.
1 //===- RegionUtils.h - Region-related transformation utilities --*- C++ -*-===//
2 //
3 // Part of the MLIR 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 #ifndef MLIR_TRANSFORMS_REGIONUTILS_H_
10 #define MLIR_TRANSFORMS_REGIONUTILS_H_
11 
12 #include "mlir/IR/Region.h"
13 #include "mlir/IR/Value.h"
14 
15 #include "llvm/ADT/SetVector.h"
16 
17 namespace mlir {
18 
22 template <typename Range>
23 bool areValuesDefinedAbove(Range values, Region &limit) {
24  for (Value v : values)
25  if (!v->getParentRegion()->isProperAncestor(&limit))
26  return false;
27  return true;
28 }
29 
31 void replaceAllUsesInRegionWith(Value orig, Value replacement, Region &region);
32 
35 void visitUsedValuesDefinedAbove(Region &region, Region &limit,
36  function_ref<void(OpOperand *)> callback);
37 
41  function_ref<void(OpOperand *)> callback);
42 
45 void getUsedValuesDefinedAbove(Region &region, Region &limit,
46  llvm::SetVector<Value> &values);
47 
51  llvm::SetVector<Value> &values);
52 
58 
59 } // namespace mlir
60 
61 #endif // MLIR_TRANSFORMS_REGIONUTILS_H_
Definition: InferTypeOpInterface.cpp:20
Definition: Region.h:23
bool areValuesDefinedAbove(Range values, Region &limit)
Definition: RegionUtils.h:23
Definition: LLVM.h:49
void visitUsedValuesDefinedAbove(Region &region, Region &limit, function_ref< void(OpOperand *)> callback)
Definition: RegionUtils.cpp:29
LogicalResult simplifyRegions(MutableArrayRef< Region > regions)
Definition: RegionUtils.cpp:344
Definition: LogicalResult.h:18
void getUsedValuesDefinedAbove(Region &region, Region &limit, llvm::SetVector< Value > &values)
Definition: RegionUtils.cpp:56
Definition: LLVM.h:38
void replaceAllUsesInRegionWith(Value orig, Value replacement, Region &region)
Replace all uses of orig within the given region with replacement.
Definition: RegionUtils.cpp:21
Definition: Value.h:38
A reference to a value, suitable for use as an operand of an operation.
Definition: UseDefLists.h:330
Definition: LinalgTypes.h:20