diff --git a/compiler/src/iree/compiler/Dialect/VM/Conversion/VMToEmitC/ConvertVMToEmitC.cpp b/compiler/src/iree/compiler/Dialect/VM/Conversion/VMToEmitC/ConvertVMToEmitC.cpp index 9df179fa5d19..7463d280f951 100644 --- a/compiler/src/iree/compiler/Dialect/VM/Conversion/VMToEmitC/ConvertVMToEmitC.cpp +++ b/compiler/src/iree/compiler/Dialect/VM/Conversion/VMToEmitC/ConvertVMToEmitC.cpp @@ -249,12 +249,11 @@ createVmTypeDefPtr(ConversionPatternRewriter &rewriter, Location loc, .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_type_def_t"), - /*callee=*/StringAttr::get(ctx, "iree_vm_make_value_type_def"), + /*callee=*/"iree_vm_make_value_type_def", + /*operands=*/ArrayRef{}, /*args=*/ ArrayAttr::get( - ctx, {emitc::OpaqueAttr::get(ctx, ptr->second.first)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{}) + ctx, {emitc::OpaqueAttr::get(ctx, ptr->second.first)})) .getResult(0); } else if (llvm::isa(elementType)) { Type objType = llvm::cast(elementType).getObjectType(); @@ -277,9 +276,7 @@ createVmTypeDefPtr(ConversionPatternRewriter &rewriter, Location loc, .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_type_def_t"), - /*callee=*/StringAttr::get(ctx, "iree_vm_make_ref_type_def"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_make_ref_type_def", /*operands=*/ArrayRef{refType}) .getResult(0); } else if (llvm::isa(elementType)) { @@ -288,10 +285,7 @@ createVmTypeDefPtr(ConversionPatternRewriter &rewriter, Location loc, .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_type_def_t"), - /*callee=*/ - StringAttr::get(ctx, "iree_vm_make_undefined_type_def"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_make_undefined_type_def", /*operands=*/ArrayRef{}) .getResult(0); } @@ -330,9 +324,7 @@ LogicalResult retainOrMoveRefs(OpBuilder &builder, Location location, builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, callee), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/callee, /*operands=*/ArrayRef{srcRef, tmpPtr}); tmpMapping.map(srcRef, tmpPtr); @@ -346,9 +338,7 @@ LogicalResult retainOrMoveRefs(OpBuilder &builder, Location location, builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, callee), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/callee, /*operands=*/ArrayRef{tmpRef, destRef}); } @@ -395,7 +385,7 @@ void releaseRefs(OpBuilder &builder, Location location, /// value, i.e. a truthy value branches to the continuation block when /// `negateCondition` is false. emitc::CallOpaqueOp failableCall( - OpBuilder &builder, Location location, Type type, StringAttr callee, + OpBuilder &builder, Location location, Type type, StringRef callee, ArrayAttr args, ArrayRef operands, const std::function &failureBlockBuilder, bool negateCondition = false) { @@ -403,9 +393,8 @@ emitc::CallOpaqueOp failableCall( /*location=*/location, /*type=*/type, /*callee=*/callee, - /*args=*/args, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/operands); + /*operands=*/operands, + /*args=*/args); Type boolType = builder.getIntegerType(1); @@ -442,7 +431,7 @@ emitc::CallOpaqueOp failableCall( } emitc::CallOpaqueOp returnIfError(OpBuilder &builder, Location location, - StringAttr callee, ArrayAttr args, + StringRef callee, ArrayAttr args, ArrayRef operands, IREE::VM::ModuleAnalysis &moduleAnalysis) { auto blockBuilder = [&builder, &location, @@ -464,7 +453,7 @@ emitc::CallOpaqueOp returnIfError(OpBuilder &builder, Location location, emitc::CallOpaqueOp failContainerNull(OpBuilder &builder, Location location, Type type, - StringAttr callee, ArrayAttr args, ArrayRef operands, + StringRef callee, ArrayAttr args, ArrayRef operands, IREE::VM::ModuleAnalysis &moduleAnalysis) { auto blockBuilder = [&builder, &location, &moduleAnalysis](emitc::CallOpaqueOp &callOp) { @@ -479,12 +468,11 @@ failContainerNull(OpBuilder &builder, Location location, Type type, auto statusOp = builder.create( /*location=*/location, /*type=*/emitc::OpaqueType::get(ctx, "iree_status_t"), - /*callee=*/StringAttr::get(ctx, "iree_make_status"), + /*callee=*/"iree_make_status", + /*operands=*/ArrayRef{}, /*args=*/ - ArrayAttr::get( - ctx, {emitc::OpaqueAttr::get(ctx, "IREE_STATUS_INVALID_ARGUMENT")}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{}); + ArrayAttr::get(ctx, {emitc::OpaqueAttr::get( + ctx, "IREE_STATUS_INVALID_ARGUMENT")})); builder.create(location, statusOp.getResult(0)); }; @@ -610,9 +598,7 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_allocator_free"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_allocator_free", /*operands=*/ArrayRef{allocatorOp, castedModuleOp.getResult()}); builder.create(loc, nullptr); @@ -671,8 +657,8 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, emitc::PointerType::get(emitc::OpaqueType::get(ctx, "void"))), /*operand=*/statePtr); - returnIfError(builder, loc, StringAttr::get(ctx, "iree_allocator_malloc"), - {}, {allocatorArg, stateSize, voidPtr.getResult()}, + returnIfError(builder, loc, "iree_allocator_malloc", {}, + {allocatorArg, stateSize, voidPtr.getResult()}, moduleAnalysis); emitc_builders::memset(builder, loc, state, 0, stateSize); @@ -704,20 +690,14 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, auto byteSpan = builder.create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_byte_span_t"), - /*callee=*/StringAttr::get(ctx, "iree_make_byte_span"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{bufferVoid.getResult(), bufferSize}); + /*callee=*/"iree_make_byte_span", + /*operands=*/ArrayRef{bufferVoid.getResult(), bufferSize}); auto allocator = builder.create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_allocator_t"), - /*callee=*/StringAttr::get(ctx, "iree_allocator_null"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{}); + /*callee=*/"iree_allocator_null", + /*operands=*/ArrayRef{}); auto buffers = emitc_builders::structPtrMember( builder, loc, @@ -738,16 +718,15 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_vm_buffer_initialize"), + /*callee=*/"iree_vm_buffer_initialize", + /*operands=*/ + ArrayRef{byteSpan.getResult(0), allocator.getResult(0), + buffer}, /*args=*/ ArrayAttr::get(ctx, {emitc::OpaqueAttr::get( ctx, "IREE_VM_BUFFER_ACCESS_ORIGIN_MODULE"), builder.getIndexAttr(0), builder.getIndexAttr(1), - builder.getIndexAttr(2)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{byteSpan.getResult(0), allocator.getResult(0), - buffer}); + builder.getIndexAttr(2)})); } // Zero out refs from state struct. @@ -792,11 +771,8 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "EMITC_DEREF_ASSIGN_VALUE"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{moduleStateArg, baseStateOp.getResult()}); + /*callee=*/"EMITC_DEREF_ASSIGN_VALUE", + /*operands=*/ArrayRef{moduleStateArg, baseStateOp.getResult()}); auto status = emitc_builders::ireeOkStatus(builder, loc); @@ -880,11 +856,8 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_allocator_free"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{allocatorOp, stateOp.getResult()}); + /*callee=*/"iree_allocator_free", + /*operands=*/ArrayRef{allocatorOp, stateOp.getResult()}); builder.create(loc, nullptr); } @@ -961,11 +934,8 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "EMITC_DEREF_ASSIGN_PTR"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{import, functionArg}); + /*callee=*/"EMITC_DEREF_ASSIGN_PTR", + /*operands=*/ArrayRef{import, functionArg}); auto status = emitc_builders::ireeOkStatus(builder, loc); @@ -1033,8 +1003,8 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, emitc::PointerType::get(emitc::OpaqueType::get(ctx, "void"))), /*operand=*/modulePtr); - returnIfError(builder, loc, StringAttr::get(ctx, "iree_allocator_malloc"), - {}, {allocatorArg, moduleSize, voidPtr.getResult()}, + returnIfError(builder, loc, "iree_allocator_malloc", {}, + {allocatorArg, moduleSize, voidPtr.getResult()}, moduleAnalysis); emitc_builders::memset(builder, loc, module, 0, moduleSize); @@ -1081,22 +1051,16 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, auto vmInitializeStatus = builder.create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_status_t"), - /*callee=*/StringAttr::get(ctx, "iree_vm_module_initialize"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{vmModulePtr, module}); + /*callee=*/"iree_vm_module_initialize", + /*operands=*/ArrayRef{vmModulePtr, module}); Type boolType = builder.getIntegerType(1); auto vmInitializeIsOk = builder.create( /*location=*/loc, /*type=*/boolType, - /*callee=*/StringAttr::get(ctx, "iree_status_is_ok"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{vmInitializeStatus.getResult(0)}); + /*callee=*/"iree_status_is_ok", + /*operands=*/ArrayRef{vmInitializeStatus.getResult(0)}); // Start by splitting the block into two. The part before will contain the // condition, and the part after will contain the continuation point. @@ -1114,11 +1078,8 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_allocator_free"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{allocatorArg, module}); + /*callee=*/"iree_allocator_free", + /*operands=*/ArrayRef{allocatorArg, module}); builder.create(loc, vmInitializeStatus.getResult(0)); @@ -1145,15 +1106,14 @@ LogicalResult createAPIFunctions(IREE::VM::ModuleOp moduleOp, auto status = builder.create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_status_t"), - /*callee=*/StringAttr::get(ctx, "iree_vm_native_module_create"), + /*callee=*/"iree_vm_native_module_create", + /*operands=*/ + ArrayRef{vmModulePtr, instanceArg, allocatorArg, moduleArg}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), emitc::OpaqueAttr::get(ctx, descriptorPtr), builder.getIndexAttr(1), builder.getIndexAttr(2), - builder.getIndexAttr(3)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{vmModulePtr, instanceArg, allocatorArg, moduleArg}); + builder.getIndexAttr(3)})); builder.create(loc, status.getResult(0)); } @@ -1548,30 +1508,30 @@ class GenericOpConversion : public EmitCConversionPattern { ConversionPatternRewriter &rewriter) const override { auto ctx = op.getContext(); - auto type = op.getOperation()->getResultTypes(); - StringAttr callee = StringAttr::get(ctx, funcName); - // Default to an empty args attribute, which results in the operands being // printed as the arguments to the function call. - ArrayAttr args; - ArrayAttr templateArgs; + SmallVector args_; // If the operation has attributes, we need to explicitely build the args // attribute of the emitc opaque_call op. This consists of index attributes // for the operands, followed by the source op attributes themselves. if (op->getAttrs().size() > 0) { - SmallVector args_ = - indexSequence(adaptor.getOperands().size(), op.getContext()); + args_ = indexSequence(adaptor.getOperands().size(), op.getContext()); for (NamedAttribute attr : op->getAttrs()) { args_.push_back(attr.getValue()); } - - args = rewriter.getArrayAttr(args_); } + ArrayAttr args = + args_.size() > 0 ? ArrayAttr::get(ctx, args_) : ArrayAttr{}; + rewriter.replaceOpWithNewOp( - op, type, callee, args, templateArgs, adaptor.getOperands()); + /*op=*/op, + /*type=*/op.getOperation()->getResultTypes(), + /*callee=*/funcName, + /*operands=*/adaptor.getOperands(), + /*args=*/args); return success(); } @@ -1956,18 +1916,15 @@ class ExportOpConversion : public EmitCConversionPattern { auto memberPtr = rewriter.create( /*location=*/loc, /*type=*/ptrType, - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_PTR_MEMBER_ADDRESS"), + /*callee=*/"EMITC_STRUCT_PTR_MEMBER_ADDRESS", + /*operands=*/ArrayRef{value}, /*args=*/ ArrayAttr::get(ctx, {rewriter.getIndexAttr(0), - emitc::OpaqueAttr::get(ctx, memberName)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{value}); + emitc::OpaqueAttr::get(ctx, memberName)})); rewriter.create( /*location=*/memberPtr.getLoc(), /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_retain_inplace"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_ref_retain_inplace", /*operands=*/ArrayRef{memberPtr.getResult(0)}); argumentStruct.callArguments.push_back(memberPtr.getResult(0)); } else { @@ -2015,12 +1972,11 @@ class ExportOpConversion : public EmitCConversionPattern { auto memberPtr = rewriter.create( /*location=*/loc, /*type=*/ptrType, - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_PTR_MEMBER_ADDRESS"), + /*callee=*/"EMITC_STRUCT_PTR_MEMBER_ADDRESS", + /*operands=*/ArrayRef{value}, /*args=*/ ArrayAttr::get(ctx, {rewriter.getIndexAttr(0), - emitc::OpaqueAttr::get(ctx, memberName)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{value}); + emitc::OpaqueAttr::get(ctx, memberName)})); resultStruct.callArguments.push_back(memberPtr.getResult(0)); } @@ -2121,12 +2077,11 @@ class ImportOpConverter { auto statusOp = builder.create( /*location=*/location, /*type=*/emitc::OpaqueType::get(ctx, "iree_status_t"), - /*callee=*/StringAttr::get(ctx, "iree_make_status"), + /*callee=*/"iree_make_status", + /*operands=*/ArrayRef{}, /*args=*/ ArrayAttr::get( - ctx, {emitc::OpaqueAttr::get(ctx, "IREE_STATUS_NOT_FOUND")}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{}); + ctx, {emitc::OpaqueAttr::get(ctx, "IREE_STATUS_NOT_FOUND")})); builder.create(location, statusOp.getResult(0)); } @@ -2324,12 +2279,11 @@ class ImportOpConverter { /*type=*/ emitc::PointerType::get( emitc::OpaqueType::get(ctx, "iree_byte_span_t")), - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_MEMBER_ADDRESS"), + /*callee=*/"EMITC_STRUCT_MEMBER_ADDRESS", + /*operands=*/ArrayRef{call}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), - emitc::OpaqueAttr::get(ctx, memberName)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{call}) + emitc::OpaqueAttr::get(ctx, memberName)})) .getResult(0); // void *byteSpan_data_void = iree_alloca(size); @@ -2339,9 +2293,7 @@ class ImportOpConverter { /*location=*/loc, /*type=*/ emitc::PointerType::get(emitc::OpaqueType::get(ctx, "void")), - /*callee=*/StringAttr::get(ctx, "iree_alloca"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_alloca", /*operands=*/ArrayRef{size}) .getResult(0); @@ -2415,9 +2367,7 @@ class ImportOpConverter { builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_assign"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_ref_assign", /*operands=*/ArrayRef{arg, refPtr}); } else { assert(!isa(argType)); @@ -2490,9 +2440,7 @@ class ImportOpConverter { builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_move"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_ref_move", /*operands=*/ArrayRef{refPtr, arg}); } else { Type valueType = llvm::cast(argType).getPointee(); @@ -2535,7 +2483,7 @@ class ImportOpConverter { returnIfError( /*rewriter=*/builder, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_PTR_MEMBER_CALL"), + /*callee=*/"EMITC_STRUCT_PTR_MEMBER_CALL", /*args=*/ ArrayAttr::get(ctx, { @@ -2840,11 +2788,8 @@ class CallOpConversion : public EmitCConversionPattern { builder.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_assign"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{operandRef, refPtr}); + /*callee=*/"iree_vm_ref_assign", + /*operands=*/ArrayRef{operandRef, refPtr}); return refPtr; } @@ -2890,9 +2835,7 @@ class CompareRefOpConversion : public EmitCConversionPattern { rewriter.replaceOpWithNewOp( /*op=*/cmpOp, /*type=*/cmpOp.getType(), - /*callee=*/StringAttr::get(ctx, funcName), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/funcName, /*operands=*/ArrayRef{refLhs, refRhs}); if (moveLhs) { @@ -2919,7 +2862,6 @@ class CompareRefNotZeroOpConversion LogicalResult matchAndRewrite(IREE::VM::CmpNZRefOp cmpOp, Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto ctx = cmpOp.getContext(); auto loc = cmpOp.getLoc(); auto funcOp = cmpOp.getOperation()->getParentOfType(); @@ -2933,9 +2875,7 @@ class CompareRefNotZeroOpConversion rewriter.replaceOpWithNewOp( /*op=*/cmpOp, /*type=*/cmpOp.getType(), - /*callee=*/StringAttr::get(ctx, "vm_cmp_nz_ref"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"vm_cmp_nz_ref", /*operands=*/ArrayRef{ref}); if (move) { @@ -2975,8 +2915,7 @@ class SelectRefOpConversion .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_ref_type_t"), - /*callee=*/StringAttr::get(ctx, "iree_vm_type_def_as_ref"), - /*args=*/ArrayAttr{}, /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_type_def_as_ref", /*operands=*/ArrayRef{resultTypePtr.value()}) .getResult(0); @@ -3009,13 +2948,12 @@ class SelectRefOpConversion returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_retain_or_move_checked"), + /*callee=*/"iree_vm_ref_retain_or_move_checked", /*args=*/ ArrayAttr::get( ctx, {rewriter.getBoolAttr(moveTrue), rewriter.getIndexAttr(0), rewriter.getIndexAttr(1), rewriter.getIndexAttr(2)}), - /*operands=*/ - ArrayRef{refTrue, resultTypeAsRef, refResult}, + /*operands=*/ArrayRef{refTrue, resultTypeAsRef, refResult}, this->getModuleAnalysis()); rewriter.create(loc, continueBlock); } @@ -3027,13 +2965,12 @@ class SelectRefOpConversion returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_retain_or_move_checked"), + /*callee=*/"iree_vm_ref_retain_or_move_checked", /*args=*/ ArrayAttr::get( ctx, {rewriter.getBoolAttr(moveFalse), rewriter.getIndexAttr(0), rewriter.getIndexAttr(1), rewriter.getIndexAttr(2)}), - /*operands=*/ - ArrayRef{refFalse, resultTypeAsRef, refResult}, + /*operands=*/ArrayRef{refFalse, resultTypeAsRef, refResult}, this->getModuleAnalysis()); rewriter.create(loc, continueBlock); } @@ -3144,9 +3081,7 @@ class ConstRefRodataOpConversion auto typeIdOp = rewriter.create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_ref_type_t"), - /*callee=*/StringAttr::get(ctx, "iree_vm_buffer_type"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_buffer_type", /*operands=*/ArrayRef{}); Value ref = getModuleAnalysis().lookupRef(constRefRodataOp.getResult()); @@ -3154,7 +3089,7 @@ class ConstRefRodataOpConversion returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_wrap_retain"), + /*callee=*/"iree_vm_ref_wrap_retain", /*args=*/ArrayAttr{}, /*operands=*/ ArrayRef{byteBufferPtrOp, typeIdOp.getResult(0), ref}, @@ -3370,7 +3305,6 @@ class ReturnOpConversion : public EmitCConversionPattern { LogicalResult matchAndRewrite(IREE::VM::ReturnOp op, Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto ctx = op.getContext(); auto loc = op.getLoc(); auto funcOp = op.getOperation()->getParentOfType(); @@ -3390,7 +3324,7 @@ class ReturnOpConversion : public EmitCConversionPattern { if (llvm::isa(operand.getType())) { assert(operand.getType() != emitc::PointerType::get( - emitc::OpaqueType::get(ctx, "iree_vm_ref_t"))); + emitc::OpaqueType::get(op.getContext(), "iree_vm_ref_t"))); Value operandRef = getModuleAnalysis().lookupRef(operand); @@ -3399,9 +3333,7 @@ class ReturnOpConversion : public EmitCConversionPattern { rewriter.create( /*location=*/loc, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "EMITC_DEREF_ASSIGN_VALUE"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"EMITC_DEREF_ASSIGN_VALUE", /*operands=*/ArrayRef{resultArgument, operand}); } } @@ -3553,7 +3485,9 @@ class FailOpConversion : public EmitCConversionPattern { auto status = rewriter.create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_status_t"), - /*callee=*/StringAttr::get(ctx, "iree_status_allocate_f"), + /*callee=*/"iree_status_allocate_f", + /*operands=*/ + ArrayRef{messageSizeIntOp.getResult(), messageDataOp}, /*args=*/ ArrayAttr::get( ctx, @@ -3561,10 +3495,7 @@ class FailOpConversion : public EmitCConversionPattern { emitc::OpaqueAttr::get(ctx, "\"\""), rewriter.getI32IntegerAttr(0), emitc::OpaqueAttr::get(ctx, "\"%.*s\""), - rewriter.getIndexAttr(0), rewriter.getIndexAttr(1)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{messageSizeIntOp.getResult(), messageDataOp}); + rewriter.getIndexAttr(0), rewriter.getIndexAttr(1)})); rewriter.create(loc, status.getResult(0)); } @@ -3597,7 +3528,6 @@ class GlobalLoadOpConversion : public EmitCConversionPattern { LogicalResult matchAndRewrite(OpTy loadOp, Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto ctx = loadOp.getContext(); auto loc = loadOp.getLoc(); GlobalOpTy globalOp = @@ -3621,14 +3551,13 @@ class GlobalLoadOpConversion : public EmitCConversionPattern { rewriter.replaceOpWithNewOp( /*op=*/loadOp, /*type=*/loadOp.getOperation()->getResultTypes(), - /*callee=*/StringAttr::get(ctx, funcName), + /*callee=*/funcName, + /*operands=*/ArrayRef{rwDataPtr}, /*args=*/ rewriter.getArrayAttr( {rewriter.getIndexAttr(0), rewriter.getUI32IntegerAttr(static_cast( - globalOp.getOrdinal()->getZExtValue()))}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{rwDataPtr}); + globalOp.getOrdinal()->getZExtValue()))})); return success(); } @@ -3712,8 +3641,7 @@ class GlobalLoadStoreRefOpConversion : public EmitCConversionPattern { .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_ref_type_t"), - /*callee=*/StringAttr::get(ctx, "iree_vm_type_def_as_ref"), - /*args=*/ArrayAttr{}, /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_type_def_as_ref", /*operands=*/ArrayRef{elementTypePtr.value()}) .getResult(0); @@ -3725,7 +3653,7 @@ class GlobalLoadStoreRefOpConversion : public EmitCConversionPattern { returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_retain_or_move_checked"), + /*callee=*/"iree_vm_ref_retain_or_move_checked", /*args=*/ ArrayAttr::get(ctx, {rewriter.getBoolAttr(move), rewriter.getIndexAttr(0), @@ -3758,7 +3686,6 @@ class GlobalStoreOpConversion : public EmitCConversionPattern { LogicalResult matchAndRewrite(OpTy storeOp, Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto ctx = storeOp.getContext(); auto loc = storeOp.getLoc(); GlobalOpTy globalOp = @@ -3782,16 +3709,14 @@ class GlobalStoreOpConversion : public EmitCConversionPattern { rewriter.replaceOpWithNewOp( /*op=*/storeOp, /*type=*/storeOp.getOperation()->getResultTypes(), - /*callee=*/StringAttr::get(ctx, funcName), + /*callee=*/funcName, + /*operands=*/ArrayRef{rwDataPtr, storeOp.getValue()}, /*args=*/ rewriter.getArrayAttr( {rewriter.getIndexAttr(0), rewriter.getUI32IntegerAttr( static_cast(globalOp.getOrdinal()->getZExtValue())), - rewriter.getIndexAttr(1)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{rwDataPtr, storeOp.getValue()}); + rewriter.getIndexAttr(1)})); return success(); } @@ -3860,7 +3785,7 @@ class ContainerOpConversion : public EmitCConversionPattern { /*location=*/loc, /*type=*/ emitc::PointerType::get(emitc::OpaqueType::get(ctx, vmType)), - /*callee=*/StringAttr::get(ctx, vmDerefCallee), + /*callee=*/vmDerefCallee, /*args=*/ArrayAttr{}, /*operands=*/ArrayRef{refValue}, this->getModuleAnalysis()); unwrappedOperands.push_back(derefOp.getResult(0)); @@ -3879,7 +3804,7 @@ class ContainerOpConversion : public EmitCConversionPattern { returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, funcName), + /*callee=*/funcName, /*args=*/ArrayAttr{}, /*operands=*/ArrayRef(unwrappedOperands), this->getModuleAnalysis()); @@ -3891,9 +3816,7 @@ class ContainerOpConversion : public EmitCConversionPattern { rewriter.replaceOpWithNewOp( /*op=*/op, /*type=*/op.getOperation()->getResultTypes(), - /*callee=*/StringAttr::get(ctx, funcName), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/funcName, /*operands=*/ArrayRef(unwrappedOperands)); } @@ -4003,7 +3926,7 @@ class ContainerAllocOpConversion : public EmitCConversionPattern { returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, cNames.value().constructor), + /*callee=*/cNames.value().constructor, /*args=*/ArrayAttr{}, /*operands=*/ArrayRef{operands.value()}, this->getModuleAnalysis()); @@ -4015,16 +3938,14 @@ class ContainerAllocOpConversion : public EmitCConversionPattern { .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_ref_type_t"), - /*callee=*/StringAttr::get(ctx, cNames.value().typeId), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/cNames.value().typeId, /*operands=*/ArrayRef{}) .getResult(0); returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_wrap_assign"), + /*callee=*/"iree_vm_ref_wrap_assign", /*args=*/ArrayAttr{}, /*operands=*/ArrayRef{container, refType, ref}, this->getModuleAnalysis()); @@ -4135,7 +4056,7 @@ class ContainerAllocOpConversion : public EmitCConversionPattern { /*type=*/ emitc::PointerType::get( emitc::OpaqueType::get(ctx, "iree_vm_buffer_t")), - /*callee=*/StringAttr::get(ctx, "iree_vm_buffer_deref"), + /*callee=*/"iree_vm_buffer_deref", /*args=*/ArrayAttr{}, /*operands=*/ArrayRef{refValue}, this->getModuleAnalysis()) .getResult(0); @@ -4197,14 +4118,14 @@ class ListGetOpConversion : public EmitCConversionPattern { /*location=*/loc, /*type=*/ emitc::PointerType::get(emitc::OpaqueType::get(ctx, "iree_vm_list_t")), - /*callee=*/StringAttr::get(ctx, "iree_vm_list_deref"), + /*callee=*/"iree_vm_list_deref", /*args=*/ArrayAttr{}, /*operands=*/ArrayRef{refValue}, this->getModuleAnalysis()); returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "iree_vm_list_get_value_as"), + /*callee=*/"iree_vm_list_get_value_as", /*args=*/ ArrayAttr::get(ctx, {rewriter.getIndexAttr(0), rewriter.getIndexAttr(1), emitc::OpaqueAttr::get(ctx, valueTypeEnum.value()), @@ -4216,9 +4137,7 @@ class ListGetOpConversion : public EmitCConversionPattern { rewriter.replaceOpWithNewOp( /*op=*/getOp, /*type=*/getOp.getType(), - /*callee=*/StringAttr::get(ctx, valueExtractor.value()), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/valueExtractor.value(), /*operands=*/ArrayRef{valuePtr}); return success(); @@ -4244,7 +4163,7 @@ class ListGetRefOpConversion /*location=*/loc, /*type=*/ emitc::PointerType::get(emitc::OpaqueType::get(ctx, "iree_vm_list_t")), - /*callee=*/StringAttr::get(ctx, "iree_vm_list_deref"), + /*callee=*/"iree_vm_list_deref", /*args=*/ArrayAttr{}, /*operands=*/ArrayRef{listRefValue}, getModuleAnalysis()); @@ -4253,7 +4172,7 @@ class ListGetRefOpConversion returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "iree_vm_list_get_ref_retain"), + /*callee=*/"iree_vm_list_get_ref_retain", /*args=*/ArrayAttr{}, /*operands=*/ ArrayRef{listDerefOp.getResult(0), getOp.getIndex(), ref}, @@ -4315,9 +4234,7 @@ class ListGetRefOpConversion .create( /*location=*/loc, /*type=*/rewriter.getI1Type(), - /*callee=*/StringAttr::get(ctx, "iree_vm_type_def_is_value"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_type_def_is_value", /*operands=*/ArrayRef{elementTypePtr.value()}) .getResult(0); @@ -4327,9 +4244,7 @@ class ListGetRefOpConversion .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_ref_type_t"), - /*callee=*/StringAttr::get(ctx, "iree_vm_type_def_as_ref"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_type_def_as_ref", /*operands=*/ArrayRef{elementTypePtr.value()}) .getResult(0); @@ -4415,9 +4330,7 @@ class ListSetOpConversion : public EmitCConversionPattern { auto valueOp = rewriter.create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_vm_value_t"), - /*callee=*/StringAttr::get(ctx, valueConstructor.value()), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/valueConstructor.value(), /*operands=*/ArrayRef{setOp.getValue()}); Value valuePtr = @@ -4431,14 +4344,14 @@ class ListSetOpConversion : public EmitCConversionPattern { /*location=*/loc, /*type=*/ emitc::PointerType::get(emitc::OpaqueType::get(ctx, "iree_vm_list_t")), - /*callee=*/StringAttr::get(ctx, "iree_vm_list_deref"), + /*callee=*/"iree_vm_list_deref", /*args=*/ArrayAttr{}, /*operands=*/ArrayRef{refValue}, this->getModuleAnalysis()); returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, "iree_vm_list_set_value"), + /*callee=*/"iree_vm_list_set_value", /*args=*/ArrayAttr{}, /*operands=*/ ArrayRef{listDerefOp.getResult(0), setOp.getIndex(), valuePtr}, @@ -4469,7 +4382,7 @@ class ListSetRefOpConversion /*location=*/loc, /*type=*/ emitc::PointerType::get(emitc::OpaqueType::get(ctx, "iree_vm_list_t")), - /*callee=*/StringAttr::get(ctx, "iree_vm_list_deref"), + /*callee=*/"iree_vm_list_deref", /*args=*/ArrayAttr{}, /*operands=*/ArrayRef{refValue}, getModuleAnalysis()); @@ -4485,7 +4398,7 @@ class ListSetRefOpConversion returnIfError( /*rewriter=*/rewriter, /*location=*/loc, - /*callee=*/StringAttr::get(ctx, callee), + /*callee=*/callee, /*args=*/ArrayAttr{}, /*operands=*/ ArrayRef{listDerefOp.getResult(0), setOp.getIndex(), diff --git a/compiler/src/iree/compiler/Dialect/VM/Conversion/VMToEmitC/EmitCBuilders.cpp b/compiler/src/iree/compiler/Dialect/VM/Conversion/VMToEmitC/EmitCBuilders.cpp index 3076f2d361e7..37138f41cce3 100644 --- a/compiler/src/iree/compiler/Dialect/VM/Conversion/VMToEmitC/EmitCBuilders.cpp +++ b/compiler/src/iree/compiler/Dialect/VM/Conversion/VMToEmitC/EmitCBuilders.cpp @@ -95,9 +95,7 @@ Value sizeOf(OpBuilder builder, Location loc, Value value) { .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_host_size_t"), - /*callee=*/StringAttr::get(ctx, "sizeof"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"sizeof", /*operands=*/ArrayRef{value}) .getResult(0); } @@ -108,22 +106,18 @@ Value sizeOf(OpBuilder builder, Location loc, Attribute attr) { .create( /*location=*/loc, /*type=*/emitc::OpaqueType::get(ctx, "iree_host_size_t"), - /*callee=*/StringAttr::get(ctx, "sizeof"), - /*args=*/ArrayAttr::get(ctx, {attr}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{}) + /*callee=*/"sizeof", + /*operands=*/ArrayRef{}, + /*args=*/ArrayAttr::get(ctx, {attr})) .getResult(0); } void memcpy(OpBuilder builder, Location location, Value dest, Value src, Value count) { - auto ctx = builder.getContext(); builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "memcpy"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"memcpy", /*operands=*/ArrayRef{dest, src, count}); } @@ -133,14 +127,12 @@ void memset(OpBuilder builder, Location location, Value dest, int ch, builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "memset"), + /*callee=*/"memset", + /*operands=*/ArrayRef{dest, count}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), builder.getUI32IntegerAttr(ch), - builder.getIndexAttr(1)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ - ArrayRef{dest, count}); + builder.getIndexAttr(1)})); } Value arrayElement(OpBuilder builder, Location location, Type type, @@ -150,12 +142,11 @@ Value arrayElement(OpBuilder builder, Location location, Type type, .create( /*location=*/location, /*type=*/type, - /*callee=*/StringAttr::get(ctx, "EMITC_ARRAY_ELEMENT"), + /*callee=*/"EMITC_ARRAY_ELEMENT", + /*operands=*/ArrayRef{operand}, /*args=*/ ArrayAttr::get( - ctx, {builder.getIndexAttr(0), builder.getI32IntegerAttr(index)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{operand}) + ctx, {builder.getIndexAttr(0), builder.getI32IntegerAttr(index)})) .getResult(0); } @@ -166,11 +157,10 @@ Value arrayElementAddress(OpBuilder builder, Location location, Type type, .create( /*location=*/location, /*type=*/type, - /*callee=*/StringAttr::get(ctx, "EMITC_ARRAY_ELEMENT_ADDRESS"), + /*callee=*/"EMITC_ARRAY_ELEMENT_ADDRESS", + /*operands=*/ArrayRef{operand}, /*args=*/ - ArrayAttr::get(ctx, {builder.getIndexAttr(0), index}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{operand}) + ArrayAttr::get(ctx, {builder.getIndexAttr(0), index})) .getResult(0); } @@ -181,12 +171,12 @@ Value arrayElementAddress(OpBuilder builder, Location location, Type type, .create( /*location=*/location, /*type=*/type, - /*callee=*/StringAttr::get(ctx, "EMITC_ARRAY_ELEMENT_ADDRESS"), + /*callee=*/"EMITC_ARRAY_ELEMENT_ADDRESS", + /*operands=*/ArrayRef{operand, index}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), builder.getIndexAttr(1)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{operand, index}) + /*templateArgs=*/ArrayAttr{}) .getResult(0); } @@ -196,13 +186,12 @@ void arrayElementAssign(OpBuilder builder, Location location, Value array, builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "EMITC_ARRAY_ELEMENT_ASSIGN"), + /*callee=*/"EMITC_ARRAY_ELEMENT_ASSIGN", + /*operands=*/ArrayRef{array, value}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), builder.getI32IntegerAttr(index), - builder.getIndexAttr(1)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{array, value}); + builder.getIndexAttr(1)})); } void structDefinition(OpBuilder builder, Location location, @@ -227,12 +216,11 @@ Value structMember(OpBuilder builder, Location location, Type type, .create( /*location=*/location, /*type=*/type, - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_MEMBER"), + /*callee=*/"EMITC_STRUCT_MEMBER", + /*operands=*/ArrayRef{operand}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), - emitc::OpaqueAttr::get(ctx, memberName)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{operand}) + emitc::OpaqueAttr::get(ctx, memberName)})) .getResult(0); } @@ -242,13 +230,12 @@ void structMemberAssign(OpBuilder builder, Location location, builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_MEMBER_ASSIGN"), + /*callee=*/"EMITC_STRUCT_MEMBER_ASSIGN", + /*operands=*/ArrayRef{operand, data}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), emitc::OpaqueAttr::get(ctx, memberName), - builder.getIndexAttr(1)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{operand, data}); + builder.getIndexAttr(1)})); } void structMemberAssign(OpBuilder builder, Location location, @@ -257,13 +244,12 @@ void structMemberAssign(OpBuilder builder, Location location, builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_MEMBER_ASSIGN"), + /*callee=*/"EMITC_STRUCT_MEMBER_ASSIGN", + /*operands=*/ArrayRef{operand}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), emitc::OpaqueAttr::get(ctx, memberName), - emitc::OpaqueAttr::get(ctx, data)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{operand}); + emitc::OpaqueAttr::get(ctx, data)})); } Value structPtrMember(OpBuilder builder, Location location, Type type, @@ -273,12 +259,11 @@ Value structPtrMember(OpBuilder builder, Location location, Type type, .create( /*location=*/location, /*type=*/type, - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_PTR_MEMBER"), + /*callee=*/"EMITC_STRUCT_PTR_MEMBER", + /*operands=*/ArrayRef{operand}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), - emitc::OpaqueAttr::get(ctx, memberName)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{operand}) + emitc::OpaqueAttr::get(ctx, memberName)})) .getResult(0); } @@ -288,13 +273,12 @@ void structPtrMemberAssign(OpBuilder builder, Location location, builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "EMITC_STRUCT_PTR_MEMBER_ASSIGN"), + /*callee=*/"EMITC_STRUCT_PTR_MEMBER_ASSIGN", + /*operands=*/ArrayRef{operand, data}, /*args=*/ ArrayAttr::get(ctx, {builder.getIndexAttr(0), emitc::OpaqueAttr::get(ctx, memberName), - builder.getIndexAttr(1)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{operand, data}); + builder.getIndexAttr(1)})); } Value ireeMakeCstringView(OpBuilder builder, Location location, @@ -309,11 +293,10 @@ Value ireeMakeCstringView(OpBuilder builder, Location location, .create( /*location=*/location, /*type=*/emitc::OpaqueType::get(ctx, "iree_string_view_t"), - /*callee=*/StringAttr::get(ctx, "iree_make_cstring_view"), + /*callee=*/"iree_make_cstring_view", + /*operands=*/ArrayRef{}, /*args=*/ - ArrayAttr::get(ctx, {emitc::OpaqueAttr::get(ctx, quotedStr)}), - /*templateArgs=*/ArrayAttr{}, - /*operands=*/ArrayRef{}) + ArrayAttr::get(ctx, {emitc::OpaqueAttr::get(ctx, quotedStr)})) .getResult(0); } @@ -323,9 +306,7 @@ Value ireeOkStatus(OpBuilder builder, Location location) { .create( /*location=*/location, /*type=*/emitc::OpaqueType::get(ctx, "iree_status_t"), - /*callee=*/StringAttr::get(ctx, "iree_ok_status"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_ok_status", /*operands=*/ArrayRef{}) .getResult(0); } @@ -338,21 +319,16 @@ Value ireeVmInstanceLookupType(OpBuilder builder, Location location, .create( /*location=*/location, /*type=*/refType, - /*callee=*/StringAttr::get(ctx, "iree_vm_instance_lookup_type"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_instance_lookup_type", /*operands=*/ArrayRef{instance, stringView}) .getResult(0); } void ireeVmRefRelease(OpBuilder builder, Location location, Value operand) { - auto ctx = builder.getContext(); builder.create( /*location=*/location, /*type=*/TypeRange{}, - /*callee=*/StringAttr::get(ctx, "iree_vm_ref_release"), - /*args=*/ArrayAttr{}, - /*templateArgs=*/ArrayAttr{}, + /*callee=*/"iree_vm_ref_release", /*operands=*/ArrayRef{operand}); }