Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
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/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/IPO.h"
#include <algorithm>
#include <cassert>
#include <utility>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "constmerge"

Enumerations

enum class  CanMerge { No , 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.
static bool IsBetterCanonical (const GlobalVariable &A, const GlobalVariable &B)
static bool hasMetadataOtherThanDebugLoc (const GlobalVariable *GV)
static void copyDebugLocMetadata (const GlobalVariable *From, GlobalVariable *To)
static Align getAlign (GlobalVariable *GV)
static bool isUnmergeableGlobal (GlobalVariable *GV, const SmallPtrSetImpl< const GlobalValue * > &UsedGlobals)
static CanMerge makeMergeable (GlobalVariable *Old, GlobalVariable *New)
static void replace (Module &M, GlobalVariable *Old, GlobalVariable *New)
static bool mergeConstants (Module &M)

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "constmerge"

Definition at line 40 of file ConstantMerge.cpp.

Enumeration Type Documentation

◆ CanMerge

enum class CanMerge
strong
Enumerator
No 
Yes 

Definition at line 103 of file ConstantMerge.cpp.

Function Documentation

◆ copyDebugLocMetadata()

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

◆ FindUsedValues()

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

◆ getAlign()

◆ hasMetadataOtherThanDebugLoc()

bool hasMetadataOtherThanDebugLoc ( const GlobalVariable * GV)
static

Definition at line 69 of file ConstantMerge.cpp.

References llvm::GlobalObject::getAllMetadata().

Referenced by makeMergeable(), and mergeConstants().

◆ IsBetterCanonical()

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

Definition at line 58 of file ConstantMerge.cpp.

References A(), and B().

Referenced by mergeConstants().

◆ isUnmergeableGlobal()

◆ makeMergeable()

◆ mergeConstants()

◆ replace()

◆ STATISTIC()

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