@@ -622,10 +622,11 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
622
622
mlir::SymbolRefAttr callee = mlir::SymbolRefAttr(),
623
623
mlir::Type returnType = mlir::cir::VoidType(),
624
624
mlir::ValueRange operands = mlir::ValueRange(),
625
+ mlir::cir::CallingConv callingConv = mlir::cir::CallingConv::C,
625
626
mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
626
627
627
- mlir::cir::CallOp callOp =
628
- create<mlir::cir::CallOp>( loc, callee, returnType, operands);
628
+ mlir::cir::CallOp callOp = create<mlir::cir::CallOp>(
629
+ loc, callee, returnType, operands, callingConv );
629
630
630
631
if (extraFnAttr) {
631
632
callOp->setAttr (" extra_attrs" , extraFnAttr);
@@ -641,41 +642,44 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
641
642
mlir::cir::CallOp
642
643
createCallOp (mlir::Location loc, mlir::cir::FuncOp callee,
643
644
mlir::ValueRange operands = mlir::ValueRange(),
645
+ mlir::cir::CallingConv callingConv = mlir::cir::CallingConv::C,
644
646
mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
645
647
return createCallOp (loc, mlir::SymbolRefAttr::get (callee),
646
648
callee.getFunctionType ().getReturnType (), operands,
647
- extraFnAttr);
649
+ callingConv, extraFnAttr);
648
650
}
649
651
650
- mlir::cir::CallOp
651
- createIndirectCallOp ( mlir::Location loc, mlir::Value ind_target,
652
- mlir::cir::FuncType fn_type ,
653
- mlir::ValueRange operands = mlir::ValueRange() ,
654
- mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
652
+ mlir::cir::CallOp createIndirectCallOp (
653
+ mlir::Location loc, mlir::Value ind_target, mlir::cir::FuncType fn_type ,
654
+ mlir::ValueRange operands = mlir::ValueRange() ,
655
+ mlir::cir::CallingConv callingConv = mlir::cir::CallingConv::C ,
656
+ mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
655
657
656
658
llvm::SmallVector<mlir::Value, 4 > resOperands ({ind_target});
657
659
resOperands.append (operands.begin (), operands.end ());
658
660
659
661
return createCallOp (loc, mlir::SymbolRefAttr (), fn_type.getReturnType (),
660
- resOperands, extraFnAttr);
662
+ resOperands, callingConv, extraFnAttr);
661
663
}
662
664
663
665
mlir::cir::CallOp
664
666
createCallOp (mlir::Location loc, mlir::SymbolRefAttr callee,
665
667
mlir::ValueRange operands = mlir::ValueRange(),
668
+ mlir::cir::CallingConv callingConv = mlir::cir::CallingConv::C,
666
669
mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
667
670
return createCallOp (loc, callee, mlir::cir::VoidType (), operands,
668
- extraFnAttr);
669
- }
670
-
671
- mlir::cir::CallOp
672
- createTryCallOp (mlir::Location loc,
673
- mlir::SymbolRefAttr callee = mlir::SymbolRefAttr(),
674
- mlir::Type returnType = mlir::cir::VoidType(),
675
- mlir::ValueRange operands = mlir::ValueRange(),
676
- mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
677
- mlir::cir::CallOp tryCallOp = create<mlir::cir::CallOp>(
678
- loc, callee, returnType, operands, getUnitAttr ());
671
+ callingConv, extraFnAttr);
672
+ }
673
+
674
+ mlir::cir::CallOp createTryCallOp (
675
+ mlir::Location loc, mlir::SymbolRefAttr callee = mlir::SymbolRefAttr(),
676
+ mlir::Type returnType = mlir::cir::VoidType(),
677
+ mlir::ValueRange operands = mlir::ValueRange(),
678
+ mlir::cir::CallingConv callingConv = mlir::cir::CallingConv::C,
679
+ mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
680
+ mlir::cir::CallOp tryCallOp =
681
+ create<mlir::cir::CallOp>(loc, callee, returnType, operands,
682
+ callingConv, /* exception=*/ getUnitAttr ());
679
683
if (extraFnAttr) {
680
684
tryCallOp->setAttr (" extra_attrs" , extraFnAttr);
681
685
} else {
@@ -687,23 +691,23 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
687
691
return tryCallOp;
688
692
}
689
693
690
- mlir::cir::CallOp
691
- createTryCallOp ( mlir::Location loc, mlir::cir::FuncOp callee,
692
- mlir::ValueRange operands ,
693
- mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
694
+ mlir::cir::CallOp createTryCallOp (
695
+ mlir::Location loc, mlir::cir::FuncOp callee, mlir::ValueRange operands ,
696
+ mlir::cir::CallingConv callingConv = mlir::cir::CallingConv::C ,
697
+ mlir::cir::ExtraFuncAttributesAttr extraFnAttr = {}) {
694
698
return createTryCallOp (loc, mlir::SymbolRefAttr::get (callee),
695
699
callee.getFunctionType ().getReturnType (), operands,
696
- extraFnAttr);
700
+ callingConv, extraFnAttr);
697
701
}
698
702
699
- mlir::cir::CallOp createIndirectTryCallOp (mlir::Location loc,
700
- mlir::Value ind_target,
701
- mlir::cir::FuncType fn_type ,
702
- mlir::ValueRange operands ) {
703
+ mlir::cir::CallOp createIndirectTryCallOp (
704
+ mlir::Location loc, mlir::Value ind_target, mlir::cir::FuncType fn_type ,
705
+ mlir::ValueRange operands ,
706
+ mlir::cir::CallingConv callingConv = mlir::cir::CallingConv::C ) {
703
707
llvm::SmallVector<mlir::Value, 4 > resOperands ({ind_target});
704
708
resOperands.append (operands.begin (), operands.end ());
705
709
return createTryCallOp (loc, mlir::SymbolRefAttr (), fn_type.getReturnType (),
706
- resOperands);
710
+ resOperands, callingConv );
707
711
}
708
712
709
713
struct GetMethodResults {
0 commit comments