mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILOptimizer: Pipe through TypeExpansionContext
This commit is contained in:
@@ -169,12 +169,15 @@ public:
|
||||
}
|
||||
|
||||
/// Print the LSBase.
|
||||
virtual void print(llvm::raw_ostream &os, SILModule *Mod) {
|
||||
virtual void print(llvm::raw_ostream &os, SILModule *Mod,
|
||||
TypeExpansionContext context) {
|
||||
os << Base;
|
||||
Path.getValue().print(os, *Mod);
|
||||
Path.getValue().print(os, *Mod, context);
|
||||
}
|
||||
|
||||
virtual void dump(SILModule *Mod) { print(llvm::dbgs(), Mod); }
|
||||
virtual void dump(SILModule *Mod, TypeExpansionContext context) {
|
||||
print(llvm::dbgs(), Mod, context);
|
||||
}
|
||||
};
|
||||
|
||||
static inline llvm::hash_code hash_value(const LSBase &S) {
|
||||
@@ -257,16 +260,18 @@ public:
|
||||
return Path.getValue().createExtract(Base, Inst, true);
|
||||
}
|
||||
|
||||
void print(llvm::raw_ostream &os, SILModule *Mod) {
|
||||
void print(llvm::raw_ostream &os, SILModule *Mod,
|
||||
TypeExpansionContext context) {
|
||||
if (CoveringValue) {
|
||||
os << "Covering Value";
|
||||
return;
|
||||
}
|
||||
LSBase::print(os, Mod);
|
||||
LSBase::print(os, Mod, context);
|
||||
}
|
||||
|
||||
/// Expand this SILValue to all individual fields it contains.
|
||||
static void expand(SILValue Base, SILModule *Mod, LSValueList &Vals,
|
||||
static void expand(SILValue Base, SILModule *Mod,
|
||||
TypeExpansionContext context, LSValueList &Vals,
|
||||
TypeExpansionAnalysis *TE);
|
||||
|
||||
/// Given a memory location and a map between the expansions of the location
|
||||
@@ -329,13 +334,14 @@ public:
|
||||
}
|
||||
|
||||
/// Returns the type of the object the LSLocation represents.
|
||||
SILType getType(SILModule *M) {
|
||||
return Path.getValue().getMostDerivedType(*M);
|
||||
SILType getType(SILModule *M, TypeExpansionContext context) {
|
||||
return Path.getValue().getMostDerivedType(*M, context);
|
||||
}
|
||||
|
||||
/// Get the first level locations based on this location's first level
|
||||
/// projection.
|
||||
void getNextLevelLSLocations(LSLocationList &Locs, SILModule *Mod);
|
||||
void getNextLevelLSLocations(LSLocationList &Locs, SILModule *Mod,
|
||||
TypeExpansionContext context);
|
||||
|
||||
/// Check whether the 2 LSLocations may alias each other or not.
|
||||
bool isMayAliasLSLocation(const LSLocation &RHS, AliasAnalysis *AA);
|
||||
@@ -351,15 +357,18 @@ public:
|
||||
/// In SIL, we can have a store to an aggregate and loads from its individual
|
||||
/// fields. Therefore, we expand all the operations on aggregates onto
|
||||
/// individual fields and process them separately.
|
||||
static void expand(LSLocation Base, SILModule *Mod, LSLocationList &Locs,
|
||||
static void expand(LSLocation Base, SILModule *Mod,
|
||||
TypeExpansionContext context, LSLocationList &Locs,
|
||||
TypeExpansionAnalysis *TE);
|
||||
|
||||
/// Given a set of locations derived from the same base, try to merge/reduce
|
||||
/// them into smallest number of LSLocations possible.
|
||||
static void reduce(LSLocation Base, SILModule *Mod, LSLocationList &Locs);
|
||||
static void reduce(LSLocation Base, SILModule *Mod,
|
||||
TypeExpansionContext context, LSLocationList &Locs);
|
||||
|
||||
/// Enumerate the given Mem LSLocation.
|
||||
static void enumerateLSLocation(SILModule *M, SILValue Mem,
|
||||
static void enumerateLSLocation(TypeExpansionContext context, SILModule *M,
|
||||
SILValue Mem,
|
||||
std::vector<LSLocation> &LSLocationVault,
|
||||
LSLocationIndexMap &LocToBit,
|
||||
LSLocationBaseMap &BaseToLoc,
|
||||
|
||||
Reference in New Issue
Block a user