|
LLVM
7.0.0
|
#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>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "constmerge" |
Functions | |
| STATISTIC (NumMerged, "Number of 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 bool | mergeConstants (Module &M) |
| INITIALIZE_PASS (ConstantMergeLegacyPass, "constmerge", "Merge Duplicate Global Constants", false, false) ModulePass *llvm | |
| #define DEBUG_TYPE "constmerge" |
Definition at line 41 of file ConstantMerge.cpp.
|
static |
Definition at line 79 of file ConstantMerge.cpp.
References llvm::GlobalVariable::addDebugInfo(), and llvm::GlobalVariable::getDebugInfo().
Referenced by mergeConstants().
|
static |
Find values that are marked as llvm.used.
Definition at line 46 of file ConstantMerge.cpp.
References llvm::GlobalVariable::getInitializer(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::Value::stripPointerCastsNoFollowAliases().
Referenced by mergeConstants().
|
static |
Definition at line 87 of file ConstantMerge.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, llvm::GlobalObject::getAlignment(), llvm::Module::getDataLayout(), llvm::GlobalValue::getParent(), and llvm::DataLayout::getPreferredAlignment().
Referenced by mergeConstants().
|
static |
Definition at line 70 of file ConstantMerge.cpp.
References llvm::GlobalObject::getAllMetadata(), and llvm::LLVMContext::MD_dbg.
Referenced by llvm::Instruction::getAllMetadataOtherThanDebugLoc(), and mergeConstants().
| INITIALIZE_PASS | ( | ConstantMergeLegacyPass | , |
| "constmerge" | , | ||
| "Merge Duplicate Global Constants" | , | ||
| false | , | ||
| false | |||
| ) |
Definition at line 255 of file ConstantMerge.cpp.
|
static |
Definition at line 59 of file ConstantMerge.cpp.
References llvm::GlobalValue::hasGlobalUnnamedAddr(), and llvm::GlobalValue::hasLocalLinkage().
Referenced by mergeConstants().
Definition at line 94 of file ConstantMerge.cpp.
References assert(), llvm::SmallVectorImpl< T >::clear(), copyDebugLocMetadata(), llvm::SmallPtrSetImpl< PtrType >::count(), E, llvm::SmallVectorBase::empty(), llvm::GlobalVariable::eraseFromParent(), FindUsedValues(), first, llvm::PointerType::getAddressSpace(), getAlignment(), llvm::Module::getGlobalVariable(), llvm::GlobalVariable::getInitializer(), llvm::GlobalValue::getType(), llvm::Module::global_begin(), llvm::Module::global_end(), llvm::GlobalVariable::hasDefinitiveInitializer(), llvm::GlobalValue::hasGlobalUnnamedAddr(), llvm::GlobalValue::hasLocalLinkage(), hasMetadataOtherThanDebugLoc(), llvm::GlobalObject::hasSection(), IsBetterCanonical(), llvm::GlobalVariable::isConstant(), llvm::GlobalValue::isWeakForLinker(), llvm::max(), llvm::GlobalValue::None, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::Constant::removeDeadConstantUsers(), second, llvm::GlobalValue::setUnnamedAddr(), llvm::SmallVectorBase::size(), and llvm::Value::use_empty().
Referenced by llvm::ConstantMergePass::run().
| STATISTIC | ( | NumMerged | , |
| "Number of global constants merged" | |||
| ) |
1.8.13