diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-11-01 18:06:13 +1100 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-11-01 18:06:13 +1100 |
commit | b7eaa99578037789a337c5061c0ea8ee3150b63c (patch) | |
tree | e63a023a85ef167760f55229c1d96fbcaaa1c64e /clang/lib/Analysis | |
parent | e207a8fec1bae01068bdb3a27a2090a4af5f8cb2 (diff) |
A bunch of fixes to the solver, and moving it in to clang.
Also some contribution writing stuff.
Basically: lots of work.
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r-- | clang/lib/Analysis/Interval.cpp | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/clang/lib/Analysis/Interval.cpp b/clang/lib/Analysis/Interval.cpp index ac96107..3a82344 100644 --- a/clang/lib/Analysis/Interval.cpp +++ b/clang/lib/Analysis/Interval.cpp @@ -221,11 +221,6 @@ M merge_maps_with(const F& f, const M& left, const M& right) { return result; } -template<> -Vector minimum(const Vector& l, const Vector& r) { - return (l < r ? l : r); - return merge_maps_with(minimum<ZBar>, l, r); -} template<class T> T max(const T& l, const T& r) { return (l < r ? l : r); @@ -702,39 +697,15 @@ void IntervalAnalysis::runOnAllBlocks() { } } - std::vector<EqnExpr*> a; - - a.push_back(&system.constant(-infinity<ZBar>())); - a.push_back(&system.constant(0)); - system[system.variable("x")] = &system.maxExpression(a); - a.clear(); - - system.variable("y"); - - a.push_back(&system.variable("x")); - a.push_back(&system.variable("z")); - EqnExpr* minExpr = &system.expression(new Maximum<ZBar>(), a); - a.clear(); - - a.push_back(&system.constant(-infinity<ZBar>())); - a.push_back(minExpr); - system[system.variable("y")] = &system.maxExpression(a); - a.clear(); - - a.push_back(&system.constant(-infinity<ZBar>())); - a.push_back(&system.variable("y")); - system[system.variable("z")] = &system.maxExpression(a); - llvm::errs() << toString(system) << "\n"; system.indexMaxExpressions(); - DynamicMaxStrategy<ZBar> strategy(system); - DynamicVariableAssignment<ZBar> rho(system, strategy); - strategy.setRho(rho); + + Solver<ZBar> solver(system); for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) { EqnVar& var = system.variable(size - i - 1); - llvm::errs() << toString(var.name()) << " = " << toString(rho[var]) << "\n"; + llvm::errs() << toString(var.name()) << " = " << toString(solver.solve(var)) << "\n"; } } |