LLVM API Documentation
#include "llvm/CodeGen/Analysis.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include "llvm/Transforms/Utils/GlobalStatus.h"
Go to the source code of this file.
Functions | |
static bool | isNoopBitcast (Type *T1, Type *T2, const TargetLoweringBase &TLI) |
static const Value * | getNoopInput (const Value *V, SmallVectorImpl< unsigned > &ValLoc, unsigned &DataBits, const TargetLoweringBase &TLI) |
static bool | slotOnlyDiscardsData (const Value *RetVal, const Value *CallVal, SmallVectorImpl< unsigned > &RetIndices, SmallVectorImpl< unsigned > &CallIndices, bool AllowDifferingSizes, const TargetLoweringBase &TLI) |
static bool | indexReallyValid (CompositeType *T, unsigned Idx) |
static bool | advanceToNextLeafType (SmallVectorImpl< CompositeType * > &SubTypes, SmallVectorImpl< unsigned > &Path) |
static bool | firstRealType (Type *Next, SmallVectorImpl< CompositeType * > &SubTypes, SmallVectorImpl< unsigned > &Path) |
static bool | nextRealType (SmallVectorImpl< CompositeType * > &SubTypes, SmallVectorImpl< unsigned > &Path) |
static bool advanceToNextLeafType | ( | SmallVectorImpl< CompositeType * > & | SubTypes, |
SmallVectorImpl< unsigned > & | Path | ||
) | [static] |
Move the given iterators to the next leaf type in depth first traversal.
Performs a depth-first traversal of the type as specified by its arguments, stopping at the next leaf node (which may be a legitimate scalar type or an empty struct or array).
SubTypes | List of the partial components making up the type from outermost to innermost non-empty aggregate. The element currently represented is SubTypes.back()->getTypeAtIndex(Path.back() - 1). |
Path | Set of extractvalue indices leading from the outermost type (SubTypes[0]) to the leaf node currently represented. |
Definition at line 391 of file CodeGen/Analysis.cpp.
References llvm::SmallVectorTemplateCommon< T >::back(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorBase::empty(), llvm::CompositeType::getTypeAtIndex(), indexReallyValid(), llvm::Type::isAggregateType(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::pop_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::pop_back(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Referenced by firstRealType(), and nextRealType().
static bool firstRealType | ( | Type * | Next, |
SmallVectorImpl< CompositeType * > & | SubTypes, | ||
SmallVectorImpl< unsigned > & | Path | ||
) | [static] |
Find the first non-empty, scalar-like type in Next and setup the iterator components.
Assuming Next is an aggregate of some kind, this function will traverse the tree from left to right (i.e. depth-first) looking for the first non-aggregate type which will play a role in function return.
For example, if Next was {[0 x i64], {{}, i32, {}}, i32} then we would setup Path as [1, 1] and SubTypes as [Next, {{}, i32, {}}] to represent the first i32 in that type.
Definition at line 432 of file CodeGen/Analysis.cpp.
References advanceToNextLeafType(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::SmallVectorBase::empty(), llvm::CompositeType::getTypeAtIndex(), indexReallyValid(), llvm::Type::isAggregateType(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by llvm::returnTypeIsEligibleForTailCall().
static const Value* getNoopInput | ( | const Value * | V, |
SmallVectorImpl< unsigned > & | ValLoc, | ||
unsigned & | DataBits, | ||
const TargetLoweringBase & | TLI | ||
) | [static] |
Look through operations that will be free to find the earliest source of this value.
ValLoc | If V has aggegate type, we will be interested in a particular scalar component. This records its address; the reverse of this list gives a sequence of indices appropriate for an extractvalue to locate the important value. This value is updated during the function and on exit will indicate similar information for the Value returned. |
DataBits | If this function looks through truncate instructions, this will record the smallest size attained. |
Definition at line 226 of file CodeGen/Analysis.cpp.
References llvm::TargetLoweringBase::allowTruncateForTailCall(), llvm::dyn_cast(), llvm::lltok::equal, getBitWidth(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::TargetLoweringBase::getPointerTy(), llvm::Type::getPrimitiveSizeInBits(), llvm::MVT::getSizeInBits(), llvm::Value::getType(), I, isNoopBitcast(), llvm::User::op_begin(), llvm::User::op_end(), llvm::ArrayRef< T >::rbegin(), llvm::SmallVectorTemplateCommon< T, typename >::rbegin(), llvm::ArrayRef< T >::rend(), llvm::SmallVectorImpl< T >::resize(), llvm::Attribute::Returned, llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::ArrayRef< T >::size().
Referenced by slotOnlyDiscardsData().
static bool indexReallyValid | ( | CompositeType * | T, |
unsigned | Idx | ||
) | [static] |
For an aggregate type, determine whether a given index is within bounds or not.
Definition at line 367 of file CodeGen/Analysis.cpp.
References T.
Referenced by advanceToNextLeafType(), and firstRealType().
static bool isNoopBitcast | ( | Type * | T1, |
Type * | T2, | ||
const TargetLoweringBase & | TLI | ||
) | [static] |
Definition at line 208 of file CodeGen/Analysis.cpp.
References llvm::EVT::getEVT(), llvm::Type::isPointerTy(), and llvm::TargetLoweringBase::isTypeLegal().
Referenced by getNoopInput().
static bool nextRealType | ( | SmallVectorImpl< CompositeType * > & | SubTypes, |
SmallVectorImpl< unsigned > & | Path | ||
) | [static] |
Set the iterator data-structures to the next non-empty, non-aggregate subtype.
Definition at line 462 of file CodeGen/Analysis.cpp.
References advanceToNextLeafType(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::SmallVectorBase::empty(), and llvm::CompositeType::getTypeAtIndex().
Referenced by llvm::returnTypeIsEligibleForTailCall().
static bool slotOnlyDiscardsData | ( | const Value * | RetVal, |
const Value * | CallVal, | ||
SmallVectorImpl< unsigned > & | RetIndices, | ||
SmallVectorImpl< unsigned > & | CallIndices, | ||
bool | AllowDifferingSizes, | ||
const TargetLoweringBase & | TLI | ||
) | [static] |
Return true if this scalar return value only has bits discarded on its path from the "tail call" to the "ret". This includes the obvious noop instructions handled by getNoopInput above as well as free truncations (or extensions prior to the call).
Definition at line 324 of file CodeGen/Analysis.cpp.
References getNoopInput().
Referenced by llvm::returnTypeIsEligibleForTailCall().