@@ -25,6 +25,10 @@ def BlockArgOpenMPOpInterface : OpInterface<"BlockArgOpenMPOpInterface"> {
25
25
26
26
let methods = [
27
27
// Default-implemented methods to be overriden by the corresponding clauses.
28
+ InterfaceMethod<"Get number of block arguments defined by `host_eval`.",
29
+ "unsigned", "numHostEvalBlockArgs", (ins), [{}], [{
30
+ return 0;
31
+ }]>,
28
32
InterfaceMethod<"Get number of block arguments defined by `in_reduction`.",
29
33
"unsigned", "numInReductionBlockArgs", (ins), [{}], [{
30
34
return 0;
@@ -54,10 +58,16 @@ def BlockArgOpenMPOpInterface : OpInterface<"BlockArgOpenMPOpInterface"> {
54
58
return 0;
55
59
}]>,
56
60
57
- // Unified access methods for clause-associated entry block arguments.
61
+ // Unified access methods for start indices of clause-associated entry block
62
+ // arguments.
63
+ InterfaceMethod<"Get start index of block arguments defined by `host_eval`.",
64
+ "unsigned", "getHostEvalBlockArgsStart", (ins), [{
65
+ return 0;
66
+ }]>,
58
67
InterfaceMethod<"Get start index of block arguments defined by `in_reduction`.",
59
68
"unsigned", "getInReductionBlockArgsStart", (ins), [{
60
- return 0;
69
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
70
+ return iface.getHostEvalBlockArgsStart() + $_op.numHostEvalBlockArgs();
61
71
}]>,
62
72
InterfaceMethod<"Get start index of block arguments defined by `map`.",
63
73
"unsigned", "getMapBlockArgsStart", (ins), [{
@@ -91,6 +101,14 @@ def BlockArgOpenMPOpInterface : OpInterface<"BlockArgOpenMPOpInterface"> {
91
101
return iface.getUseDeviceAddrBlockArgsStart() + $_op.numUseDeviceAddrBlockArgs();
92
102
}]>,
93
103
104
+ // Unified access methods for clause-associated entry block arguments.
105
+ InterfaceMethod<"Get block arguments defined by `host_eval`.",
106
+ "::llvm::MutableArrayRef<::mlir::BlockArgument>",
107
+ "getHostEvalBlockArgs", (ins), [{
108
+ auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
109
+ return $_op->getRegion(0).getArguments().slice(
110
+ iface.getHostEvalBlockArgsStart(), $_op.numHostEvalBlockArgs());
111
+ }]>,
94
112
InterfaceMethod<"Get block arguments defined by `in_reduction`.",
95
113
"::llvm::MutableArrayRef<::mlir::BlockArgument>",
96
114
"getInReductionBlockArgs", (ins), [{
@@ -147,10 +165,11 @@ def BlockArgOpenMPOpInterface : OpInterface<"BlockArgOpenMPOpInterface"> {
147
165
148
166
let verify = [{
149
167
auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>($_op);
150
- unsigned expectedArgs = iface.numInReductionBlockArgs() +
151
- iface.numMapBlockArgs() + iface.numPrivateBlockArgs() +
152
- iface.numReductionBlockArgs() + iface.numTaskReductionBlockArgs() +
153
- iface.numUseDeviceAddrBlockArgs() + iface.numUseDevicePtrBlockArgs();
168
+ unsigned expectedArgs = iface.numHostEvalBlockArgs() +
169
+ iface.numInReductionBlockArgs() + iface.numMapBlockArgs() +
170
+ iface.numPrivateBlockArgs() + iface.numReductionBlockArgs() +
171
+ iface.numTaskReductionBlockArgs() + iface.numUseDeviceAddrBlockArgs() +
172
+ iface.numUseDevicePtrBlockArgs();
154
173
if ($_op->getRegion(0).getNumArguments() < expectedArgs)
155
174
return $_op->emitOpError() << "expected at least " << expectedArgs
156
175
<< " entry block argument(s)";
0 commit comments