llvm::IdentifyingPassPtr

Discriminated union of Pass ID types.

Synopsis

Declared in <llvm/CodeGen/TargetPassConfig.h>

class IdentifyingPassPtr;

Description

The PassConfig API prefers dealing with IDs because they are safer and more efficient. IDs decouple configuration from instantiation. This way, when a pass is overriden, it isn't unnecessarily instantiated. It is also unsafe to refer to a Pass pointer after adding it to a pass manager, which deletes redundant pass instances.

However, it is convient to directly instantiate target passes with non-default ctors. These often don't have a registered PassInfo. Rather than force all target passes to implement the pass registry boilerplate, allow the PassConfig API to handle either type.

AnalysisID is sadly char*, so PointerIntPair won't work.

Member Functions

NameDescription
IdentifyingPassPtr [constructor]Constructors
getID Return the analysis ID held by this object.
getInstance Return the Pass instance held by this object.
isInstance Return true if this holds a concrete Pass instance rather than an ID.
isValid Return true if this holds a non-null pass ID or instance.

Data Members

NameDescription
ID [variant member]Pass analysis ID when this does not hold an instance.
P [variant member]Concrete pass instance when IsInstance is true.