|
Enzyme main
|
#include <cstdint>#include <deque>#include <llvm/Config/llvm-config.h>#include "llvm/Demangle/Demangle.h"#include "llvm/Demangle/ItaniumDemangle.h"#include "llvm/IR/Constants.h"#include "llvm/IR/Function.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/ModuleSlotTracker.h"#include "llvm/IR/Type.h"#include "llvm/IR/Value.h"#include "llvm/ProfileData/InstrProf.h"#include "llvm/IR/InstIterator.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/TimeProfiler.h"#include "llvm/Support/raw_ostream.h"#include "llvm/ADT/SmallSet.h"#include "llvm/ADT/StringMap.h"#include "llvm/ADT/StringSet.h"#include "llvm/IR/InlineAsm.h"#include "../EnzymeLogic.h"#include "../Utils.h"#include "TypeAnalysis.h"#include "../FunctionUtils.h"#include "../LibraryFuncs.h"#include "TBAA.h"#include <math.h>#include "BlasTA.inc"
Go to the source code of this file.
Macros | |
| #define | CONSIDER(fn) |
| #define | CONSIDER2(fn, ...) |
Functions | |
| llvm::cl::opt< int > | MaxIntOffset ("enzyme-max-int-offset", cl::init(100), cl::Hidden, cl::desc("Maximum type tree offset")) |
| Maximum offset for type trees to keep. | |
| llvm::cl::opt< unsigned > | EnzymeMaxTypeDepth ("enzyme-max-type-depth", cl::init(6), cl::Hidden, cl::desc("Maximum type tree depth")) |
| llvm::cl::opt< bool > | EnzymePrintType ("enzyme-print-type", cl::init(false), cl::Hidden, cl::desc("Print type analysis algorithm")) |
| llvm::cl::opt< bool > | RustTypeRules ("enzyme-rust-type", cl::init(false), cl::Hidden, cl::desc("Enable rust-specific type rules")) |
| llvm::cl::opt< bool > | EnzymeStrictAliasing ("enzyme-strict-aliasing", cl::init(true), cl::Hidden, cl::desc("Assume strict aliasing of types / type stability")) |
| static bool | isItaniumEncoding (StringRef S) |
| bool | dontAnalyze (StringRef str) |
| static SmallPtrSet< BasicBlock *, 1 > | findLoopIndices (llvm::Value *val, LoopInfo &LI, DominatorTree &DT, SmallPtrSet< PHINode *, 1 > &seen) |
| void | getConstantAnalysis (Constant *Val, TypeAnalyzer &TA, std::map< llvm::Value *, TypeTree > &analysis) |
| Given a constant value, deduce any type information applicable. | |
| static bool | AllJuliaTypes (Type *T) |
| static TypeTree | fortranDescriptorTree (Value *desc, const DataLayout &DL) |
| Type of a pointer to an LLVM flang descriptor (CFI_cdesc_t). | |
| static bool | AnyJuliaTypes (Type *T) |
| static void | AugmentWithJuliaObjectType (TypeTree &TT, Type *T, const DataLayout &DL) |
| static void | checkEnzymeTypeExtent (TypeAnalyzer *TA, const TypeTree &TT, size_t RegSize, Instruction &I, Value *Val) |
| template<typename T > | |
| std::set< SmallVector< T, 4 > > | getSet (ArrayRef< std::set< T > > todo, size_t idx) |
| template<typename RT , typename... Args> | |
| void | analyzeFuncTypesNoFn (CallBase &call, TypeAnalyzer &TA) |
| template<typename RT , typename... Args> | |
| void | analyzeFuncTypes (RT(*fn)(Args...), CallBase &call, TypeAnalyzer &TA) |
| void | analyzeIntelSubscriptIntrinsic (IntrinsicInst &II, TypeAnalyzer &TA) |
| size_t | skippedBytes (SmallSet< size_t, 8 > &offs, Type *T, const DataLayout &DL, size_t offset=0) |
| TypeTree | defaultTypeTreeForLLVM (llvm::Type *ET, llvm::Instruction *I, bool intIsPointer) |
| FnTypeInfo | preventTypeAnalysisLoops (const FnTypeInfo &oldTypeInfo_, llvm::Function *todiff) |
Variables | |
| const llvm::StringMap< llvm::Intrinsic::ID > | LIBM_FUNCTIONS |
| #define CONSIDER | ( | fn | ) |
Referenced by TypeAnalyzer::visitCallBase().
| #define CONSIDER2 | ( | fn, | |
| ... ) |
Referenced by TypeAnalyzer::visitCallBase().
|
static |
Definition at line 952 of file TypeAnalysis.cpp.
References AllJuliaTypes().
Referenced by AllJuliaTypes(), and AugmentWithJuliaObjectType().
| void analyzeFuncTypes | ( | RT(* | fn )(Args...), |
| CallBase & | call, | ||
| TypeAnalyzer & | TA ) |
Definition at line 4587 of file TypeAnalysis.cpp.
References analyzeFuncTypesNoFn(), and Args.
| void analyzeFuncTypesNoFn | ( | CallBase & | call, |
| TypeAnalyzer & | TA ) |
Definition at line 4581 of file TypeAnalysis.cpp.
References FunctionArgumentIterator< Arg0 >::analyzeFuncTypesHelper().
Referenced by analyzeFuncTypes().
| void analyzeIntelSubscriptIntrinsic | ( | IntrinsicInst & | II, |
| TypeAnalyzer & | TA ) |
Definition at line 4591 of file TypeAnalysis.cpp.
References CustomErrorHandler, TypeTree::Data0(), TypeAnalyzer::direction, TypeAnalyzer::DOWN, TypeAnalyzer::dump(), TypeAnalyzer::fntypeinfo, FnTypeInfo::Function, TypeAnalyzer::getAnalysis(), getSet(), IllegalTypeAnalysis, TypeTree::Inner0(), Integer, isIntelSubscriptIntrinsic(), TypeAnalyzer::knownIntegralValues(), TypeTree::Only(), TypeTree::ShiftIndices(), TypeAnalyzer::UP, and TypeAnalyzer::updateAnalysis().
Referenced by TypeAnalyzer::visitCallBase().
|
static |
Definition at line 1002 of file TypeAnalysis.cpp.
References AnyJuliaTypes().
Referenced by AnyJuliaTypes(), and AugmentWithJuliaObjectType().
|
static |
Definition at line 1022 of file TypeAnalysis.cpp.
References AllJuliaTypes(), AnyJuliaTypes(), TypeTree::insert(), Pointer, TypeTree::remove(), and Unknown.
Referenced by TypeAnalyzer::getAnalysis().
|
static |
Definition at line 1411 of file TypeAnalysis.cpp.
References CustomErrorHandler, EmitFailure(), TypeTree::getMapping(), IllegalTypeAnalysis, str(), and TypeTree::str().
Referenced by TypeAnalyzer::considerTBAA().
| TypeTree defaultTypeTreeForLLVM | ( | llvm::Type * | ET, |
| llvm::Instruction * | I, | ||
| bool | intIsPointer ) |
Definition at line 6785 of file TypeAnalysis.cpp.
References defaultTypeTreeForLLVM(), getAggregateElementOffset(), Integer, TypeTree::Only(), Pointer, and TypeTree::ShiftIndices().
Referenced by defaultTypeTreeForLLVM(), AdjointGenerator::visitCommonStore(), and AdjointGenerator::visitLoadLike().
| bool dontAnalyze | ( | StringRef | str | ) |
Definition at line 237 of file TypeAnalysis.cpp.
References isItaniumEncoding(), and str().
Referenced by TypeAnalyzer::visitCallBase().
| llvm::cl::opt< unsigned > EnzymeMaxTypeDepth | ( | "enzyme-max-type-depth" | , |
| cl::init(6) | , | ||
| cl::Hidden | , | ||
| cl::desc("Maximum type tree depth") | ) |
| llvm::cl::opt< bool > EnzymePrintType | ( | "enzyme-print-type" | , |
| cl::init(false) | , | ||
| cl::Hidden | , | ||
| cl::desc("Print type analysis algorithm") | ) |
| llvm::cl::opt< bool > EnzymeStrictAliasing | ( | "enzyme-strict-aliasing" | , |
| cl::init(true) | , | ||
| cl::Hidden | , | ||
| cl::desc("Assume strict aliasing of types / type stability") | ) |
|
static |
Definition at line 311 of file TypeAnalysis.cpp.
References findLoopIndices().
Referenced by findLoopIndices(), and TypeAnalyzer::visitGEPOperator().
|
static |
Type of a pointer to an LLVM flang descriptor (CFI_cdesc_t).
All fields but base_addr are integral; dims are included only when the rank is known from the allocation type, as a pointer may follow them.
Definition at line 978 of file TypeAnalysis.cpp.
References getBaseObject(), TypeTree::insert(), Integer, and Pointer.
Referenced by TypeAnalyzer::visitCallBase().
| void getConstantAnalysis | ( | Constant * | Val, |
| TypeAnalyzer & | TA, | ||
| std::map< llvm::Value *, TypeTree > & | analysis ) |
Given a constant value, deduce any type information applicable.
Definition at line 691 of file TypeAnalysis.cpp.
References Anything, TypeTree::CanonicalizeInPlace(), TypeAnalyzer::fntypeinfo, TypeTree::fromMD(), FnTypeInfo::Function, getAggregateElementOffset(), TypeAnalyzer::getAnalysis(), getConstantAnalysis(), TypeTree::insert(), insertBeforeInst(), Integer, TypeAnalyzer::interprocedural, TypeAnalyzer::notForAnalysis, TypeTree::Only(), Pointer, TypeTree::ShiftIndices(), startsWith(), TypeTree::toMD(), TypeAnalyzer::visitGEPOperator(), and TypeAnalyzer::workList.
Referenced by TypeAnalyzer::getAnalysis(), and getConstantAnalysis().
| std::set< SmallVector< T, 4 > > getSet | ( | ArrayRef< std::set< T > > | todo, |
| size_t | idx ) |
Definition at line 2029 of file TypeAnalysis.cpp.
References getSet().
Referenced by analyzeIntelSubscriptIntrinsic(), getSet(), and TypeAnalyzer::visitGEPOperator().
|
static |
Definition at line 232 of file TypeAnalysis.cpp.
References startsWith().
Referenced by dontAnalyze().
| llvm::cl::opt< int > MaxIntOffset | ( | "enzyme-max-int-offset" | , |
| cl::init(100) | , | ||
| cl::Hidden | , | ||
| cl::desc("Maximum type tree offset") | ) |
Maximum offset for type trees to keep.
Referenced by TypeAnalyzer::getCallInfo(), FnTypeInfo::knownIntegralValues(), and TypeAnalyzer::visitCallBase().
| FnTypeInfo preventTypeAnalysisLoops | ( | const FnTypeInfo & | oldTypeInfo_, |
| llvm::Function * | todiff ) |
Definition at line 6868 of file TypeAnalysis.cpp.
References FnTypeInfo::KnownValues.
Referenced by TypeAnalyzer::visitCallBase(), and TypeAnalyzer::visitIPOCall().
| llvm::cl::opt< bool > RustTypeRules | ( | "enzyme-rust-type" | , |
| cl::init(false) | , | ||
| cl::Hidden | , | ||
| cl::desc("Enable rust-specific type rules") | ) |
Referenced by TypeAnalyzer::visitStoreInst().
| size_t skippedBytes | ( | SmallSet< size_t, 8 > & | offs, |
| Type * | T, | ||
| const DataLayout & | DL, | ||
| size_t | offset = 0 ) |
Definition at line 6573 of file TypeAnalysis.cpp.
References skippedBytes().
Referenced by TypeResults::allFloat(), TypeResults::anyFloat(), TypeResults::anyPointer(), and skippedBytes().
| const llvm::StringMap<llvm::Intrinsic::ID> LIBM_FUNCTIONS |
Definition at line 98 of file TypeAnalysis.cpp.
Referenced by isMemFreeLibMFunction().