LLVM  8.0.1
Macros | Enumerations | Functions
ConstantMerge.cpp File Reference
#include "llvm/Transforms/IPO/ConstantMerge.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Transforms/IPO.h"
#include <algorithm>
#include <cassert>
#include <utility>
Include dependency graph for ConstantMerge.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "constmerge"
 

Enumerations

enum  CanMerge { CanMerge::No, CanMerge::Yes }
 

Functions

 STATISTIC (NumIdenticalMerged, "Number of identical global constants merged")
 
static void FindUsedValues (GlobalVariable *LLVMUsed, SmallPtrSetImpl< const GlobalValue *> &UsedValues)
 Find values that are marked as llvm.used. More...
 
static bool IsBetterCanonical (const GlobalVariable &A, const GlobalVariable &B)
 
static bool hasMetadataOtherThanDebugLoc (const GlobalVariable *GV)
 
static void copyDebugLocMetadata (const GlobalVariable *From, GlobalVariable *To)
 
static unsigned getAlignment (GlobalVariable *GV)
 
static CanMerge makeMergeable (GlobalVariable *Old, GlobalVariable *New)
 
static void replace (Module &M, GlobalVariable *Old, GlobalVariable *New)
 
static bool mergeConstants (Module &M)
 
 INITIALIZE_PASS (ConstantMergeLegacyPass, "constmerge", "Merge Duplicate Global Constants", false, false) ModulePass *llvm
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "constmerge"

Definition at line 41 of file ConstantMerge.cpp.

Enumeration Type Documentation

◆ CanMerge

enum CanMerge
strong
Enumerator
No 
Yes 

Definition at line 94 of file ConstantMerge.cpp.

Function Documentation

◆ copyDebugLocMetadata()

static void copyDebugLocMetadata ( const GlobalVariable From,
GlobalVariable To 
)
static

◆ FindUsedValues()

static void FindUsedValues ( GlobalVariable LLVMUsed,
SmallPtrSetImpl< const GlobalValue *> &  UsedValues 
)
static

◆ getAlignment()

static unsigned getAlignment ( GlobalVariable GV)
static

◆ hasMetadataOtherThanDebugLoc()

static bool hasMetadataOtherThanDebugLoc ( const GlobalVariable GV)
static

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( ConstantMergeLegacyPass  ,
"constmerge"  ,
"Merge Duplicate Global Constants"  ,
false  ,
false   
)

Definition at line 281 of file ConstantMerge.cpp.

◆ IsBetterCanonical()

static bool IsBetterCanonical ( const GlobalVariable A,
const GlobalVariable B 
)
static

◆ makeMergeable()

static CanMerge makeMergeable ( GlobalVariable Old,
GlobalVariable New 
)
static

◆ mergeConstants()

static bool mergeConstants ( Module M)
static

◆ replace()

static void replace ( Module M,
GlobalVariable Old,
GlobalVariable New 
)
static

◆ STATISTIC()

STATISTIC ( NumIdenticalMerged  ,
"Number of identical global constants merged"   
)