#include "llvm/Transforms/Utils/Evaluator.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#define DEBUG_TYPE …
usingnamespacellvm;
static inline bool
isSimpleEnoughValueToCommit(Constant *C,
SmallPtrSetImpl<Constant *> &SimpleConstants,
const DataLayout &DL);
static bool
isSimpleEnoughValueToCommitHelper(Constant *C,
SmallPtrSetImpl<Constant *> &SimpleConstants,
const DataLayout &DL) { … }
static inline bool
isSimpleEnoughValueToCommit(Constant *C,
SmallPtrSetImpl<Constant *> &SimpleConstants,
const DataLayout &DL) { … }
void Evaluator::MutableValue::clear() { … }
Constant *Evaluator::MutableValue::read(Type *Ty, APInt Offset,
const DataLayout &DL) const { … }
bool Evaluator::MutableValue::makeMutable() { … }
bool Evaluator::MutableValue::write(Constant *V, APInt Offset,
const DataLayout &DL) { … }
Constant *Evaluator::MutableAggregate::toConstant() const { … }
Constant *Evaluator::ComputeLoadResult(Constant *P, Type *Ty) { … }
Constant *Evaluator::ComputeLoadResult(GlobalVariable *GV, Type *Ty,
const APInt &Offset) { … }
static Function *getFunction(Constant *C) { … }
Function *
Evaluator::getCalleeWithFormalArgs(CallBase &CB,
SmallVectorImpl<Constant *> &Formals) { … }
bool Evaluator::getFormalParams(CallBase &CB, Function *F,
SmallVectorImpl<Constant *> &Formals) { … }
Constant *Evaluator::castCallResultIfNeeded(Type *ReturnType, Constant *RV) { … }
bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst, BasicBlock *&NextBB,
bool &StrippedPointerCastsForAliasAnalysis) { … }
bool Evaluator::EvaluateFunction(Function *F, Constant *&RetVal,
const SmallVectorImpl<Constant*> &ActualArgs) { … }