LLVM 22.0.0git
|
#include "llvm/Transforms/IPO/Attributor.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumeBundleQueries.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/CycleAnalysis.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LazyValueInfo.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Assumptions.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/IntrinsicsNVPTX.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/NoFolder.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/InterleavedRange.h"
#include "llvm/Support/KnownFPClass.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/TypeSize.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/CallPromotionUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <cassert>
#include <numeric>
#include <optional>
#include <string>
Go to the source code of this file.
Classes | |
struct | llvm::DenseMapInfo< AAPointerInfo::Access > |
Helper for AA::PointerInfo::Access DenseMap/Set usage. More... | |
struct | llvm::DenseMapInfo< AA::RangeTy > |
Helper that allows RangeTy as a key in a DenseMap. More... | |
struct | llvm::AccessAsInstructionInfo |
Helper for AA::PointerInfo::Access DenseMap/Set usage ignoring everythign but the instruction. More... | |
struct | llvm::AA::PointerInfo::State |
A type to track pointer/struct usage and accesses for AAPointerInfo. More... | |
struct | ReachabilityQueryInfo< ToTy > |
----------------—AAIntraFnReachability Attribute-----------------------— More... | |
struct | llvm::DenseMapInfo< ReachabilityQueryInfo< ToTy > * > |
Namespaces | |
namespace | llvm |
This is an optimization pass for GlobalISel generic memory operations. | |
namespace | llvm::AA |
Abstract Attribute helper functions. | |
namespace | llvm::AA::PointerInfo |
Functions | |
STATISTIC (NumAAs, "Number of abstract attributes created") | |
STATISTIC (NumIndirectCallsPromoted, "Number of indirect calls promoted") | |
template<> | |
ChangeStatus | llvm::clampStateAndIndicateChange< DerefState > (DerefState &S, const DerefState &R) |
static bool | mayBeInCycle (const CycleInfo *CI, const Instruction *I, bool HeaderOnly, Cycle **CPtr=nullptr) |
static bool | isDenselyPacked (Type *Ty, const DataLayout &DL) |
Checks if a type could have padding bytes. | |
static const Value * | getPointerOperand (const Instruction *I, bool AllowVolatile) |
Get pointer operand of memory accessing instruction. | |
static Value * | constructPointer (Value *Ptr, int64_t Offset, IRBuilder< NoFolder > &IRB) |
Helper function to create a pointer based on Ptr , and advanced by Offset bytes. | |
static const Value * | stripAndAccumulateOffsets (Attributor &A, const AbstractAttribute &QueryingAA, const Value *Val, const DataLayout &DL, APInt &Offset, bool GetMinOffset, bool AllowNonInbounds, bool UseAssumed=false) |
static const Value * | getMinimalBaseOfPointer (Attributor &A, const AbstractAttribute &QueryingAA, const Value *Ptr, int64_t &BytesOffset, const DataLayout &DL, bool AllowNonInbounds=false) |
template<typename AAType, typename StateType = typename AAType::StateType, Attribute::AttrKind IRAttributeKind = AAType::IRAttributeKind, bool RecurseForSelectAndPHI = true> | |
static void | clampReturnedValueStates (Attributor &A, const AAType &QueryingAA, StateType &S, const IRPosition::CallBaseContext *CBContext=nullptr) |
Clamp the information known for all returned values of a function (identified by QueryingAA ) into S . | |
template<typename AAType> | |
static std::optional< Constant * > | askForAssumedConstant (Attributor &A, const AbstractAttribute &QueryingAA, const IRPosition &IRP, Type &Ty) |
CREATE_ABSTRACT_ATTRIBUTE_FOR_ONE_POSITION (IRP_CALL_SITE, CallSite, AAIndirectCallInfo) CREATE_ABSTRACT_ATTRIBUTE_FOR_ONE_POSITION(IRP_FLOAT |
Variables | |
static cl::opt< bool > | ManifestInternal ("attributor-manifest-internal", cl::Hidden, cl::desc("Manifest Attributor internal string attributes."), cl::init(false)) |
static cl::opt< int > | MaxHeapToStackSize ("max-heap-to-stack-size", cl::init(128), cl::Hidden) |
static cl::opt< unsigned, true > | MaxPotentialValues ("attributor-max-potential-values", cl::Hidden, cl::desc("Maximum number of potential values to be " "tracked for each position."), cl::location(llvm::PotentialConstantIntValuesState::MaxPotentialValues), cl::init(7)) |
static cl::opt< int > | MaxPotentialValuesIterations ("attributor-max-potential-values-iterations", cl::Hidden, cl::desc("Maximum number of iterations we keep dismantling potential values."), cl::init(64)) |
Floating |
#define BUILD_STAT_MSG_IR_ATTR | ( | TYPE, | |
NAME ) |
Definition at line 126 of file AttributorAttributes.cpp.
#define BUILD_STAT_NAME | ( | NAME, | |
TYPE ) |
Definition at line 128 of file AttributorAttributes.cpp.
#define CREATE_ABSTRACT_ATTRIBUTE_FOR_ONE_POSITION | ( | POS, | |
SUFFIX, | |||
CLASS ) |
Definition at line 13644 of file AttributorAttributes.cpp.
Referenced by CREATE_ABSTRACT_ATTRIBUTE_FOR_ONE_POSITION().
#define CREATE_ALL_ABSTRACT_ATTRIBUTE_FOR_POSITION | ( | CLASS | ) |
Definition at line 13656 of file AttributorAttributes.cpp.
#define CREATE_FUNCTION_ABSTRACT_ATTRIBUTE_FOR_POSITION | ( | CLASS | ) |
Definition at line 13612 of file AttributorAttributes.cpp.
#define CREATE_FUNCTION_ONLY_ABSTRACT_ATTRIBUTE_FOR_POSITION | ( | CLASS | ) |
Definition at line 13672 of file AttributorAttributes.cpp.
#define CREATE_NON_RET_ABSTRACT_ATTRIBUTE_FOR_POSITION | ( | CLASS | ) |
Definition at line 13688 of file AttributorAttributes.cpp.
#define CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION | ( | CLASS | ) |
Definition at line 13628 of file AttributorAttributes.cpp.
#define DEBUG_TYPE "attributor" |
Definition at line 82 of file AttributorAttributes.cpp.
#define DefineKeys | ( | ToTy | ) |
Definition at line 3482 of file AttributorAttributes.cpp.
#define PIPE_OPERATOR | ( | CLASS | ) |
Definition at line 157 of file AttributorAttributes.cpp.
#define STATS_DECL | ( | NAME, | |
TYPE, | |||
MSG ) |
Definition at line 130 of file AttributorAttributes.cpp.
#define STATS_DECL_ | ( | NAME, | |
MSG ) |
Definition at line 129 of file AttributorAttributes.cpp.
#define STATS_DECLTRACK | ( | NAME, | |
TYPE, | |||
MSG ) |
Definition at line 133 of file AttributorAttributes.cpp.
#define STATS_DECLTRACK_ARG_ATTR | ( | NAME | ) |
Definition at line 135 of file AttributorAttributes.cpp.
#define STATS_DECLTRACK_CS_ATTR | ( | NAME | ) |
Definition at line 142 of file AttributorAttributes.cpp.
#define STATS_DECLTRACK_CSARG_ATTR | ( | NAME | ) |
Definition at line 137 of file AttributorAttributes.cpp.
#define STATS_DECLTRACK_CSRET_ATTR | ( | NAME | ) |
Definition at line 147 of file AttributorAttributes.cpp.
#define STATS_DECLTRACK_FLOATING_ATTR | ( | NAME | ) |
Definition at line 150 of file AttributorAttributes.cpp.
#define STATS_DECLTRACK_FN_ATTR | ( | NAME | ) |
Definition at line 140 of file AttributorAttributes.cpp.
#define STATS_DECLTRACK_FNRET_ATTR | ( | NAME | ) |
Definition at line 144 of file AttributorAttributes.cpp.
#define STATS_TRACK | ( | NAME, | |
TYPE ) |
Definition at line 132 of file AttributorAttributes.cpp.
#define SWITCH_PK_CREATE | ( | CLASS, | |
IRP, | |||
PK, | |||
SUFFIX ) |
Definition at line 13606 of file AttributorAttributes.cpp.
#define SWITCH_PK_INV | ( | CLASS, | |
PK, | |||
POS_NAME ) |
Definition at line 13602 of file AttributorAttributes.cpp.
|
static |
Definition at line 10793 of file AttributorAttributes.cpp.
References A(), llvm::CallingConv::C, llvm::NONE, and llvm::OPTIONAL.
|
static |
Clamp the information known for all returned values of a function (identified by QueryingAA
) into S
.
Definition at line 359 of file AttributorAttributes.cpp.
References A(), assert(), llvm::dbgs(), llvm::AA::hasAssumedIRAttr(), llvm::AA::Intraprocedural, llvm::IRPosition::IRP_CALL_SITE_RETURNED, llvm::IRPosition::IRP_RETURNED, llvm::Attribute::isEnumAttrKind(), LLVM_DEBUG, llvm::REQUIRED, T, and llvm::IRPosition::value().
Helper function to create a pointer based on Ptr
, and advanced by Offset
bytes.
Definition at line 296 of file AttributorAttributes.cpp.
References llvm::IRBuilderBase::CreatePtrAdd(), llvm::dbgs(), llvm::IRBuilderBase::getInt64(), LLVM_DEBUG, llvm::Offset, and Ptr.
CREATE_ABSTRACT_ATTRIBUTE_FOR_ONE_POSITION | ( | IRP_CALL_SITE | , |
CallSite | , | ||
AAIndirectCallInfo | ) |
References CREATE_ABSTRACT_ATTRIBUTE_FOR_ONE_POSITION.
|
static |
Definition at line 342 of file AttributorAttributes.cpp.
References A(), llvm::sampleprof::Base, DL, llvm::APInt::getSExtValue(), Ptr, and stripAndAccumulateOffsets().
|
static |
Get pointer operand of memory accessing instruction.
If I
is not a memory accessing instruction, return nullptr. If AllowVolatile
, is set to false and the instruction is volatile, return nullptr.
Definition at line 270 of file AttributorAttributes.cpp.
References llvm::dyn_cast(), and I.
|
static |
Checks if a type could have padding bytes.
Definition at line 229 of file AttributorAttributes.cpp.
References llvm::cast(), DL, llvm::dyn_cast(), E(), llvm::StructLayout::getElementOffsetInBits(), llvm::StructType::getElementType(), llvm::StructType::getNumElements(), I, llvm::isa(), and isDenselyPacked().
Referenced by isDenselyPacked().
|
static |
Definition at line 215 of file AttributorAttributes.cpp.
References llvm::CallingConv::C, llvm::GenericCycleInfo< ContextT >::getCycle(), and I.
STATISTIC | ( | NumAAs | , |
"Number of abstract attributes created" | ) |
STATISTIC | ( | NumIndirectCallsPromoted | , |
"Number of indirect calls promoted" | ) |
|
static |
Definition at line 308 of file AttributorAttributes.cpp.
References A(), DL, llvm::IntegerRangeState::getAssumed(), llvm::IntegerRangeState::getKnown(), llvm::NONE, llvm::Offset, llvm::OPTIONAL, Range, llvm::Value::stripAndAccumulateConstantOffsets(), and llvm::IRPosition::value().
Referenced by getMinimalBaseOfPointer().
Floating |
Definition at line 13739 of file AttributorAttributes.cpp.
|
static |
|
static |
|
static |
|
static |