summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR/Builders.cpp
diff options
context:
space:
mode:
authorUday Bondhugula <bondhugula@google.com>2018-10-04 17:15:30 -0700
committerjpienaar <jpienaar@google.com>2019-03-29 13:23:19 -0700
commit6cfdb756b165ebd32068506fc70d623f86bb80b3 (patch)
tree2ac173f35c2b0b7913a243d0b5eed17c78c5a09b /mlir/lib/IR/Builders.cpp
parentb55b4076011419c8d8d8cac58c8fda7631067bb2 (diff)
downloadbcm5719-llvm-6cfdb756b165ebd32068506fc70d623f86bb80b3.tar.gz
bcm5719-llvm-6cfdb756b165ebd32068506fc70d623f86bb80b3.zip
Introduce memref replacement/rewrite support: to replace an existing memref
with a new one (of a potentially different rank/shape) with an optional index remapping. - introduce Utils::replaceAllMemRefUsesWith - use this for DMA double buffering (This CL also adds a few temporary utilities / code that will be done away with once: 1) abstract DMA op's are added 2) memref deferencing side-effect / trait is available on op's 3) b/117159533 is resolved (memref index computation slices). PiperOrigin-RevId: 215831373
Diffstat (limited to 'mlir/lib/IR/Builders.cpp')
-rw-r--r--mlir/lib/IR/Builders.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp
index 8ca0fe8318f..deac801f822 100644
--- a/mlir/lib/IR/Builders.cpp
+++ b/mlir/lib/IR/Builders.cpp
@@ -312,6 +312,18 @@ OperationStmt *MLFuncBuilder::createOperation(const OperationState &state) {
return op;
}
+/// Create an operation given the fields.
+OperationStmt *MLFuncBuilder::createOperation(Location *location,
+ Identifier name,
+ ArrayRef<MLValue *> operands,
+ ArrayRef<Type *> types,
+ ArrayRef<NamedAttribute> attrs) {
+ auto *op = OperationStmt::create(location, name, operands, types, attrs,
+ getContext());
+ block->getStatements().insert(insertPoint, op);
+ return op;
+}
+
ForStmt *MLFuncBuilder::createFor(Location *location,
ArrayRef<MLValue *> lbOperands,
AffineMap *lbMap,
OpenPOWER on IntegriCloud