#include "llvm/Analysis/Lint.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Argument.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/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/AMDGPUAddrSpace.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
#include <iterator>
#include <string>
usingnamespacellvm;
static const char LintAbortOnErrorArgName[] = …;
static cl::opt<bool>
LintAbortOnError(LintAbortOnErrorArgName, cl::init(false),
cl::desc("In the Lint pass, abort on errors."));
namespace {
namespace MemRef {
static const unsigned Read = …;
static const unsigned Write = …;
static const unsigned Callee = …;
static const unsigned Branchee = …;
}
class Lint : public InstVisitor<Lint> { … };
}
#define Check(C, ...) …
void Lint::visitFunction(Function &F) { … }
void Lint::visitCallBase(CallBase &I) { … }
void Lint::visitReturnInst(ReturnInst &I) { … }
void Lint::visitMemoryReference(Instruction &I, const MemoryLocation &Loc,
MaybeAlign Align, Type *Ty, unsigned Flags) { … }
void Lint::visitLoadInst(LoadInst &I) { … }
void Lint::visitStoreInst(StoreInst &I) { … }
void Lint::visitAtomicCmpXchgInst(AtomicCmpXchgInst &I) { … }
void Lint::visitAtomicRMWInst(AtomicRMWInst &I) { … }
void Lint::visitXor(BinaryOperator &I) { … }
void Lint::visitSub(BinaryOperator &I) { … }
void Lint::visitLShr(BinaryOperator &I) { … }
void Lint::visitAShr(BinaryOperator &I) { … }
void Lint::visitShl(BinaryOperator &I) { … }
static bool isZero(Value *V, const DataLayout &DL, DominatorTree *DT,
AssumptionCache *AC) { … }
void Lint::visitSDiv(BinaryOperator &I) { … }
void Lint::visitUDiv(BinaryOperator &I) { … }
void Lint::visitSRem(BinaryOperator &I) { … }
void Lint::visitURem(BinaryOperator &I) { … }
void Lint::visitAllocaInst(AllocaInst &I) { … }
void Lint::visitVAArgInst(VAArgInst &I) { … }
void Lint::visitIndirectBrInst(IndirectBrInst &I) { … }
void Lint::visitExtractElementInst(ExtractElementInst &I) { … }
void Lint::visitInsertElementInst(InsertElementInst &I) { … }
void Lint::visitUnreachableInst(UnreachableInst &I) { … }
Value *Lint::findValue(Value *V, bool OffsetOk) const { … }
Value *Lint::findValueImpl(Value *V, bool OffsetOk,
SmallPtrSetImpl<Value *> &Visited) const { … }
PreservedAnalyses LintPass::run(Function &F, FunctionAnalysisManager &AM) { … }
void llvm::lintFunction(const Function &f) { … }
void llvm::lintModule(const Module &M) { … }