[PATCH] D110820: [fir][NFC] Move fir.select_type builder to cpp file
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 1 00:19:49 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa149b103ca1f: [fir][NFC] Move fir.select_type builder to cpp file (authored by clementval).
Changed prior to commit:
https://reviews.llvm.org/D110820?vs=376335&id=376435#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110820/new/
https://reviews.llvm.org/D110820
Files:
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/lib/Optimizer/Dialect/FIROps.cpp
Index: flang/lib/Optimizer/Dialect/FIROps.cpp
===================================================================
--- flang/lib/Optimizer/Dialect/FIROps.cpp
+++ flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -2671,6 +2671,37 @@
return mlir::success();
}
+void fir::SelectTypeOp::build(mlir::OpBuilder &builder,
+ mlir::OperationState &result,
+ mlir::Value selector,
+ llvm::ArrayRef<mlir::Attribute> typeOperands,
+ llvm::ArrayRef<mlir::Block *> destinations,
+ llvm::ArrayRef<mlir::ValueRange> destOperands,
+ llvm::ArrayRef<mlir::NamedAttribute> attributes) {
+ result.addOperands(selector);
+ result.addAttribute(getCasesAttr(), builder.getArrayAttr(typeOperands));
+ const auto count = destinations.size();
+ for (mlir::Block *dest : destinations)
+ result.addSuccessors(dest);
+ const auto opCount = destOperands.size();
+ llvm::SmallVector<int32_t> argOffs;
+ int32_t sumArgs = 0;
+ for (std::remove_const_t<decltype(count)> i = 0; i != count; ++i) {
+ if (i < opCount) {
+ result.addOperands(destOperands[i]);
+ const auto argSz = destOperands[i].size();
+ argOffs.push_back(argSz);
+ sumArgs += argSz;
+ } else {
+ argOffs.push_back(0);
+ }
+ }
+ result.addAttribute(getOperandSegmentSizeAttr(),
+ builder.getI32VectorAttr({1, 0, sumArgs}));
+ result.addAttribute(getTargetOffsetAttr(), builder.getI32VectorAttr(argOffs));
+ result.addAttributes(attributes);
+}
+
//===----------------------------------------------------------------------===//
// ShapeOp
//===----------------------------------------------------------------------===//
Index: flang/include/flang/Optimizer/Dialect/FIROps.td
===================================================================
--- flang/include/flang/Optimizer/Dialect/FIROps.td
+++ flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -720,34 +720,7 @@
"llvm::ArrayRef<mlir::Attribute>":$typeOperands,
"llvm::ArrayRef<mlir::Block *>":$destinations,
CArg<"llvm::ArrayRef<mlir::ValueRange>", "{}">:$destOperands,
- CArg<"llvm::ArrayRef<mlir::NamedAttribute>", "{}">:$attributes),
- [{
- $_state.addOperands(selector);
- $_state.addAttribute(getCasesAttr(),
- $_builder.getArrayAttr(typeOperands));
- const auto count = destinations.size();
- for (auto d : destinations)
- $_state.addSuccessors(d);
- const auto opCount = destOperands.size();
- llvm::SmallVector<int32_t, 8> argOffs;
- int32_t sumArgs = 0;
- for (std::remove_const_t<decltype(count)> i = 0; i != count; ++i) {
- if (i < opCount) {
- $_state.addOperands(destOperands[i]);
- const auto argSz = destOperands[i].size();
- argOffs.push_back(argSz);
- sumArgs += argSz;
- } else {
- argOffs.push_back(0);
- }
- }
- $_state.addAttribute(getOperandSegmentSizeAttr(),
- $_builder.getI32VectorAttr({1, 0, sumArgs}));
- $_state.addAttribute(getTargetOffsetAttr(),
- $_builder.getI32VectorAttr(argOffs));
- $_state.addAttributes(attributes);
- }]
- >];
+ CArg<"llvm::ArrayRef<mlir::NamedAttribute>", "{}">:$attributes)>];
let parser = "return parseSelectType(parser, result);";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110820.376435.patch
Type: text/x-patch
Size: 3408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211001/8ba8e98b/attachment.bin>
More information about the llvm-commits
mailing list