LLVM 20.0.0git
|
As we analyze each global or thread-local variable, keep track of some information about it. More...
#include "llvm/Transforms/Utils/GlobalStatus.h"
Public Types | |
enum | StoredType { NotStored , InitializerStored , StoredOnce , Stored } |
Keep track of what stores to the global look like. More... | |
Public Member Functions | |
Value * | getStoredOnceValue () const |
If only one value (besides the initializer constant) is ever stored to this global return the stored value. | |
GlobalStatus () | |
Static Public Member Functions | |
static bool | analyzeGlobal (const Value *V, GlobalStatus &GS) |
Look at all uses of the global and fill in the GlobalStatus structure. | |
Public Attributes | |
bool | IsCompared = false |
True if the global's address is used in a comparison. | |
bool | IsLoaded = false |
True if the global is ever loaded. | |
unsigned | NumStores = 0 |
Number of stores to the global. | |
enum llvm::GlobalStatus::StoredType | StoredType = NotStored |
const StoreInst * | StoredOnceStore = nullptr |
If only one value (besides the initializer constant) is ever stored to this global, keep track of what value it is via the store instruction. | |
const Function * | AccessingFunction = nullptr |
These start out null/false. | |
bool | HasMultipleAccessingFunctions = false |
AtomicOrdering | Ordering = AtomicOrdering::NotAtomic |
Set to the strongest atomic ordering requirement. | |
As we analyze each global or thread-local variable, keep track of some information about it.
If we find out that the address of the global is taken, none of this info will be accurate.
Definition at line 30 of file GlobalStatus.h.
Keep track of what stores to the global look like.
Definition at line 42 of file GlobalStatus.h.
|
default |
|
static |
Look at all uses of the global and fill in the GlobalStatus structure.
If the global has its address taken, return true to indicate we can't do anything with it.
Definition at line 196 of file GlobalStatus.cpp.
References analyzeGlobalAux().
Referenced by processGlobal().
|
inline |
If only one value (besides the initializer constant) is ever stored to this global return the stored value.
Definition at line 67 of file GlobalStatus.h.
References llvm::User::getOperand(), StoredOnce, and StoredOnceStore.
These start out null/false.
When the first accessing function is noticed, it is recorded. When a second different accessing function is noticed, HasMultipleAccessingFunctions is set to true.
Definition at line 76 of file GlobalStatus.h.
bool llvm::GlobalStatus::HasMultipleAccessingFunctions = false |
Definition at line 77 of file GlobalStatus.h.
bool llvm::GlobalStatus::IsCompared = false |
True if the global's address is used in a comparison.
Definition at line 32 of file GlobalStatus.h.
bool llvm::GlobalStatus::IsLoaded = false |
True if the global is ever loaded.
If the global isn't ever loaded it can be deleted.
Definition at line 36 of file GlobalStatus.h.
unsigned llvm::GlobalStatus::NumStores = 0 |
Number of stores to the global.
Definition at line 39 of file GlobalStatus.h.
AtomicOrdering llvm::GlobalStatus::Ordering = AtomicOrdering::NotAtomic |
Set to the strongest atomic ordering requirement.
Definition at line 80 of file GlobalStatus.h.
If only one value (besides the initializer constant) is ever stored to this global, keep track of what value it is via the store instruction.
Definition at line 63 of file GlobalStatus.h.
Referenced by getStoredOnceValue().