mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILBuilder: add an API to insert _after_ an instruction.
... and use that API in FullApplySite::insertAfterInvocation. Also change FullApplySite::insertAfterInvocation/insertAfterFullEvaluation to directly pass a SILBuilder instead of just an insertion point to the callback. This makes more sense (given the function names) and simplifies the usages. It's a NFC.
This commit is contained in:
@@ -2499,6 +2499,20 @@ public:
|
||||
assert(DS && "Instruction without debug scope associated!");
|
||||
setCurrentDebugScope(DS);
|
||||
}
|
||||
|
||||
/// If \p inst is a terminator apply site, then pass a builder to insert at
|
||||
/// the first instruction of each successor to \p func. Otherwise, pass a
|
||||
/// builder to insert at std::next(inst).
|
||||
///
|
||||
/// The intention is that this abstraction will enable the compiler writer to
|
||||
/// ignore whether or not \p inst is a terminator when inserting instructions
|
||||
/// after \p inst.
|
||||
///
|
||||
/// Precondition: It's the responsibility of the caller to ensure that if
|
||||
/// \p inst is a terminator, all successor blocks have only a single
|
||||
/// predecessor block: the parent of \p inst.
|
||||
static void insertAfter(SILInstruction *inst,
|
||||
function_ref<void(SILBuilder &)> func);
|
||||
};
|
||||
|
||||
class SavedInsertionPointRAII {
|
||||
|
||||
Reference in New Issue
Block a user