Add a function to remove a global variable from a SILModule.

This API is useful for some global optimizations. If we can prove that a global is not used in the application, we can remove it.

Swift SVN r31529
This commit is contained in:
Roman Levenstein
2015-08-27 18:08:35 +00:00
parent 24b89de8e6
commit b5d964d536
2 changed files with 9 additions and 0 deletions

View File

@@ -548,6 +548,12 @@ void SILModule::eraseFunction(SILFunction *F) {
}
}
/// Erase a global SIL variable from the module.
void SILModule::eraseGlobalVariable(SILGlobalVariable *G) {
GlobalVariableTable.erase(G->getName());
getSILGlobalList().erase(G);
}
SILVTable *SILModule::lookUpVTable(const ClassDecl *C,
std::function<void(SILFunction *)> Callback) {
if (!C)