LLVM
8.0.1
|
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"
#include "llvm/Transforms/IPO.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "ipconstprop" |
Functions | |
STATISTIC (NumArgumentsProped, "Number of args turned into constants") | |
STATISTIC (NumReturnValProped, "Number of return values turned into constants") | |
static bool | PropagateConstantsIntoArguments (Function &F) |
PropagateConstantsIntoArguments - Look at all uses of the specified function. More... | |
static bool | PropagateConstantReturn (Function &F) |
INITIALIZE_PASS (IPCP, "ipconstprop", "Interprocedural constant propagation", false, false) ModulePass *llvm | |
#define DEBUG_TYPE "ipconstprop" |
Definition at line 29 of file IPConstantPropagation.cpp.
INITIALIZE_PASS | ( | IPCP | , |
"ipconstprop" | , | ||
"Interprocedural constant propagation" | , | ||
false | , | ||
false | |||
) |
Definition at line 259 of file IPConstantPropagation.cpp.
References F(), PropagateConstantReturn(), and PropagateConstantsIntoArguments().
Definition at line 130 of file IPConstantPropagation.cpp.
References llvm::dyn_cast(), E, llvm::Instruction::eraseFromParent(), llvm::FindInsertedValue(), llvm::UndefValue::get(), llvm::StructType::getElementType(), llvm::StructType::getNumElements(), llvm::Function::getReturnType(), llvm::Function::hasFnAttribute(), I, llvm::MipsISD::Ins, llvm::GlobalValue::isDefinitionExact(), llvm::Type::isVoidTy(), llvm::Attribute::Naked, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Value::replaceAllUsesWith(), and llvm::SmallVectorBase::size().
Referenced by INITIALIZE_PASS().
PropagateConstantsIntoArguments - Look at all uses of the specified function.
If all uses are direct call sites, and all pass a particular constant in for an argument, propagate that constant in as the argument.
Definition at line 51 of file IPConstantPropagation.cpp.
References Arg, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_begin(), llvm::Function::arg_begin(), llvm::Function::arg_empty(), llvm::Function::arg_size(), assert(), C, llvm::dyn_cast(), first, llvm::UndefValue::get(), llvm::Value::getType(), llvm::Argument::hasByValAttr(), llvm::Argument::hasInAllocaAttr(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::isCallee(), llvm::Function::onlyReadsMemory(), llvm::Value::replaceAllUsesWith(), llvm::SmallVectorImpl< T >::resize(), second, llvm::SmallVectorBase::size(), llvm::Value::use_empty(), and llvm::Value::uses().
Referenced by INITIALIZE_PASS().
STATISTIC | ( | NumArgumentsProped | , |
"Number of args turned into constants" | |||
) |
STATISTIC | ( | NumReturnValProped | , |
"Number of return values turned into constants" | |||
) |