libswift: Add the StackList data structure

StackList is a very efficient data structure for worklist type things.
This is a port of the C++ utility with the same name.

Compared to Array, it does not require any memory allocations.
This commit is contained in:
Erik Eckstein
2021-04-23 20:26:42 +02:00
parent d49108da07
commit 14422cdb50
8 changed files with 235 additions and 5 deletions

View File

@@ -52,10 +52,17 @@ class LibswiftPassInvocation {
/// Non-null if this is an instruction pass, invoked from SILCombine.
SILCombiner *silCombiner;
/// All slabs, allocated by the pass.
SILModule::SlabList allocatedSlabs;
public:
LibswiftPassInvocation(SILPassManager *passManager, SILCombiner *silCombiner) :
passManager(passManager), silCombiner(silCombiner) {}
FixedSizeSlab *allocSlab(FixedSizeSlab *afterSlab);
FixedSizeSlab *freeSlab(FixedSizeSlab *slab);
/// The top-level API to erase an instruction, called from the Swift pass.
void eraseInstruction(SILInstruction *inst);