void LSLocation::enumerateLSLocation(SILModule *M, SILValue Mem, std::vector<LSLocation> &Locations, LSLocationIndexMap &IndexMap, LSLocationBaseMap &BaseMap, TypeExpansionAnalysis *TypeCache) { // We have processed this SILValue before. if (BaseMap.find(Mem) != BaseMap.end()) return; // Construct a Location to represent the memory written by this instruction. SILValue UO = getUnderlyingObject(Mem); LSLocation L(UO, NewProjectionPath::getProjectionPath(UO, Mem)); // If we cant figure out the Base or Projection Path for the memory location, // simply ignore it for now. if (!L.isValid()) return; // Record the SILValue to location mapping. BaseMap[Mem] = L; // Expand the given Mem into individual fields and add them to the // locationvault. LSLocationList Locs; LSLocation::expand(L, M, Locs, TypeCache); for (auto &Loc : Locs) { if (IndexMap.find(Loc) != IndexMap.end()) continue; IndexMap[Loc] = Locations.size(); Locations.push_back(Loc); } }
void LSLocation::enumerateLSLocation(SILModule *M, SILValue Mem, std::vector<LSLocation> &Locations, LSLocationIndexMap &IndexMap, LSLocationBaseMap &BaseMap, TypeExpansionAnalysis *TypeCache) { // We have processed this SILValue before. if (BaseMap.find(Mem) != BaseMap.end()) return; // Construct a Location to represent the memory written by this instruction. // ProjectionPath currently does not handle mark_dependence so stop our // underlying object search at these instructions. // We still get a benefit if we cse mark_dependence instructions and then // merge loads from them. SILValue UO = getUnderlyingObjectStopAtMarkDependence(Mem); LSLocation L(UO, ProjectionPath::getProjectionPath(UO, Mem)); // If we can't figure out the Base or Projection Path for the memory location, // simply ignore it for now. if (!L.isValid()) return; // Record the SILValue to location mapping. BaseMap[Mem] = L; // Expand the given Mem into individual fields and add them to the // locationvault. LSLocationList Locs; LSLocation::expand(L, M, Locs, TypeCache); for (auto &Loc : Locs) { if (IndexMap.find(Loc) != IndexMap.end()) continue; IndexMap[Loc] = Locations.size(); Locations.push_back(Loc); } }