1//===-- Analysis.cpp - CodeGen LLVM IR Analysis Utilities -----------------===// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7//===----------------------------------------------------------------------===// 9// This file defines several CodeGen-specific LLVM IR analysis utilities. 11//===----------------------------------------------------------------------===// 30/// Compute the linearized index of a member in a nested aggregate/struct/array 31/// by recursing and accumulating CurIndex as long as there are indices in the 34constunsigned *Indices,
35constunsigned *IndicesEnd,
37// Base case: We're done. 38if (Indices && Indices == IndicesEnd)
41// Given a struct type, recursively traverse the elements. 42if (
StructType *STy = dyn_cast<StructType>(Ty)) {
45if (Indices && *Indices ==
I.index())
49assert(!Indices &&
"Unexpected out of bound");
52// Given an array type, recursively traverse the elements. 53elseif (
ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
54Type *EltTy = ATy->getElementType();
55unsigned NumElts = ATy->getNumElements();
56// Compute the Linear offset when jumping one element of the array 59assert(*Indices < NumElts &&
"Unexpected out of bound");
60// If the indice is inside the array, compute the index to the requested 61// elt and recurse inside the element with the end of the indices list 62 CurIndex += EltLinearOffset* *Indices;
65 CurIndex += EltLinearOffset*NumElts;
68// We haven't found the type we're looking for, so keep searching. 72/// ComputeValueVTs - Given an LLVM IR type, compute a sequence of 73/// EVTs that represent all the individual underlying 74/// non-aggregate types that comprise it. 76/// If Offsets is non-null, it points to a vector to be filled in 77/// with the in-memory offsets of each of the individual values. 85 StartingOffset.
isZero()) &&
86"Offset/TypeSize mismatch!");
87// Given a struct type, recursively traverse the elements. 88if (
StructType *STy = dyn_cast<StructType>(Ty)) {
89// If the Offsets aren't needed, don't query the struct layout. This allows 90// us to support structs with scalable vectors for operations that don't 95 EE = STy->element_end();
97// Don't compute the element offset if we didn't get a StructLayout above. 101 StartingOffset + EltOffset);
105// Given an array type, recursively traverse the elements. 106if (
ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
107Type *EltTy = ATy->getElementType();
109for (
unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
111 StartingOffset + i * EltSize);
114// Interpret void as zero return values. 117// Base case: we can get an EVT for this LLVM IR type. 122 Offsets->push_back(StartingOffset);
145// Given a struct type, recursively traverse the elements. 146if (
StructType *STy = dyn_cast<StructType>(&Ty)) {
147// If the Offsets aren't needed, don't query the struct layout. This allows 148// us to support structs with scalable vectors for operations that don't 151for (
unsignedI = 0, E = STy->getNumElements();
I != E; ++
I) {
154 StartingOffset + EltOffset);
158// Given an array type, recursively traverse the elements. 159if (
ArrayType *ATy = dyn_cast<ArrayType>(&Ty)) {
160Type *EltTy = ATy->getElementType();
161uint64_t EltSize =
DL.getTypeAllocSize(EltTy).getFixedValue();
162for (
unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
164 StartingOffset + i * EltSize);
167// Interpret void as zero return values. 170// Base case: we can get an LLT for this LLVM IR type. 172if (Offsets !=
nullptr)
173 Offsets->push_back(StartingOffset * 8);
176/// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V. 178 V = V->stripPointerCasts();
182if (Var && Var->
getName() ==
"llvm.eh.catch.all.value") {
184"The EH catch-all value must have an initializer");
186 GV = dyn_cast<GlobalValue>(
Init);
187if (!GV) V = cast<ConstantPointerNull>(
Init);
190assert((GV || isa<ConstantPointerNull>(V)) &&
191"TypeInfo must be a global variable or NULL");
195/// getFCmpCondCode - Return the ISD condition code corresponding to 196/// the given LLVM IR floating-point condition code. This includes 197/// consideration of global floating-point math flags. 253return ICmpInst::ICMP_EQ;
255return ICmpInst::ICMP_NE;
257return ICmpInst::ICMP_SLE;
259return ICmpInst::ICMP_ULE;
261return ICmpInst::ICMP_SGE;
263return ICmpInst::ICMP_UGE;
265return ICmpInst::ICMP_SLT;
267return ICmpInst::ICMP_ULT;
269return ICmpInst::ICMP_SGT;
271return ICmpInst::ICMP_UGT;
280 (isa<VectorType>(
T1) && isa<VectorType>(T2) &&
284/// Look through operations that will be free to find the earliest source of 287/// @param ValLoc If V has aggregate type, we will be interested in a particular 288/// scalar component. This records its address; the reverse of this list gives a 289/// sequence of indices appropriate for an extractvalue to locate the important 290/// value. This value is updated during the function and on exit will indicate 291/// similar information for the Value returned. 293/// @param DataBits If this function looks through truncate instructions, this 294/// will record the smallest size attained. 301// Try to look through V1; if V1 is not an instruction, it can't be looked 304if (!
I ||
I->getNumOperands() == 0)
return V;
305constValue *NoopInput =
nullptr;
308if (isa<BitCastInst>(
I)) {
309// Look through truly no-op bitcasts. 312 }
elseif (isa<GetElementPtrInst>(
I)) {
313// Look through getelementptr 314if (cast<GetElementPtrInst>(
I)->hasAllZeroIndices())
316 }
elseif (isa<IntToPtrInst>(
I)) {
317// Look through inttoptr. 318// Make sure this isn't a truncating or extending cast. We could 319// support this eventually, but don't bother for now. 320if (!isa<VectorType>(
I->getType()) &&
321DL.getPointerSizeInBits() ==
322 cast<IntegerType>(
Op->getType())->getBitWidth())
324 }
elseif (isa<PtrToIntInst>(
I)) {
325// Look through ptrtoint. 326// Make sure this isn't a truncating or extending cast. We could 327// support this eventually, but don't bother for now. 328if (!isa<VectorType>(
I->getType()) &&
329DL.getPointerSizeInBits() ==
330 cast<IntegerType>(
I->getType())->getBitWidth())
332 }
elseif (isa<TruncInst>(
I) &&
336I->getType()->getPrimitiveSizeInBits().getFixedValue());
338 }
elseif (
auto *CB = dyn_cast<CallBase>(
I)) {
339constValue *ReturnedOp = CB->getReturnedArgOperand();
341 NoopInput = ReturnedOp;
343// Value may come from either the aggregate or the scalar 345if (ValLoc.
size() >= InsertLoc.
size() &&
346 std::equal(InsertLoc.
begin(), InsertLoc.
end(), ValLoc.
rbegin())) {
347// The type being inserted is a nested sub-type of the aggregate; we 348// have to remove those initial indices to get the location we're 349// interested in for the operand. 351 NoopInput = IVI->getInsertedValueOperand();
353// The struct we're inserting into has the value we're interested in, no 358// The part we're interested in will inevitably be some sub-section of the 359// previous aggregate. Combine the two paths to obtain the true address of 365// Terminate if we couldn't find anything to look through. 373/// Return true if this scalar return value only has bits discarded on its path 374/// from the "tail call" to the "ret". This includes the obvious noop 375/// instructions handled by getNoopInput above as well as free truncations (or 376/// extensions prior to the call). 380bool AllowDifferingSizes,
384// Trace the sub-value needed by the return value as far back up the graph as 385// possible, in the hope that it will intersect with the value produced by the 386// call. In the simple case with no "returned" attribute, the hope is actually 387// that we end up back at the tail call instruction itself. 388unsigned BitsRequired = UINT_MAX;
391// If this slot in the value returned is undef, it doesn't matter what the 392// call puts there, it'll be fine. 393if (isa<UndefValue>(RetVal))
396// Now do a similar search up through the graph to find where the value 397// actually returned by the "tail call" comes from. In the simple case without 398// a "returned" attribute, the search will be blocked immediately and the loop 400unsigned BitsProvided = UINT_MAX;
401 CallVal =
getNoopInput(CallVal, CallIndices, BitsProvided, TLI,
DL);
403// There's no hope if we can't actually trace them to (the same part of!) the 405if (CallVal != RetVal || CallIndices != RetIndices)
408// However, intervening truncates may have made the call non-tail. Make sure 409// all the bits that are needed by the "ret" have been provided by the "tail 410// call". FIXME: with sufficiently cunning bit-tracking, we could look through 412if (BitsProvided < BitsRequired ||
413 (!AllowDifferingSizes && BitsProvided != BitsRequired))
419/// For an aggregate type, determine whether a given index is within bounds or 423returnIdx < AT->getNumElements();
425return Idx < cast<StructType>(
T)->getNumElements();
428/// Move the given iterators to the next leaf type in depth first traversal. 430/// Performs a depth-first traversal of the type as specified by its arguments, 431/// stopping at the next leaf node (which may be a legitimate scalar type or an 432/// empty struct or array). 434/// @param SubTypes List of the partial components making up the type from 435/// outermost to innermost non-empty aggregate. The element currently 436/// represented is SubTypes.back()->getTypeAtIndex(Path.back() - 1). 438/// @param Path Set of extractvalue indices leading from the outermost type 439/// (SubTypes[0]) to the leaf node currently represented. 441/// @returns true if a new type was found, false otherwise. Calling this 442/// function again on a finished iterator will repeatedly return 443/// false. SubTypes.back()->getTypeAtIndex(Path.back()) is either an empty 444/// aggregate or a non-aggregate 447// First march back up the tree until we can successfully increment one of the 448// coordinates in Path. 454// If we reached the top, then the iterator is done. 458// We know there's *some* valid leaf now, so march back down the tree picking 459// out the left-most element at each node. 476/// Find the first non-empty, scalar-like type in Next and setup the iterator 479/// Assuming Next is an aggregate of some kind, this function will traverse the 480/// tree from left to right (i.e. depth-first) looking for the first 481/// non-aggregate type which will play a role in function return. 483/// For example, if Next was {[0 x i64], {{}, i32, {}}, i32} then we would setup 484/// Path as [1, 1] and SubTypes as [Next, {{}, i32, {}}] to represent the first 488// First initialise the iterator components to the first "leaf" node 489// (i.e. node with no valid sub-type at any index, so {} does count as a leaf 490// despite nominally being an aggregate). 497// If there's no Path now, Next was originally scalar already (or empty 502// Otherwise, use normal iteration to keep looking through the tree until we 503// find a non-aggregate type. 513/// Set the iterator data-structures to the next non-empty, non-aggregate 521assert(!Path.empty() &&
"found a leaf but didn't set the path?");
529/// Test if the given instruction is in a position to be optimized 530/// with a tail-call. This roughly means that it's in a block with 531/// a return and there's nothing that needs to be scheduled 532/// between it and the return. 534/// This function only tests target-independent requirements. 536bool ReturnsFirstArg) {
539constReturnInst *Ret = dyn_cast<ReturnInst>(Term);
541// The block must end in a return statement or unreachable. 543// FIXME: Decline tailcall if it's not guaranteed and if the block ends in 544// an unreachable, for now. The way tailcall optimization is currently 545// implemented means it will add an epilogue followed by a jump. That is 546// not profitable. Also, if the callee is a special function (e.g. 547// longjmp on x86), it can end up causing miscompilation that has not 548// been fully understood. 549if (!Ret && ((!TM.Options.GuaranteedTailCallOpt &&
552 !isa<UnreachableInst>(Term)))
555// If I will have a chain, make sure no other instruction that will have a 556// chain interposes between I and the return. 557// Check for all calls including speculatable functions. 561// Debug info intrinsics do not get in the way of tail call optimization. 562// Pseudo probe intrinsics do not block tail call optimization either. 563if (BBI->isDebugOrPseudoInst())
565// A lifetime end, assume or noalias.decl intrinsic should not stop tail 568if (
II->getIntrinsicID() == Intrinsic::lifetime_end ||
569II->getIntrinsicID() == Intrinsic::assume ||
570II->getIntrinsicID() == Intrinsic::experimental_noalias_scope_decl ||
571II->getIntrinsicID() == Intrinsic::fake_use)
573if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() ||
580F, &Call, Ret, *TM.getSubtargetImpl(*F)->getTargetLowering(),
587bool *AllowDifferingSizes) {
588// ADS may be null, so don't write to it directly. 590bool &ADS = AllowDifferingSizes ? *AllowDifferingSizes : DummyADS;
593AttrBuilder CallerAttrs(
F->getContext(),
F->getAttributes().getRetAttrs());
595 cast<CallInst>(
I)->getAttributes().getRetAttrs());
597// Following attributes are completely benign as far as calling convention 598// goes, they shouldn't affect whether the call is a tail call. 599for (
constauto &Attr : {Attribute::Alignment, Attribute::Dereferenceable,
600 Attribute::DereferenceableOrNull, Attribute::NoAlias,
601 Attribute::NonNull, Attribute::NoUndef,
602 Attribute::Range, Attribute::NoFPClass}) {
607if (CallerAttrs.
contains(Attribute::ZExt)) {
608if (!CalleeAttrs.
contains(Attribute::ZExt))
614 }
elseif (CallerAttrs.
contains(Attribute::SExt)) {
615if (!CalleeAttrs.
contains(Attribute::SExt))
623// Drop sext and zext return attributes if the result is not used. 624// This enables tail calls for code like: 626// define void @caller() { 628// %unused_result = tail call zeroext i1 @callee() 638// If they're still different, there's some facet we don't understand 639// (currently only "inreg", but in future who knows). It may be OK but the 640// only safe option is to reject the tail call. 641return CallerAttrs == CalleeAttrs;
648bool ReturnsFirstArg) {
649// If the block ends with a void return or unreachable, it doesn't matter 650// what the call's return type is. 651if (!Ret || Ret->getNumOperands() == 0)
returntrue;
653// If the return value is undef, it doesn't matter what the call's 655if (isa<UndefValue>(Ret->getOperand(0)))
returntrue;
657// Make sure the attributes attached to each return are compatible. 658bool AllowDifferingSizes;
662// If the return value is the first argument of the call. 666constValue *RetVal = Ret->getOperand(0), *CallVal =
I;
671bool CallEmpty = !
firstRealType(CallVal->getType(), CallSubTypes, CallPath);
673// Nothing's actually returned, it doesn't matter what the callee put there 674// it's a valid tail call. 678// Iterate pairwise through each of the value types making up the tail call 679// and the corresponding return. For each one we want to know whether it's 680// essentially going directly from the tail call to the ret, via operations 681// that end up not generating any code. 683// We allow a certain amount of covariance here. For example it's permitted 684// for the tail call to define more bits than the ret actually cares about 685// (e.g. via a truncate). 688// We've exhausted the values produced by the tail call instruction, the 689// rest are essentially undef. The type doesn't really matter, but we need 696// The manipulations performed when we're looking through an insertvalue or 697// an extractvalue would happen at the front of the RetPath list, so since 698// we have to copy it anyway it's more efficient to create a reversed copy. 702// Finally, we can check whether the value produced by the tail call at this 703// index is compatible with the value we return. 705 AllowDifferingSizes, TLI,
717Value *RetVal = Ret ? Ret->getReturnValue() :
nullptr;
718bool ReturnsFirstArg =
false;
720 ReturnsFirstArg =
true;
721return ReturnsFirstArg;
728while (!Worklist.
empty()) {
730// Don't follow blocks which start new scopes. 734// Add this MBB to our scope. 735autoP = EHScopeMembership.
insert(std::make_pair(Visiting, EHScope));
737// Don't revisit blocks. 739assert(
P.first->second == EHScope &&
"MBB is part of two scopes!");
743// Returns are boundaries where scope transfer can occur, don't follow 756// We don't have anything to do if there aren't any EH pads. 758return EHScopeMembership;
780// CatchPads are not scopes for SEH so do not consider CatchRet to 781// transfer control to another scope. 785// FIXME: SEH CatchPads are not necessarily in the parent function: 786// they could be inside a finally block. 793// We don't have anything to do if there aren't any EH pads. 794if (EHScopeBlocks.
empty())
795return EHScopeMembership;
797// Identify all the basic blocks reachable from the function entry. 799// All blocks not part of a scope are in the parent function. 802// Next, identify all the blocks inside the scopes. 805// SEH CatchPads aren't really scopes, handle them separately. 808// Finally, identify all the targets of a catchret. 809for (std::pair<const MachineBasicBlock *, int> CatchRetPair :
813return EHScopeMembership;
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static bool isNoopBitcast(Type *T1, Type *T2, const TargetLoweringBase &TLI)
static bool firstRealType(Type *Next, SmallVectorImpl< Type * > &SubTypes, SmallVectorImpl< unsigned > &Path)
Find the first non-empty, scalar-like type in Next and setup the iterator components.
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...
static void collectEHScopeMembers(DenseMap< const MachineBasicBlock *, int > &EHScopeMembership, int EHScope, const MachineBasicBlock *MBB)
static bool indexReallyValid(Type *T, unsigned Idx)
For an aggregate type, determine whether a given index is within bounds or not.
static bool nextRealType(SmallVectorImpl< Type * > &SubTypes, SmallVectorImpl< unsigned > &Path)
Set the iterator data-structures to the next non-empty, non-aggregate subtype.
static bool advanceToNextLeafType(SmallVectorImpl< Type * > &SubTypes, SmallVectorImpl< unsigned > &Path)
Move the given iterators to the next leaf type in depth first traversal.
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.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
const HexagonInstrInfo * TII
Module.h This file contains the declarations for the Module class.
uint64_t IntrinsicInst * II
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file describes how to lower LLVM code to machine code.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
reverse_iterator rend() const
size_t size() const
size - Get the array size.
reverse_iterator rbegin() const
Class to represent array types.
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
LLVM Basic Block Representation.
InstListType::const_iterator const_iterator
const Function * getParent() const
Return the enclosing method, or null if none.
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...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Value * getArgOperand(unsigned i) const
This class represents a function call, abstracting a target machine's calling convention.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
This instruction extracts a struct member or array element value from an aggregate value.
static Type * getIndexedType(Type *Agg, ArrayRef< unsigned > Idxs)
Returns the type of the element that would be extracted with an extractvalue instruction with the spe...
Constant * getPersonalityFn() const
Get the personality function associated with this function.
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
bool hasInitializer() const
Definitions have initializers, declarations don't.
This instruction inserts a struct field of array element value into an aggregate value.
A wrapper class for inspecting calls to intrinsic functions.
bool isEHPad() const
Returns true if the block is a landing pad.
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
bool isEHScopeEntry() const
Returns true if this is the entry block of an EH scope, i.e., the block that used to have a catchpad ...
iterator_range< succ_iterator > successors()
bool isEHScopeReturnBlock() const
Convenience function that returns true if the bock ends in a EH scope return instruction.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineBasicBlock & front() const
Return a value (possibly void), from a function.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
reverse_iterator rbegin()
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
TypeSize getElementOffset(unsigned Idx) const
Class to represent struct types.
Type::subtype_iterator element_iterator
TargetInstrInfo - Interface to description of machine instruction set.
This base class for TargetLowering contains the SelectionDAG-independent parts that can be used from ...
EVT getMemValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
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 ...
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Primary interface to the complete machine description for the target machine.
virtual const TargetInstrInfo * getInstrInfo() const
static constexpr TypeSize getFixed(ScalarTy ExactSize)
static constexpr TypeSize getZero()
The instances of the Type class are immutable: once they are created, they are never changed.
bool isPointerTy() const
True if this is an instance of PointerType.
bool isAggregateType() const
Return true if the type is an aggregate type.
bool isScalableTy(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this is a type whose size is a known multiple of vscale.
bool isVoidTy() const
Return true if this is 'void'.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
StringRef getName() const
Return a constant reference to the value's name.
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr bool isZero() const
const ParentTy * getParent() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
@ SwiftTail
This follows the Swift calling convention in how arguments are passed but guarantees tail calls will ...
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
This is an optimization pass for GlobalISel generic memory operations.
ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred)
getICmpCondCode - Return the ISD condition code corresponding to the given LLVM IR integer condition ...
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
auto reverse(ContainerTy &&C)
bool returnTypeIsEligibleForTailCall(const Function *F, const Instruction *I, const ReturnInst *Ret, const TargetLoweringBase &TLI, bool ReturnsFirstArg=false)
Test if given that the input instruction is in the tail call position if the return type or any attri...
void computeValueLLTs(const DataLayout &DL, Type &Ty, SmallVectorImpl< LLT > &ValueTys, SmallVectorImpl< uint64_t > *Offsets=nullptr, uint64_t StartingOffset=0)
computeValueLLTs - Given an LLVM IR type, compute a sequence of LLTs that represent all the individua...
bool isSafeToSpeculativelyExecute(const Instruction *I, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr, bool UseVariableInfo=true)
Return true if the instruction does not have any effects besides calculating the result and does not ...
ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred)
getFCmpCondCode - Return the ISD condition code corresponding to the given LLVM IR floating-point con...
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
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...
bool isInTailCallPosition(const CallBase &Call, const TargetMachine &TM, bool ReturnsFirstArg=false)
Test if the given instruction is in a position to be optimized with a tail-call.
DWARFExpression::Operation Op
ISD::CondCode getFCmpCodeWithoutNaN(ISD::CondCode CC)
getFCmpCodeWithoutNaN - Given an ISD condition code comparing floats, return the equivalent code if w...
void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty, SmallVectorImpl< EVT > &ValueVTs, SmallVectorImpl< EVT > *MemVTs, SmallVectorImpl< TypeSize > *Offsets=nullptr, TypeSize StartingOffset=TypeSize::getZero())
ComputeValueVTs - Given an LLVM IR type, compute a sequence of EVTs that represent all the individual...
bool isAsynchronousEHPersonality(EHPersonality Pers)
Returns true if this personality function catches asynchronous exceptions.
bool funcReturnsFirstArgOfCall(const CallInst &CI)
Returns true if the parent of CI returns CI's first argument after calling CI.
GlobalValue * ExtractTypeInfo(Value *V)
ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
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.
DenseMap< const MachineBasicBlock *, int > getEHScopeMembership(const MachineFunction &MF)
LLT getLLTForType(Type &Ty, const DataLayout &DL)
Construct a low-level type based on an LLVM type.
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.