LLVM  10.0.0svn
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.

◆ GlobalNumberState()

 llvm::GlobalNumberState::GlobalNumberState ( )
default

◆ clear()

 void llvm::GlobalNumberState::clear ( )
inline

Definition at line 84 of file FunctionComparator.h.

Referenced by isEligibleForMerging().

◆ erase()

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

Definition at line 80 of file FunctionComparator.h.

Referenced by canCreateAliasFor().

◆ getNumber()

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

Definition at line 71 of file FunctionComparator.h.

Referenced by llvm::FunctionComparator::cmpGlobalValues().

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