mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Enable dead function removal for internal function in whole-module compilation.
This is controlled by a new isWholeModule() attribute in SILModule. It gives about 9% code size reduction on the benchmark executables. For test-suite reasons it is currently not done for the stdlib. Swift SVN r22491
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "swift/Serialization/SerializedSILLoader.h"
|
||||
#include "swift/SIL/SILValue.h"
|
||||
#include "llvm/ADT/FoldingSet.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -91,10 +92,11 @@ class SILModule::SerializationCallback : public SerializedSILLoader::Callback {
|
||||
}
|
||||
};
|
||||
|
||||
SILModule::SILModule(Module *SwiftModule, const DeclContext *associatedDC)
|
||||
SILModule::SILModule(Module *SwiftModule, const DeclContext *associatedDC,
|
||||
bool wholeModule)
|
||||
: TheSwiftModule(SwiftModule), AssociatedDeclContext(associatedDC),
|
||||
Stage(SILStage::Raw), Callback(new SILModule::SerializationCallback()),
|
||||
Types(*this) {
|
||||
wholeModule(wholeModule), Types(*this) {
|
||||
TypeListUniquing = new SILTypeListUniquingType();
|
||||
}
|
||||
|
||||
@@ -663,6 +665,12 @@ private:
|
||||
|
||||
} // end anonymous namespace.
|
||||
|
||||
SILFunction *SILModule::lookUpFunction(SILDeclRef fnRef) {
|
||||
llvm::SmallString<32> name;
|
||||
fnRef.mangle(name);
|
||||
return lookUpFunction(name);
|
||||
}
|
||||
|
||||
bool SILModule::linkFunction(SILFunction *Fun, SILModule::LinkingMode Mode) {
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode,
|
||||
ExternalSource).processFunction(Fun);
|
||||
|
||||
Reference in New Issue
Block a user