From 33dc7ac4fdc45afa602b4ec1bb09d70f0cb2117f Mon Sep 17 00:00:00 2001 From: tnowicki Date: Tue, 3 Sep 2024 15:10:54 -0400 Subject: [PATCH] [Coroutines] Move util headers to include/llvm Plugin libraries that use coroutines can do so right now, however, to provide their own ABI they need to be able to use various headers, some of which such are required. This change exposes the coro utils and required headers by moving them to include/llvm/Transforms/Coroutines. Headers moved: * ABI.h (ABI object) * CoroInstr.h (helpers) * Coroshape.h (Shape object) * MaterializationUtils.h (helpers) * SpillingUtils.h (helpers) * SuspendCrossingInfo.h (analysis) The patch has no code changes other than those required to move the headers and these are: * include guard name changes * include path changes * minor clang-format induced changes * removal of LLVM_LIBRARY_VISIBILITY --- .../llvm}/Transforms/Coroutines/ABI.h | 17 ++-- .../llvm}/Transforms/Coroutines/CoroInstr.h | 88 +++++++++---------- .../llvm}/Transforms/Coroutines/CoroShape.h | 4 +- .../llvm/Transforms/Coroutines/CoroSplit.h | 1 + .../Coroutines/MaterializationUtils.h | 9 +- .../llvm}/Transforms/Coroutines/SpillUtils.h | 5 +- .../Coroutines/SuspendCrossingInfo.h | 6 +- llvm/lib/Transforms/Coroutines/CoroEarly.cpp | 2 +- llvm/lib/Transforms/Coroutines/CoroFrame.cpp | 9 +- llvm/lib/Transforms/Coroutines/CoroInternal.h | 4 +- llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 6 +- llvm/lib/Transforms/Coroutines/Coroutines.cpp | 6 +- .../Coroutines/MaterializationUtils.cpp | 5 +- llvm/lib/Transforms/Coroutines/SpillUtils.cpp | 3 +- .../Coroutines/SuspendCrossingInfo.cpp | 2 +- .../Transforms/Coroutines/ExtraRematTest.cpp | 1 + 16 files changed, 85 insertions(+), 83 deletions(-) rename llvm/{lib => include/llvm}/Transforms/Coroutines/ABI.h (89%) rename llvm/{lib => include/llvm}/Transforms/Coroutines/CoroInstr.h (90%) rename llvm/{lib => include/llvm}/Transforms/Coroutines/CoroShape.h (99%) rename llvm/{lib => include/llvm}/Transforms/Coroutines/MaterializationUtils.h (76%) rename llvm/{lib => include/llvm}/Transforms/Coroutines/SpillUtils.h (93%) rename llvm/{lib => include/llvm}/Transforms/Coroutines/SuspendCrossingInfo.h (97%) diff --git a/llvm/lib/Transforms/Coroutines/ABI.h b/llvm/include/llvm/Transforms/Coroutines/ABI.h similarity index 89% rename from llvm/lib/Transforms/Coroutines/ABI.h rename to llvm/include/llvm/Transforms/Coroutines/ABI.h index 7fa835e84ca336..e7568d275c1615 100644 --- a/llvm/lib/Transforms/Coroutines/ABI.h +++ b/llvm/include/llvm/Transforms/Coroutines/ABI.h @@ -12,12 +12,13 @@ // ABI enum and ABI class are used by the Coroutine passes when lowering. //===----------------------------------------------------------------------===// -#ifndef LIB_TRANSFORMS_COROUTINES_ABI_H -#define LIB_TRANSFORMS_COROUTINES_ABI_H +#ifndef LLVM_TRANSFORMS_COROUTINES_ABI_H +#define LLVM_TRANSFORMS_COROUTINES_ABI_H -#include "CoroShape.h" -#include "SuspendCrossingInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/Transforms/Coroutines/CoroShape.h" +#include "llvm/Transforms/Coroutines/MaterializationUtils.h" +#include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h" namespace llvm { @@ -30,7 +31,7 @@ namespace coro { // ABI operations. The ABIs (e.g. Switch, Async, Retcon{Once}) are the common // ABIs. -class LLVM_LIBRARY_VISIBILITY BaseABI { +class BaseABI { public: BaseABI(Function &F, coro::Shape &S, std::function IsMaterializable) @@ -56,7 +57,7 @@ class LLVM_LIBRARY_VISIBILITY BaseABI { std::function IsMaterializable; }; -class LLVM_LIBRARY_VISIBILITY SwitchABI : public BaseABI { +class SwitchABI : public BaseABI { public: SwitchABI(Function &F, coro::Shape &S, std::function IsMaterializable) @@ -69,7 +70,7 @@ class LLVM_LIBRARY_VISIBILITY SwitchABI : public BaseABI { TargetTransformInfo &TTI) override; }; -class LLVM_LIBRARY_VISIBILITY AsyncABI : public BaseABI { +class AsyncABI : public BaseABI { public: AsyncABI(Function &F, coro::Shape &S, std::function IsMaterializable) @@ -82,7 +83,7 @@ class LLVM_LIBRARY_VISIBILITY AsyncABI : public BaseABI { TargetTransformInfo &TTI) override; }; -class LLVM_LIBRARY_VISIBILITY AnyRetconABI : public BaseABI { +class AnyRetconABI : public BaseABI { public: AnyRetconABI(Function &F, coro::Shape &S, std::function IsMaterializable) diff --git a/llvm/lib/Transforms/Coroutines/CoroInstr.h b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h similarity index 90% rename from llvm/lib/Transforms/Coroutines/CoroInstr.h rename to llvm/include/llvm/Transforms/Coroutines/CoroInstr.h index a31703fe01304c..a329a06bf13891 100644 --- a/llvm/lib/Transforms/Coroutines/CoroInstr.h +++ b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h @@ -22,8 +22,8 @@ // the Coroutine library. //===----------------------------------------------------------------------===// -#ifndef LLVM_LIB_TRANSFORMS_COROUTINES_COROINSTR_H -#define LLVM_LIB_TRANSFORMS_COROUTINES_COROINSTR_H +#ifndef LLVM_TRANSFORMS_COROUTINES_COROINSTR_H +#define LLVM_TRANSFORMS_COROUTINES_COROINSTR_H #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/IntrinsicInst.h" @@ -32,7 +32,7 @@ namespace llvm { /// This class represents the llvm.coro.subfn.addr instruction. -class LLVM_LIBRARY_VISIBILITY CoroSubFnInst : public IntrinsicInst { +class CoroSubFnInst : public IntrinsicInst { enum { FrameArg, IndexArg }; public: @@ -67,7 +67,7 @@ class LLVM_LIBRARY_VISIBILITY CoroSubFnInst : public IntrinsicInst { }; /// This represents the llvm.coro.alloc instruction. -class LLVM_LIBRARY_VISIBILITY CoroAllocInst : public IntrinsicInst { +class CoroAllocInst : public IntrinsicInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -82,7 +82,7 @@ class LLVM_LIBRARY_VISIBILITY CoroAllocInst : public IntrinsicInst { // FIXME: add callback metadata // FIXME: make a proper IntrinisicInst. Currently this is not possible, // because llvm.coro.await.suspend.* can be invoked. -class LLVM_LIBRARY_VISIBILITY CoroAwaitSuspendInst : public CallBase { +class CoroAwaitSuspendInst : public CallBase { enum { AwaiterArg, FrameArg, WrapperArg }; public: @@ -112,7 +112,7 @@ class LLVM_LIBRARY_VISIBILITY CoroAwaitSuspendInst : public CallBase { }; /// This represents a common base class for llvm.coro.id instructions. -class LLVM_LIBRARY_VISIBILITY AnyCoroIdInst : public IntrinsicInst { +class AnyCoroIdInst : public IntrinsicInst { public: CoroAllocInst *getCoroAlloc() { for (User *U : users()) @@ -143,7 +143,7 @@ class LLVM_LIBRARY_VISIBILITY AnyCoroIdInst : public IntrinsicInst { }; /// This represents the llvm.coro.id instruction. -class LLVM_LIBRARY_VISIBILITY CoroIdInst : public AnyCoroIdInst { +class CoroIdInst : public AnyCoroIdInst { enum { AlignArg, PromiseArg, CoroutineArg, InfoArg }; public: @@ -232,7 +232,7 @@ class LLVM_LIBRARY_VISIBILITY CoroIdInst : public AnyCoroIdInst { /// This represents either the llvm.coro.id.retcon or /// llvm.coro.id.retcon.once instruction. -class LLVM_LIBRARY_VISIBILITY AnyCoroIdRetconInst : public AnyCoroIdInst { +class AnyCoroIdRetconInst : public AnyCoroIdInst { enum { SizeArg, AlignArg, StorageArg, PrototypeArg, AllocArg, DeallocArg }; public: @@ -246,9 +246,7 @@ class LLVM_LIBRARY_VISIBILITY AnyCoroIdRetconInst : public AnyCoroIdInst { return cast(getArgOperand(AlignArg))->getAlignValue(); } - Value *getStorage() const { - return getArgOperand(StorageArg); - } + Value *getStorage() const { return getArgOperand(StorageArg); } /// Return the prototype for the continuation function. The type, /// attributes, and calling convention of the continuation function(s) @@ -270,8 +268,8 @@ class LLVM_LIBRARY_VISIBILITY AnyCoroIdRetconInst : public AnyCoroIdInst { // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { auto ID = I->getIntrinsicID(); - return ID == Intrinsic::coro_id_retcon - || ID == Intrinsic::coro_id_retcon_once; + return ID == Intrinsic::coro_id_retcon || + ID == Intrinsic::coro_id_retcon_once; } static bool classof(const Value *V) { return isa(V) && classof(cast(V)); @@ -279,8 +277,7 @@ class LLVM_LIBRARY_VISIBILITY AnyCoroIdRetconInst : public AnyCoroIdInst { }; /// This represents the llvm.coro.id.retcon instruction. -class LLVM_LIBRARY_VISIBILITY CoroIdRetconInst - : public AnyCoroIdRetconInst { +class CoroIdRetconInst : public AnyCoroIdRetconInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -292,8 +289,7 @@ class LLVM_LIBRARY_VISIBILITY CoroIdRetconInst }; /// This represents the llvm.coro.id.retcon.once instruction. -class LLVM_LIBRARY_VISIBILITY CoroIdRetconOnceInst - : public AnyCoroIdRetconInst { +class CoroIdRetconOnceInst : public AnyCoroIdRetconInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -305,7 +301,7 @@ class LLVM_LIBRARY_VISIBILITY CoroIdRetconOnceInst }; /// This represents the llvm.coro.id.async instruction. -class LLVM_LIBRARY_VISIBILITY CoroIdAsyncInst : public AnyCoroIdInst { +class CoroIdAsyncInst : public AnyCoroIdInst { enum { SizeArg, AlignArg, StorageArg, AsyncFuncPtrArg }; public: @@ -356,7 +352,7 @@ class LLVM_LIBRARY_VISIBILITY CoroIdAsyncInst : public AnyCoroIdInst { }; /// This represents the llvm.coro.context.alloc instruction. -class LLVM_LIBRARY_VISIBILITY CoroAsyncContextAllocInst : public IntrinsicInst { +class CoroAsyncContextAllocInst : public IntrinsicInst { enum { AsyncFuncPtrArg }; public: @@ -375,8 +371,7 @@ class LLVM_LIBRARY_VISIBILITY CoroAsyncContextAllocInst : public IntrinsicInst { }; /// This represents the llvm.coro.context.dealloc instruction. -class LLVM_LIBRARY_VISIBILITY CoroAsyncContextDeallocInst - : public IntrinsicInst { +class CoroAsyncContextDeallocInst : public IntrinsicInst { enum { AsyncContextArg }; public: @@ -396,7 +391,7 @@ class LLVM_LIBRARY_VISIBILITY CoroAsyncContextDeallocInst /// This represents the llvm.coro.async.resume instruction. /// During lowering this is replaced by the resume function of a suspend point /// (the continuation function). -class LLVM_LIBRARY_VISIBILITY CoroAsyncResumeInst : public IntrinsicInst { +class CoroAsyncResumeInst : public IntrinsicInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -408,7 +403,7 @@ class LLVM_LIBRARY_VISIBILITY CoroAsyncResumeInst : public IntrinsicInst { }; /// This represents the llvm.coro.async.size.replace instruction. -class LLVM_LIBRARY_VISIBILITY CoroAsyncSizeReplace : public IntrinsicInst { +class CoroAsyncSizeReplace : public IntrinsicInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -420,7 +415,7 @@ class LLVM_LIBRARY_VISIBILITY CoroAsyncSizeReplace : public IntrinsicInst { }; /// This represents the llvm.coro.frame instruction. -class LLVM_LIBRARY_VISIBILITY CoroFrameInst : public IntrinsicInst { +class CoroFrameInst : public IntrinsicInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -432,7 +427,7 @@ class LLVM_LIBRARY_VISIBILITY CoroFrameInst : public IntrinsicInst { }; /// This represents the llvm.coro.free instruction. -class LLVM_LIBRARY_VISIBILITY CoroFreeInst : public IntrinsicInst { +class CoroFreeInst : public IntrinsicInst { enum { IdArg, FrameArg }; public: @@ -447,8 +442,8 @@ class LLVM_LIBRARY_VISIBILITY CoroFreeInst : public IntrinsicInst { } }; -/// This class represents the llvm.coro.begin instruction. -class LLVM_LIBRARY_VISIBILITY CoroBeginInst : public IntrinsicInst { +/// This class represents the llvm.coro.begin instructions. +class CoroBeginInst : public IntrinsicInst { enum { IdArg, MemArg }; public: @@ -468,7 +463,7 @@ class LLVM_LIBRARY_VISIBILITY CoroBeginInst : public IntrinsicInst { }; /// This represents the llvm.coro.save instruction. -class LLVM_LIBRARY_VISIBILITY CoroSaveInst : public IntrinsicInst { +class CoroSaveInst : public IntrinsicInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -480,7 +475,7 @@ class LLVM_LIBRARY_VISIBILITY CoroSaveInst : public IntrinsicInst { }; /// This represents the llvm.coro.promise instruction. -class LLVM_LIBRARY_VISIBILITY CoroPromiseInst : public IntrinsicInst { +class CoroPromiseInst : public IntrinsicInst { enum { FrameArg, AlignArg, FromArg }; public: @@ -505,7 +500,7 @@ class LLVM_LIBRARY_VISIBILITY CoroPromiseInst : public IntrinsicInst { } }; -class LLVM_LIBRARY_VISIBILITY AnyCoroSuspendInst : public IntrinsicInst { +class AnyCoroSuspendInst : public IntrinsicInst { public: CoroSaveInst *getCoroSave() const; @@ -521,7 +516,7 @@ class LLVM_LIBRARY_VISIBILITY AnyCoroSuspendInst : public IntrinsicInst { }; /// This represents the llvm.coro.suspend instruction. -class LLVM_LIBRARY_VISIBILITY CoroSuspendInst : public AnyCoroSuspendInst { +class CoroSuspendInst : public AnyCoroSuspendInst { enum { SaveArg, FinalArg }; public: @@ -553,7 +548,7 @@ inline CoroSaveInst *AnyCoroSuspendInst::getCoroSave() const { } /// This represents the llvm.coro.suspend.async instruction. -class LLVM_LIBRARY_VISIBILITY CoroSuspendAsyncInst : public AnyCoroSuspendInst { +class CoroSuspendAsyncInst : public AnyCoroSuspendInst { public: enum { StorageArgNoArg, @@ -594,7 +589,7 @@ class LLVM_LIBRARY_VISIBILITY CoroSuspendAsyncInst : public AnyCoroSuspendInst { }; /// This represents the llvm.coro.suspend.retcon instruction. -class LLVM_LIBRARY_VISIBILITY CoroSuspendRetconInst : public AnyCoroSuspendInst { +class CoroSuspendRetconInst : public AnyCoroSuspendInst { public: op_iterator value_begin() { return arg_begin(); } const_op_iterator value_begin() const { return arg_begin(); } @@ -619,7 +614,7 @@ class LLVM_LIBRARY_VISIBILITY CoroSuspendRetconInst : public AnyCoroSuspendInst }; /// This represents the llvm.coro.size instruction. -class LLVM_LIBRARY_VISIBILITY CoroSizeInst : public IntrinsicInst { +class CoroSizeInst : public IntrinsicInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -631,7 +626,7 @@ class LLVM_LIBRARY_VISIBILITY CoroSizeInst : public IntrinsicInst { }; /// This represents the llvm.coro.align instruction. -class LLVM_LIBRARY_VISIBILITY CoroAlignInst : public IntrinsicInst { +class CoroAlignInst : public IntrinsicInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -643,7 +638,7 @@ class LLVM_LIBRARY_VISIBILITY CoroAlignInst : public IntrinsicInst { }; /// This represents the llvm.end.results instruction. -class LLVM_LIBRARY_VISIBILITY CoroEndResults : public IntrinsicInst { +class CoroEndResults : public IntrinsicInst { public: op_iterator retval_begin() { return arg_begin(); } const_op_iterator retval_begin() const { return arg_begin(); } @@ -671,7 +666,7 @@ class LLVM_LIBRARY_VISIBILITY CoroEndResults : public IntrinsicInst { } }; -class LLVM_LIBRARY_VISIBILITY AnyCoroEndInst : public IntrinsicInst { +class AnyCoroEndInst : public IntrinsicInst { enum { FrameArg, UnwindArg, TokenArg }; public: @@ -700,7 +695,7 @@ class LLVM_LIBRARY_VISIBILITY AnyCoroEndInst : public IntrinsicInst { }; /// This represents the llvm.coro.end instruction. -class LLVM_LIBRARY_VISIBILITY CoroEndInst : public AnyCoroEndInst { +class CoroEndInst : public AnyCoroEndInst { public: // Methods to support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { @@ -712,7 +707,7 @@ class LLVM_LIBRARY_VISIBILITY CoroEndInst : public AnyCoroEndInst { }; /// This represents the llvm.coro.end instruction. -class LLVM_LIBRARY_VISIBILITY CoroAsyncEndInst : public AnyCoroEndInst { +class CoroAsyncEndInst : public AnyCoroEndInst { enum { FrameArg, UnwindArg, MustTailCallFuncArg }; public: @@ -736,12 +731,11 @@ class LLVM_LIBRARY_VISIBILITY CoroAsyncEndInst : public AnyCoroEndInst { }; /// This represents the llvm.coro.alloca.alloc instruction. -class LLVM_LIBRARY_VISIBILITY CoroAllocaAllocInst : public IntrinsicInst { +class CoroAllocaAllocInst : public IntrinsicInst { enum { SizeArg, AlignArg }; + public: - Value *getSize() const { - return getArgOperand(SizeArg); - } + Value *getSize() const { return getArgOperand(SizeArg); } Align getAlignment() const { return cast(getArgOperand(AlignArg))->getAlignValue(); } @@ -756,8 +750,9 @@ class LLVM_LIBRARY_VISIBILITY CoroAllocaAllocInst : public IntrinsicInst { }; /// This represents the llvm.coro.alloca.get instruction. -class LLVM_LIBRARY_VISIBILITY CoroAllocaGetInst : public IntrinsicInst { +class CoroAllocaGetInst : public IntrinsicInst { enum { AllocArg }; + public: CoroAllocaAllocInst *getAlloc() const { return cast(getArgOperand(AllocArg)); @@ -773,8 +768,9 @@ class LLVM_LIBRARY_VISIBILITY CoroAllocaGetInst : public IntrinsicInst { }; /// This represents the llvm.coro.alloca.free instruction. -class LLVM_LIBRARY_VISIBILITY CoroAllocaFreeInst : public IntrinsicInst { +class CoroAllocaFreeInst : public IntrinsicInst { enum { AllocArg }; + public: CoroAllocaAllocInst *getAlloc() const { return cast(getArgOperand(AllocArg)); @@ -791,4 +787,4 @@ class LLVM_LIBRARY_VISIBILITY CoroAllocaFreeInst : public IntrinsicInst { } // End namespace llvm. -#endif +#endif // LLVM_TRANSFORMS_COROUTINES_COROINSTR_H diff --git a/llvm/lib/Transforms/Coroutines/CoroShape.h b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h similarity index 99% rename from llvm/lib/Transforms/Coroutines/CoroShape.h rename to llvm/include/llvm/Transforms/Coroutines/CoroShape.h index 7daa03beb2542a..ea93ced1ce29e6 100644 --- a/llvm/lib/Transforms/Coroutines/CoroShape.h +++ b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h @@ -12,9 +12,9 @@ #ifndef LLVM_TRANSFORMS_COROUTINES_COROSHAPE_H #define LLVM_TRANSFORMS_COROUTINES_COROSHAPE_H -#include "CoroInstr.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/PassManager.h" +#include "llvm/Transforms/Coroutines/CoroInstr.h" namespace llvm { @@ -49,7 +49,7 @@ enum class ABI { // Holds structural Coroutine Intrinsics for a particular function and other // values used during CoroSplit pass. -struct LLVM_LIBRARY_VISIBILITY Shape { +struct Shape { CoroBeginInst *CoroBegin = nullptr; SmallVector CoroEnds; SmallVector CoroSizes; diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h index 52b6c4918ada9b..a5fd57f8f9dfab 100644 --- a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h +++ b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h @@ -18,6 +18,7 @@ #include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/Analysis/LazyCallGraph.h" #include "llvm/IR/PassManager.h" +#include "llvm/Transforms/Coroutines/ABI.h" namespace llvm { diff --git a/llvm/lib/Transforms/Coroutines/MaterializationUtils.h b/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h similarity index 76% rename from llvm/lib/Transforms/Coroutines/MaterializationUtils.h rename to llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h index f391851c97b3b6..d8fc0c86a6fb50 100644 --- a/llvm/lib/Transforms/Coroutines/MaterializationUtils.h +++ b/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h @@ -6,11 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "SuspendCrossingInfo.h" -#include "llvm/IR/Instruction.h" +#include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h" -#ifndef LIB_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H -#define LIB_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H +#ifndef LLVM_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H +#define LLVM_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H namespace llvm { @@ -27,4 +26,4 @@ void doRematerializations(Function &F, SuspendCrossingInfo &Checker, } // namespace llvm -#endif // LIB_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H +#endif // LLVM_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H diff --git a/llvm/lib/Transforms/Coroutines/SpillUtils.h b/llvm/include/llvm/Transforms/Coroutines/SpillUtils.h similarity index 93% rename from llvm/lib/Transforms/Coroutines/SpillUtils.h rename to llvm/include/llvm/Transforms/Coroutines/SpillUtils.h index 8843b611e08424..6cdf83c0603f4d 100644 --- a/llvm/lib/Transforms/Coroutines/SpillUtils.h +++ b/llvm/include/llvm/Transforms/Coroutines/SpillUtils.h @@ -6,8 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "CoroInternal.h" -#include "SuspendCrossingInfo.h" +#include "llvm/IR/Dominators.h" +#include "llvm/Transforms/Coroutines/CoroShape.h" +#include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h" #ifndef LLVM_TRANSFORMS_COROUTINES_SPILLINGINFO_H #define LLVM_TRANSFORMS_COROUTINES_SPILLINGINFO_H diff --git a/llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.h b/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h similarity index 97% rename from llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.h rename to llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h index db889966dcf1db..49cae6dde47e54 100644 --- a/llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.h +++ b/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h @@ -12,16 +12,16 @@ // ptrs in the BlockToIndexMapping. //===----------------------------------------------------------------------===// -#ifndef LLVM_LIB_TRANSFORMS_COROUTINES_SUSPENDCROSSINGINFO_H -#define LLVM_LIB_TRANSFORMS_COROUTINES_SUSPENDCROSSINGINFO_H +#ifndef LLVM_TRANSFORMS_COROUTINES_SUSPENDCROSSINGINFO_H +#define LLVM_TRANSFORMS_COROUTINES_SUSPENDCROSSINGINFO_H -#include "CoroInstr.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/SmallVector.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instruction.h" +#include "llvm/Transforms/Coroutines/CoroInstr.h" namespace llvm { diff --git a/llvm/lib/Transforms/Coroutines/CoroEarly.cpp b/llvm/lib/Transforms/Coroutines/CoroEarly.cpp index 093a81648c92e1..a3674306f3e10e 100644 --- a/llvm/lib/Transforms/Coroutines/CoroEarly.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroEarly.cpp @@ -8,12 +8,12 @@ #include "llvm/Transforms/Coroutines/CoroEarly.h" #include "CoroInternal.h" -#include "CoroShape.h" #include "llvm/IR/DIBuilder.h" #include "llvm/IR/Function.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/InstIterator.h" #include "llvm/IR/Module.h" +#include "llvm/Transforms/Coroutines/CoroShape.h" using namespace llvm; diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index 91530503a7e1ed..a83c9e2638b488 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -15,11 +15,7 @@ // the value into the coroutine frame. //===----------------------------------------------------------------------===// -#include "ABI.h" #include "CoroInternal.h" -#include "MaterializationUtils.h" -#include "SpillUtils.h" -#include "SuspendCrossingInfo.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/ADT/SmallString.h" @@ -33,6 +29,11 @@ #include "llvm/IR/Module.h" #include "llvm/Support/Debug.h" #include "llvm/Support/OptimizedStructLayout.h" +#include "llvm/Transforms/Coroutines/ABI.h" +#include "llvm/Transforms/Coroutines/CoroInstr.h" +#include "llvm/Transforms/Coroutines/MaterializationUtils.h" +#include "llvm/Transforms/Coroutines/SpillUtils.h" +#include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/PromoteMemToReg.h" diff --git a/llvm/lib/Transforms/Coroutines/CoroInternal.h b/llvm/lib/Transforms/Coroutines/CoroInternal.h index 88d0f83c98c9ec..a0b52063aca10f 100644 --- a/llvm/lib/Transforms/Coroutines/CoroInternal.h +++ b/llvm/lib/Transforms/Coroutines/CoroInternal.h @@ -11,10 +11,10 @@ #ifndef LLVM_LIB_TRANSFORMS_COROUTINES_COROINTERNAL_H #define LLVM_LIB_TRANSFORMS_COROUTINES_COROINTERNAL_H -#include "CoroInstr.h" -#include "CoroShape.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/IR/IRBuilder.h" +#include "llvm/Transforms/Coroutines/CoroInstr.h" +#include "llvm/Transforms/Coroutines/CoroShape.h" namespace llvm { diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 9aed4f6522a3f7..ef1f27118bc14b 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -19,10 +19,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Coroutines/CoroSplit.h" -#include "ABI.h" -#include "CoroInstr.h" #include "CoroInternal.h" -#include "MaterializationUtils.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/PriorityWorklist.h" #include "llvm/ADT/SmallPtrSet.h" @@ -64,6 +61,9 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Transforms/Coroutines/ABI.h" +#include "llvm/Transforms/Coroutines/CoroInstr.h" +#include "llvm/Transforms/Coroutines/MaterializationUtils.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/CallGraphUpdater.h" diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp index 184efbfe903d20..f4d9a7a8aa8569 100644 --- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp +++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp @@ -10,10 +10,7 @@ // //===----------------------------------------------------------------------===// -#include "ABI.h" -#include "CoroInstr.h" #include "CoroInternal.h" -#include "CoroShape.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Analysis/CallGraph.h" @@ -29,6 +26,9 @@ #include "llvm/IR/Type.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Transforms/Coroutines/ABI.h" +#include "llvm/Transforms/Coroutines/CoroInstr.h" +#include "llvm/Transforms/Coroutines/CoroShape.h" #include "llvm/Transforms/Utils/Local.h" #include #include diff --git a/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp b/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp index 708e8734175f93..c3ea0977d42117 100644 --- a/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp +++ b/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp @@ -9,12 +9,13 @@ // This file contains classes used to materialize insts after suspends points. //===----------------------------------------------------------------------===// -#include "MaterializationUtils.h" -#include "SpillUtils.h" +#include "llvm/Transforms/Coroutines/MaterializationUtils.h" +#include "CoroInternal.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/InstIterator.h" #include "llvm/IR/Instruction.h" +#include "llvm/Transforms/Coroutines/SpillUtils.h" #include using namespace llvm; diff --git a/llvm/lib/Transforms/Coroutines/SpillUtils.cpp b/llvm/lib/Transforms/Coroutines/SpillUtils.cpp index 96b5c8440e5f9a..e8609af992122c 100644 --- a/llvm/lib/Transforms/Coroutines/SpillUtils.cpp +++ b/llvm/lib/Transforms/Coroutines/SpillUtils.cpp @@ -6,7 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "SpillUtils.h" +#include "llvm/Transforms/Coroutines/SpillUtils.h" +#include "CoroInternal.h" #include "llvm/Analysis/CFG.h" #include "llvm/Analysis/PtrUseVisitor.h" #include "llvm/IR/CFG.h" diff --git a/llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.cpp b/llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.cpp index 84699e653db602..f18f23306befb4 100644 --- a/llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.cpp +++ b/llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.cpp @@ -12,7 +12,7 @@ // ptrs in the BlockToIndexMapping. //===----------------------------------------------------------------------===// -#include "SuspendCrossingInfo.h" +#include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h" // The "coro-suspend-crossing" flag is very noisy. There is another debug type, // "coro-frame", which results in leaner debug spew. diff --git a/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp b/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp index 9aab3cfd9cf10f..1d55889a32d7aa 100644 --- a/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp +++ b/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp @@ -11,6 +11,7 @@ #include "llvm/Passes/PassBuilder.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Testing/Support/Error.h" +#include "llvm/Transforms/Coroutines/ABI.h" #include "llvm/Transforms/Coroutines/CoroSplit.h" #include "gtest/gtest.h"