本文整理汇总了C++中TargetPassConfig::printAndVerify方法的典型用法代码示例。如果您正苦于以下问题:C++ TargetPassConfig::printAndVerify方法的具体用法?C++ TargetPassConfig::printAndVerify怎么用?C++ TargetPassConfig::printAndVerify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TargetPassConfig
的用法示例。
在下文中一共展示了TargetPassConfig::printAndVerify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compileModule
//.........这里部分代码省略.........
{
raw_pwrite_stream *OS = &Out->os();
// Manually do the buffering rather than using buffer_ostream,
// so we can memcmp the contents in CompileTwice mode
SmallVector<char, 0> Buffer;
std::unique_ptr<raw_svector_ostream> BOS;
if ((FileType != TargetMachine::CGFT_AssemblyFile &&
!Out->os().supportsSeeking()) ||
CompileTwice) {
BOS = make_unique<raw_svector_ostream>(Buffer);
OS = BOS.get();
}
AnalysisID StartBeforeID = nullptr;
AnalysisID StartAfterID = nullptr;
AnalysisID StopAfterID = nullptr;
const PassRegistry *PR = PassRegistry::getPassRegistry();
if (!RunPassNames->empty()) {
if (!StartAfter.empty() || !StopAfter.empty()) {
errs() << argv[0] << ": start-after and/or stop-after passes are "
"redundant when run-pass is specified.\n";
return 1;
}
if (!MIR) {
errs() << argv[0] << ": run-pass needs a .mir input.\n";
return 1;
}
LLVMTargetMachine &LLVMTM = static_cast<LLVMTargetMachine&>(*Target);
TargetPassConfig *TPC = LLVMTM.createPassConfig(PM);
PM.add(TPC);
LLVMTM.addMachineModuleInfo(PM);
LLVMTM.addMachineFunctionAnalysis(PM, MIR.get());
TPC->printAndVerify("");
for (std::string &RunPassName : *RunPassNames) {
const PassInfo *PI = PR->getPassInfo(RunPassName);
if (!PI) {
errs() << argv[0] << ": run-pass " << RunPassName << " is not registered.\n";
return 1;
}
Pass *P;
if (PI->getTargetMachineCtor())
P = PI->getTargetMachineCtor()(Target.get());
else if (PI->getNormalCtor())
P = PI->getNormalCtor()();
else {
errs() << argv[0] << ": cannot create pass: "
<< PI->getPassName() << "\n";
return 1;
}
std::string Banner
= std::string("After ") + std::string(P->getPassName());
PM.add(P);
TPC->printAndVerify(Banner);
}
PM.add(createPrintMIRPass(errs()));
} else {
if (!StartAfter.empty()) {
const PassInfo *PI = PR->getPassInfo(StartAfter);
if (!PI) {
errs() << argv[0] << ": start-after pass is not registered.\n";
return 1;
}
StartAfterID = PI->getTypeInfo();