37 const unsigned *Indices,
38 const unsigned *IndicesEnd,
41 if (Indices && Indices == IndicesEnd)
45 if (
StructType *STy = dyn_cast<StructType>(Ty)) {
48 EE = STy->element_end();
50 if (Indices && *Indices ==
unsigned(EI - EB))
54 assert(!Indices &&
"Unexpected out of bound");
58 else if (
ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
59 Type *EltTy = ATy->getElementType();
60 unsigned NumElts = ATy->getNumElements();
64 assert(*Indices < NumElts &&
"Unexpected out of bound");
67 CurIndex += EltLinearOffset* *Indices;
70 CurIndex += EltLinearOffset*NumElts;
87 uint64_t StartingOffset) {
89 if (
StructType *STy = dyn_cast<StructType>(Ty)) {
93 EE = STy->element_end();
100 if (
ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
101 Type *EltTy = ATy->getElementType();
103 for (
unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
105 StartingOffset + i * EltSize);
123 if (Var && Var->getName() ==
"llvm.eh.catch.all.value") {
124 assert(Var->hasInitializer() &&
125 "The EH catch-all value must have an initializer");
128 if (!GV) V = cast<ConstantPointerNull>(Init);
131 assert((GV || isa<ConstantPointerNull>(V)) &&
132 "TypeInfo must be a global variable or NULL");
141 for (
unsigned i = 0, e = CInfos.size(); i != e; ++i) {
143 for (
unsigned j = 0, ee = CI.
Codes.size(); j != ee; ++j) {
218 (isa<VectorType>(T1) && isa<VectorType>(T2) &&
243 const Value *NoopInput =
nullptr;
246 if (isa<BitCastInst>(I)) {
250 }
else if (isa<GetElementPtrInst>(I)) {
252 if (cast<GetElementPtrInst>(I)->hasAllZeroIndices())
254 }
else if (isa<IntToPtrInst>(I)) {
258 if (!isa<VectorType>(I->
getType()) &&
262 }
else if (isa<PtrToIntInst>(I)) {
266 if (!isa<VectorType>(I->
getType()) &&
270 }
else if (isa<TruncInst>(I) &&
274 }
else if (isa<CallInst>(I)) {
278 unsigned attrInd = i - I->
op_begin() + 1;
285 }
else if (isa<InvokeInst>(I)) {
289 unsigned attrInd = i - I->
op_begin() + 1;
296 }
else if (
const InsertValueInst *IVI = dyn_cast<InsertValueInst>(V)) {
299 if (ValLoc.
size() >= InsertLoc.
size() &&
305 NoopInput = IVI->getInsertedValueOperand();
334 bool AllowDifferingSizes,
342 unsigned BitsRequired = UINT_MAX;
343 RetVal =
getNoopInput(RetVal, RetIndices, BitsRequired, TLI, DL);
347 if (isa<UndefValue>(RetVal))
354 unsigned BitsProvided = UINT_MAX;
355 CallVal =
getNoopInput(CallVal, CallIndices, BitsProvided, TLI, DL);
359 if (CallVal != RetVal || CallIndices != RetIndices)
366 if (BitsProvided < BitsRequired ||
367 (!AllowDifferingSizes && BitsProvided != BitsRequired))
376 if (
ArrayType *AT = dyn_cast<ArrayType>(T))
377 return Idx < AT->getNumElements();
379 return Idx < cast<StructType>(
T)->getNumElements();
448 SubTypes.
push_back(cast<CompositeType>(Next));
450 Next = cast<CompositeType>(Next)->getTypeAtIndex(0U);
476 assert(!Path.
empty() &&
"found a leaf but didn't set the path?");
515 if (isa<DbgInfoIntrinsic>(BBI))
517 if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() ||
537 if (isa<UndefValue>(Ret->
getOperand(0)))
return true;
550 bool AllowDifferingSizes =
true;
555 AllowDifferingSizes =
false;
562 AllowDifferingSizes =
false;
570 if (CallerAttrs != CalleeAttrs)
611 AllowDifferingSizes, TLI,
631 if (!Var->isConstant())
637 if (isa<GlobalAlias>(GV))
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type (if unknown returns 0).
ReturnInst - Return a value (possibly void), from a function.
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred)
getICmpCondCode - Return the ISD condition code corresponding to the given LLVM IR integer condition ...
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
Sign extended before/after call.
InstrTy * getInstruction() const
bool canBeOmittedFromSymbolTable(const GlobalValue *GV)
unsigned getNumOperands() const
virtual bool allowTruncateForTailCall(Type *, Type *) const
Return true if a truncation from Ty1 to Ty2 is permitted when deciding whether a call is in tail posi...
static const Value * getNoopInput(const Value *V, SmallVectorImpl< unsigned > &ValLoc, unsigned &DataBits, const TargetLoweringBase &TLI, const DataLayout &DL)
Look through operations that will be free to find the earliest source of this value.
bool mayHaveSideEffects() const
mayHaveSideEffects - Return true if the instruction may have side effects.
0 1 0 0 True if ordered and less than
1 1 1 0 True if unordered or not equal
const Function * getParent() const
Return the enclosing method, or null if none.
GlobalValue * ExtractTypeInfo(Value *V)
ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
bool returnTypeIsEligibleForTailCall(const Function *F, const Instruction *I, const ReturnInst *Ret, const TargetLoweringBase &TLI)
Test if given that the input instruction is in the tail call position if the return type or any attri...
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number...
1 0 0 1 True if unordered or equal
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Type::subtype_iterator element_iterator
const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
StructType - Class to represent struct types.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
A Use represents the edge between a Value definition and its users.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
0 1 0 1 True if ordered and less than or equal
Number of individual test Apply this number of consecutive mutations to each input exit after the first new interesting input is found the minimized corpus is saved into the first input directory Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool mayReadFromMemory() const
mayReadFromMemory - Return true if this instruction may read memory.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
reverse_iterator rbegin() const
ArrayType - Class to represent array types.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
static bool nextRealType(SmallVectorImpl< CompositeType * > &SubTypes, SmallVectorImpl< unsigned > &Path)
Set the iterator data-structures to the next non-empty, non-aggregate subtype.
ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred)
getFCmpCondCode - Return the ISD condition code corresponding to the given LLVM IR floating-point con...
size_t size() const
size - Get the array size.
Considered to not alias after call.
void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty, SmallVectorImpl< EVT > &ValueVTs, SmallVectorImpl< uint64_t > *Offsets=nullptr, uint64_t StartingOffset=0)
ComputeValueVTs - Given an LLVM IR type, compute a sequence of EVTs that represent all the individual...
bool hasInlineAsmMemConstraint(InlineAsm::ConstraintInfoVector &CInfos, const TargetLowering &TLI)
hasInlineAsmMemConstraint - Return true if the inline asm instruction being processed uses a memory '...
uint64_t getElementOffset(unsigned Idx) const
static bool indexReallyValid(CompositeType *T, unsigned Idx)
For an aggregate type, determine whether a given index is within bounds or not.
reverse_iterator rend() const
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
As we analyze each global, keep track of some information about it.
Subclasses of this class are all able to terminate a basic block.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
bool isIndirect
isIndirect - True if this operand is an indirect operand.
Return value is always equal to this argument.
Type * getTypeAtIndex(const Value *V)
getTypeAtIndex - Given an index value into the type, return the type of the element.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline...
Value * getOperand(unsigned i) const
Zero extended before/after call.
0 1 1 1 True if ordered (no nans)
static bool analyzeGlobal(const Value *V, GlobalStatus &GS)
Look at all uses of the global and fill in the GlobalStatus structure.
1 1 1 1 Always true (always folded)
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool isPointerTy() const
isPointerTy - True if this is an instance of PointerType.
static UndefValue * get(Type *T)
get() - Static factory methods - Return an 'undef' object of the specified type.
static bool slotOnlyDiscardsData(const Value *RetVal, const Value *CallVal, SmallVectorImpl< unsigned > &RetIndices, SmallVectorImpl< unsigned > &CallIndices, bool AllowDifferingSizes, const TargetLoweringBase &TLI, const DataLayout &DL)
Return true if this scalar return value only has bits discarded on its path from the "tail call" to t...
1 1 0 1 True if unordered, less than, or equal
bool isInTailCallPosition(ImmutableCallSite CS, const TargetMachine &TM)
Test if the given instruction is in a position to be optimized with a tail-call.
This base class for TargetLowering contains the SelectionDAG-independent parts that can be used from ...
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
0 0 1 0 True if ordered and greater than
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
static bool isNoopBitcast(Type *T1, Type *T2, const TargetLoweringBase &TLI)
1 1 0 0 True if unordered or less than
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
virtual const TargetLowering * getTargetLowering() const
Value * stripPointerCasts()
Strip off pointer casts, all-zero GEPs, and aliases.
ISD::CondCode getFCmpCodeWithoutNaN(ISD::CondCode CC)
getFCmpCodeWithoutNaN - Given an ISD condition code comparing floats, return the equivalent code if w...
AttributeSet getAttributes() const
Return the attribute list for this Function.
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
CompositeType - Common super class of ArrayType, StructType, PointerType and VectorType.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
bool isAggregateType() const
isAggregateType - Return true if the type is an aggregate type.
bool IsCompared
True if the global's address is used in a comparison.
unsigned greater or equal
ImmutableCallSite - establish a view to a call site for examination.
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
bool hasLinkOnceODRLinkage() const
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
0 1 1 0 True if ordered and operands are unequal
1 0 1 0 True if unordered or greater than
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
getEVT - Return the value type corresponding to the specified type.
AttributeSet getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
reverse_iterator rbegin()
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
getPrimitiveSizeInBits - Return the basic size of this type if it is a primitive type.
0 0 0 1 True if ordered and equal
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
bool hasUnnamedAddr() const
1 0 1 1 True if unordered, greater than, or equal
Primary interface to the complete machine description for the target machine.
static bool advanceToNextLeafType(SmallVectorImpl< CompositeType * > &SubTypes, SmallVectorImpl< unsigned > &Path)
Move the given iterators to the next leaf type in depth first traversal.
bool isSafeToSpeculativelyExecute(const Value *V, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr)
isSafeToSpeculativelyExecute - Return true if the instruction does not have any effects besides calcu...
0 0 1 1 True if ordered and greater than or equal
unsigned ComputeLinearIndex(Type *Ty, const unsigned *Indices, const unsigned *IndicesEnd, unsigned CurIndex=0)
Compute the linearized index of a member in a nested aggregate/struct/array.
std::vector< ConstraintInfo > ConstraintInfoVector
const BasicBlock * getParent() const
0 0 0 0 Always false (always folded)
This file describes how to lower LLVM code to machine code.
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.
InsertValueInst - This instruction inserts a struct field of array element value into an aggregate va...
static bool firstRealType(Type *Next, SmallVectorImpl< CompositeType * > &SubTypes, SmallVectorImpl< unsigned > &Path)
Find the first non-empty, scalar-like type in Next and setup the iterator components.