IR: Introduce Module::global_objects().

This is a convenience iterator that allows clients to enumerate the
GlobalObjects within a Module.

Also start using it in a few places where it is obviously the right thing
to use.

Differential Revision: http://reviews.llvm.org/D21580

llvm-svn: 273470
This commit is contained in:
Peter Collingbourne
2016-06-22 20:29:42 +00:00
parent 4a07bf6372
commit 6d88fde3af
7 changed files with 88 additions and 43 deletions

View File

@@ -235,10 +235,8 @@ void ExecutionEngine::clearAllGlobalMappings() {
void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) {
MutexGuard locked(lock);
for (Function &FI : *M)
EEState.RemoveMapping(getMangledName(&FI));
for (GlobalVariable &GI : M->globals())
EEState.RemoveMapping(getMangledName(&GI));
for (GlobalObject &GO : M->global_objects())
EEState.RemoveMapping(getMangledName(&GO));
}
uint64_t ExecutionEngine::updateGlobalMapping(const GlobalValue *GV,