2011-10-17 19:17:43 +02:00
|
|
|
//===-- GlobalMerge.cpp - Internal globals merging -----------------------===//
|
2010-07-24 23:52:08 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// This pass merges globals with internal linkage into one. This way all the
|
|
|
|
// globals which were merged into a biggest one can be addressed using offsets
|
|
|
|
// from the same base pointer (no need for separate base pointer for each of the
|
|
|
|
// global). Such a transformation can significantly reduce the register pressure
|
|
|
|
// when many globals are involved.
|
|
|
|
//
|
2012-07-24 12:51:42 +02:00
|
|
|
// For example, consider the code which touches several global variables at
|
2010-09-28 06:18:29 +02:00
|
|
|
// once:
|
2010-07-24 23:52:08 +02:00
|
|
|
//
|
|
|
|
// static int foo[N], bar[N], baz[N];
|
|
|
|
//
|
|
|
|
// for (i = 0; i < N; ++i) {
|
|
|
|
// foo[i] = bar[i] * baz[i];
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// On ARM the addresses of 3 arrays should be kept in the registers, thus
|
|
|
|
// this code has quite large register pressure (loop body):
|
|
|
|
//
|
|
|
|
// ldr r1, [r5], #4
|
|
|
|
// ldr r2, [r6], #4
|
|
|
|
// mul r1, r2, r1
|
|
|
|
// str r1, [r0], #4
|
|
|
|
//
|
|
|
|
// Pass converts the code to something like:
|
|
|
|
//
|
|
|
|
// static struct {
|
|
|
|
// int foo[N];
|
|
|
|
// int bar[N];
|
|
|
|
// int baz[N];
|
|
|
|
// } merged;
|
|
|
|
//
|
|
|
|
// for (i = 0; i < N; ++i) {
|
|
|
|
// merged.foo[i] = merged.bar[i] * merged.baz[i];
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// and in ARM code this becomes:
|
|
|
|
//
|
|
|
|
// ldr r0, [r5, #40]
|
|
|
|
// ldr r1, [r5, #80]
|
|
|
|
// mul r0, r1, r0
|
|
|
|
// str r0, [r5], #4
|
|
|
|
//
|
|
|
|
// note that we saved 2 registers here almostly "for free".
|
2010-09-28 06:18:29 +02:00
|
|
|
// ===---------------------------------------------------------------------===//
|
2010-07-24 23:52:08 +02:00
|
|
|
|
2011-10-17 19:17:43 +02:00
|
|
|
#include "llvm/Transforms/Scalar.h"
|
2013-03-18 23:30:07 +01:00
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
2012-12-03 17:50:05 +01:00
|
|
|
#include "llvm/ADT/Statistic.h"
|
2013-01-02 12:36:10 +01:00
|
|
|
#include "llvm/IR/Attributes.h"
|
|
|
|
#include "llvm/IR/Constants.h"
|
|
|
|
#include "llvm/IR/DataLayout.h"
|
|
|
|
#include "llvm/IR/DerivedTypes.h"
|
|
|
|
#include "llvm/IR/Function.h"
|
|
|
|
#include "llvm/IR/GlobalVariable.h"
|
|
|
|
#include "llvm/IR/Instructions.h"
|
|
|
|
#include "llvm/IR/Intrinsics.h"
|
|
|
|
#include "llvm/IR/Module.h"
|
2010-07-24 23:52:08 +02:00
|
|
|
#include "llvm/Pass.h"
|
2014-06-14 00:57:59 +02:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2013-03-18 23:30:07 +01:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
2010-07-24 23:52:08 +02:00
|
|
|
#include "llvm/Target/TargetLowering.h"
|
2010-11-17 22:25:39 +01:00
|
|
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
2014-08-04 23:25:23 +02:00
|
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
2010-07-24 23:52:08 +02:00
|
|
|
using namespace llvm;
|
|
|
|
|
2014-04-22 04:55:47 +02:00
|
|
|
#define DEBUG_TYPE "global-merge"
|
|
|
|
|
2014-02-18 12:17:29 +01:00
|
|
|
static cl::opt<bool>
|
2014-06-11 08:35:26 +02:00
|
|
|
EnableGlobalMerge("enable-global-merge", cl::Hidden,
|
2014-02-18 12:17:29 +01:00
|
|
|
cl::desc("Enable global merge pass"),
|
|
|
|
cl::init(true));
|
|
|
|
|
2013-03-18 23:30:07 +01:00
|
|
|
static cl::opt<bool>
|
|
|
|
EnableGlobalMergeOnConst("global-merge-on-const", cl::Hidden,
|
2013-07-22 23:11:30 +02:00
|
|
|
cl::desc("Enable global merge pass on constants"),
|
|
|
|
cl::init(false));
|
2013-03-18 23:30:07 +01:00
|
|
|
|
2014-06-11 08:44:53 +02:00
|
|
|
// FIXME: this could be a transitional option, and we probably need to remove
|
|
|
|
// it if only we are sure this optimization could always benefit all targets.
|
|
|
|
static cl::opt<bool>
|
|
|
|
EnableGlobalMergeOnExternal("global-merge-on-external", cl::Hidden,
|
|
|
|
cl::desc("Enable global merge pass on external linkage"),
|
|
|
|
cl::init(false));
|
|
|
|
|
2011-10-17 19:17:43 +02:00
|
|
|
STATISTIC(NumMerged , "Number of globals merged");
|
2010-07-24 23:52:08 +02:00
|
|
|
namespace {
|
2011-10-17 19:17:43 +02:00
|
|
|
class GlobalMerge : public FunctionPass {
|
2013-06-19 23:07:11 +02:00
|
|
|
const TargetMachine *TM;
|
2010-07-24 23:52:08 +02:00
|
|
|
|
|
|
|
bool doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
|
2013-01-07 13:31:25 +01:00
|
|
|
Module &M, bool isConst, unsigned AddrSpace) const;
|
2010-07-24 23:52:08 +02:00
|
|
|
|
2013-03-18 23:30:07 +01:00
|
|
|
/// \brief Check if the given variable has been identified as must keep
|
|
|
|
/// \pre setMustKeepGlobalVariables must have been called on the Module that
|
|
|
|
/// contains GV
|
|
|
|
bool isMustKeepGlobalVariable(const GlobalVariable *GV) const {
|
|
|
|
return MustKeepGlobalVariables.count(GV);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Collect every variables marked as "used" or used in a landing pad
|
|
|
|
/// instruction for this Module.
|
|
|
|
void setMustKeepGlobalVariables(Module &M);
|
|
|
|
|
|
|
|
/// Collect every variables marked as "used"
|
|
|
|
void collectUsedGlobalVariables(Module &M);
|
|
|
|
|
2013-03-19 22:46:49 +01:00
|
|
|
/// Keep track of the GlobalVariable that must not be merged away
|
2013-03-18 23:30:07 +01:00
|
|
|
SmallPtrSet<const GlobalVariable *, 16> MustKeepGlobalVariables;
|
|
|
|
|
2010-07-24 23:52:08 +02:00
|
|
|
public:
|
|
|
|
static char ID; // Pass identification, replacement for typeid.
|
2014-04-25 07:29:35 +02:00
|
|
|
explicit GlobalMerge(const TargetMachine *TM = nullptr)
|
2013-06-19 23:07:11 +02:00
|
|
|
: FunctionPass(ID), TM(TM) {
|
2011-10-17 19:17:43 +02:00
|
|
|
initializeGlobalMergePass(*PassRegistry::getPassRegistry());
|
|
|
|
}
|
2010-07-24 23:52:08 +02:00
|
|
|
|
2014-03-05 10:10:37 +01:00
|
|
|
bool doInitialization(Module &M) override;
|
|
|
|
bool runOnFunction(Function &F) override;
|
|
|
|
bool doFinalization(Module &M) override;
|
2010-07-24 23:52:08 +02:00
|
|
|
|
2014-03-05 10:10:37 +01:00
|
|
|
const char *getPassName() const override {
|
2010-07-24 23:52:08 +02:00
|
|
|
return "Merge internal globals";
|
|
|
|
}
|
|
|
|
|
2014-03-05 10:10:37 +01:00
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
2010-07-24 23:52:08 +02:00
|
|
|
AU.setPreservesCFG();
|
|
|
|
FunctionPass::getAnalysisUsage(AU);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // end anonymous namespace
|
|
|
|
|
2011-10-17 19:17:43 +02:00
|
|
|
char GlobalMerge::ID = 0;
|
2014-06-11 09:04:37 +02:00
|
|
|
INITIALIZE_TM_PASS(GlobalMerge, "global-merge", "Merge global variables",
|
|
|
|
false, false)
|
2010-07-24 23:52:08 +02:00
|
|
|
|
2011-10-17 19:17:43 +02:00
|
|
|
bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
|
2013-01-07 13:31:25 +01:00
|
|
|
Module &M, bool isConst, unsigned AddrSpace) const {
|
2014-08-04 23:25:23 +02:00
|
|
|
const TargetLowering *TLI = TM->getSubtargetImpl()->getTargetLowering();
|
2014-02-21 01:06:31 +01:00
|
|
|
const DataLayout *DL = TLI->getDataLayout();
|
2010-07-24 23:52:08 +02:00
|
|
|
|
|
|
|
// FIXME: Infer the maximum possible offset depending on the actual users
|
|
|
|
// (these max offsets are different for the users inside Thumb or ARM
|
|
|
|
// functions)
|
|
|
|
unsigned MaxOffset = TLI->getMaximalGlobalOffset();
|
|
|
|
|
|
|
|
// FIXME: Find better heuristics
|
2014-03-01 12:47:00 +01:00
|
|
|
std::stable_sort(Globals.begin(), Globals.end(),
|
|
|
|
[DL](const GlobalVariable *GV1, const GlobalVariable *GV2) {
|
|
|
|
Type *Ty1 = cast<PointerType>(GV1->getType())->getElementType();
|
|
|
|
Type *Ty2 = cast<PointerType>(GV2->getType())->getElementType();
|
|
|
|
|
|
|
|
return (DL->getTypeAllocSize(Ty1) < DL->getTypeAllocSize(Ty2));
|
|
|
|
});
|
2010-07-24 23:52:08 +02:00
|
|
|
|
2011-07-18 06:54:35 +02:00
|
|
|
Type *Int32Ty = Type::getInt32Ty(M.getContext());
|
2010-07-24 23:52:08 +02:00
|
|
|
|
2014-06-11 08:44:53 +02:00
|
|
|
assert(Globals.size() > 1);
|
|
|
|
|
|
|
|
// FIXME: This simple solution merges globals all together as maximum as
|
|
|
|
// possible. However, with this solution it would be hard to remove dead
|
|
|
|
// global symbols at link-time. An alternative solution could be checking
|
|
|
|
// global symbols references function by function, and make the symbols
|
|
|
|
// being referred in the same function merged and we would probably need
|
|
|
|
// to introduce heuristic algorithm to solve the merge conflict from
|
|
|
|
// different functions.
|
2010-07-24 23:52:08 +02:00
|
|
|
for (size_t i = 0, e = Globals.size(); i != e; ) {
|
|
|
|
size_t j = 0;
|
|
|
|
uint64_t MergedSize = 0;
|
2011-07-12 16:06:48 +02:00
|
|
|
std::vector<Type*> Tys;
|
2010-07-24 23:52:08 +02:00
|
|
|
std::vector<Constant*> Inits;
|
2014-06-11 08:44:53 +02:00
|
|
|
|
|
|
|
bool HasExternal = false;
|
|
|
|
GlobalVariable *TheFirstExternal = 0;
|
2010-11-17 22:25:36 +01:00
|
|
|
for (j = i; j != e; ++j) {
|
2011-07-12 16:06:48 +02:00
|
|
|
Type *Ty = Globals[j]->getType()->getElementType();
|
2014-02-21 01:06:31 +01:00
|
|
|
MergedSize += DL->getTypeAllocSize(Ty);
|
2010-11-17 22:25:36 +01:00
|
|
|
if (MergedSize > MaxOffset) {
|
|
|
|
break;
|
|
|
|
}
|
2010-07-24 23:52:08 +02:00
|
|
|
Tys.push_back(Ty);
|
|
|
|
Inits.push_back(Globals[j]->getInitializer());
|
2014-06-11 08:44:53 +02:00
|
|
|
|
|
|
|
if (Globals[j]->hasExternalLinkage() && !HasExternal) {
|
|
|
|
HasExternal = true;
|
|
|
|
TheFirstExternal = Globals[j];
|
|
|
|
}
|
2010-07-24 23:52:08 +02:00
|
|
|
}
|
|
|
|
|
2014-06-11 08:44:53 +02:00
|
|
|
// If merged variables doesn't have external linkage, we needn't to expose
|
|
|
|
// the symbol after merging.
|
|
|
|
GlobalValue::LinkageTypes Linkage = HasExternal
|
|
|
|
? GlobalValue::ExternalLinkage
|
|
|
|
: GlobalValue::InternalLinkage;
|
|
|
|
|
2010-09-05 23:18:45 +02:00
|
|
|
StructType *MergedTy = StructType::get(M.getContext(), Tys);
|
|
|
|
Constant *MergedInit = ConstantStruct::get(MergedTy, Inits);
|
2014-06-11 08:44:53 +02:00
|
|
|
|
2014-07-08 16:55:06 +02:00
|
|
|
// If merged variables have external linkage, we use symbol name of the
|
|
|
|
// first variable merged as the suffix of global symbol name. This would
|
|
|
|
// be able to avoid the link-time naming conflict for globalm symbols.
|
2014-06-11 08:44:53 +02:00
|
|
|
GlobalVariable *MergedGV = new GlobalVariable(
|
2014-07-08 16:55:06 +02:00
|
|
|
M, MergedTy, isConst, Linkage, MergedInit,
|
|
|
|
HasExternal ? "_MergedGlobals_" + TheFirstExternal->getName()
|
|
|
|
: "_MergedGlobals",
|
|
|
|
nullptr, GlobalVariable::NotThreadLocal, AddrSpace);
|
2014-06-11 08:44:53 +02:00
|
|
|
|
2010-07-24 23:52:08 +02:00
|
|
|
for (size_t k = i; k < j; ++k) {
|
2014-06-11 08:44:53 +02:00
|
|
|
GlobalValue::LinkageTypes Linkage = Globals[k]->getLinkage();
|
|
|
|
std::string Name = Globals[k]->getName();
|
|
|
|
|
2010-09-05 23:18:45 +02:00
|
|
|
Constant *Idx[2] = {
|
|
|
|
ConstantInt::get(Int32Ty, 0),
|
|
|
|
ConstantInt::get(Int32Ty, k-i)
|
|
|
|
};
|
2011-07-21 16:31:17 +02:00
|
|
|
Constant *GEP = ConstantExpr::getInBoundsGetElementPtr(MergedGV, Idx);
|
2010-07-24 23:52:08 +02:00
|
|
|
Globals[k]->replaceAllUsesWith(GEP);
|
|
|
|
Globals[k]->eraseFromParent();
|
2014-06-11 08:44:53 +02:00
|
|
|
|
|
|
|
if (Linkage != GlobalValue::InternalLinkage) {
|
|
|
|
// Generate a new alias...
|
|
|
|
auto *PTy = cast<PointerType>(GEP->getType());
|
|
|
|
GlobalAlias::create(PTy->getElementType(), PTy->getAddressSpace(),
|
|
|
|
Linkage, Name, GEP, &M);
|
|
|
|
}
|
|
|
|
|
2011-10-17 19:17:43 +02:00
|
|
|
NumMerged++;
|
2010-07-24 23:52:08 +02:00
|
|
|
}
|
|
|
|
i = j;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-03-18 23:30:07 +01:00
|
|
|
void GlobalMerge::collectUsedGlobalVariables(Module &M) {
|
|
|
|
// Extract global variables from llvm.used array
|
|
|
|
const GlobalVariable *GV = M.getGlobalVariable("llvm.used");
|
|
|
|
if (!GV || !GV->hasInitializer()) return;
|
|
|
|
|
|
|
|
// Should be an array of 'i8*'.
|
2013-04-22 16:58:02 +02:00
|
|
|
const ConstantArray *InitList = cast<ConstantArray>(GV->getInitializer());
|
|
|
|
|
2013-03-18 23:30:07 +01:00
|
|
|
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i)
|
|
|
|
if (const GlobalVariable *G =
|
|
|
|
dyn_cast<GlobalVariable>(InitList->getOperand(i)->stripPointerCasts()))
|
|
|
|
MustKeepGlobalVariables.insert(G);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GlobalMerge::setMustKeepGlobalVariables(Module &M) {
|
|
|
|
collectUsedGlobalVariables(M);
|
|
|
|
|
|
|
|
for (Module::iterator IFn = M.begin(), IEndFn = M.end(); IFn != IEndFn;
|
|
|
|
++IFn) {
|
|
|
|
for (Function::iterator IBB = IFn->begin(), IEndBB = IFn->end();
|
|
|
|
IBB != IEndBB; ++IBB) {
|
2014-03-13 01:04:17 +01:00
|
|
|
// Follow the invoke link to find the landing pad instruction
|
2013-03-18 23:30:07 +01:00
|
|
|
const InvokeInst *II = dyn_cast<InvokeInst>(IBB->getTerminator());
|
|
|
|
if (!II) continue;
|
|
|
|
|
|
|
|
const LandingPadInst *LPInst = II->getUnwindDest()->getLandingPadInst();
|
|
|
|
// Look for globals in the clauses of the landing pad instruction
|
|
|
|
for (unsigned Idx = 0, NumClauses = LPInst->getNumClauses();
|
|
|
|
Idx != NumClauses; ++Idx)
|
|
|
|
if (const GlobalVariable *GV =
|
|
|
|
dyn_cast<GlobalVariable>(LPInst->getClause(Idx)
|
|
|
|
->stripPointerCasts()))
|
|
|
|
MustKeepGlobalVariables.insert(GV);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-07-24 23:52:08 +02:00
|
|
|
|
2011-10-17 19:17:43 +02:00
|
|
|
bool GlobalMerge::doInitialization(Module &M) {
|
2014-02-18 12:17:29 +01:00
|
|
|
if (!EnableGlobalMerge)
|
|
|
|
return false;
|
|
|
|
|
2013-01-07 13:31:25 +01:00
|
|
|
DenseMap<unsigned, SmallVector<GlobalVariable*, 16> > Globals, ConstGlobals,
|
|
|
|
BSSGlobals;
|
2014-08-04 23:25:23 +02:00
|
|
|
const TargetLowering *TLI = TM->getSubtargetImpl()->getTargetLowering();
|
2014-02-21 01:06:31 +01:00
|
|
|
const DataLayout *DL = TLI->getDataLayout();
|
2010-07-24 23:52:08 +02:00
|
|
|
unsigned MaxOffset = TLI->getMaximalGlobalOffset();
|
|
|
|
bool Changed = false;
|
2013-03-18 23:30:07 +01:00
|
|
|
setMustKeepGlobalVariables(M);
|
2010-07-24 23:52:08 +02:00
|
|
|
|
|
|
|
// Grab all non-const globals.
|
|
|
|
for (Module::global_iterator I = M.global_begin(),
|
|
|
|
E = M.global_end(); I != E; ++I) {
|
2014-06-11 08:44:53 +02:00
|
|
|
// Merge is safe for "normal" internal or external globals only
|
|
|
|
if (I->isDeclaration() || I->isThreadLocal() || I->hasSection())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!(EnableGlobalMergeOnExternal && I->hasExternalLinkage()) &&
|
|
|
|
!I->hasInternalLinkage())
|
2010-07-24 23:52:08 +02:00
|
|
|
continue;
|
|
|
|
|
2013-01-07 13:31:25 +01:00
|
|
|
PointerType *PT = dyn_cast<PointerType>(I->getType());
|
|
|
|
assert(PT && "Global variable is not a pointer!");
|
|
|
|
|
|
|
|
unsigned AddressSpace = PT->getAddressSpace();
|
|
|
|
|
2010-07-24 23:52:08 +02:00
|
|
|
// Ignore fancy-aligned globals for now.
|
2014-02-21 01:06:31 +01:00
|
|
|
unsigned Alignment = DL->getPreferredAlignment(I);
|
2011-07-18 06:54:35 +02:00
|
|
|
Type *Ty = I->getType()->getElementType();
|
2014-02-21 01:06:31 +01:00
|
|
|
if (Alignment > DL->getABITypeAlignment(Ty))
|
2010-07-24 23:52:08 +02:00
|
|
|
continue;
|
|
|
|
|
2010-07-26 20:45:39 +02:00
|
|
|
// Ignore all 'special' globals.
|
|
|
|
if (I->getName().startswith("llvm.") ||
|
|
|
|
I->getName().startswith(".llvm."))
|
|
|
|
continue;
|
|
|
|
|
2013-03-18 23:30:07 +01:00
|
|
|
// Ignore all "required" globals:
|
|
|
|
if (isMustKeepGlobalVariable(I))
|
|
|
|
continue;
|
|
|
|
|
2014-02-21 01:06:31 +01:00
|
|
|
if (DL->getTypeAllocSize(Ty) < MaxOffset) {
|
2014-06-10 22:39:39 +02:00
|
|
|
if (TargetLoweringObjectFile::getKindForGlobal(I, *TM).isBSSLocal())
|
2013-01-07 13:31:25 +01:00
|
|
|
BSSGlobals[AddressSpace].push_back(I);
|
2010-11-17 22:25:39 +01:00
|
|
|
else if (I->isConstant())
|
2013-01-07 13:31:25 +01:00
|
|
|
ConstGlobals[AddressSpace].push_back(I);
|
2010-07-24 23:52:08 +02:00
|
|
|
else
|
2013-01-07 13:31:25 +01:00
|
|
|
Globals[AddressSpace].push_back(I);
|
2010-07-24 23:52:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-07 13:31:25 +01:00
|
|
|
for (DenseMap<unsigned, SmallVector<GlobalVariable*, 16> >::iterator
|
|
|
|
I = Globals.begin(), E = Globals.end(); I != E; ++I)
|
|
|
|
if (I->second.size() > 1)
|
|
|
|
Changed |= doMerge(I->second, M, false, I->first);
|
|
|
|
|
|
|
|
for (DenseMap<unsigned, SmallVector<GlobalVariable*, 16> >::iterator
|
|
|
|
I = BSSGlobals.begin(), E = BSSGlobals.end(); I != E; ++I)
|
|
|
|
if (I->second.size() > 1)
|
|
|
|
Changed |= doMerge(I->second, M, false, I->first);
|
2010-11-17 22:25:39 +01:00
|
|
|
|
2013-03-18 23:30:07 +01:00
|
|
|
if (EnableGlobalMergeOnConst)
|
|
|
|
for (DenseMap<unsigned, SmallVector<GlobalVariable*, 16> >::iterator
|
|
|
|
I = ConstGlobals.begin(), E = ConstGlobals.end(); I != E; ++I)
|
|
|
|
if (I->second.size() > 1)
|
|
|
|
Changed |= doMerge(I->second, M, true, I->first);
|
2010-07-24 23:52:08 +02:00
|
|
|
|
|
|
|
return Changed;
|
|
|
|
}
|
|
|
|
|
2011-10-17 19:17:43 +02:00
|
|
|
bool GlobalMerge::runOnFunction(Function &F) {
|
2010-07-24 23:52:08 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-03-19 22:46:49 +01:00
|
|
|
bool GlobalMerge::doFinalization(Module &M) {
|
|
|
|
MustKeepGlobalVariables.clear();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-06-19 23:07:11 +02:00
|
|
|
Pass *llvm::createGlobalMergePass(const TargetMachine *TM) {
|
|
|
|
return new GlobalMerge(TM);
|
2010-07-24 23:52:08 +02:00
|
|
|
}
|