llvm::lowerGlobalIFuncUsersAsGlobalCtor

Lower ifunc calls via a global table initialized by a constructor.

Synopsis

Declared in <llvm/Transforms/Utils/ModuleUtils.h>

bool
lowerGlobalIFuncUsersAsGlobalCtor(
    Module& M,
    ArrayRef<GlobalIFunc*> IFuncsToLower = {});

Description

Replaces uses with indirect calls loaded out of a global table initialized in a global constructor. This will introduce one constructor function and adds it to llvm.global_ctors. The constructor will call the resolver function once for each ifunc.

Leaves any unhandled constant initializer uses as-is.

If IFuncsToLower is empty, all ifuncs in the module will be lowered. If IFuncsToLower is non-empty, only the selected ifuncs will be lowered.

The processed ifuncs without remaining users will be removed from the module.

Return Value

True if any ifunc users could not be lowered and were left as-is.

Parameters

NameDescription
MModule whose ifunc users are lowered.
IFuncsToLowerIFuncs to lower, or empty to lower all ifuncs in M.