@@ -327,7 +327,9 @@ class LLVM_LIBRARY_VISIBILITY CoroIdRetconOnceDynamicInst
327327 StorageArg,
328328 PrototypeArg,
329329 AllocArg,
330- DeallocArg
330+ DeallocArg,
331+ AllocFrameArg,
332+ DeallocFrameArg,
331333 };
332334
333335public:
@@ -371,6 +373,16 @@ class LLVM_LIBRARY_VISIBILITY CoroIdRetconOnceDynamicInst
371373 return cast<Function>(getArgOperand (DeallocArg)->stripPointerCasts ());
372374 }
373375
376+ // / Return the function to use for allocating memory.
377+ Function *getAllocFrameFunction () const {
378+ return cast<Function>(getArgOperand (AllocFrameArg)->stripPointerCasts ());
379+ }
380+
381+ // / Return the function to use for deallocating memory.
382+ Function *getDeallocFrameFunction () const {
383+ return cast<Function>(getArgOperand (DeallocFrameArg)->stripPointerCasts ());
384+ }
385+
374386 Value *getAllocator () const { return getArgOperand (AllocatorArg); }
375387
376388 // Methods to support type inquiry through isa, cast, and dyn_cast:
@@ -822,8 +834,7 @@ class CoroAsyncEndInst : public AnyCoroEndInst {
822834 }
823835};
824836
825- // / This represents the llvm.coro.alloca.alloc instruction.
826- class CoroAllocaAllocInst : public IntrinsicInst {
837+ class AnyCoroAllocaAllocInst : public IntrinsicInst {
827838 enum { SizeArg, AlignArg };
828839
829840public:
@@ -832,6 +843,21 @@ class CoroAllocaAllocInst : public IntrinsicInst {
832843 return cast<ConstantInt>(getArgOperand (AlignArg))->getAlignValue ();
833844 }
834845
846+ // Methods to support type inquiry through isa, cast, and dyn_cast:
847+ static bool classof (const IntrinsicInst *I) {
848+ auto ID = I->getIntrinsicID ();
849+ return ID == Intrinsic::coro_alloca_alloc ||
850+ ID == Intrinsic::coro_alloca_alloc_frame;
851+ }
852+
853+ static bool classof (const Value *V) {
854+ return isa<IntrinsicInst>(V) && classof (cast<IntrinsicInst>(V));
855+ }
856+ };
857+
858+ // / This represents the llvm.coro.alloca.alloc instruction.
859+ class CoroAllocaAllocInst : public AnyCoroAllocaAllocInst {
860+ public:
835861 // Methods to support type inquiry through isa, cast, and dyn_cast:
836862 static bool classof (const IntrinsicInst *I) {
837863 return I->getIntrinsicID () == Intrinsic::coro_alloca_alloc;
@@ -841,13 +867,25 @@ class CoroAllocaAllocInst : public IntrinsicInst {
841867 }
842868};
843869
870+ // / This represents the llvm.coro.alloca.alloc.frame instruction.
871+ class CoroAllocaAllocFrameInst : public AnyCoroAllocaAllocInst {
872+ public:
873+ // Methods to support type inquiry through isa, cast, and dyn_cast:
874+ static bool classof (const IntrinsicInst *I) {
875+ return I->getIntrinsicID () == Intrinsic::coro_alloca_alloc_frame;
876+ }
877+ static bool classof (const Value *V) {
878+ return isa<IntrinsicInst>(V) && classof (cast<IntrinsicInst>(V));
879+ }
880+ };
881+
844882// / This represents the llvm.coro.alloca.get instruction.
845883class CoroAllocaGetInst : public IntrinsicInst {
846884 enum { AllocArg };
847885
848886public:
849- CoroAllocaAllocInst *getAlloc () const {
850- return cast<CoroAllocaAllocInst >(getArgOperand (AllocArg));
887+ AnyCoroAllocaAllocInst *getAlloc () const {
888+ return cast<AnyCoroAllocaAllocInst >(getArgOperand (AllocArg));
851889 }
852890
853891 // Methods to support type inquiry through isa, cast, and dyn_cast:
@@ -859,15 +897,29 @@ class CoroAllocaGetInst : public IntrinsicInst {
859897 }
860898};
861899
862- // / This represents the llvm.coro.alloca.free instruction.
863- class CoroAllocaFreeInst : public IntrinsicInst {
900+ class AnyCoroAllocaFreeInst : public IntrinsicInst {
864901 enum { AllocArg };
865902
866903public:
867- CoroAllocaAllocInst *getAlloc () const {
868- return cast<CoroAllocaAllocInst >(getArgOperand (AllocArg));
904+ AnyCoroAllocaAllocInst *getAlloc () const {
905+ return cast<AnyCoroAllocaAllocInst >(getArgOperand (AllocArg));
869906 }
870907
908+ // Methods to support type inquiry through isa, cast, and dyn_cast:
909+ static bool classof (const IntrinsicInst *I) {
910+ auto ID = I->getIntrinsicID ();
911+ return ID == Intrinsic::coro_alloca_free ||
912+ ID == Intrinsic::coro_alloca_free_frame;
913+ }
914+
915+ static bool classof (const Value *V) {
916+ return isa<IntrinsicInst>(V) && classof (cast<IntrinsicInst>(V));
917+ }
918+ };
919+
920+ // / This represents the llvm.coro.alloca.free instruction.
921+ class CoroAllocaFreeInst : public IntrinsicInst {
922+ public:
871923 // Methods to support type inquiry through isa, cast, and dyn_cast:
872924 static bool classof (const IntrinsicInst *I) {
873925 return I->getIntrinsicID () == Intrinsic::coro_alloca_free;
@@ -877,6 +929,18 @@ class CoroAllocaFreeInst : public IntrinsicInst {
877929 }
878930};
879931
932+ // / This represents the llvm.coro.alloca.free instruction.
933+ class CoroAllocaFreeFrameInst : public IntrinsicInst {
934+ public:
935+ // Methods to support type inquiry through isa, cast, and dyn_cast:
936+ static bool classof (const IntrinsicInst *I) {
937+ return I->getIntrinsicID () == Intrinsic::coro_alloca_free_frame;
938+ }
939+ static bool classof (const Value *V) {
940+ return isa<IntrinsicInst>(V) && classof (cast<IntrinsicInst>(V));
941+ }
942+ };
943+
880944} // End namespace llvm.
881945
882946#endif // LLVM_TRANSFORMS_COROUTINES_COROINSTR_H
0 commit comments