struct DerefState
Declaration
struct DerefState : public AbstractState { /* full declaration omitted */ };
Description
State for dereferenceable attribute
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3534
Inherits from: AbstractState
Member Variables
- public IncIntegerState<> DerefBytesState
- State representing for dereferenceable bytes.
- public std::map<int64_t, uint64_t> AccessedBytesMap
- Map representing for accessed memory offsets and sizes. A key is Offset and a value is size. If there is a load/store instruction something like, p[offset] = v; (offset, sizeof(v)) will be inserted to this map. std::map is used because we want to iterate keys in ascending order.
- public llvm::BooleanState GlobalState
- State representing that whether the value is globaly dereferenceable.
- protected const llvm::AANonNull* NonNullAA = nullptr
Method Overview
- public void addAccessedBytes(int64_t Offset, uint64_t Size)
- public void computeKnownDerefBytesFromAccessedMap()
- public static llvm::DerefState getBestState()
- public static llvm::DerefState getBestState(const llvm::DerefState &)
- public static llvm::DerefState getWorstState()
- public static llvm::DerefState getWorstState(const llvm::DerefState &)
- public llvm::ChangeStatus indicateOptimisticFixpoint()
- public llvm::ChangeStatus indicatePessimisticFixpoint()
- public bool isAtFixpoint() const
- public bool isValidState() const
- public void takeAssumedDerefBytesMinimum(uint64_t Bytes)
- public void takeKnownDerefBytesMaximum(uint64_t Bytes)
Inherited from AbstractState:
- public indicateOptimisticFixpoint
- public indicatePessimisticFixpoint
- public isAtFixpoint
- public isValidState
Methods
¶void addAccessedBytes(int64_t Offset,
uint64_t Size)
void addAccessedBytes(int64_t Offset,
uint64_t Size)
Description
Add accessed bytes to the map.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3630
Parameters
- int64_t Offset
- uint64_t Size
¶void computeKnownDerefBytesFromAccessedMap()
void computeKnownDerefBytesFromAccessedMap()
Description
Helper function to calculate dereferenceable bytes from current known bytes and accessed bytes. int f(int *A){ *A = 0; *(A+2) = 2; *(A+1) = 1; *(A+10) = 10; } ``` In that case, AccessedBytesMap is `{0:4, 4:4, 8:4, 40:4}`. AccessedBytesMap is std::map so it is iterated in accending order on key(Offset). So KnownBytes will be updated like this: |Access | KnownBytes |(0, 4)| 0 -> 4 |(4, 4)| 4 -> 8 |(8, 4)| 8 -> 12 |(40, 4) | 12 (break)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3579
¶static llvm::DerefState getBestState()
static llvm::DerefState getBestState()
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3536
¶static llvm::DerefState getBestState(
const llvm::DerefState&)
static llvm::DerefState getBestState(
const llvm::DerefState&)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3537
Parameters
- const llvm::DerefState&
¶static llvm::DerefState getWorstState()
static llvm::DerefState getWorstState()
Description
Return the worst possible representable state.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3540
¶static llvm::DerefState getWorstState(
const llvm::DerefState&)
static llvm::DerefState getWorstState(
const llvm::DerefState&)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3545
Parameters
- const llvm::DerefState&
¶llvm::ChangeStatus indicateOptimisticFixpoint()
llvm::ChangeStatus indicateOptimisticFixpoint()
Description
See AbstractState::indicateOptimisticFixpoint(...)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3603
¶llvm::ChangeStatus indicatePessimisticFixpoint()
llvm::ChangeStatus indicatePessimisticFixpoint()
Description
See AbstractState::indicatePessimisticFixpoint(...)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3610
¶bool isAtFixpoint() const
bool isAtFixpoint() const
Description
See AbstractState::isAtFixpoint()
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3597
¶bool isValidState() const
bool isValidState() const
Description
See AbstractState::isValidState()
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3594
¶void takeAssumedDerefBytesMinimum(uint64_t Bytes)
void takeAssumedDerefBytesMinimum(uint64_t Bytes)
Description
Update assumed dereferenceable bytes.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3625
Parameters
- uint64_t Bytes
¶void takeKnownDerefBytesMaximum(uint64_t Bytes)
void takeKnownDerefBytesMaximum(uint64_t Bytes)
Description
Update known dereferenceable bytes.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:3617
Parameters
- uint64_t Bytes