Assigns stable serial numbers to global values for ordering comparisons.
Declared in <llvm/Transforms/Utils/FunctionComparator.h>
class GlobalNumberState;
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.
| Name | Description |
|---|---|
GlobalNumberState [constructor] | Construct an empty global-number state. |
clear | Remove all assigned serial numbers. |
erase | Forget the serial number previously assigned to Global. |
getNumber | Return the serial number for Global, assigning one on first visit. |