本文整理汇总了C++中PassRegistry类的典型用法代码示例。如果您正苦于以下问题:C++ PassRegistry类的具体用法?C++ PassRegistry怎么用?C++ PassRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PassRegistry类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LLVMRustPrintPasses
extern "C" void LLVMRustPrintPasses() {
LLVMInitializePasses();
struct MyListener : PassRegistrationListener {
void passEnumerate(const PassInfo *Info) {
#if LLVM_VERSION_GE(4, 0)
StringRef PassArg = Info->getPassArgument();
StringRef PassName = Info->getPassName();
if (!PassArg.empty()) {
// These unsigned->signed casts could theoretically overflow, but
// realistically never will (and even if, the result is implementation
// defined rather plain UB).
printf("%15.*s - %.*s\n", (int)PassArg.size(), PassArg.data(),
(int)PassName.size(), PassName.data());
}
#else
if (Info->getPassArgument() && *Info->getPassArgument()) {
printf("%15s - %s\n", Info->getPassArgument(), Info->getPassName());
}
#endif
}
} Listener;
PassRegistry *PR = PassRegistry::getPassRegistry();
PR->enumerateWith(&Listener);
}
示例2: LLVMRustFindAndCreatePass
extern "C" LLVMPassRef LLVMRustFindAndCreatePass(const char *PassName) {
StringRef SR(PassName);
PassRegistry *PR = PassRegistry::getPassRegistry();
const PassInfo *PI = PR->getPassInfo(SR);
if (PI) {
return wrap(PI->createPass());
}
return nullptr;
}
示例3: LLVMCreatePass
extern "C" LLVMPassRef LLVMCreatePass(const char * PassName) {
StringRef SR(PassName);
PassRegistry * PR = PassRegistry::getPassRegistry();
const PassInfo * PI = PR->getPassInfo(SR);
if (PI) {
return wrap(PI->createPass());
} else {
return (LLVMPassRef)0;
}
}
示例4: LLVMRustFindAndCreatePass
extern "C" Pass*
LLVMRustFindAndCreatePass(const char *PassName) {
StringRef SR(PassName);
PassRegistry *PR = PassRegistry::getPassRegistry();
const PassInfo *PI = PR->getPassInfo(SR);
if (PI) {
return PI->createPass();
}
return NULL;
}
示例5: LLVMRustAddPass
extern "C" bool
LLVMRustAddPass(LLVMPassManagerRef PM, const char *PassName) {
PassManagerBase *pm = unwrap(PM);
StringRef SR(PassName);
PassRegistry *PR = PassRegistry::getPassRegistry();
const PassInfo *PI = PR->getPassInfo(SR);
if (PI) {
pm->add(PI->createPass());
return true;
}
return false;
}
示例6: LLVMRustPrintPasses
extern "C" void
LLVMRustPrintPasses() {
LLVMInitializePasses();
struct MyListener : PassRegistrationListener {
void passEnumerate(const PassInfo *info) {
if (info->getPassArgument() && *info->getPassArgument()) {
printf("%15s - %s\n", info->getPassArgument(),
info->getPassName());
}
}
} listener;
PassRegistry *PR = PassRegistry::getPassRegistry();
PR->enumerateWith(&listener);
}
示例7: initializePassOnce
static void initializePassOnce(PassRegistry &Registry) {
const char *Name = "Hexagon Expand Predicate Spill Code";
PassInfo *PI = new PassInfo(Name, "hexagon-spill-pred",
&HexagonExpandPredSpillCode::ID,
nullptr, false, false);
Registry.registerPass(*PI, true);
}
示例8: initializePassOnce
static void initializePassOnce(PassRegistry &Registry) {
PassInfo *PI = new PassInfo("Hexagon CFG Optimizer", "hexagon-cfg",
&HexagonCFGOptimizer::ID, nullptr, false, false);
Registry.registerPass(*PI, true);
}
示例9: initializePassOnce
static void initializePassOnce(PassRegistry &Registry) {
const char *Name = "Hexagon Expand Condsets";
PassInfo *PI = new PassInfo(Name, "expand-condsets",
&HexagonExpandCondsets::ID, 0, false, false);
Registry.registerPass(*PI, true);
}