@@ -716,58 +716,21 @@ unsigned cir::CallOp::getNumArgOperands() {
716716}
717717
718718static mlir::ParseResult
719- parseTryCallBranches (mlir::OpAsmParser &parser, mlir::OperationState &result,
720- llvm::SmallVectorImpl<mlir::OpAsmParser::UnresolvedOperand>
721- &continueOperands,
722- llvm::SmallVectorImpl<mlir::OpAsmParser::UnresolvedOperand>
723- &landingPadOperands,
724- llvm::SmallVectorImpl<mlir::Type> &continueTypes,
725- llvm::SmallVectorImpl<mlir::Type> &landingPadTypes,
726- llvm::SMLoc &continueOperandsLoc,
727- llvm::SMLoc &landingPadOperandsLoc) {
728- mlir::Block *continueSuccessor = nullptr ;
729- mlir::Block *landingPadSuccessor = nullptr ;
730-
731- if (parser.parseSuccessor (continueSuccessor))
719+ parseTryCallDestinations (mlir::OpAsmParser &parser,
720+ mlir::OperationState &result) {
721+ mlir::Block *normalDestSuccessor;
722+ if (parser.parseSuccessor (normalDestSuccessor))
732723 return mlir::failure ();
733724
734- if (mlir::succeeded (parser.parseOptionalLParen ())) {
735- continueOperandsLoc = parser.getCurrentLocation ();
736- if (parser.parseOperandList (continueOperands))
737- return mlir::failure ();
738- if (parser.parseColon ())
739- return mlir::failure ();
740-
741- if (parser.parseTypeList (continueTypes))
742- return mlir::failure ();
743- if (parser.parseRParen ())
744- return mlir::failure ();
745- }
746-
747725 if (parser.parseComma ())
748726 return mlir::failure ();
749727
750- if (parser.parseSuccessor (landingPadSuccessor))
751- return mlir::failure ();
752-
753- if (mlir::succeeded (parser.parseOptionalLParen ())) {
754- landingPadOperandsLoc = parser.getCurrentLocation ();
755- if (parser.parseOperandList (landingPadOperands))
756- return mlir::failure ();
757- if (parser.parseColon ())
758- return mlir::failure ();
759-
760- if (parser.parseTypeList (landingPadTypes))
761- return mlir::failure ();
762- if (parser.parseRParen ())
763- return mlir::failure ();
764- }
765-
766- if (parser.parseOptionalAttrDict (result.attributes ))
728+ mlir::Block *unwindDestSuccessor;
729+ if (parser.parseSuccessor (unwindDestSuccessor))
767730 return mlir::failure ();
768731
769- result.addSuccessors (continueSuccessor );
770- result.addSuccessors (landingPadSuccessor );
732+ result.addSuccessors (normalDestSuccessor );
733+ result.addSuccessors (unwindDestSuccessor );
771734 return mlir::success ();
772735}
773736
@@ -809,10 +772,7 @@ static mlir::ParseResult parseCallCommon(mlir::OpAsmParser &parser,
809772 return mlir::failure ();
810773
811774 if (hasDestinationBlocks &&
812- parseTryCallBranches (parser, result, continueOperands, landingPadOperands,
813- continueTypes, landingPadTypes, continueOperandsLoc,
814- landingPadOperandsLoc)
815- .failed ()) {
775+ parseTryCallDestinations (parser, result).failed ()) {
816776 return ::mlir::failure ();
817777 }
818778
@@ -874,8 +834,8 @@ static void printCallCommon(mlir::Operation *op,
874834 mlir::Value indirectCallee,
875835 mlir::OpAsmPrinter &printer, bool isNothrow,
876836 cir::SideEffect sideEffect,
877- mlir::Block *cont = nullptr ,
878- mlir::Block *landingPad = nullptr ) {
837+ mlir::Block *normalDest = nullptr ,
838+ mlir::Block *unwindDest = nullptr ) {
879839 printer << ' ' ;
880840
881841 auto callLikeOp = mlir::cast<cir::CIRCallOpInterface>(op);
@@ -892,28 +852,28 @@ static void printCallCommon(mlir::Operation *op,
892852
893853 printer << " (" << ops << " )" ;
894854
895- if (cont ) {
855+ if (normalDest ) {
896856 assert (landingPad && " expected two successors" );
897857 auto tryCall = dyn_cast<cir::TryCallOp>(op);
898858 assert (tryCall && " regular calls do not branch" );
899- printer << ' ' << tryCall.getCont ();
900- if (!tryCall.getContOperands ().empty ()) {
859+ printer << ' ' << tryCall.getNormalDest ();
860+ if (!tryCall.getNormalDestOperands ().empty ()) {
901861 printer << " (" ;
902- printer << tryCall.getContOperands ();
862+ printer << tryCall.getNormalDestOperands ();
903863 printer << ' ' << " :" ;
904864 printer << ' ' ;
905- printer << tryCall.getContOperands ().getTypes ();
865+ printer << tryCall.getNormalDestOperands ().getTypes ();
906866 printer << " )" ;
907867 }
908868 printer << " ," ;
909869 printer << ' ' ;
910- printer << tryCall.getLandingPad ();
911- if (!tryCall.getLandingPadOperands ().empty ()) {
870+ printer << tryCall.getUnwindDest ();
871+ if (!tryCall.getUnwindDestOperands ().empty ()) {
912872 printer << " (" ;
913- printer << tryCall.getLandingPadOperands ();
873+ printer << tryCall.getUnwindDestOperands ();
914874 printer << ' ' << " :" ;
915875 printer << ' ' ;
916- printer << tryCall.getLandingPadOperands ().getTypes ();
876+ printer << tryCall.getUnwindDestOperands ().getTypes ();
917877 printer << " )" ;
918878 }
919879 }
@@ -1063,15 +1023,15 @@ void cir::TryCallOp::print(::mlir::OpAsmPrinter &p) {
10631023 mlir::Value indirectCallee = isIndirect () ? getIndirectCall () : nullptr ;
10641024 cir::SideEffect sideEffect = getSideEffect ();
10651025 printCallCommon (*this , getCalleeAttr (), indirectCallee, p, getNothrow (),
1066- sideEffect, getCont (), getLandingPad ());
1026+ sideEffect, getNormalDest (), getUnwindDest ());
10671027}
10681028
10691029mlir::SuccessorOperands cir::TryCallOp::getSuccessorOperands (unsigned index) {
10701030 assert (index < getNumSuccessors () && " invalid successor index" );
10711031 if (index == 0 )
1072- return SuccessorOperands (getContOperandsMutable ());
1032+ return SuccessorOperands (getNormalDestOperandsMutable ());
10731033 if (index == 1 )
1074- return SuccessorOperands (getLandingPadOperandsMutable ());
1034+ return SuccessorOperands (getUnwindDestOperandsMutable ());
10751035
10761036 // index == 2
10771037 return SuccessorOperands (getArgOperandsMutable ());
0 commit comments