@@ -47,38 +47,66 @@ def BlockArgOpenMPOpInterface : OpInterface<"BlockArgOpenMPOpInterface"> {
47
47
}]>,
48
48
49
49
// Unified access methods for clause-associated entry block arguments.
50
+ InterfaceMethod<"Get start index of block arguments defined by `in_reduction`.",
51
+ "unsigned", "getInReductionBlockArgsStart", (ins), [{
52
+ return 0;
53
+ }]>,
54
+ InterfaceMethod<"Get start index of block arguments defined by `map`.",
55
+ "unsigned", "getMapBlockArgsStart", (ins), [{
56
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
57
+ return iface.getInReductionBlockArgsStart() +
58
+ $_op.numInReductionBlockArgs();
59
+ }]>,
60
+ InterfaceMethod<"Get start index of block arguments defined by `private`.",
61
+ "unsigned", "getPrivateBlockArgsStart", (ins), [{
62
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
63
+ return iface.getMapBlockArgsStart() + $_op.numMapBlockArgs();
64
+ }]>,
65
+ InterfaceMethod<"Get start index of block arguments defined by `reduction`.",
66
+ "unsigned", "getReductionBlockArgsStart", (ins), [{
67
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
68
+ return iface.getPrivateBlockArgsStart() + $_op.numPrivateBlockArgs();
69
+ }]>,
70
+ InterfaceMethod<"Get start index of block arguments defined by `task_reduction`.",
71
+ "unsigned", "getTaskReductionBlockArgsStart", (ins), [{
72
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
73
+ return iface.getReductionBlockArgsStart() + $_op.numReductionBlockArgs();
74
+ }]>,
75
+
50
76
InterfaceMethod<"Get block arguments defined by `in_reduction`.",
51
77
"::llvm::MutableArrayRef<::mlir::BlockArgument>",
52
78
"getInReductionBlockArgs", (ins), [{
53
- return $_op->getRegion(0).getArguments().take_front(
54
- $_op.numInReductionBlockArgs());
79
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
80
+ return $_op->getRegion(0).getArguments().slice(
81
+ iface.getInReductionBlockArgsStart(), $_op.numInReductionBlockArgs());
55
82
}]>,
56
83
InterfaceMethod<"Get block arguments defined by `map`.",
57
84
"::llvm::MutableArrayRef<::mlir::BlockArgument>",
58
85
"getMapBlockArgs", (ins), [{
86
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
59
87
return $_op->getRegion(0).getArguments().slice(
60
- $_op.numInReductionBlockArgs (), $_op.numMapBlockArgs());
88
+ iface.getMapBlockArgsStart (), $_op.numMapBlockArgs());
61
89
}]>,
62
90
InterfaceMethod<"Get block arguments defined by `private`.",
63
91
"::llvm::MutableArrayRef<::mlir::BlockArgument>",
64
92
"getPrivateBlockArgs", (ins), [{
93
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
65
94
return $_op->getRegion(0).getArguments().slice(
66
- $_op.numInReductionBlockArgs() + $_op.numMapBlockArgs(),
67
- $_op.numPrivateBlockArgs());
95
+ iface.getPrivateBlockArgsStart(), $_op.numPrivateBlockArgs());
68
96
}]>,
69
97
InterfaceMethod<"Get block arguments defined by `reduction`.",
70
98
"::llvm::MutableArrayRef<::mlir::BlockArgument>",
71
99
"getReductionBlockArgs", (ins), [{
100
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
72
101
return $_op->getRegion(0).getArguments().slice(
73
- $_op.numInReductionBlockArgs() + $_op.numMapBlockArgs() +
74
- $_op.numPrivateBlockArgs(), $_op.numReductionBlockArgs());
102
+ iface.getReductionBlockArgsStart(), $_op.numReductionBlockArgs());
75
103
}]>,
76
104
InterfaceMethod<"Get block arguments defined by `task_reduction`.",
77
105
"::llvm::MutableArrayRef<::mlir::BlockArgument>",
78
106
"getTaskReductionBlockArgs", (ins), [{
107
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
79
108
return $_op->getRegion(0).getArguments().slice(
80
- $_op.numInReductionBlockArgs() + $_op.numMapBlockArgs() +
81
- $_op.numPrivateBlockArgs() + $_op.numReductionBlockArgs(),
109
+ iface.getTaskReductionBlockArgsStart(),
82
110
$_op.numTaskReductionBlockArgs());
83
111
}]>,
84
112
];
0 commit comments