LLVM 20.0.0git
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
SafepointIRVerifier.cpp File Reference
#include "llvm/IR/SafepointIRVerifier.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Statepoint.h"
#include "llvm/IR/Value.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"

Go to the source code of this file.

Classes

struct  BasicBlockState
 State we compute and track per basic block. More...
 

Namespaces

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

Macros

#define DEBUG_TYPE   "safepoint-ir-verifier"
 

Typedefs

using AvailableValueSet = DenseSet< const Value * >
 The verifier algorithm is phrased in terms of availability.
 

Enumerations

enum  BaseType { NonConstant = 1 , ExclusivelyNull , ExclusivelySomeConstant }
 A given derived pointer can have multiple base pointers through phi/selects. More...
 

Functions

static void Verify (const Function &F, const DominatorTree &DT, const CFGDeadness &CD)
 
 INITIALIZE_PASS_BEGIN (SafepointIRVerifier, "verify-safepoint-ir", "Safepoint IR Verifier", false, false) INITIALIZE_PASS_END(SafepointIRVerifier
 
verify safepoint Safepoint IR static false bool isGCPointerType (Type *T)
 
static bool containsGCPtrType (Type *Ty)
 
template<typename IteratorTy >
static void PrintValueSet (raw_ostream &OS, IteratorTy Begin, IteratorTy End)
 
static enum BaseType getBaseType (const Value *Val)
 Return the baseType for Val which states whether Val is exclusively derived from constant/null, or not exclusively derived from constant.
 
static bool isNotExclusivelyConstantDerived (const Value *V)
 

Variables

static cl::opt< boolPrintOnly ("safepoint-ir-verifier-print-only", cl::init(false))
 This option is used for writing test cases.
 
verify safepoint ir
 
verify safepoint Safepoint IR Verifier
 
verify safepoint Safepoint IR false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "safepoint-ir-verifier"

Definition at line 51 of file SafepointIRVerifier.cpp.

Typedef Documentation

◆ AvailableValueSet

The verifier algorithm is phrased in terms of availability.

The set of values "available" at a given point in the control flow graph is the set of correctly relocated value at that point, and is a subset of the set of definitions dominating that point.

Definition at line 290 of file SafepointIRVerifier.cpp.

Enumeration Type Documentation

◆ BaseType

enum BaseType

A given derived pointer can have multiple base pointers through phi/selects.

This type indicates when the base pointer is exclusively constant (ExclusivelySomeConstant), and if that constant is proven to be exclusively null, we record that as ExclusivelyNull. In all other cases, the BaseType is NonConstant.

Enumerator
NonConstant 
ExclusivelyNull 
ExclusivelySomeConstant 

Definition at line 314 of file SafepointIRVerifier.cpp.

Function Documentation

◆ containsGCPtrType()

static bool containsGCPtrType ( Type Ty)
static

◆ getBaseType()

static enum BaseType getBaseType ( const Value Val)
static

Return the baseType for Val which states whether Val is exclusively derived from constant/null, or not exclusively derived from constant.

Val is exclusively derived off a constant base when all operands of phi and selects are derived off a constant base.

Definition at line 326 of file SafepointIRVerifier.cpp.

References llvm::append_range(), llvm::SmallVectorBase< Size_T >::empty(), ExclusivelyNull, ExclusivelySomeConstant, GEP, llvm::Constant::getNullValue(), llvm::PHINode::incoming_values(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), NonConstant, llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

Referenced by llvm::DwarfUnit::getOrCreateTypeDIE(), and isNotExclusivelyConstantDerived().

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( SafepointIRVerifier  ,
"verify-safepoint-ir"  ,
"Safepoint IR Verifier"  ,
false  ,
false   
)

◆ isGCPointerType()

verify safepoint Safepoint IR static false bool isGCPointerType ( Type T)
static

Definition at line 253 of file SafepointIRVerifier.cpp.

Referenced by containsGCPtrType(), and isHandledGCPointerType().

◆ isNotExclusivelyConstantDerived()

static bool isNotExclusivelyConstantDerived ( const Value V)
static

Definition at line 390 of file SafepointIRVerifier.cpp.

References getBaseType(), and NonConstant.

◆ PrintValueSet()

template<typename IteratorTy >
static void PrintValueSet ( raw_ostream OS,
IteratorTy  Begin,
IteratorTy  End 
)
static

Definition at line 276 of file SafepointIRVerifier.cpp.

References End, and OS.

◆ Verify()

static void Verify ( const Function F,
const DominatorTree DT,
const CFGDeadness &  CD 
)
static

Definition at line 890 of file SafepointIRVerifier.cpp.

References llvm::dbgs(), F, LLVM_DEBUG, PrintOnly, and Verifier.

Variable Documentation

◆ false

verify safepoint Safepoint IR false

Definition at line 251 of file SafepointIRVerifier.cpp.

◆ ir

verify safepoint ir

Definition at line 250 of file SafepointIRVerifier.cpp.

◆ PrintOnly

cl::opt< bool > PrintOnly("safepoint-ir-verifier-print-only", cl::init(false)) ( "safepoint-ir-verifier-print-only"  ,
cl::init(false)   
)
static

This option is used for writing test cases.

Instead of crashing the program when verification fails, report a message to the console (for FileCheck usage) and continue execution as if nothing happened.

Referenced by Verify().

◆ Verifier

verify safepoint Safepoint IR Verifier