File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
include/mlir/Dialect/EmitC/IR Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -1304,7 +1304,7 @@ def EmitC_VerbatimOp : EmitC_Op<"verbatim"> {
1304
1304
FailureOr<SmallVector<::mlir::emitc::ReplacementItem>> parseFormatString();
1305
1305
}];
1306
1306
1307
- let arguments = (ins StrAttr:$value, Variadic<EmitCType>:$fmtArgs);
1307
+ let arguments = (ins StrAttr:$value, Variadic<AnyTypeOf<[ EmitCType, EmitC_LValueType]> >:$fmtArgs);
1308
1308
1309
1309
let builders = [OpBuilder<(ins "::mlir::StringAttr":$value),
1310
1310
[{ build($_builder, $_state, value, {}); }]>];
Original file line number Diff line number Diff line change @@ -246,12 +246,20 @@ emitc.verbatim "typedef float f32;"
246
246
// The value is not interpreted as format string if there are no operands.
247
247
emitc.verbatim " {} { }"
248
248
249
- func.func @test_verbatim (%arg0 : !emitc.ptr <i32 >, %arg1 : i32 ) {
249
+ func.func @test_verbatim (%arg0 : !emitc.ptr <i32 >, %arg1 : i32 , %arg2: !emitc.array <3 x!emitc.ptr <i32 >>) {
250
+ %a = " emitc.variable" () <{value = #emitc.opaque <" 1" >}> : () -> !emitc.lvalue <i32 >
251
+
252
+ // Check that the lvalue type can be used by verbatim.
253
+ emitc.verbatim " ++{};" args %a : !emitc.lvalue <i32 >
254
+
255
+ // Check that the array type can be used by verbatim.
256
+ emitc.verbatim " *{}[0] = 1;" args %arg2 : !emitc.array <3 x!emitc.ptr <i32 >>
257
+
250
258
emitc.verbatim " {} + {};" args %arg0 , %arg1 : !emitc.ptr <i32 >, i32
251
259
252
- // Check there is no ambiguity whether %a is the argument to the emitc.verbatim op.
253
- emitc.verbatim " a "
254
- %a = " emitc.constant" (){value = 42 : i32 } : () -> i32
260
+ // Check there is no ambiguity whether %b is the argument to the emitc.verbatim op.
261
+ emitc.verbatim " b "
262
+ %b = " emitc.constant" (){value = 42 : i32 } : () -> i32
255
263
256
264
return
257
265
}
You can’t perform that action at this time.
0 commit comments