From 14c0c8bb717a668084cae8cd4b359ffd6fca73b0 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Mon, 22 Oct 2012 14:55:54 +1100 Subject: Try fixing clang to work with the fixed solver. (This may not compile, for an annoying reason. I'll check in again soon with something better-er, or whatever.) --- clang/lib/Analysis/Interval.cpp | 42 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) (limited to 'clang/lib/Analysis') diff --git a/clang/lib/Analysis/Interval.cpp b/clang/lib/Analysis/Interval.cpp index ac96107..d005048 100644 --- a/clang/lib/Analysis/Interval.cpp +++ b/clang/lib/Analysis/Interval.cpp @@ -702,40 +702,24 @@ void IntervalAnalysis::runOnAllBlocks() { } } - std::vector a; - - a.push_back(&system.constant(-infinity())); - 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(), a); - a.clear(); - - a.push_back(&system.constant(-infinity())); - a.push_back(minExpr); - system[system.variable("y")] = &system.maxExpression(a); - a.clear(); - - a.push_back(&system.constant(-infinity())); - a.push_back(&system.variable("y")); - system[system.variable("z")] = &system.maxExpression(a); - - llvm::errs() << toString(system) << "\n"; - system.indexMaxExpressions(); - DynamicMaxStrategy strategy(system); - DynamicVariableAssignment rho(system, strategy); - strategy.setRho(rho); + IdMap result = solve_for(system); for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) { + EqnVar& var = system.variable(i); + cout << var.name() << " = " << result[var] << endl; + } + + /* + DynamicMaxStrategy strategy(system); + DynamicVariableAssignment rho(system, strategy); + strategy.setRho(rho); + + 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"; - } + } + */ } -- cgit v1.2.3