LLVM 19.0.0git
Classes | Namespaces | Macros | Functions | Variables
Verifier.cpp File Reference
#include "llvm/IR/Verifier.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/AttributeMask.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Comdat.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/ConvergenceVerifier.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GCStrategy.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InlineAsm.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/Intrinsics.h"
#include "llvm/IR/IntrinsicsAArch64.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/IntrinsicsARM.h"
#include "llvm/IR/IntrinsicsNVPTX.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Statepoint.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/IR/VFABIDemangler.h"
#include "llvm/IR/Value.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "llvm/IR/Metadata.def"
#include "llvm/IR/Attributes.inc"
#include "llvm/IR/VPIntrinsics.def"
#include "llvm/IR/ConstrainedOps.def"

Go to the source code of this file.

Classes

struct  llvm::VerifierSupport
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS)   void visit##CLASS(const CLASS &N);
 
#define Check(C, ...)
 We know that cond should be true, if not print an error message.
 
#define CheckDI(C, ...)
 We know that a debug info condition should be true, if not print an error message.
 
#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS)
 
#define GET_ATTR_NAMES
 
#define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME)
 
#define ATTRIBUTE_STRBOOL(ENUM_NAME, DISPLAY_NAME)
 
#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...)   case Intrinsic::VPID:
 
#define INSTRUCTION(NAME, NARGS, ROUND_MODE, INTRINSIC)    case Intrinsic::INTRINSIC:
 
#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC)
 
#define CheckTBAA(C, ...)
 

Functions

static void forEachUser (const Value *User, SmallPtrSet< const Value *, 32 > &Visited, llvm::function_ref< bool(const Value *)> Callback)
 
static bool isType (const Metadata *MD)
 
static bool isScope (const Metadata *MD)
 
static bool isDINode (const Metadata *MD)
 
static bool hasConflictingReferenceFlags (unsigned Flags)
 Detect mutually exclusive flags.
 
static InstructiongetSuccPad (Instruction *Terminator)
 
static bool isTypeCongruent (Type *L, Type *R)
 Two types are "congruent" if they are identical, or if they are both pointer types with different pointee types and the same address space.
 
static AttrBuilder getParameterABIAttributes (LLVMContext &C, unsigned I, AttributeList Attrs)
 
static bool isContiguous (const ConstantRange &A, const ConstantRange &B)
 
static ValuegetParentPad (Value *EHPad)
 
static DISubprogramgetSubprogram (Metadata *LocalScope)
 Carefully grab the subprogram from a local scope.
 
static bool IsRootTBAANode (const MDNode *MD)
 
static bool IsScalarTBAANodeImpl (const MDNode *MD, SmallPtrSetImpl< const MDNode * > &Visited)
 
static bool isNewFormatTBAATypeNode (llvm::MDNode *Type)
 

Variables

static cl::opt< boolVerifyNoAliasScopeDomination ("verify-noalias-scope-decl-dom", cl::Hidden, cl::init(false), cl::desc("Ensure that llvm.experimental.noalias.scope.decl for identical " "scopes are not dominating"))
 

Macro Definition Documentation

◆ ATTRIBUTE_ENUM

#define ATTRIBUTE_ENUM (   ENUM_NAME,
  DISPLAY_NAME 
)

◆ ATTRIBUTE_STRBOOL

#define ATTRIBUTE_STRBOOL (   ENUM_NAME,
  DISPLAY_NAME 
)
Value:
if (A.getKindAsString() == #DISPLAY_NAME) { \
auto V = A.getValueAsString(); \
if (!(V.empty() || V == "true" || V == "false")) \
CheckFailed("invalid value for '" #DISPLAY_NAME "' attribute: " + V + \
""); \
}
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

◆ BEGIN_REGISTER_VP_INTRINSIC

#define BEGIN_REGISTER_VP_INTRINSIC (   VPID,
  ... 
)    case Intrinsic::VPID:

◆ Check

#define Check (   C,
  ... 
)
Value:
do { \
if (!(C)) { \
CheckFailed(__VA_ARGS__); \
return; \
} \
} while (false)
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34

We know that cond should be true, if not print an error message.

Definition at line 662 of file Verifier.cpp.

◆ CheckDI

#define CheckDI (   C,
  ... 
)
Value:
do { \
if (!(C)) { \
DebugInfoCheckFailed(__VA_ARGS__); \
return; \
} \
} while (false)

We know that a debug info condition should be true, if not print an error message.

Definition at line 672 of file Verifier.cpp.

◆ CheckTBAA

#define CheckTBAA (   C,
  ... 
)
Value:
do { \
if (!(C)) { \
CheckFailed(__VA_ARGS__); \
return false; \
} \
} while (false)

Definition at line 7125 of file Verifier.cpp.

◆ GET_ATTR_NAMES

#define GET_ATTR_NAMES

◆ HANDLE_SPECIALIZED_MDNODE_LEAF [1/2]

#define HANDLE_SPECIALIZED_MDNODE_LEAF (   CLASS)    void visit##CLASS(const CLASS &N);

Definition at line 538 of file Verifier.cpp.

◆ HANDLE_SPECIALIZED_MDNODE_LEAF [2/2]

#define HANDLE_SPECIALIZED_MDNODE_LEAF (   CLASS)
Value:
case Metadata::CLASS##Kind: \
visit##CLASS(cast<CLASS>(MD)); \
break;

Definition at line 538 of file Verifier.cpp.

◆ INSTRUCTION [1/2]

#define INSTRUCTION (   NAME,
  NARG,
  ROUND_MODE,
  INTRINSIC 
)
Value:
case Intrinsic::INTRINSIC: \
NumOperands = NARG; \
HasRoundingMD = ROUND_MODE; \
break;

◆ INSTRUCTION [2/2]

#define INSTRUCTION (   NAME,
  NARGS,
  ROUND_MODE,
  INTRINSIC 
)     case Intrinsic::INTRINSIC:

Function Documentation

◆ forEachUser()

static void forEachUser ( const Value User,
SmallPtrSet< const Value *, 32 > &  Visited,
llvm::function_ref< bool(const Value *)>  Callback 
)
static

◆ getParameterABIAttributes()

static AttrBuilder getParameterABIAttributes ( LLVMContext C,
unsigned  I,
AttributeList  Attrs 
)
static

Definition at line 3755 of file Verifier.cpp.

References llvm::CallingConv::C, I, and llvm::Attribute::isValid().

◆ getParentPad()

static Value * getParentPad ( Value EHPad)
static

Definition at line 4317 of file Verifier.cpp.

◆ getSubprogram()

static DISubprogram * getSubprogram ( Metadata LocalScope)
static

Carefully grab the subprogram from a local scope.

This carefully grabs the subprogram from a local scope, avoiding the built-in assertions that would typically fire.

Definition at line 6281 of file Verifier.cpp.

References assert(), and getSubprogram().

Referenced by getSubprogram().

◆ getSuccPad()

static Instruction * getSuccPad ( Instruction Terminator)
static

Definition at line 2634 of file Verifier.cpp.

References llvm::BasicBlock::getFirstNonPHI().

◆ hasConflictingReferenceFlags()

static bool hasConflictingReferenceFlags ( unsigned  Flags)
static

Detect mutually exclusive flags.

Definition at line 1279 of file Verifier.cpp.

◆ isContiguous()

static bool isContiguous ( const ConstantRange A,
const ConstantRange B 
)
static

Definition at line 4073 of file Verifier.cpp.

References A, and B.

◆ isDINode()

static bool isDINode ( const Metadata MD)
static

Definition at line 1131 of file Verifier.cpp.

◆ isNewFormatTBAATypeNode()

static bool isNewFormatTBAATypeNode ( llvm::MDNode Type)
static

Definition at line 7347 of file Verifier.cpp.

Referenced by llvm::TBAAVerifier::visitTBAAMetadata().

◆ IsRootTBAANode()

static bool IsRootTBAANode ( const MDNode MD)
static

◆ IsScalarTBAANodeImpl()

static bool IsScalarTBAANodeImpl ( const MDNode MD,
SmallPtrSetImpl< const MDNode * > &  Visited 
)
static

◆ isScope()

static bool isScope ( const Metadata MD)
static

Definition at line 1130 of file Verifier.cpp.

◆ isType()

static bool isType ( const Metadata MD)
static

Definition at line 1129 of file Verifier.cpp.

◆ isTypeCongruent()

static bool isTypeCongruent ( Type L,
Type R 
)
static

Two types are "congruent" if they are identical, or if they are both pointer types with different pointee types and the same address space.

Definition at line 3745 of file Verifier.cpp.

Variable Documentation

◆ VerifyNoAliasScopeDomination

cl::opt< bool > VerifyNoAliasScopeDomination("verify-noalias-scope-decl-dom", cl::Hidden, cl::init(false), cl::desc("Ensure that llvm.experimental.noalias.scope.decl for identical " "scopes are not dominating")) ( "verify-noalias-scope-decl-dom"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Ensure that llvm.experimental.noalias.scope.decl for identical " "scopes are not dominating")   
)
static