LLVM 20.0.0git
|
GlobalNumberState assigns an integer to each global value in the program, which is used by the comparison routine to order references to globals. More...
#include "llvm/Transforms/Utils/FunctionComparator.h"
Public Member Functions | |
GlobalNumberState ()=default | |
uint64_t | getNumber (GlobalValue *Global) |
void | erase (GlobalValue *Global) |
void | clear () |
GlobalNumberState assigns an integer to each global value in the program, which is used by the comparison routine to order references to globals.
This state must be preserved throughout the pass, because Functions and other globals need to maintain their relative order. Globals are assigned a number when they are first visited. This order is deterministic, and so the assigned numbers are as well. When two functions are merged, neither number is updated. If the symbols are weak, this would be incorrect. If they are strong, then one will be replaced at all references to the other, and so direct callsites will now see one or the other symbol, and no update is necessary. Note that if we were guaranteed unique names, we could just compare those, but this would not work for stripped bitcodes or for those few symbols without a name.
Definition at line 54 of file FunctionComparator.h.
|
default |
|
inline |
Definition at line 84 of file FunctionComparator.h.
References llvm::ValueMap< KeyT, ValueT, Config >::clear().
|
inline |
Definition at line 80 of file FunctionComparator.h.
References llvm::ValueMap< KeyT, ValueT, Config >::erase(), and llvm::Global.
|
inline |
Definition at line 71 of file FunctionComparator.h.
References llvm::Global, llvm::ValueMap< KeyT, ValueT, Config >::insert(), and llvm::ValueMapIterator< DenseMapT, KeyT >::ValueTypeProxy::second.
Referenced by llvm::FunctionComparator::cmpGlobalValues().