本文整理汇总了C++中module::global_iterator::getNumOperands方法的典型用法代码示例。如果您正苦于以下问题:C++ global_iterator::getNumOperands方法的具体用法?C++ global_iterator::getNumOperands怎么用?C++ global_iterator::getNumOperands使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module::global_iterator
的用法示例。
在下文中一共展示了global_iterator::getNumOperands方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mangler
/// InputFilename is a LLVM bitcode file. Read it using bitcode reader.
/// Collect global functions and symbol names in symbols vector.
/// Collect external references in references vector.
/// Return LTO_READ_SUCCESS if there is no error.
enum LTOStatus
LTO::readLLVMObjectFile(const std::string &InputFilename,
NameToSymbolMap &symbols,
std::set<std::string> &references)
{
Module *m = getModule(InputFilename);
if (!m)
return LTO_READ_FAILURE;
// Collect Target info
getTarget(m);
if (!Target)
return LTO_READ_FAILURE;
// Use mangler to add GlobalPrefix to names to match linker names.
// FIXME : Instead of hard coding "-" use GlobalPrefix.
Mangler mangler(*m, Target->getTargetAsmInfo()->getGlobalPrefix());
modules.push_back(m);
for (Module::iterator f = m->begin(), e = m->end(); f != e; ++f) {
LTOLinkageTypes lt = getLTOLinkageType(f);
LTOVisibilityTypes vis = getLTOVisibilityType(f);
if (!f->isDeclaration() && lt != LTOInternalLinkage
&& strncmp (f->getName().c_str(), "llvm.", 5)) {
int alignment = ( 16 > f->getAlignment() ? 16 : f->getAlignment());
LLVMSymbol *newSymbol = new LLVMSymbol(lt, vis, f, f->getName(),
mangler.getValueName(f),
Log2_32(alignment));
symbols[newSymbol->getMangledName()] = newSymbol;
allSymbols[newSymbol->getMangledName()] = newSymbol;
}
// Collect external symbols referenced by this function.
for (Function::iterator b = f->begin(), fe = f->end(); b != fe; ++b)
for (BasicBlock::iterator i = b->begin(), be = b->end();
i != be; ++i) {
for (unsigned count = 0, total = i->getNumOperands();
count != total; ++count)
findExternalRefs(i->getOperand(count), references, mangler);
}
}
for (Module::global_iterator v = m->global_begin(), e = m->global_end();
v != e; ++v) {
LTOLinkageTypes lt = getLTOLinkageType(v);
LTOVisibilityTypes vis = getLTOVisibilityType(v);
if (!v->isDeclaration() && lt != LTOInternalLinkage
&& strncmp (v->getName().c_str(), "llvm.", 5)) {
const TargetData *TD = Target->getTargetData();
LLVMSymbol *newSymbol = new LLVMSymbol(lt, vis, v, v->getName(),
mangler.getValueName(v),
TD->getPreferredAlignmentLog(v));
symbols[newSymbol->getMangledName()] = newSymbol;
allSymbols[newSymbol->getMangledName()] = newSymbol;
for (unsigned count = 0, total = v->getNumOperands();
count != total; ++count)
findExternalRefs(v->getOperand(count), references, mangler);
}
}
return LTO_READ_SUCCESS;
}