mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
* Implement stuff so that code can declare that they only depend on the CFG of
a function, not on anything else. This speeds up GCCAS a lot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3156 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
37d66c4dea
commit
6b5fe1962b
@ -124,6 +124,11 @@ struct RegisterPassBase {
|
|||||||
protected:
|
protected:
|
||||||
PassInfo *PIObj; // The PassInfo object for this pass
|
PassInfo *PIObj; // The PassInfo object for this pass
|
||||||
void registerPass(PassInfo *);
|
void registerPass(PassInfo *);
|
||||||
|
|
||||||
|
// setPreservesCFG - Notice that this pass only depends on the CFG, so
|
||||||
|
// transformations that do not modify the CFG do not invalidate this pass.
|
||||||
|
//
|
||||||
|
void setPreservesCFG();
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename PassName>
|
template<typename PassName>
|
||||||
@ -185,27 +190,20 @@ struct RegisterOpt : public RegisterPassBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// RegisterAnalysis - Register something that is to show up in Analysis, this is
|
// RegisterAnalysis - Register something that is to show up in Analysis, this is
|
||||||
// just a shortcut for specifying RegisterPass...
|
// just a shortcut for specifying RegisterPass... Analyses take a special
|
||||||
|
// argument that, when set to true, tells the system that the analysis ONLY
|
||||||
|
// depends on the shape of the CFG, so if a transformation preserves the CFG
|
||||||
|
// that the analysis is not invalidated.
|
||||||
//
|
//
|
||||||
template<typename PassName>
|
template<typename PassName>
|
||||||
struct RegisterAnalysis : public RegisterPassBase {
|
struct RegisterAnalysis : public RegisterPassBase {
|
||||||
RegisterAnalysis(const char *PassArg, const char *Name) {
|
RegisterAnalysis(const char *PassArg, const char *Name,
|
||||||
|
bool CFGOnly = false) {
|
||||||
registerPass(new PassInfo(Name, PassArg, typeid(PassName),
|
registerPass(new PassInfo(Name, PassArg, typeid(PassName),
|
||||||
PassInfo::Analysis,
|
PassInfo::Analysis,
|
||||||
callDefaultCtor<PassName>, 0));
|
callDefaultCtor<PassName>, 0));
|
||||||
}
|
if (CFGOnly)
|
||||||
|
setPreservesCFG();
|
||||||
// Register Pass using default constructor explicitly...
|
|
||||||
RegisterAnalysis(const char *PassArg, const char *Name, Pass *(*ctor)()) {
|
|
||||||
registerPass(new PassInfo(Name, PassArg, typeid(PassName),
|
|
||||||
PassInfo::Analys, ctor, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register Pass using TargetData constructor...
|
|
||||||
RegisterAnalysis(const char *PassArg, const char *Name,
|
|
||||||
Pass *(*datactor)(const TargetData &)) {
|
|
||||||
registerPass(new PassInfo(Name, PassArg, typeid(PassName),
|
|
||||||
PassInfo::Analysis, 0, datactor));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user