MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / build

Method build

lib/Dialect/CudaTile/IR/CudaTile.cpp:2492–2522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2490}
2491
2492void ForOp::build(
2493 OpBuilder &builder, OperationState &result, Value lb, Value ub, Value step,
2494 ValueRange initArgs,
2495 function_ref<void(OpBuilder &, Location, Value, ValueRange)> bodyBuilder,
2496 bool unsignedCmp) {
2497 OpBuilder::InsertionGuard guard(builder);
2498
2499 result.addOperands({lb, ub, step});
2500 result.addOperands(initArgs);
2501 if (unsignedCmp)
2502 result.addAttribute(getUnsignedCmpAttrName(result.name),
2503 builder.getUnitAttr());
2504 Region *bodyRegion = result.addRegion();
2505 Block *bodyBlock = builder.createBlock(bodyRegion);
2506 bodyBlock->addArgument(lb.getType(), result.location);
2507 for (Value v : initArgs) {
2508 result.addTypes(v.getType());
2509 bodyBlock->addArgument(v.getType(), v.getLoc());
2510 }
2511 // Create the default terminator if the builder is not provided and if the
2512 // iteration arguments are not provided. Otherwise, leave this to the caller
2513 // because we don't know which values to return from the loop.
2514 if (initArgs.empty() && !bodyBuilder) {
2515 ForOp::ensureTerminator(*bodyRegion, builder, result.location);
2516 } else if (bodyBuilder) {
2517 OpBuilder::InsertionGuard guard(builder);
2518 builder.setInsertionPointToStart(bodyBlock);
2519 bodyBuilder(builder, result.location, bodyBlock->getArgument(0),
2520 bodyBlock->getArguments().drop_front());
2521 }
2522}
2523
2524LogicalResult ForOp::verifyRegions() {
2525 // First block argument must be the induction variable.

Callers

nothing calls this directly

Calls 2

getTypeMethod · 0.80
getArgumentMethod · 0.80

Tested by

no test coverage detected