Create a pass that merges globals to share a base pointer.

Synopsis

Declared in <llvm/CodeGen/Passes.h>

Pass*
createGlobalMergePass(
    TargetMachine const* TM,
    unsigned int MaximalOffset,
    bool OnlyOptimizeForSize = false,
    bool MergeExternalByDefault = false,
    bool MergeConstantByDefault = false,
    bool MergeConstAggressiveByDefault = false);

Description

This pass merges internal (by default) globals into structs to enable reuse of a base pointer by indexed addressing modes. It can also be configured to focus on size optimizations only.

Return Value

The newly created Pass.

Parameters

Name

Description

TM

Target machine providing data layout and addressing limits.

MaximalOffset

Max offset from the merged base that still addresses a member.

OnlyOptimizeForSize

If true, merge only globals used in minsize functions.

MergeExternalByDefault

If true, also merge globals with external linkage.

MergeConstantByDefault

If true, also merge constant globals.

MergeConstAggressiveByDefault

If true, merge constants without considering uses.

Created with MrDocs