LLVM API Documentation
#include "llvm/Transforms/IPO.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include <set>
#include <algorithm>
Include dependency graph for GlobalOpt.cpp:
Go to the source code of this file.
|
Definition at line 16 of file GlobalOpt.cpp. |
|
AllUsesOfLoadedValueWillTrapIfNull - Return true if all uses of any loads from GV will trap if the loaded value is null. Note that this also permits comparisons of the loaded value against null, as a special case. Definition at line 480 of file GlobalOpt.cpp. References AllUsesOfValueWillTrapIfNull(), E, llvm::Value::use_begin(), and llvm::Value::use_end(). Referenced by OptimizeOnceStoredGlobal(). |
|
AllUsesOfValueWillTrapIfNull - Return true if all users of the specified value will trap if the value is dynamically null. Definition at line 444 of file GlobalOpt.cpp. References E, llvm::Value::use_begin(), and llvm::Value::use_end(). Referenced by AllUsesOfLoadedValueWillTrapIfNull(). |
|
AnalyzeGlobal - Look at all uses of the global and fill in the GlobalStatus structure. If the global has its address taken, return true to indicate we can't do anything with it. Definition at line 124 of file GlobalOpt.cpp. References C, ConstantIsDead(), E, I, GlobalStatus::isInitializerStored, GlobalStatus::isLoaded, GlobalStatus::isNotSuitableForSRA, GlobalStatus::isStored, GlobalStatus::isStoredOnce, llvm::Select, GlobalStatus::StoredOnceValue, GlobalStatus::StoredType, llvm::Value::use_begin(), and llvm::Value::use_end(). |
|
CleanupConstantGlobalUsers - We just marked GV constant. Loop over all users of the global, cleaning up the obvious ones. This is largely just a quick scan over the use list to clean up the easy and obvious cruft. This returns true if it made a change. Definition at line 273 of file GlobalOpt.cpp. References C, ConstantIsDead(), E, TraverseGEPInitializer(), U, llvm::Value::use_begin(), and llvm::Value::use_end(). Referenced by OptimizeAwayTrappingUsesOfLoads(). |
|
ConstantIsDead - Return true if the specified constant is (transitively) dead. The constant may be used by other constants (e.g. constant arrays and constant exprs) as long as they are dead, but it cannot be used by anything else. Definition at line 108 of file GlobalOpt.cpp. References E. Referenced by AnalyzeGlobal(), and CleanupConstantGlobalUsers(). |
|
ConstantPropUsersOf - Walk the use list of V, constant folding all of the instructions that are foldable. Definition at line 608 of file GlobalOpt.cpp. References llvm::ConstantFoldInstruction(), E, I, llvm::Value::use_begin(), and llvm::Value::use_end(). Referenced by OptimizeGlobalAddressOfMalloc(). |
|
Definition at line 223 of file GlobalOpt.cpp. References llvm::ConstantIntegral::getRawValue(). Referenced by SRAGlobal(), and TraverseGEPInitializer(). |
|
OptimizeAwayTrappingUsesOfLoads - The specified global has only one non-null value stored into it. If there are uses of the loaded value that would trap if the loaded value is dynamically null, then we know that they cannot be reachable with a null optimize away the load. Definition at line 560 of file GlobalOpt.cpp. References CleanupConstantGlobalUsers(), DEBUG, E, llvm::GlobalVariable::eraseFromParent(), llvm::Instruction::eraseFromParent(), NumDeleted, NumGlobUses, OptimizeAwayTrappingUsesOfValue(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::use_end(). Referenced by OptimizeOnceStoredGlobal(). |
|
Definition at line 496 of file GlobalOpt.cpp. References C, E, llvm::Value::getType(), I, llvm::Value::use_begin(), and llvm::Value::use_end(). Referenced by OptimizeAwayTrappingUsesOfLoads(). |
|
|
|
SRAGlobal - Perform scalar replacement of aggregates on the specified global variable. This opens the door for other optimizations by exposing the behavior of the program in a more fine-grained way. We have determined that this transformation is safe already. We return the first global variable we insert so that the caller can reprocess it. Definition at line 333 of file GlobalOpt.cpp. References DEBUG, getAggregateConstantElement(), llvm::Module::getGlobalList(), llvm::GlobalVariable::getInitializer(), llvm::Value::getName(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::GlobalValue::hasInternalLinkage(), llvm::GlobalVariable::isConstant(), NumSRA, llvm::Value::replaceAllUsesWith(), llvm::Value::use_back(), llvm::Value::use_empty(), llvm::Value::use_size(), and llvm::utostr(). |
|
Definition at line 254 of file GlobalOpt.cpp. References getAggregateConstantElement(), llvm::User::getNumOperands(), and llvm::User::getOperand(). Referenced by CleanupConstantGlobalUsers(). |
|
ValueIsOnlyUsedLocallyOrStoredToOneGlobal - Scan the use-list of V checking to make sure that there are no complex uses of V. We permit simple things like dereferencing the pointer, but not storing through the address, unless it is to the specified global. Definition at line 745 of file GlobalOpt.cpp. References E, llvm::User::getOperand(), llvm::Value::use_begin(), and llvm::Value::use_end(). Referenced by OptimizeOnceStoredGlobal(). |
|
Referenced by llvm::Inliner::doFinalization(), InlineCallIfPossible(), OptimizeAwayTrappingUsesOfLoads(), and removeIdenticalCalls(). |
|
|
|
Referenced by OptimizeAwayTrappingUsesOfLoads(). |
|
|
|
Referenced by SRAGlobal(). |
|
|
|
|