LLVM
8.0.1
|
#include "llvm/IR/Constants.h"
#include "ConstantFold.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include "llvm/IR/Value.def"
Go to the source code of this file.
Macros | |
#define | HANDLE_CONSTANT(Name) |
#define | HANDLE_CONSTANT(Name) |
Functions | |
static bool | canTrapImpl (const Constant *C, SmallPtrSetImpl< const ConstantExpr *> &NonTrappingOps) |
static bool | ConstHasGlobalValuePredicate (const Constant *C, bool(*Predicate)(const GlobalValue *)) |
Check if C contains a GlobalValue for which Predicate is true. More... | |
static bool | removeDeadUsersOfConstant (const Constant *C) |
If the specified constantexpr is dead, remove it. More... | |
static const fltSemantics * | TypeToFloatSemantics (Type *Ty) |
template<typename ItTy , typename EltTy > | |
static bool | rangeOnlyContains (ItTy Start, ItTy End, EltTy Elt) |
template<typename SequentialTy , typename ElementTy > | |
static Constant * | getIntSequenceIfElementsMatch (ArrayRef< Constant *> V) |
template<typename SequentialTy , typename ElementTy > | |
static Constant * | getFPSequenceIfElementsMatch (ArrayRef< Constant *> V) |
template<typename SequenceTy > | |
static Constant * | getSequenceIfElementsMatch (Constant *C, ArrayRef< Constant *> V) |
static Constant * | getFoldedCast (Instruction::CastOps opc, Constant *C, Type *Ty, bool OnlyIfReduced=false) |
This is a utility function to handle folding of casts and lookup of the cast in the ExprConstants map. More... | |
static bool | isAllZeros (StringRef Arr) |
Return true if the array is empty or all zeros. More... | |
#define HANDLE_CONSTANT | ( | Name | ) |
#define HANDLE_CONSTANT | ( | Name | ) |
|
static |
Definition at line 402 of file Constants.cpp.
References assert(), C, llvm::dyn_cast(), llvm::User::getNumOperands(), llvm::Value::getType(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::Type::isFirstClassType(), and llvm::User::Op().
Referenced by llvm::Constant::canTrap().
|
static |
Check if C contains a GlobalValue for which Predicate is true.
Definition at line 440 of file Constants.cpp.
References llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::User::Op(), llvm::User::operands(), llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::SmallVectorTemplateBase< T >::push_back().
Referenced by llvm::Constant::isDLLImportDependent(), and llvm::Constant::isThreadDependent().
|
static |
This is a utility function to handle folding of casts and lookup of the cast in the ExprConstants map.
It is used by the various get* methods below.
Definition at line 1512 of file Constants.cpp.
References assert(), llvm::ConstantFoldCastInstruction(), llvm::LLVMContextImpl::ExprConstants, R600_InstFlag::FC, llvm::Type::getContext(), llvm::Type::isFirstClassType(), and llvm::LLVMContext::pImpl.
Referenced by llvm::ConstantExpr::getAddrSpaceCast(), llvm::ConstantExpr::getBitCast(), llvm::ConstantExpr::getFPExtend(), llvm::ConstantExpr::getFPToSI(), llvm::ConstantExpr::getFPToUI(), llvm::ConstantExpr::getFPTrunc(), llvm::ConstantExpr::getIntToPtr(), llvm::ConstantExpr::getPtrToInt(), llvm::ConstantExpr::getSExt(), llvm::ConstantExpr::getSIToFP(), llvm::ConstantExpr::getTrunc(), llvm::ConstantExpr::getUIToFP(), and llvm::ConstantExpr::getZExt().
|
static |
Definition at line 923 of file Constants.cpp.
References assert(), llvm::ArrayRef< T >::empty(), llvm::Value::getContext(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
|
static |
Definition at line 910 of file Constants.cpp.
References assert(), llvm::ArrayRef< T >::empty(), llvm::Value::getContext(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
|
static |
Definition at line 936 of file Constants.cpp.
Return true if the array is empty or all zeros.
Definition at line 2463 of file Constants.cpp.
References I.
Referenced by llvm::ConstantDataSequential::getImpl().
|
static |
Definition at line 902 of file Constants.cpp.
Referenced by llvm::ConstantArray::get().
If the specified constantexpr is dead, remove it.
This involves recursively eliminating any dead users of the constantexpr.
Definition at line 522 of file Constants.cpp.
References C, llvm::Constant::destroyConstant(), llvm::dyn_cast(), llvm::Value::use_empty(), and llvm::Value::user_back().
Referenced by llvm::Constant::removeDeadConstantUsers().
|
static |
Definition at line 669 of file Constants.cpp.
References assert(), llvm::APFloatBase::IEEEdouble(), llvm::APFloatBase::IEEEhalf(), llvm::APFloatBase::IEEEquad(), llvm::APFloatBase::IEEEsingle(), llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), llvm::Type::isFP128Ty(), llvm::Type::isHalfTy(), llvm::Type::isPPC_FP128Ty(), llvm::Type::isX86_FP80Ty(), llvm::APFloatBase::PPCDoubleDouble(), and llvm::APFloatBase::x87DoubleExtended().
Referenced by llvm::ConstantFP::get(), llvm::ConstantFP::getInfinity(), llvm::ConstantFP::getNaN(), llvm::ConstantFP::getNegativeZero(), llvm::ConstantFP::getQNaN(), and llvm::ConstantFP::getSNaN().