|
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/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 "RustDebugInfo.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. | |
| 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().
| void analyzeFuncTypes | ( | RT(* | fn )(Args...), |
| CallBase & | call, | ||
| TypeAnalyzer & | TA ) |
Definition at line 4412 of file TypeAnalysis.cpp.
References analyzeFuncTypesNoFn(), and Args.
| void analyzeFuncTypesNoFn | ( | CallBase & | call, |
| TypeAnalyzer & | TA ) |
Definition at line 4406 of file TypeAnalysis.cpp.
References FunctionArgumentIterator< Arg0 >::analyzeFuncTypesHelper().
Referenced by analyzeFuncTypes().
| void analyzeIntelSubscriptIntrinsic | ( | IntrinsicInst & | II, |
| TypeAnalyzer & | TA ) |
Definition at line 4416 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().
| TypeTree defaultTypeTreeForLLVM | ( | llvm::Type * | ET, |
| llvm::Instruction * | I, | ||
| bool | intIsPointer ) |
Definition at line 6387 of file TypeAnalysis.cpp.
References defaultTypeTreeForLLVM(), getUnqual(), Integer, TypeTree::Only(), Pointer, and TypeTree::ShiftIndices().
Referenced by defaultTypeTreeForLLVM(), AdjointGenerator::visitCommonStore(), and AdjointGenerator::visitLoadLike().
| bool dontAnalyze | ( | StringRef | str | ) |
Definition at line 219 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 293 of file TypeAnalysis.cpp.
References findLoopIndices().
Referenced by findLoopIndices(), and TypeAnalyzer::visitGEPOperator().
| void getConstantAnalysis | ( | Constant * | Val, |
| TypeAnalyzer & | TA, | ||
| std::map< llvm::Value *, TypeTree > & | analysis ) |
Given a constant value, deduce any type information applicable.
Definition at line 672 of file TypeAnalysis.cpp.
References Anything, TypeTree::CanonicalizeInPlace(), TypeAnalyzer::fntypeinfo, FnTypeInfo::Function, TypeAnalyzer::getAnalysis(), getConstantAnalysis(), getUnqual(), TypeTree::insert(), Integer, TypeAnalyzer::interprocedural, TypeAnalyzer::notForAnalysis, TypeTree::Only(), Pointer, TypeTree::ShiftIndices(), 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 1863 of file TypeAnalysis.cpp.
References getSet().
Referenced by analyzeIntelSubscriptIntrinsic(), getSet(), and TypeAnalyzer::visitGEPOperator().
|
static |
Definition at line 214 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 6506 of file TypeAnalysis.cpp.
References FnTypeInfo::KnownValues.
Referenced by TypeAnalyzer::visitIPOCall().
| llvm::cl::opt< bool > RustTypeRules | ( | "enzyme-rust-type" | , |
| cl::init(false) | , | ||
| cl::Hidden | , | ||
| cl::desc("Enable rust-specific type rules") | ) |
Referenced by TypeAnalysis::analyzeFunction(), and TypeAnalyzer::visitStoreInst().
| size_t skippedBytes | ( | SmallSet< size_t, 8 > & | offs, |
| Type * | T, | ||
| const DataLayout & | DL, | ||
| size_t | offset = 0 ) |
Definition at line 6110 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 97 of file TypeAnalysis.cpp.
Referenced by isMemFreeLibMFunction().