Polly 20.0.0git
Public Member Functions | Private Attributes | List of all members
polly::IslMaxOperationsGuard Class Referencefinal

Scoped limit of ISL operations. More...

#include <GICHelper.h>

Public Member Functions

 IslMaxOperationsGuard (isl_ctx *IslCtx, unsigned long LocalMaxOps, bool AutoEnter=true)
 Enter a max operations scope.
 
IslQuotaScope enter (bool AllowReturnNull=true)
 Enter a scope that can handle out-of-quota errors.
 
bool hasQuotaExceeded () const
 Return whether the current quota has exceeded.
 

Private Attributes

isl_ctxIslCtx
 The ISL context to set the operations limit.
 
unsigned long LocalMaxOps
 Maximum number of operations for the scope.
 
IslQuotaScope TopLevelScope
 When AutoEnter is enabled, holds the IslQuotaScope object.
 

Detailed Description

Scoped limit of ISL operations.

Limits the number of ISL operations during the lifetime of this object. The idea is to use this as an RAII guard for the scope where the code is aware that ISL can return errors even when all input is valid. After leaving the scope, it will return to the error setting as it was before. That also means that the error setting should not be changed while in that scope.

Such scopes are not allowed to be nested because the previous operations counter cannot be reset to the previous state, or one that adds the operations while being in the nested scope. Use therefore is only allowed while currently a no operations-limit is active.

Definition at line 424 of file GICHelper.h.

Constructor & Destructor Documentation

◆ IslMaxOperationsGuard()

polly::IslMaxOperationsGuard::IslMaxOperationsGuard ( isl_ctx IslCtx,
unsigned long  LocalMaxOps,
bool  AutoEnter = true 
)
inline

Enter a max operations scope.

Parameters
IslCtxThe ISL context to set the operations limit for.
LocalMaxOpsMaximum number of operations allowed in the scope. If set to zero, no operations limit is enforced.
AutoEnterIf true, automatically enters an IslQuotaScope such that isl operations may return quota errors immediately. If false, only starts the operations counter, but isl does not return quota errors before calling enter().

Definition at line 449 of file GICHelper.h.

References assert, enter(), isl_ctx_get_max_operations(), isl_ctx_reset_error(), isl_ctx_reset_operations(), IslCtx, LocalMaxOps, and TopLevelScope.

Member Function Documentation

◆ enter()

IslQuotaScope polly::IslMaxOperationsGuard::enter ( bool  AllowReturnNull = true)
inline

Enter a scope that can handle out-of-quota errors.

Parameters
AllowReturnNullWhether the scoped code can handle out-of-quota errors. If false, returns a dummy scope object that does nothing.

Definition at line 477 of file GICHelper.h.

References IslCtx, and LocalMaxOps.

Referenced by IslMaxOperationsGuard().

◆ hasQuotaExceeded()

bool polly::IslMaxOperationsGuard::hasQuotaExceeded ( ) const
inline

Return whether the current quota has exceeded.

Definition at line 483 of file GICHelper.h.

References isl_ctx_last_error(), isl_error_quota, and IslCtx.

Member Data Documentation

◆ IslCtx

isl_ctx* polly::IslMaxOperationsGuard::IslCtx
private

The ISL context to set the operations limit.

If set to nullptr, there is no need for any action at the end of the scope.

Definition at line 430 of file GICHelper.h.

Referenced by enter(), hasQuotaExceeded(), and IslMaxOperationsGuard().

◆ LocalMaxOps

unsigned long polly::IslMaxOperationsGuard::LocalMaxOps
private

Maximum number of operations for the scope.

Definition at line 433 of file GICHelper.h.

Referenced by enter(), and IslMaxOperationsGuard().

◆ TopLevelScope

IslQuotaScope polly::IslMaxOperationsGuard::TopLevelScope
private

When AutoEnter is enabled, holds the IslQuotaScope object.

Definition at line 436 of file GICHelper.h.

Referenced by IslMaxOperationsGuard().


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