mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-12 06:31:14 +00:00
Added ability to register FunctionPasses as optimizations, with
TargetMachine-accepting constructors (thanks to Chris). llvm-svn: 9781
This commit is contained in:
parent
9347dcdeb9
commit
9116e0e93e
@ -219,6 +219,15 @@ struct RegisterOpt : public RegisterPassBase {
|
||||
if (CFGOnly) setOnlyUsesCFG();
|
||||
}
|
||||
|
||||
/// Register FunctionPass using default constructor explicitly...
|
||||
///
|
||||
RegisterOpt(const char *PassArg, const char *Name, FunctionPass *(*ctor)(),
|
||||
bool CFGOnly = false) {
|
||||
registerPass(new PassInfo(Name, PassArg, typeid(PassName),
|
||||
PassInfo::Optimization, (Pass*(*)())ctor));
|
||||
if (CFGOnly) setOnlyUsesCFG();
|
||||
}
|
||||
|
||||
/// Register Pass using TargetMachine constructor...
|
||||
///
|
||||
RegisterOpt(const char *PassArg, const char *Name,
|
||||
@ -227,6 +236,17 @@ struct RegisterOpt : public RegisterPassBase {
|
||||
PassInfo::Optimization, 0, targetctor));
|
||||
if (CFGOnly) setOnlyUsesCFG();
|
||||
}
|
||||
|
||||
/// Register FunctionPass using TargetMachine constructor...
|
||||
///
|
||||
RegisterOpt(const char *PassArg, const char *Name,
|
||||
FunctionPass *(*targetctor)(TargetMachine &),
|
||||
bool CFGOnly = false) {
|
||||
registerPass(new PassInfo(Name, PassArg, typeid(PassName),
|
||||
PassInfo::Optimization, 0,
|
||||
(Pass*(*)(TargetMachine&))targetctor));
|
||||
if (CFGOnly) setOnlyUsesCFG();
|
||||
}
|
||||
};
|
||||
|
||||
/// RegisterAnalysis - Register something that is to show up in Analysis, this
|
||||
|
Loading…
x
Reference in New Issue
Block a user