mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
Add option '-analyzer-max-loop', which specifies the maximum
number of times the analyzer will go through a loop. llvm-svn: 104007
This commit is contained in:
parent
0dd05fb167
commit
b013b0bc04
@ -37,8 +37,12 @@ class AnalysisManager : public BugReporterData {
|
||||
|
||||
enum AnalysisScope { ScopeTU, ScopeDecl } AScope;
|
||||
|
||||
// The maximum number of exploded nodes the analyzer will generate.
|
||||
unsigned MaxNodes;
|
||||
|
||||
// The maximum number of times the analyzer will go through a loop.
|
||||
unsigned MaxLoop;
|
||||
|
||||
bool VisualizeEGDot;
|
||||
bool VisualizeEGUbi;
|
||||
bool PurgeDead;
|
||||
@ -59,12 +63,13 @@ public:
|
||||
const LangOptions &lang, PathDiagnosticClient *pd,
|
||||
StoreManagerCreator storemgr,
|
||||
ConstraintManagerCreator constraintmgr, unsigned maxnodes,
|
||||
unsigned maxloop,
|
||||
bool vizdot, bool vizubi, bool purge, bool eager, bool trim,
|
||||
bool inlinecall)
|
||||
|
||||
: Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd),
|
||||
CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
|
||||
AScope(ScopeDecl), MaxNodes(maxnodes),
|
||||
AScope(ScopeDecl), MaxNodes(maxnodes), MaxLoop(maxloop),
|
||||
VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
|
||||
EagerlyAssume(eager), TrimGraph(trim), InlineCall(inlinecall) {}
|
||||
|
||||
@ -110,6 +115,8 @@ public:
|
||||
|
||||
unsigned getMaxNodes() const { return MaxNodes; }
|
||||
|
||||
unsigned getMaxLoop() const { return MaxLoop; }
|
||||
|
||||
bool shouldVisualizeGraphviz() const { return VisualizeEGDot; }
|
||||
|
||||
bool shouldVisualizeUbigraph() const { return VisualizeEGUbi; }
|
||||
|
@ -99,6 +99,8 @@ def analyzer_inline_call : Flag<"-analyzer-inline-call">,
|
||||
HelpText<"Experimental transfer function inlining callees when its definition is available.">;
|
||||
def analyzer_max_nodes : Separate<"-analyzer-max-nodes">,
|
||||
HelpText<"The maximum number of nodes the analyzer can generate">;
|
||||
def analyzer_max_loop : Separate<"-analyzer-max-loop">,
|
||||
HelpText<"The maximum number of times the analyzer will go through a loop">;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// CodeGen Options
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
AnalysisDiagClients AnalysisDiagOpt;
|
||||
std::string AnalyzeSpecificFunction;
|
||||
unsigned MaxNodes;
|
||||
unsigned MaxLoop;
|
||||
unsigned AnalyzeAll : 1;
|
||||
unsigned AnalyzerDisplayProgress : 1;
|
||||
unsigned AnalyzeNestedBlocks : 1;
|
||||
|
@ -1017,9 +1017,8 @@ void GRExprEngine::VisitLValue(Expr* Ex, ExplodedNode* Pred,
|
||||
|
||||
bool GRExprEngine::ProcessBlockEntrance(CFGBlock* B, const ExplodedNode *Pred,
|
||||
GRBlockCounter BC) {
|
||||
|
||||
return BC.getNumVisited(Pred->getLocationContext()->getCurrentStackFrame(),
|
||||
B->getBlockID()) < 3;
|
||||
B->getBlockID()) < AMgr.getMaxLoop();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -174,7 +174,7 @@ public:
|
||||
Mgr.reset(new AnalysisManager(*Ctx, PP.getDiagnostics(),
|
||||
PP.getLangOptions(), PD,
|
||||
CreateStoreMgr, CreateConstraintMgr,
|
||||
Opts.MaxNodes,
|
||||
Opts.MaxNodes, Opts.MaxLoop,
|
||||
Opts.VisualizeEGDot, Opts.VisualizeEGUbi,
|
||||
Opts.PurgeDead, Opts.EagerlyAssume,
|
||||
Opts.TrimGraph, Opts.InlineCall));
|
||||
|
@ -798,6 +798,7 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
|
||||
Args.hasArg(OPT_analyzer_experimental_internal_checks);
|
||||
Opts.TrimGraph = Args.hasArg(OPT_trim_egraph);
|
||||
Opts.MaxNodes = getLastArgIntValue(Args, OPT_analyzer_max_nodes,150000,Diags);
|
||||
Opts.MaxLoop = getLastArgIntValue(Args, OPT_analyzer_max_loop, 3, Diags);
|
||||
Opts.InlineCall = Args.hasArg(OPT_analyzer_inline_call);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user