clang 24.0.0git
cir::PointsToAnalysis Class Reference

Computes the points-to set of every value in an operation. More...

#include "clang/CIR/Dialect/Analysis/CIRPointsToAnalysis.h"

Public Member Functions

 PointsToAnalysis (mlir::Operation *op, const PointsToLimits &limits=PointsToLimits())
 PointsToAnalysis (const PointsToAnalysis &)=delete
PointsToAnalysis & operator= (const PointsToAnalysis &)=delete
const PointsToSet & getPointsTo (mlir::Value value) const
 Return the objects value may point to.
void emitRemarks (llvm::StringRef subCategory={}) const
 Report the results as optimization remarks in the "points-to" category, when remarks are enabled for it: the set of every loaded pointer as an analysis remark, and what made the analysis lose precision as missed remarks: the objects that escaped, the sets that were replaced by "unknown", and the operation or work limit, if the analysis gave up on one.

Detailed Description

Computes the points-to set of every value in an operation.

The analysis looks at the operations nested in the operation it is built for and tracks the addresses of cir.alloca objects through cir.store and cir.load. Comparing a tracked address or testing it for null doesn't let code reach the object, but any other use of a tracked address is treated as an escape: the object may then be read or written by code the analysis does not model, so its memory is assumed to hold "unknown", and everything stored in it escapes too. Values the analysis does not compute a set for, such as function arguments or the results of operations it does not model, point to "unknown". A null pointer constant points to no object.

The sets describe the IR at the time the analysis is built and are not updated when it changes.

Definition at line 120 of file CIRPointsToAnalysis.h.

Constructor & Destructor Documentation

◆ PointsToAnalysis() [1/2]

PointsToAnalysis::PointsToAnalysis ( mlir::Operation * op,
const PointsToLimits & limits = PointsToLimits() )
explicit

Definition at line 90 of file CIRPointsToAnalysis.cpp.

Referenced by operator=(), and PointsToAnalysis().

◆ PointsToAnalysis() [2/2]

cir::PointsToAnalysis::PointsToAnalysis ( const PointsToAnalysis & )
delete

References PointsToAnalysis().

Member Function Documentation

◆ emitRemarks()

void PointsToAnalysis::emitRemarks ( llvm::StringRef subCategory = {}) const

Report the results as optimization remarks in the "points-to" category, when remarks are enabled for it: the set of every loaded pointer as an analysis remark, and what made the analysis lose precision as missed remarks: the objects that escaped, the sets that were replaced by "unknown", and the operation or work limit, if the analysis gave up on one.

subCategory names the client, if any. The analysis doesn't emit remarks by itself.

Definition at line 151 of file CIRPointsToAnalysis.cpp.

References getObjectName(), getPointsTo(), and getRemarkOpts().

◆ getPointsTo()

const PointsToSet & PointsToAnalysis::getPointsTo ( mlir::Value value) const

Return the objects value may point to.

Values that were not analyzed point to "unknown".

Definition at line 186 of file CIRPointsToAnalysis.cpp.

Referenced by emitRemarks().

◆ operator=()

PointsToAnalysis & cir::PointsToAnalysis::operator= ( const PointsToAnalysis & )
delete

References PointsToAnalysis().


The documentation for this class was generated from the following files: