mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-13 06:29:59 +00:00
Rename NameAnonFunctions to NameAnonGlobals to match what it is doing (NFC)
llvm-svn: 281745
This commit is contained in:
parent
55d44fcce3
commit
21a9844262
@ -244,7 +244,7 @@ void initializeMergedLoadStoreMotionLegacyPassPass(PassRegistry &);
|
|||||||
void initializeMetaRenamerPass(PassRegistry&);
|
void initializeMetaRenamerPass(PassRegistry&);
|
||||||
void initializeModuleDebugInfoPrinterPass(PassRegistry&);
|
void initializeModuleDebugInfoPrinterPass(PassRegistry&);
|
||||||
void initializeModuleSummaryIndexWrapperPassPass(PassRegistry &);
|
void initializeModuleSummaryIndexWrapperPassPass(PassRegistry &);
|
||||||
void initializeNameAnonFunctionLegacyPassPass(PassRegistry &);
|
void initializeNameAnonGlobalLegacyPassPass(PassRegistry &);
|
||||||
void initializeNaryReassociateLegacyPassPass(PassRegistry &);
|
void initializeNaryReassociateLegacyPassPass(PassRegistry &);
|
||||||
void initializeNoAAPass(PassRegistry&);
|
void initializeNoAAPass(PassRegistry&);
|
||||||
void initializeObjCARCAAWrapperPassPass(PassRegistry&);
|
void initializeObjCARCAAWrapperPassPass(PassRegistry&);
|
||||||
|
@ -516,7 +516,7 @@ FunctionPass *createLoopVersioningPass();
|
|||||||
FunctionPass *createLoopDataPrefetchPass();
|
FunctionPass *createLoopDataPrefetchPass();
|
||||||
|
|
||||||
///===---------------------------------------------------------------------===//
|
///===---------------------------------------------------------------------===//
|
||||||
ModulePass *createNameAnonFunctionPass();
|
ModulePass *createNameAnonGlobalPass();
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ std::pair<Function *, Function *> createSanitizerCtorAndInitFunctions(
|
|||||||
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
|
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
|
||||||
StringRef VersionCheckName = StringRef());
|
StringRef VersionCheckName = StringRef());
|
||||||
|
|
||||||
/// Rename all the anon functions in the module using a hash computed from
|
/// Rename all the anon globals in the module using a hash computed from
|
||||||
/// the list of public globals in the module.
|
/// the list of public globals in the module.
|
||||||
bool nameUnamedFunctions(Module &M);
|
bool nameUnamedGlobals(Module &M);
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//===-- NameAnonFunctions.h - Anonymous Function Naming Pass ----*- C++ -*-===//
|
//===-- NameAnonGlobals.h - Anonymous Global Naming Pass ----*- C++ -*-=======//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
@ -7,25 +7,25 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// This file implements naming anonymous function to make sure they can be
|
// This file implements naming anonymous globals to make sure they can be
|
||||||
// referred to by ThinLTO.
|
// referred to by ThinLTO.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#ifndef LLVM_TRANSFORMS_UTILS_NAMEANONFUNCTIONS_H
|
#ifndef LLVM_TRANSFORMS_UTILS_NAMEANONGLOBALSS_H
|
||||||
#define LLVM_TRANSFORMS_UTILS_NAMEANONFUNCTIONS_H
|
#define LLVM_TRANSFORMS_UTILS_NAMEANONGLOBALSS_H
|
||||||
|
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/IR/PassManager.h"
|
#include "llvm/IR/PassManager.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
/// Simple pass that provides a name to every anonymous function.
|
/// Simple pass that provides a name to every anonymous globals.
|
||||||
class NameAnonFunctionPass : public PassInfoMixin<NameAnonFunctionPass> {
|
class NameAnonGlobalPass : public PassInfoMixin<NameAnonGlobalPass> {
|
||||||
public:
|
public:
|
||||||
NameAnonFunctionPass() {}
|
NameAnonGlobalPass() {}
|
||||||
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
|
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // LLVM_TRANSFORMS_UTILS_NAMEANONFUNCTIONS_H
|
#endif // LLVM_TRANSFORMS_UTILS_NAMEANONGLOBALS_H
|
@ -24,11 +24,11 @@
|
|||||||
#include "llvm/Analysis/BlockFrequencyInfo.h"
|
#include "llvm/Analysis/BlockFrequencyInfo.h"
|
||||||
#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
|
#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
|
||||||
#include "llvm/Analysis/BranchProbabilityInfo.h"
|
#include "llvm/Analysis/BranchProbabilityInfo.h"
|
||||||
|
#include "llvm/Analysis/CFGPrinter.h"
|
||||||
#include "llvm/Analysis/CFLAndersAliasAnalysis.h"
|
#include "llvm/Analysis/CFLAndersAliasAnalysis.h"
|
||||||
#include "llvm/Analysis/CFLSteensAliasAnalysis.h"
|
#include "llvm/Analysis/CFLSteensAliasAnalysis.h"
|
||||||
#include "llvm/Analysis/CGSCCPassManager.h"
|
#include "llvm/Analysis/CGSCCPassManager.h"
|
||||||
#include "llvm/Analysis/CallGraph.h"
|
#include "llvm/Analysis/CallGraph.h"
|
||||||
#include "llvm/Analysis/CFGPrinter.h"
|
|
||||||
#include "llvm/Analysis/DemandedBits.h"
|
#include "llvm/Analysis/DemandedBits.h"
|
||||||
#include "llvm/Analysis/DependenceAnalysis.h"
|
#include "llvm/Analysis/DependenceAnalysis.h"
|
||||||
#include "llvm/Analysis/DominanceFrontier.h"
|
#include "llvm/Analysis/DominanceFrontier.h"
|
||||||
@ -125,7 +125,7 @@
|
|||||||
#include "llvm/Transforms/Utils/LowerInvoke.h"
|
#include "llvm/Transforms/Utils/LowerInvoke.h"
|
||||||
#include "llvm/Transforms/Utils/Mem2Reg.h"
|
#include "llvm/Transforms/Utils/Mem2Reg.h"
|
||||||
#include "llvm/Transforms/Utils/MemorySSA.h"
|
#include "llvm/Transforms/Utils/MemorySSA.h"
|
||||||
#include "llvm/Transforms/Utils/NameAnonFunctions.h"
|
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
|
||||||
#include "llvm/Transforms/Utils/SimplifyInstructions.h"
|
#include "llvm/Transforms/Utils/SimplifyInstructions.h"
|
||||||
#include "llvm/Transforms/Utils/SymbolRewriter.h"
|
#include "llvm/Transforms/Utils/SymbolRewriter.h"
|
||||||
#include "llvm/Transforms/Vectorize/LoopVectorize.h"
|
#include "llvm/Transforms/Vectorize/LoopVectorize.h"
|
||||||
|
@ -54,7 +54,7 @@ MODULE_PASS("internalize", InternalizePass())
|
|||||||
MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
|
MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
|
||||||
MODULE_PASS("ipsccp", IPSCCPPass())
|
MODULE_PASS("ipsccp", IPSCCPPass())
|
||||||
MODULE_PASS("lowertypetests", LowerTypeTestsPass())
|
MODULE_PASS("lowertypetests", LowerTypeTestsPass())
|
||||||
MODULE_PASS("name-anon-functions", NameAnonFunctionPass())
|
MODULE_PASS("name-global-functions", NameAnonGlobalPass())
|
||||||
MODULE_PASS("no-op-module", NoOpModulePass())
|
MODULE_PASS("no-op-module", NoOpModulePass())
|
||||||
MODULE_PASS("partial-inliner", PartialInlinerPass())
|
MODULE_PASS("partial-inliner", PartialInlinerPass())
|
||||||
MODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
|
MODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
|
||||||
|
@ -491,8 +491,8 @@ void PassManagerBuilder::populateModulePassManager(
|
|||||||
if (PrepareForThinLTO) {
|
if (PrepareForThinLTO) {
|
||||||
// Reduce the size of the IR as much as possible.
|
// Reduce the size of the IR as much as possible.
|
||||||
MPM.add(createGlobalOptimizerPass());
|
MPM.add(createGlobalOptimizerPass());
|
||||||
// Rename anon function to be able to export them in the summary.
|
// Rename anon globals to be able to export them in the summary.
|
||||||
MPM.add(createNameAnonFunctionPass());
|
MPM.add(createNameAnonGlobalPass());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ add_llvm_library(LLVMTransformUtils
|
|||||||
MemorySSA.cpp
|
MemorySSA.cpp
|
||||||
MetaRenamer.cpp
|
MetaRenamer.cpp
|
||||||
ModuleUtils.cpp
|
ModuleUtils.cpp
|
||||||
NameAnonFunctions.cpp
|
NameAnonGlobals.cpp
|
||||||
PromoteMemoryToRegister.cpp
|
PromoteMemoryToRegister.cpp
|
||||||
SSAUpdater.cpp
|
SSAUpdater.cpp
|
||||||
SanitizerStats.cpp
|
SanitizerStats.cpp
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//===- NameAnonFunctions.cpp - ThinLTO Summary-based Function Import ------===//
|
//===- NameAnonGlobals.cpp - ThinLTO Support: Name Unnamed Globals --------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
@ -7,12 +7,12 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// This file implements naming anonymous function to make sure they can be
|
// This file implements naming anonymous globals to make sure they can be
|
||||||
// refered to by ThinLTO.
|
// referred to by ThinLTO.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Transforms/Utils/NameAnonFunctions.h"
|
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
|
||||||
|
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
@ -23,7 +23,7 @@ using namespace llvm;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// Compute a "unique" hash for the module based on the name of the public
|
// Compute a "unique" hash for the module based on the name of the public
|
||||||
// functions.
|
// globals.
|
||||||
class ModuleHasher {
|
class ModuleHasher {
|
||||||
Module &TheModule;
|
Module &TheModule;
|
||||||
std::string TheHash;
|
std::string TheHash;
|
||||||
@ -62,12 +62,12 @@ public:
|
|||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
// Rename all the anon functions in the module
|
// Rename all the anon globals in the module
|
||||||
bool llvm::nameUnamedFunctions(Module &M) {
|
bool llvm::nameUnamedGlobals(Module &M) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
ModuleHasher ModuleHash(M);
|
ModuleHasher ModuleHash(M);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
auto RenameIfNeed = [&] (GlobalValue &GV) {
|
auto RenameIfNeed = [&](GlobalValue &GV) {
|
||||||
if (GV.hasName())
|
if (GV.hasName())
|
||||||
return;
|
return;
|
||||||
GV.setName(Twine("anon.") + ModuleHash.get() + "." + Twine(count++));
|
GV.setName(Twine("anon.") + ModuleHash.get() + "." + Twine(count++));
|
||||||
@ -83,39 +83,39 @@ bool llvm::nameUnamedFunctions(Module &M) {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Legacy pass that provides a name to every anon function.
|
// Legacy pass that provides a name to every anon globals.
|
||||||
class NameAnonFunctionLegacyPass : public ModulePass {
|
class NameAnonGlobalLegacyPass : public ModulePass {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Pass identification, replacement for typeid
|
/// Pass identification, replacement for typeid
|
||||||
static char ID;
|
static char ID;
|
||||||
|
|
||||||
/// Specify pass name for debug output
|
/// Specify pass name for debug output
|
||||||
const char *getPassName() const override { return "Name Anon Functions"; }
|
const char *getPassName() const override { return "Name Anon Globals"; }
|
||||||
|
|
||||||
explicit NameAnonFunctionLegacyPass() : ModulePass(ID) {}
|
explicit NameAnonGlobalLegacyPass() : ModulePass(ID) {}
|
||||||
|
|
||||||
bool runOnModule(Module &M) override { return nameUnamedFunctions(M); }
|
bool runOnModule(Module &M) override { return nameUnamedGlobals(M); }
|
||||||
};
|
};
|
||||||
char NameAnonFunctionLegacyPass::ID = 0;
|
char NameAnonGlobalLegacyPass::ID = 0;
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
PreservedAnalyses NameAnonFunctionPass::run(Module &M,
|
PreservedAnalyses NameAnonGlobalPass::run(Module &M,
|
||||||
ModuleAnalysisManager &AM) {
|
ModuleAnalysisManager &AM) {
|
||||||
if (!nameUnamedFunctions(M))
|
if (!nameUnamedGlobals(M))
|
||||||
return PreservedAnalyses::all();
|
return PreservedAnalyses::all();
|
||||||
|
|
||||||
return PreservedAnalyses::none();
|
return PreservedAnalyses::none();
|
||||||
}
|
}
|
||||||
|
|
||||||
INITIALIZE_PASS_BEGIN(NameAnonFunctionLegacyPass, "name-anon-functions",
|
INITIALIZE_PASS_BEGIN(NameAnonGlobalLegacyPass, "name-anon-globals",
|
||||||
"Provide a name to nameless functions", false, false)
|
"Provide a name to nameless globals", false, false)
|
||||||
INITIALIZE_PASS_END(NameAnonFunctionLegacyPass, "name-anon-functions",
|
INITIALIZE_PASS_END(NameAnonGlobalLegacyPass, "name-anon-globals",
|
||||||
"Provide a name to nameless functions", false, false)
|
"Provide a name to nameless globals", false, false)
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
ModulePass *createNameAnonFunctionPass() {
|
ModulePass *createNameAnonGlobalPass() {
|
||||||
return new NameAnonFunctionLegacyPass();
|
return new NameAnonGlobalLegacyPass();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,7 +28,7 @@ void llvm::initializeTransformUtils(PassRegistry &Registry) {
|
|||||||
initializeLoopSimplifyPass(Registry);
|
initializeLoopSimplifyPass(Registry);
|
||||||
initializeLowerInvokeLegacyPassPass(Registry);
|
initializeLowerInvokeLegacyPassPass(Registry);
|
||||||
initializeLowerSwitchPass(Registry);
|
initializeLowerSwitchPass(Registry);
|
||||||
initializeNameAnonFunctionLegacyPassPass(Registry);
|
initializeNameAnonGlobalLegacyPassPass(Registry);
|
||||||
initializePromoteLegacyPassPass(Registry);
|
initializePromoteLegacyPassPass(Registry);
|
||||||
initializeUnifyFunctionExitNodesPass(Registry);
|
initializeUnifyFunctionExitNodesPass(Registry);
|
||||||
initializeInstSimplifierPass(Registry);
|
initializeInstSimplifierPass(Registry);
|
||||||
|
Loading…
Reference in New Issue
Block a user