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) &&
275 const Value *ReturnedOp = CS.getReturnedArgOperand();
277 NoopInput = ReturnedOp;
278 }
else if (
const InsertValueInst *IVI = dyn_cast<InsertValueInst>(V)) {
281 if (ValLoc.
size() >= InsertLoc.
size() &&
287 NoopInput = IVI->getInsertedValueOperand();
316 bool AllowDifferingSizes,
324 unsigned BitsRequired = UINT_MAX;
325 RetVal =
getNoopInput(RetVal, RetIndices, BitsRequired, TLI, DL);
329 if (isa<UndefValue>(RetVal))
336 unsigned BitsProvided = UINT_MAX;
337 CallVal =
getNoopInput(CallVal, CallIndices, BitsProvided, TLI, DL);
341 if (CallVal != RetVal || CallIndices != RetIndices)
348 if (BitsProvided < BitsRequired ||
349 (!AllowDifferingSizes && BitsProvided != BitsRequired))
358 if (
ArrayType *AT = dyn_cast<ArrayType>(T))
359 return Idx < AT->getNumElements();
361 return Idx < cast<StructType>(
T)->getNumElements();
430 SubTypes.
push_back(cast<CompositeType>(Next));
432 Next = cast<CompositeType>(Next)->getTypeAtIndex(0U);
458 assert(!Path.
empty() &&
"found a leaf but didn't set the path?");
497 if (isa<DbgInfoIntrinsic>(BBI))
503 if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() ||
516 bool *AllowDifferingSizes) {
519 bool &ADS = AllowDifferingSizes ? *AllowDifferingSizes : DummyADS;
567 return CallerAttrs == CalleeAttrs;
580 if (isa<UndefValue>(Ret->
getOperand(0)))
return true;
583 bool AllowDifferingSizes;
593 const CallInst *Call = cast<CallInst>(
I);
643 AllowDifferingSizes, TLI,
657 while (!Worklist.
empty()) {
660 if (Visiting->
isEHPad() && Visiting != MBB)
664 auto P = EHScopeMembership.
insert(std::make_pair(Visiting, EHScope));
668 assert(
P.first->second == EHScope &&
"MBB is part of two scopes!");
688 return EHScopeMembership;
700 if (MBB.isEHScopeEntry()) {
702 }
else if (IsSEH && MBB.isEHPad()) {
704 }
else if (MBB.pred_empty()) {
724 if (EHScopeBlocks.
empty())
725 return EHScopeMembership;
739 for (std::pair<const MachineBasicBlock *, int> CatchRetPair :
743 return EHScopeMembership;
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
Return a value (possibly void), from a function.
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 ...
bool isEHScopeReturnBlock() const
Convenience function that returns true if the bock ends in a EH scope return instruction.
This class represents lattice values for constants.
const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
void push_back(const T &Elt)
This class represents a function call, abstracting a target machine's calling convention.
virtual const TargetLowering * getTargetLowering() const
reverse_iterator rbegin() const
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.
0 1 0 0 True if ordered and less than
1 1 1 0 True if unordered or not equal
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
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...
iterator_range< succ_iterator > successors()
Value * getArgOperand(unsigned i) const
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
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)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
const HexagonInstrInfo * TII
Class to represent struct types.
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
InstrTy * getInstruction() const
unsigned getCatchReturnOpcode() const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
Type * getType() const
All values are typed, get the type of this value.
Class to represent array types.
AttributeList getAttributes() const
Return the attribute list for this Function.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
virtual const TargetInstrInfo * getInstrInfo() const
ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred)
getFCmpCondCode - Return the ISD condition code corresponding to the given LLVM IR floating-point con...
Type::subtype_iterator element_iterator
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...
Value * getOperand(unsigned i) const
bool hasInlineAsmMemConstraint(InlineAsm::ConstraintInfoVector &CInfos, const TargetLowering &TLI)
hasInlineAsmMemConstraint - Return true if the inline asm instruction being processed uses a memory '...
TargetInstrInfo - Interface to description of machine instruction set.
bool isVoidTy() const
Return true if this is 'void'.
static bool indexReallyValid(CompositeType *T, unsigned Idx)
For an aggregate type, determine whether a given index is within bounds or not.
static bool nextRealType(SmallVectorImpl< CompositeType *> &SubTypes, SmallVectorImpl< unsigned > &Path)
Set the iterator data-structures to the next non-empty, non-aggregate subtype.
LLVM Basic Block Representation.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
The instances of the Type class are immutable: once they are created, they are never changed...
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
bool isIndirect
isIndirect - True if this operand is an indirect operand.
size_t size() const
size - Get the array size.
bool isPointerTy() const
True if this is an instance of PointerType.
bool mayHaveSideEffects() const
Return true if the instruction may have side effects.
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline...
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.
0 1 1 1 True if ordered (no nans)
1 1 1 1 Always true (always folded)
virtual bool allowTruncateForTailCall(Type *FromTy, Type *ToTy) const
Return true if a truncation from FromTy to ToTy is permitted when deciding whether a call is in tail ...
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
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...
const MachineBasicBlock & front() const
1 1 0 1 True if unordered, less than, or equal
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
bool isInTailCallPosition(ImmutableCallSite CS, const TargetMachine &TM)
Test if the given instruction is in a position to be optimized with a tail-call.
std::vector< ConstraintInfo > ConstraintInfoVector
This base class for TargetLowering contains the SelectionDAG-independent parts that can be used from ...
0 0 1 0 True if ordered and greater than
Iterator for intrusive lists based on ilist_node.
unsigned getNumOperands() const
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.
bool isAggregateType() const
Return true if the type is an aggregate type.
LLVM_NODISCARD T pop_back_val()
DenseMap< const MachineBasicBlock *, int > getEHScopeMembership(const MachineFunction &MF)
static bool advanceToNextLeafType(SmallVectorImpl< CompositeType *> &SubTypes, SmallVectorImpl< unsigned > &Path)
Move the given iterators to the next leaf type in depth first traversal.
ISD::CondCode getFCmpCodeWithoutNaN(ISD::CondCode CC)
getFCmpCodeWithoutNaN - Given an ISD condition code comparing floats, return the equivalent code if w...
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
const Function & getFunction() const
Return the LLVM function that this machine code represents.
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Common super class of ArrayType, StructType and VectorType.
static void collectEHScopeMembers(DenseMap< const MachineBasicBlock *, int > &EHScopeMembership, int EHScope, const MachineBasicBlock *MBB)
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
reverse_iterator rend() const
uint64_t getElementOffset(unsigned Idx) const
bool isEHPad() const
Returns true if the block is a landing pad.
LLVM_NODISCARD bool empty() const
unsigned greater or equal
Establish a view to a call site for examination.
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
const Function * getParent() const
Return the enclosing method, or null if none.
bool mayReadFromMemory() const
Return true if this instruction may read memory.
0 1 1 0 True if ordered and operands are unequal
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
1 0 1 0 True if unordered or greater than
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
reverse_iterator rbegin()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isAsynchronousEHPersonality(EHPersonality Pers)
Returns true if this personality function catches asynchronous exceptions.
bool isSafeToSpeculativelyExecute(const Value *V, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr)
Return true if the instruction does not have any effects besides calculating the result and does not ...
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
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.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
1 0 1 1 True if unordered, greater than, or equal
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
bool attributesPermitTailCall(const Function *F, const Instruction *I, const ReturnInst *Ret, const TargetLoweringBase &TLI, bool *AllowDifferingSizes=nullptr)
Test if given that the input instruction is in the tail call position, if there is an attribute misma...
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.
0 0 0 0 Always false (always folded)
A wrapper class for inspecting calls to intrinsic functions.
This file describes how to lower LLVM code to machine code.
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
const BasicBlock * getParent() const
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
This instruction inserts a struct field of array element value into an aggregate value.