LLVM 20.0.0git
Classes | Public Member Functions | List of all members
llvm::GlobalNumberState Class Reference

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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ GlobalNumberState()

llvm::GlobalNumberState::GlobalNumberState ( )
default

Member Function Documentation

◆ clear()

void llvm::GlobalNumberState::clear ( )
inline

◆ erase()

void llvm::GlobalNumberState::erase ( GlobalValue Global)
inline

◆ getNumber()

uint64_t llvm::GlobalNumberState::getNumber ( GlobalValue Global)
inline

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