Skip to content

TODO: this is not required anymore. Remove it. + Zapping missing serializeAll parameter #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/SILPasses/Scalar/StackPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ StackPromoter::ChangeState StackPromoter::promote() {
// Search the whole function for stack promotable allocations.
for (SILBasicBlock &BB : *F) {
for (auto Iter = BB.begin(); Iter != BB.end();) {
// The allocaiton instruction may be moved, so increment Iter prior to
// The allocation instruction may be moved, so increment Iter prior to
// doing the optimization.
SILInstruction *I = &*Iter++;
if (isPromotableAllocInst(I)) {
Expand Down
24 changes: 8 additions & 16 deletions lib/Serialization/SerializeSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ namespace {
<< " for layout " << Layout::Code << "\n");
}

// TODO: this is not required anymore. Remove it.
bool ShouldSerializeAll;

/// Helper function to update ListOfValues for MethodInst. Format:
/// Attr, SILDeclRef (DeclID, Kind, uncurryLevel, IsObjC), and an operand.
void handleMethodInst(const MethodInst *MI, SILValue operand,
Expand Down Expand Up @@ -205,8 +202,8 @@ namespace {

public:
SILSerializer(Serializer &S, ASTContext &Ctx,
llvm::BitstreamWriter &Out, bool serializeAll)
: S(S), Ctx(Ctx), Out(Out), ShouldSerializeAll(serializeAll) {}
llvm::BitstreamWriter &Out)
: S(S), Ctx(Ctx), Out(Out) {}

void writeSILModule(const SILModule *SILMod);
};
Expand Down Expand Up @@ -1691,28 +1688,23 @@ void SILSerializer::writeSILBlock(const SILModule *SILMod) {
// FIXME: Resilience: could write out vtable for fragile classes.
const DeclContext *assocDC = SILMod->getAssociatedContext();
for (const SILVTable &vt : SILMod->getVTables()) {
if (ShouldSerializeAll &&
vt.getClass()->isChildContextOf(assocDC))
if (vt.getClass()->isChildContextOf(assocDC))
writeSILVTable(vt);
}

// Write out WitnessTables. For now, write out only if EnableSerializeAll.
// Write out WitnessTables.
for (const SILWitnessTable &wt : SILMod->getWitnessTables()) {
if (ShouldSerializeAll &&
wt.getConformance()->getDeclContext()->isChildContextOf(assocDC))
if (wt.getConformance()->getDeclContext()->isChildContextOf(assocDC))
writeSILWitnessTable(wt);
}

// Go through all the SILFunctions in SILMod and write out any
// mandatory function bodies.
for (const SILFunction &F : *SILMod) {
if (shouldEmitFunctionBody(F) || ShouldSerializeAll)
if (shouldEmitFunctionBody(F))
writeSILFunction(F);
}

if (ShouldSerializeAll)
return;

// Now write function declarations for every function we've
// emitted a reference to without emitting a function body for.
for (const SILFunction &F : *SILMod) {
Expand All @@ -1726,10 +1718,10 @@ void SILSerializer::writeSILModule(const SILModule *SILMod) {
writeIndexTables();
}

void Serializer::writeSIL(const SILModule *SILMod, bool serializeAllSIL) {
void Serializer::writeSIL(const SILModule *SILMod) {
if (!SILMod)
return;

SILSerializer SILSer(*this, M->getASTContext(), Out, serializeAllSIL);
SILSerializer SILSer(*this, M->getASTContext(), Out);
SILSer.writeSILModule(SILMod);
}