LLVM 20.0.0git |
An abstract attribute for undefined behavior.More...
#include "llvm/Transforms/IPO/Attributor.h"
Public Member Functions | |
AAUndefinedBehavior (constIRPosition &IRP,Attributor &A) | |
bool | isAssumedToCauseUB ()const |
Return true if "undefined behavior" is assumed. | |
virtualbool | isAssumedToCauseUB (Instruction *I)const =0 |
Return true if "undefined behavior" is assumed for a specific instruction. | |
bool | isKnownToCauseUB ()const |
Return true if "undefined behavior" is known. | |
virtualbool | isKnownToCauseUB (Instruction *I)const =0 |
Return true if "undefined behavior" is known for a specific instruction. | |
const std::string | getName ()const override |
SeeAbstractAttribute::getName() | |
constchar * | getIdAddr ()const override |
SeeAbstractAttribute::getIdAddr() | |
![]() | |
StateWrapper (constIRPosition &IRP, Ts... Args) | |
StateType & | getState () override |
See AbstractAttribute::getState(...). | |
constStateType & | getState ()const override |
See AbstractAttribute::getState(...). | |
![]() | |
AbstractAttribute (constIRPosition &IRP) | |
virtual | ~AbstractAttribute ()=default |
Virtual destructor. | |
virtual void | initialize (Attributor &A) |
Initialize the state with the information in theAttributorA . | |
virtualbool | isQueryAA ()const |
A queryAA is always scheduled as long as we do updates because it does lazy computation that cannot be determined to be done from the outside. | |
virtualStateType & | getState ()=0 |
Return the internal abstract state for inspection. | |
virtualconstStateType & | getState ()const =0 |
constIRPosition & | getIRPosition ()const |
Return an IR position, see structIRPosition. | |
IRPosition & | getIRPosition () |
void | print (raw_ostream &OS)const |
Helper functions, for debug purposes only. | |
void | print (Attributor *,raw_ostream &OS)const override |
virtual void | printWithDeps (raw_ostream &OS)const |
void | dump ()const |
virtualconst std::string | getAsStr (Attributor *A)const =0 |
This function should return the "summarized" assumed state as string. | |
virtualconst std::string | getName ()const =0 |
This function should return the name of theAbstractAttribute. | |
virtualconstchar * | getIdAddr ()const =0 |
This function should return the address of the ID of theAbstractAttribute. | |
![]() | |
IRPosition () | |
Default constructor available to create invalid positions implicitly. | |
bool | operator== (constIRPosition &RHS)const |
bool | operator!= (constIRPosition &RHS)const |
Value & | getAnchorValue ()const |
Return the value this abstract attribute is anchored with. | |
Function * | getAssociatedFunction ()const |
Return the associated function, if any. | |
Argument * | getAssociatedArgument ()const |
Return the associated argument, if any. | |
bool | isFnInterfaceKind ()const |
Return true if the position refers to a function interface, that is the function scope, the function return, or an argument. | |
bool | isFunctionScope ()const |
Return true if this is a function or call site position. | |
Function * | getAnchorScope ()const |
Return theFunction surrounding the anchor value. | |
Instruction * | getCtxI ()const |
Return the context instruction, if any. | |
Value & | getAssociatedValue ()const |
Return the value this abstract attribute is associated with. | |
Type * | getAssociatedType ()const |
Return the type this abstract attribute is associated with. | |
int | getCalleeArgNo ()const |
Return the callee argument number of the associated value if it is an argument or call site argument, otherwise a negative value. | |
int | getCallSiteArgNo ()const |
Return the call site argument number of the associated value if it is an argument or call site argument, otherwise a negative value. | |
unsigned | getAttrIdx ()const |
Return the index in the attribute list for this position. | |
Value * | getAttrListAnchor ()const |
Return the value attributes are attached to. | |
AttributeList | getAttrList ()const |
Return the attributes associated with this function or call site scope. | |
void | setAttrList (constAttributeList &AttrList)const |
Update the attributes associated with this function or call site scope. | |
unsigned | getNumArgs ()const |
Return the number of arguments associated with this function or call site scope. | |
Value * | getArg (unsigned ArgNo)const |
Return theargumentArgNo associated with this function or call site scope. | |
Kind | getPositionKind ()const |
Return the associated position kind. | |
bool | isAnyCallSitePosition ()const |
bool | isArgumentPosition ()const |
Return true if the position is an argument or call site argument. | |
IRPosition | stripCallBaseContext ()const |
Return the same position without the call base context. | |
constCallBaseContext * | getCallBaseContext ()const |
Get the call base context from the position. | |
bool | hasCallBaseContext ()const |
Check if the position has any call base context. | |
operator void * ()const | |
} | |
![]() | |
virtual | ~AADepGraphNode ()=default |
aaiterator | begin () |
aaiterator | end () |
iterator | child_begin () |
iterator | child_end () |
void | print (raw_ostream &OS)const |
virtual void | print (Attributor *,raw_ostream &OS)const |
DepSetTy & | getDeps () |
![]() | |
BooleanState ()=default | |
BooleanState (base_tAssumed) | |
void | setAssumed (boolValue) |
Set the assumed value toValue but never below the known one. | |
void | setKnown (boolValue) |
Set the known and asssumed value toValue . | |
bool | isAssumed ()const |
Return true if the state is assumed to hold. | |
bool | isKnown ()const |
Return true if the state is known to hold. | |
![]() | |
IntegerStateBase ()=default | |
IntegerStateBase (base_t Assumed) | |
bool | isValidState ()const override |
SeeAbstractState::isValidState() NOTE: For now we simply pretend that the worst possible state is invalid. | |
bool | isAtFixpoint ()const override |
SeeAbstractState::isAtFixpoint() | |
ChangeStatus | indicateOptimisticFixpoint () override |
See AbstractState::indicateOptimisticFixpoint(...) | |
ChangeStatus | indicatePessimisticFixpoint () override |
See AbstractState::indicatePessimisticFixpoint(...) | |
base_t | getKnown ()const |
Return the known state encoding. | |
base_t | getAssumed ()const |
Return the assumed state encoding. | |
bool | operator== (constIntegerStateBase<base_t, BestState, WorstState > &R)const |
Equality forIntegerStateBase. | |
bool | operator!= (constIntegerStateBase<base_t, BestState, WorstState > &R)const |
Inequality forIntegerStateBase. | |
void | operator^= (constIntegerStateBase<base_t, BestState, WorstState > &R) |
"Clamp" this state withR . | |
void | operator+= (constIntegerStateBase<base_t, BestState, WorstState > &R) |
"Clamp" this state withR . | |
void | operator|= (constIntegerStateBase<base_t, BestState, WorstState > &R) |
void | operator&= (constIntegerStateBase<base_t, BestState, WorstState > &R) |
![]() | |
virtual | ~AbstractState ()=default |
virtualbool | isValidState ()const =0 |
Return if this abstract state is in a valid state. | |
virtualbool | isAtFixpoint ()const =0 |
Return if this abstract state is fixed, thus does not need to be updated if information changes as it cannot change itself. | |
virtualChangeStatus | indicateOptimisticFixpoint ()=0 |
Indicate that the abstract state should converge to the optimistic state. | |
virtualChangeStatus | indicatePessimisticFixpoint ()=0 |
Indicate that the abstract state should converge to the pessimistic state. | |
Static Public Member Functions | |
staticAAUndefinedBehavior & | createForPosition (constIRPosition &IRP,Attributor &A) |
Create an abstract attribute view for the positionIRP . | |
staticbool | classof (constAbstractAttribute *AA) |
This function should return true if the type of theAA is AAUndefineBehavior. | |
![]() | |
staticbool | classof (constAADepGraphNode *DGN) |
This function is used to identify if anDGN is of typeAbstractAttribute so that the dyn_cast and cast can use such information to cast anAADepGraphNode to anAbstractAttribute. | |
staticbool | hasTrivialInitializer () |
Return false if thisAA does anything non-trivial (hence not done by default) in its initializer. | |
staticbool | requiresCalleeForCallBase () |
Return true if thisAA requires a "callee" (or an associted function) for a call site positon. | |
staticbool | requiresNonAsmForCallBase () |
Return true if thisAA requires non-asm "callee" for a call site positon. | |
staticbool | requiresCallersForArgOrFunction () |
Return true if thisAA requires all callees for an argument or function positon. | |
staticbool | isValidIRPositionForInit (Attributor &A,constIRPosition &IRP) |
Return false if anAA should not be created forIRP . | |
staticbool | isValidIRPositionForUpdate (Attributor &A,constIRPosition &IRP) |
Return false if anAA should not be updated forIRP . | |
![]() | |
staticconstIRPosition | value (constValue &V,constCallBaseContext *CBContext=nullptr) |
Create a position describing the value ofV . | |
staticconstIRPosition | inst (constInstruction &I,constCallBaseContext *CBContext=nullptr) |
Create a position describing the instructionI . | |
staticconstIRPosition | function (constFunction &F,constCallBaseContext *CBContext=nullptr) |
Create a position describing the function scope ofF . | |
staticconstIRPosition | returned (constFunction &F,constCallBaseContext *CBContext=nullptr) |
Create a position describing the returned value ofF . | |
staticconstIRPosition | argument (constArgument &Arg,constCallBaseContext *CBContext=nullptr) |
Create a position describing the argumentArg . | |
staticconstIRPosition | callsite_function (constCallBase &CB) |
Create a position describing the function scope ofCB . | |
staticconstIRPosition | callsite_returned (constCallBase &CB) |
Create a position describing the returned value ofCB . | |
staticconstIRPosition | callsite_argument (constCallBase &CB,unsigned ArgNo) |
Create a position describing the argument ofCB at positionArgNo . | |
staticconstIRPosition | callsite_argument (AbstractCallSite ACS,unsigned ArgNo) |
Create a position describing the argument ofACS at positionArgNo . | |
staticconstIRPosition | function_scope (constIRPosition &IRP,constCallBaseContext *CBContext=nullptr) |
Create a position with function scope matching the "context" ofIRP . | |
![]() | |
static constexprbase_t | getBestState () |
Return the best possible representable state. | |
static constexprbase_t | getBestState (constIntegerStateBase &) |
static constexprbase_t | getWorstState () |
Return the worst possible representable state. | |
static constexprbase_t | getWorstState (constIntegerStateBase &) |
Static Public Attributes | |
staticconstchar | ID = 0 |
Unique ID (due to the unique address) | |
![]() | |
static constexprAttribute::AttrKind | IRAttributeKind =Attribute::None |
Compile time access to the IR attribute kind. | |
![]() | |
staticconstIRPosition | EmptyKey |
SpecialDenseMap key values. | |
staticconstIRPosition | TombstoneKey |
Additional Inherited Members | |
![]() | |
ChangeStatus | update (Attributor &A) |
Hook for theAttributor to trigger an update of the internal state. | |
virtualChangeStatus | manifest (Attributor &A) |
Hook for theAttributor to trigger the manifestation of the information represented by the abstract attribute in the LLVM-IR. | |
virtual void | trackStatistics ()const =0 |
Hook to enable custom statistic tracking, called after manifest that resulted in a change if statistics are enabled. | |
virtualChangeStatus | updateImpl (Attributor &A)=0 |
The actual update/transfer function which has to be implemented by the derived classes. | |
![]() | |
operator AbstractAttribute * () | |
![]() | |
virtual void | handleNewAssumedValue (base_tValue)=0 |
Handle a new assumed valueValue . Subtype dependent. | |
virtual void | handleNewKnownValue (base_tValue)=0 |
Handle a new known valueValue . Subtype dependent. | |
virtual void | joinOR (base_t AssumedValue,base_t KnownValue)=0 |
Handle a valueValue . Subtype dependent. | |
virtual void | joinAND (base_t AssumedValue,base_t KnownValue)=0 |
Handle a new assumed valueValue . Subtype dependent. | |
![]() | |
staticAADepGraphNode * | DepGetVal (constDepTy &DT) |
staticAbstractAttribute * | DepGetValAA (constDepTy &DT) |
![]() | |
DepSetTy | Deps |
Set of dependency graph nodes which should be updated if this one is updated. | |
![]() | |
base_t | Known |
The known state encoding in an integer of type base_t. | |
base_t | Assumed |
The assumed state encoding in an integer of type base_t. | |
An abstract attribute for undefined behavior.
Definition at line3786 of fileAttributor.h.
Definition at line3788 of fileAttributor.h.
| inline |
Definition at line3789 of fileAttributor.h.
| inlinestatic |
This function should return true if the type of theAA
is AAUndefineBehavior.
Definition at line3815 of fileAttributor.h.
Referencesllvm::AbstractAttribute::getIdAddr().
| static |
Create an abstract attribute view for the positionIRP
.
SeeAbstractAttribute::getIdAddr()
Implementsllvm::AbstractAttribute.
Definition at line3811 of fileAttributor.h.
ReferencesID.
| inlineoverridevirtual |
SeeAbstractAttribute::getName()
Implementsllvm::AbstractAttribute.
Definition at line3808 of fileAttributor.h.
| inline |
Return true if "undefined behavior" is assumed.
Definition at line3792 of fileAttributor.h.
Referencesllvm::IntegerStateBase< bool, true, false >::getAssumed().
| pure virtual |
Return true if "undefined behavior" is assumed for a specific instruction.
| inline |
Return true if "undefined behavior" is known.
Definition at line3798 of fileAttributor.h.
Referencesllvm::IntegerStateBase< bool, true, false >::getKnown().
| pure virtual |
Return true if "undefined behavior" is known for a specific instruction.
Unique ID (due to the unique address)
Definition at line3820 of fileAttributor.h.
Referenced bygetIdAddr().