本文整理汇总了C++中module::iterator::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::setName方法的具体用法?C++ iterator::setName怎么用?C++ iterator::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module::iterator
的用法示例。
在下文中一共展示了iterator::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StripSymbolNames
/// StripSymbolNames - Strip symbol names.
static bool StripSymbolNames(Module &M, bool PreserveDbgInfo) {
SmallPtrSet<const GlobalValue*, 8> llvmUsedValues;
findUsedValues(M.getGlobalVariable("llvm.used"), llvmUsedValues);
findUsedValues(M.getGlobalVariable("llvm.compiler.used"), llvmUsedValues);
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I) {
if (I->hasLocalLinkage() && llvmUsedValues.count(I) == 0)
if (!PreserveDbgInfo || !I->getName().startswith("llvm.dbg"))
I->setName(""); // Internal symbols can't participate in linkage
}
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
if (I->hasLocalLinkage() && llvmUsedValues.count(I) == 0)
if (!PreserveDbgInfo || !I->getName().startswith("llvm.dbg"))
I->setName(""); // Internal symbols can't participate in linkage
StripSymtab(I->getValueSymbolTable(), PreserveDbgInfo);
}
// Remove all names from types.
StripTypeSymtab(M.getTypeSymbolTable(), PreserveDbgInfo);
return true;
}
示例2: DisambiguateGlobalSymbols
/// DisambiguateGlobalSymbols - Give anonymous global values names.
///
static void DisambiguateGlobalSymbols(Module *M) {
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
if (!I->hasName())
I->setName("anon_global");
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
if (!I->hasName())
I->setName("anon_fn");
}
示例3: DisambiguateGlobalSymbols
/// DisambiguateGlobalSymbols - Mangle symbols to guarantee uniqueness by
/// modifying predominantly internal symbols rather than external ones.
///
static void DisambiguateGlobalSymbols(Module *M) {
// Try not to cause collisions by minimizing chances of renaming an
// already-external symbol, so take in external globals and functions as-is.
// The code should work correctly without disambiguation (assuming the same
// mangler is used by the two code generators), but having symbols with the
// same name causes warnings to be emitted by the code generator.
Mangler Mang(*M);
// Agree with the CBE on symbol naming
Mang.markCharUnacceptable('.');
Mang.setPreserveAsmNames(true);
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
I->setName(Mang.getValueName(I));
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
I->setName(Mang.getValueName(I));
}
示例4: DisambiguateGlobalSymbols
/// DisambiguateGlobalSymbols - Mangle symbols to guarantee uniqueness by
/// modifying predominantly internal symbols rather than external ones.
///
static void DisambiguateGlobalSymbols(Module *M) {
// Try not to cause collisions by minimizing chances of renaming an
// already-external symbol, so take in external globals and functions as-is.
// The code should work correctly without disambiguation (assuming the same
// mangler is used by the two code generators), but having symbols with the
// same name causes warnings to be emitted by the code generator.
Mangler Mang(*M);
// Agree with the CBE on symbol naming
Mang.markCharUnacceptable('.');
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I) {
// Don't mangle asm names.
if (!I->hasName() || I->getName()[0] != 1)
I->setName(Mang.getMangledName(I));
}
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
// Don't mangle asm names or intrinsics.
if ((!I->hasName() || I->getName()[0] != 1) &&
I->getIntrinsicID() == 0)
I->setName(Mang.getMangledName(I));
}
}