LLVM 17.0.0git
|
#include "llvm/IR/Constants.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/ConstantFold.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalIFunc.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/ErrorHandling.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 | containsUndefinedElement (const Constant *C, function_ref< bool(const Constant *)> HasFn) |
static bool | ConstHasGlobalValuePredicate (const Constant *C, bool(*Predicate)(const GlobalValue *)) |
Check if C contains a GlobalValue for which Predicate is true. | |
static bool | constantIsDead (const Constant *C, bool RemoveDeadUsers) |
Return true if the specified constantexpr is dead. | |
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. | |
static bool | isAllZeros (StringRef Arr) |
Return true if the array is empty or all zeros. | |
#define HANDLE_CONSTANT | ( | Name | ) |
#define HANDLE_CONSTANT | ( | Name | ) |
Return true if the specified constantexpr is dead.
This involves recursively traversing users of the constantexpr. If RemoveDeadUsers is true, also remove dead users at the same time.
Definition at line 679 of file Constants.cpp.
References llvm::CallingConv::C, constantIsDead(), E, I, and llvm::ReplaceableMetadataImpl::SalvageDebugInfo().
Referenced by constantIsDead(), and llvm::Constant::removeDeadConstantUsers().
|
static |
Check if C contains a GlobalValue for which Predicate is true.
Definition at line 570 of file Constants.cpp.
References llvm::CallingConv::C, llvm::SmallVectorBase< Size_T >::empty(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::Constant::isDLLImportDependent(), and llvm::Constant::isThreadDependent().
|
static |
Definition at line 309 of file Constants.cpp.
References llvm::CallingConv::C.
Referenced by llvm::Constant::containsPoisonElement(), llvm::Constant::containsUndefElement(), and llvm::Constant::containsUndefOrPoisonElement().
|
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 1939 of file Constants.cpp.
References assert(), llvm::CallingConv::C, llvm::ConstantFoldCastInstruction(), llvm::LLVMContextImpl::ExprConstants, 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 1174 of file Constants.cpp.
References assert(), llvm::CallingConv::C, getType(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
|
static |
Definition at line 1161 of file Constants.cpp.
References assert(), llvm::CallingConv::C, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
|
static |
Definition at line 1187 of file Constants.cpp.
References llvm::CallingConv::C.
Return true if the array is empty or all zeros.
Definition at line 2811 of file Constants.cpp.
References I.
Referenced by llvm::ConstantDataSequential::getImpl().