本文整理汇总了C++中LTOModule::ParseSymbols方法的典型用法代码示例。如果您正苦于以下问题:C++ LTOModule::ParseSymbols方法的具体用法?C++ LTOModule::ParseSymbols怎么用?C++ LTOModule::ParseSymbols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LTOModule
的用法示例。
在下文中一共展示了LTOModule::ParseSymbols方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializeAllTargets
LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer,
std::string &errMsg) {
static bool Initialized = false;
if (!Initialized) {
InitializeAllTargets();
InitializeAllTargetMCs();
InitializeAllAsmParsers();
Initialized = true;
}
// parse bitcode buffer
OwningPtr<Module> m(getLazyBitcodeModule(buffer, getGlobalContext(),
&errMsg));
if (!m) {
delete buffer;
return NULL;
}
std::string Triple = m->getTargetTriple();
if (Triple.empty())
Triple = sys::getDefaultTargetTriple();
// find machine architecture for this module
const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
if (!march)
return NULL;
// construct LTOModule, hand over ownership of module and target
SubtargetFeatures Features;
Features.getDefaultSubtargetFeatures(llvm::Triple(Triple));
std::string FeatureStr = Features.getString();
std::string CPU;
TargetOptions Options;
TargetMachine *target = march->createTargetMachine(Triple, CPU, FeatureStr,
Options);
LTOModule *Ret = new LTOModule(m.take(), target);
if (Ret->ParseSymbols(errMsg)) {
delete Ret;
return NULL;
}
return Ret;
}