@@ -379,21 +379,37 @@ class LSLocation : public LSBase {
379379 static void reduce (LSLocation Base, SILModule *Mod,
380380 TypeExpansionContext context, LSLocationList &Locs);
381381
382+ // / Gets the base address for `v`.
383+ // / If `stopAtImmutable` is true, the base address is only calculated up to
384+ // / a `ref_element_addr [immutable]` or a `ref_tail_addr [immutable]`.
385+ // / Return the base address and true if such an immutable class projection
386+ // / is found.
387+ static std::pair<SILValue, bool >
388+ getBaseAddressOrObject (SILValue v, bool stopAtImmutable);
389+
382390 // / Enumerate the given Mem LSLocation.
383- static void enumerateLSLocation (TypeExpansionContext context, SILModule *M,
391+ // / If `stopAtImmutable` is true, the base address is only calculated up to
392+ // / a `ref_element_addr [immutable]` or a `ref_tail_addr [immutable]`.
393+ // / Returns true if it's an immutable location.
394+ static bool enumerateLSLocation (TypeExpansionContext context, SILModule *M,
384395 SILValue Mem,
385396 std::vector<LSLocation> &LSLocationVault,
386397 LSLocationIndexMap &LocToBit,
387398 LSLocationBaseMap &BaseToLoc,
388- TypeExpansionAnalysis *TE);
399+ TypeExpansionAnalysis *TE,
400+ bool stopAtImmutable);
389401
390402 // / Enumerate all the locations in the function.
403+ // / If `stopAtImmutable` is true, the base addresses are only calculated up to
404+ // / a `ref_element_addr [immutable]` or a `ref_tail_addr [immutable]`.
391405 static void enumerateLSLocations (SILFunction &F,
392406 std::vector<LSLocation> &LSLocationVault,
393407 LSLocationIndexMap &LocToBit,
394408 LSLocationBaseMap &BaseToLoc,
395409 TypeExpansionAnalysis *TE,
396- std::pair<int , int > &LSCount);
410+ bool stopAtImmutable,
411+ int &numLoads, int &numStores,
412+ bool &immutableLoadsFound);
397413};
398414
399415static inline llvm::hash_code hash_value (const LSLocation &L) {
0 commit comments