LLVM API Documentation

ConstantFolding.cpp File Reference

#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/LLVMContext.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/MathExtras.h"
#include <cerrno>
#include <cmath>

Include dependency graph for ConstantFolding.cpp:

Go to the source code of this file.

Functions

static bool IsConstantOffsetFromGlobal (Constant *C, GlobalValue *&GV, int64_t &Offset, const TargetData &TD)
static Constant * SymbolicallyEvaluateBinop (unsigned Opc, Constant *Op0, Constant *Op1, const TargetData *TD, LLVMContext &Context)
static Constant * SymbolicallyEvaluateGEP (Constant *const *Ops, unsigned NumOps, const Type *ResultTy, LLVMContext &Context, const TargetData *TD)
static Constant * FoldBitCast (Constant *C, const Type *DestTy, const TargetData &TD, LLVMContext &Context)
Constant * llvm::ConstantFoldInstruction (Instruction *I, LLVMContext &Context, const TargetData *TD=0)
Constant * llvm::ConstantFoldConstantExpression (ConstantExpr *CE, LLVMContext &Context, const TargetData *TD=0)
Constant * llvm::ConstantFoldInstOperands (unsigned Opcode, const Type *DestTy, Constant *const *Ops, unsigned NumOps, LLVMContext &Context, const TargetData *TD=0)
Constant * llvm::ConstantFoldCompareInstOperands (unsigned Predicate, Constant *const *Ops, unsigned NumOps, LLVMContext &Context, const TargetData *TD=0)
Constant * llvm::ConstantFoldLoadThroughGEPConstantExpr (Constant *C, ConstantExpr *CE, LLVMContext &Context)
bool llvm::canConstantFoldCallTo (const Function *F)
static Constant * ConstantFoldFP (double(*NativeFP)(double), double V, const Type *Ty, LLVMContext &Context)
static Constant * ConstantFoldBinaryFP (double(*NativeFP)(double, double), double V, double W, const Type *Ty, LLVMContext &Context)
Constant * llvm::ConstantFoldCall (Function *F, Constant *const *Operands, unsigned NumOperands)


Function Documentation

static Constant* ConstantFoldBinaryFP ( double(*)(double, double)  NativeFP,
double  V,
double  W,
const Type *  Ty,
LLVMContext &  Context 
) [static]

static Constant* ConstantFoldFP ( double(*)(double)  NativeFP,
double  V,
const Type *  Ty,
LLVMContext &  Context 
) [static]

static Constant* FoldBitCast ( Constant *  C,
const Type *  DestTy,
const TargetData &  TD,
LLVMContext &  Context 
) [static]

static bool IsConstantOffsetFromGlobal ( Constant *  C,
GlobalValue *&  GV,
int64_t &  Offset,
const TargetData &  TD 
) [static]

static Constant* SymbolicallyEvaluateBinop ( unsigned  Opc,
Constant *  Op0,
Constant *  Op1,
const TargetData *  TD,
LLVMContext &  Context 
) [static]

SymbolicallyEvaluateBinop - One of Op0/Op1 is a constant expression. Attempt to symbolically evaluate the result of a binary operator merging these together. If target data info is available, it is provided as TD, otherwise TD is null.

Definition at line 96 of file ConstantFolding.cpp.

References llvm::Value::getType(), and IsConstantOffsetFromGlobal().

Referenced by llvm::ConstantFoldInstOperands().

static Constant* SymbolicallyEvaluateGEP ( Constant *const *  Ops,
unsigned  NumOps,
const Type *  ResultTy,
LLVMContext &  Context,
const TargetData *  TD 
) [static]