blob: 2eda869c0ec53f9aa53cd23a0df990c4fc335a10 [file] [log] [blame]
Ted Kremenekd27f8162008-01-15 23:55:06 +00001//===-- GRConstants.cpp - Simple, Path-Sens. Constant Prop. ------*- C++ -*-==//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Constant Propagation via Graph Reachability
11//
12// This files defines a simple analysis that performs path-sensitive
13// constant propagation within a function. An example use of this analysis
14// is to perform simple checks for NULL dereferences.
15//
16//===----------------------------------------------------------------------===//
17
18#include "clang/Analysis/PathSensitive/GREngine.h"
19#include "clang/AST/Expr.h"
20#include "clang/Analysis/Analyses/LiveVariables.h"
21#include "clang/Analysis/Visitors/CFGStmtVisitor.h"
22
23#include "llvm/Support/Casting.h"
24#include "llvm/Support/DataTypes.h"
25#include "llvm/ADT/APSInt.h"
26#include "llvm/ADT/FoldingSet.h"
27#include "llvm/ADT/ImmutableMap.h"
Ted Kremenek3c6c6722008-01-16 17:56:25 +000028#include "llvm/ADT/SmallVector.h"
Ted Kremenekd27f8162008-01-15 23:55:06 +000029#include "llvm/Support/Compiler.h"
30
Ted Kremenekaa66a322008-01-16 21:46:15 +000031#ifndef NDEBUG
32#include "llvm/Support/GraphWriter.h"
33#include <sstream>
34#endif
35
Ted Kremenekd27f8162008-01-15 23:55:06 +000036using namespace clang;
37using llvm::APInt;
38using llvm::APFloat;
39using llvm::dyn_cast;
40using llvm::cast;
41
42//===----------------------------------------------------------------------===//
Ted Kremenekaa66a322008-01-16 21:46:15 +000043/// DSPtr - A variant smart pointer that wraps either a ValueDecl* or a
Ted Kremenekd27f8162008-01-15 23:55:06 +000044/// Stmt*. Use cast<> or dyn_cast<> to get actual pointer type
45//===----------------------------------------------------------------------===//
46namespace {
Ted Kremenekcb448ca2008-01-16 00:53:15 +000047class VISIBILITY_HIDDEN DSPtr {
Ted Kremenek0525a4f2008-01-16 19:47:19 +000048 uintptr_t Raw;
Ted Kremenekd27f8162008-01-15 23:55:06 +000049public:
Ted Kremeneke3d7c242008-01-16 23:35:31 +000050 enum VariantKind { IsSubExp=0x0, IsValueDecl=0x1, IsBlkLvl=0x2, Flags=0x3 };
Ted Kremenekd27f8162008-01-15 23:55:06 +000051 inline void* getPtr() const { return reinterpret_cast<void*>(Raw & ~Flags); }
52 inline VariantKind getKind() const { return (VariantKind) (Raw & Flags); }
53
Ted Kremenekaa66a322008-01-16 21:46:15 +000054 DSPtr(ValueDecl* D) : Raw(reinterpret_cast<uintptr_t>(D) | IsValueDecl) {}
Ted Kremenekcb448ca2008-01-16 00:53:15 +000055 DSPtr(Stmt* S, bool isBlkLvl)
Ted Kremenekd27f8162008-01-15 23:55:06 +000056 : Raw(reinterpret_cast<uintptr_t>(S) | (isBlkLvl ? IsBlkLvl : IsSubExp)) {}
57
58 bool isSubExpr() const { return getKind() == IsSubExp; }
59
60 inline void Profile(llvm::FoldingSetNodeID& ID) const {
Ted Kremenek98491852008-01-16 05:51:13 +000061 ID.AddPointer(getPtr());
62 ID.AddInteger((unsigned) getKind());
Ted Kremenekd27f8162008-01-15 23:55:06 +000063 }
Ted Kremenekcb448ca2008-01-16 00:53:15 +000064 inline bool operator==(const DSPtr& X) const { return Raw == X.Raw; }
65 inline bool operator!=(const DSPtr& X) const { return Raw != X.Raw; }
Ted Kremenekb3d2dca2008-01-16 23:33:44 +000066 inline bool operator<(const DSPtr& X) const {
67 VariantKind k = getKind(), Xk = X.getKind();
Ted Kremeneke00fe3f2008-01-17 00:52:48 +000068 return k == Xk ? getPtr() < X.getPtr() : ((unsigned) k) < ((unsigned) Xk);
Ted Kremenekb3d2dca2008-01-16 23:33:44 +000069 }
Ted Kremenekd27f8162008-01-15 23:55:06 +000070};
71} // end anonymous namespace
72
Ted Kremenekcb448ca2008-01-16 00:53:15 +000073// Machinery to get cast<> and dyn_cast<> working with DSPtr.
Ted Kremenekd27f8162008-01-15 23:55:06 +000074namespace llvm {
Ted Kremenekaa66a322008-01-16 21:46:15 +000075 template<> inline bool isa<ValueDecl,DSPtr>(const DSPtr& V) {
76 return V.getKind() == DSPtr::IsValueDecl;
Ted Kremenekd27f8162008-01-15 23:55:06 +000077 }
Ted Kremenekcb448ca2008-01-16 00:53:15 +000078 template<> inline bool isa<Stmt,DSPtr>(const DSPtr& V) {
Ted Kremeneke00fe3f2008-01-17 00:52:48 +000079 return ((unsigned) V.getKind()) != DSPtr::IsValueDecl;
Ted Kremenekd27f8162008-01-15 23:55:06 +000080 }
Ted Kremenekaa66a322008-01-16 21:46:15 +000081 template<> struct VISIBILITY_HIDDEN cast_retty_impl<ValueDecl,DSPtr> {
82 typedef const ValueDecl* ret_type;
Ted Kremenekd27f8162008-01-15 23:55:06 +000083 };
Ted Kremenekcb448ca2008-01-16 00:53:15 +000084 template<> struct VISIBILITY_HIDDEN cast_retty_impl<Stmt,DSPtr> {
Ted Kremenekd27f8162008-01-15 23:55:06 +000085 typedef const Stmt* ret_type;
86 };
Ted Kremenekcb448ca2008-01-16 00:53:15 +000087 template<> struct VISIBILITY_HIDDEN simplify_type<DSPtr> {
Ted Kremenekd27f8162008-01-15 23:55:06 +000088 typedef void* SimpleType;
Ted Kremenekcb448ca2008-01-16 00:53:15 +000089 static inline SimpleType getSimplifiedValue(const DSPtr &V) {
Ted Kremenekd27f8162008-01-15 23:55:06 +000090 return V.getPtr();
91 }
92 };
93} // end llvm namespace
94
95//===----------------------------------------------------------------------===//
96// DeclStmtMapTy - A ImmutableMap type from Decl*/Stmt* to integers.
97//
98// FIXME: We may eventually use APSInt, or a mixture of APSInt and
99// integer primitives to do this right; this will handle both
100// different bit-widths and allow us to detect integer overflows, etc.
101//
102//===----------------------------------------------------------------------===//
103
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000104typedef llvm::ImmutableMap<DSPtr,uint64_t> DeclStmtMapTy;
Ted Kremenekd27f8162008-01-15 23:55:06 +0000105
106namespace clang {
107template<>
108struct VISIBILITY_HIDDEN GRTrait<DeclStmtMapTy> {
109 static inline void* toPtr(DeclStmtMapTy M) {
110 return reinterpret_cast<void*>(M.getRoot());
111 }
112 static inline DeclStmtMapTy toState(void* P) {
113 return DeclStmtMapTy(static_cast<DeclStmtMapTy::TreeTy*>(P));
114 }
115};
116}
117
118//===----------------------------------------------------------------------===//
119// The Checker!
120//===----------------------------------------------------------------------===//
121
122namespace {
123class VISIBILITY_HIDDEN ExprVariantTy {
124 const uint64_t val;
125 const bool isConstant;
126public:
127 ExprVariantTy() : val(0), isConstant(false) {}
128 ExprVariantTy(uint64_t v) : val(v), isConstant(true) {}
129
130 operator bool() const { return isConstant; }
131 uint64_t getVal() const { assert (isConstant); return val; }
132
133 ExprVariantTy operator+(const ExprVariantTy& X) const {
134 if (!isConstant || !X.isConstant) return ExprVariantTy();
135 else return ExprVariantTy(val+X.val);
136 }
137
138 ExprVariantTy operator-(const ExprVariantTy& X) const {
139 if (!isConstant || !X.isConstant) return ExprVariantTy();
Ted Kremenek95b3f6f2008-01-16 22:20:36 +0000140 else return ExprVariantTy(val-X.val);
Ted Kremenekd27f8162008-01-15 23:55:06 +0000141 }
142};
143} // end anonymous namespace
144
145//===----------------------------------------------------------------------===//
146// The Checker!
147//===----------------------------------------------------------------------===//
148
149namespace {
150class VISIBILITY_HIDDEN GRConstants : public CFGStmtVisitor<GRConstants> {
151
152public:
153 typedef DeclStmtMapTy StateTy;
154 typedef GRNodeBuilder<GRConstants> NodeBuilder;
155 typedef ExplodedNode<StateTy> NodeTy;
156
157protected:
Ted Kremenekaa66a322008-01-16 21:46:15 +0000158 // Liveness - live-variables information the ValueDecl* and Expr* (block-level)
Ted Kremenekd27f8162008-01-15 23:55:06 +0000159 // in the CFG. Used to prune out dead state.
160 LiveVariables* Liveness;
161
162 // Builder - The current GRNodeBuilder which is used when building the nodes
163 // for a given statement.
164 NodeBuilder* Builder;
165
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000166 DeclStmtMapTy::Factory StateMgr;
Ted Kremenekd27f8162008-01-15 23:55:06 +0000167
168 // cfg - the current CFG.
169 CFG* cfg;
170
Ted Kremenek3c6c6722008-01-16 17:56:25 +0000171 typedef llvm::SmallVector<NodeTy*,8> NodeSetTy;
Ted Kremenekd27f8162008-01-15 23:55:06 +0000172 NodeSetTy NodeSetA;
173 NodeSetTy NodeSetB;
174 NodeSetTy* Nodes;
175 NodeSetTy* OldNodes;
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000176 StateTy CurrentState;
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000177 NodeTy* InitialPred;
Ted Kremenekd27f8162008-01-15 23:55:06 +0000178
Ted Kremenekd27f8162008-01-15 23:55:06 +0000179public:
180 GRConstants() : Liveness(NULL), Builder(NULL), cfg(NULL),
Ted Kremenek3c6c6722008-01-16 17:56:25 +0000181 Nodes(&NodeSetA), OldNodes(&NodeSetB),
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000182 CurrentState(StateMgr.GetEmptyMap()), InitialPred(NULL) {}
Ted Kremenekd27f8162008-01-15 23:55:06 +0000183
184 ~GRConstants() { delete Liveness; }
185
186 CFG& getCFG() { assert (cfg); return *cfg; }
187
188 void Initialize(CFG& c) {
189 cfg = &c;
190 Liveness = new LiveVariables(c);
191 Liveness->runOnCFG(c);
192 }
193
194 StateTy getInitialState() {
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000195 return StateMgr.GetEmptyMap();
Ted Kremenekd27f8162008-01-15 23:55:06 +0000196 }
197
198 void ProcessStmt(Stmt* S, NodeBuilder& builder);
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000199 void SwitchNodeSets();
Ted Kremenekd27f8162008-01-15 23:55:06 +0000200 void DoStmt(Stmt* S);
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000201
202 StateTy RemoveDescendantMappings(Stmt* S, StateTy M, unsigned Levels=2);
203 StateTy RemoveSubExprMappings(StateTy M);
Ted Kremenekd27f8162008-01-15 23:55:06 +0000204
205 void AddBinding(Expr* E, ExprVariantTy V, bool isBlkLvl = false);
Ted Kremenekaa66a322008-01-16 21:46:15 +0000206 void AddBinding(ValueDecl* D, ExprVariantTy V);
Ted Kremenek1ccd31c2008-01-16 19:42:59 +0000207
Ted Kremenekd27f8162008-01-15 23:55:06 +0000208 ExprVariantTy GetBinding(Expr* E);
209
210 void BlockStmt_VisitStmt(Stmt* S) { DoStmt(S); }
Ted Kremenekd27f8162008-01-15 23:55:06 +0000211
212 void VisitAssign(BinaryOperator* O);
Ted Kremenekd27f8162008-01-15 23:55:06 +0000213 void VisitBinAdd(BinaryOperator* O);
214 void VisitBinSub(BinaryOperator* O);
Ted Kremenek1ccd31c2008-01-16 19:42:59 +0000215 void VisitBinAssign(BinaryOperator* D);
Ted Kremenekd27f8162008-01-15 23:55:06 +0000216};
217} // end anonymous namespace
218
Ted Kremenekca3e8572008-01-16 22:28:08 +0000219static inline Expr* IgnoreParen(Expr* E) {
220 while (ParenExpr* P = dyn_cast<ParenExpr>(E))
221 E = P->getSubExpr();
222
223 return E;
224}
225
Ted Kremenekd27f8162008-01-15 23:55:06 +0000226void GRConstants::ProcessStmt(Stmt* S, NodeBuilder& builder) {
227 Builder = &builder;
228 Nodes->clear();
229 OldNodes->clear();
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000230 InitialPred = Builder->getLastNode();
231 assert (InitialPred);
232 OldNodes->push_back(InitialPred);
233 CurrentState = RemoveSubExprMappings(InitialPred->getState());
Ted Kremenekd27f8162008-01-15 23:55:06 +0000234 BlockStmt_Visit(S);
235 Builder = NULL;
236}
237
238ExprVariantTy GRConstants::GetBinding(Expr* E) {
Ted Kremenek0525a4f2008-01-16 19:47:19 +0000239 DSPtr P(NULL);
Ted Kremenekca3e8572008-01-16 22:28:08 +0000240 E = IgnoreParen(E);
Ted Kremenek0525a4f2008-01-16 19:47:19 +0000241
Ted Kremenekca3e8572008-01-16 22:28:08 +0000242 switch (E->getStmtClass()) {
243 case Stmt::DeclRefExprClass:
244 P = DSPtr(cast<DeclRefExpr>(E)->getDecl());
245 break;
246
247 case Stmt::IntegerLiteralClass:
248 return cast<IntegerLiteral>(E)->getValue().getZExtValue();
249
250 default:
251 P = DSPtr(E, getCFG().isBlkExpr(E));
252 break;
253 }
Ted Kremenek0525a4f2008-01-16 19:47:19 +0000254
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000255 StateTy::iterator I = CurrentState.find(P);
Ted Kremenekd27f8162008-01-15 23:55:06 +0000256
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000257 if (I == CurrentState.end())
Ted Kremenekd27f8162008-01-15 23:55:06 +0000258 return ExprVariantTy();
259
260 return (*I).second;
261}
262
263void GRConstants::AddBinding(Expr* E, ExprVariantTy V, bool isBlkLvl) {
Ted Kremenek22f0d972008-01-16 19:28:16 +0000264 if (V)
265 CurrentState = StateMgr.Add(CurrentState, DSPtr(E,isBlkLvl), V.getVal());
Ted Kremenekd27f8162008-01-15 23:55:06 +0000266}
267
Ted Kremenekaa66a322008-01-16 21:46:15 +0000268void GRConstants::AddBinding(ValueDecl* D, ExprVariantTy V) {
Ted Kremenek1ccd31c2008-01-16 19:42:59 +0000269 if (V)
270 CurrentState = StateMgr.Add(CurrentState, DSPtr(D), V.getVal());
271 else
272 CurrentState = StateMgr.Remove(CurrentState, DSPtr(D));
273}
274
Ted Kremenekd27f8162008-01-15 23:55:06 +0000275void GRConstants::SwitchNodeSets() {
276 NodeSetTy* Tmp = OldNodes;
277 OldNodes = Nodes;
278 Nodes = Tmp;
279 Nodes->clear();
280}
281
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000282GRConstants::StateTy
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000283GRConstants::RemoveSubExprMappings(StateTy M) {
284#if 0
285 return M;
286#else
287 for (StateTy::iterator I = M.begin(), E = M.end();
288 I!=E && I.getKey().getKind() == DSPtr::IsSubExp; ++I) {
289 // Note: we can assign a new map to M since the iterators are
290 // iterating over the tree of the original map (aren't immutable maps
291 // nice?).
292 M = StateMgr.Remove(M, I.getKey());
293 }
294
295 return M;
296#endif
297}
298
299
300GRConstants::StateTy
301GRConstants::RemoveDescendantMappings(Stmt* S, GRConstants::StateTy State,
302 unsigned Levels) {
303#if 1
304 return State;
305#else
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000306 typedef Stmt::child_iterator iterator;
307
308 for (iterator I=S->child_begin(), E=S->child_end(); I!=E; ++I)
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000309 if (Stmt* C = *I) {
310 if (Levels == 1) {
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000311 // Observe that this will only remove mappings to non-block level
312 // expressions. This is valid even if *CI is a block-level expression,
313 // since it simply won't be in the map in the first place.
Ted Kremenek3c6c6722008-01-16 17:56:25 +0000314 // Note: This should also work if 'C' is a block-level expression,
315 // although ideally we would want to skip processing C's children.
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000316 State = StateMgr.Remove(State, DSPtr(C,false));
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000317 }
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000318 else {
319 if (ParenExpr* P = dyn_cast<ParenExpr>(C))
320 State = RemoveDescendantMappings(P, State, Levels);
321 else
322 State = RemoveDescendantMappings(C, State, Levels-1);
323 }
324 }
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000325
326 return State;
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000327#endif
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000328}
Ted Kremenekd27f8162008-01-15 23:55:06 +0000329
330void GRConstants::DoStmt(Stmt* S) {
331 for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I!=E; ++I)
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000332 if (*I) DoStmt(*I);
Ted Kremenekd27f8162008-01-15 23:55:06 +0000333
Ted Kremenekd27f8162008-01-15 23:55:06 +0000334 for (NodeSetTy::iterator I=OldNodes->begin(), E=OldNodes->end(); I!=E; ++I) {
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000335 NodeTy* Pred = *I;
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000336
337 if (Pred != InitialPred)
338 CurrentState = Pred->getState();
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000339
Ted Kremenek3c6c6722008-01-16 17:56:25 +0000340 StateTy OldState = CurrentState;
Ted Kremeneke00fe3f2008-01-17 00:52:48 +0000341
342 if (Pred != InitialPred)
343 CurrentState = RemoveDescendantMappings(S, CurrentState);
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000344
Ted Kremenekd27f8162008-01-15 23:55:06 +0000345 Visit(S);
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000346
Ted Kremenek3c6c6722008-01-16 17:56:25 +0000347 if (CurrentState != OldState) {
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000348 NodeTy* N = Builder->generateNode(S, CurrentState, Pred);
Ted Kremenek3c6c6722008-01-16 17:56:25 +0000349 if (N) Nodes->push_back(N);
Ted Kremenekcb448ca2008-01-16 00:53:15 +0000350 }
Ted Kremenek3c6c6722008-01-16 17:56:25 +0000351 else Nodes->push_back(Pred);
Ted Kremenekd27f8162008-01-15 23:55:06 +0000352 }
Ted Kremenek3c6c6722008-01-16 17:56:25 +0000353
354 SwitchNodeSets();
Ted Kremenekd27f8162008-01-15 23:55:06 +0000355}
356
Ted Kremenekd27f8162008-01-15 23:55:06 +0000357void GRConstants::VisitBinAdd(BinaryOperator* B) {
358 AddBinding(B, GetBinding(B->getLHS()) + GetBinding(B->getRHS()));
359}
360
361void GRConstants::VisitBinSub(BinaryOperator* B) {
362 AddBinding(B, GetBinding(B->getLHS()) - GetBinding(B->getRHS()));
363}
Ted Kremenekee985462008-01-16 18:18:48 +0000364
Ted Kremenek1ccd31c2008-01-16 19:42:59 +0000365
Ted Kremenek1ccd31c2008-01-16 19:42:59 +0000366void GRConstants::VisitBinAssign(BinaryOperator* B) {
367 if (DeclRefExpr* D = dyn_cast<DeclRefExpr>(IgnoreParen(B->getLHS())))
368 AddBinding(D->getDecl(), GetBinding(B->getRHS()));
369}
370
Ted Kremenekee985462008-01-16 18:18:48 +0000371//===----------------------------------------------------------------------===//
372// Driver.
373//===----------------------------------------------------------------------===//
374
Ted Kremenekaa66a322008-01-16 21:46:15 +0000375#ifndef NDEBUG
376namespace llvm {
377template<>
378struct VISIBILITY_HIDDEN DOTGraphTraits<GRConstants::NodeTy*> :
379 public DefaultDOTGraphTraits {
380
381 static std::string getNodeLabel(const GRConstants::NodeTy* N, void*) {
382 std::ostringstream Out;
383
384 Out << "Vertex: " << (void*) N << '\n';
385 ProgramPoint Loc = N->getLocation();
386
387 switch (Loc.getKind()) {
388 case ProgramPoint::BlockEntranceKind:
389 Out << "Block Entrance: B"
390 << cast<BlockEntrance>(Loc).getBlock()->getBlockID();
391 break;
392
393 case ProgramPoint::BlockExitKind:
394 assert (false);
395 break;
396
397 case ProgramPoint::PostStmtKind: {
398 const PostStmt& L = cast<PostStmt>(Loc);
399 Out << "Stmt: " << (void*) L.getStmt() << '\n';
400 L.getStmt()->printPretty(Out);
401 break;
402 }
403
404 default: {
405 const BlockEdge& E = cast<BlockEdge>(Loc);
406 Out << "Edge: (B" << E.getSrc()->getBlockID() << ", B"
407 << E.getDst()->getBlockID() << ')';
408 }
409 }
410
411 Out << "\n{";
412
413 GRConstants::StateTy M = N->getState();
414 bool isFirst = true;
415
416 for (GRConstants::StateTy::iterator I=M.begin(), E=M.end(); I!=E; ++I) {
417 if (!isFirst)
418 Out << '\n';
419 else
420 isFirst = false;
421
422 if (ValueDecl* V = dyn_cast<ValueDecl>(I.getKey())) {
423 Out << "Decl: " << (void*) V << ", " << V->getName();
424 }
425 else {
426 Stmt* E = cast<Stmt>(I.getKey());
427 Out << "Stmt: " << (void*) E;
428 }
429
430 Out << " => " << I.getData();
431 }
432
433 Out << " }";
434
435 return Out.str();
436 }
437};
438} // end llvm namespace
439#endif
440
Ted Kremenekee985462008-01-16 18:18:48 +0000441namespace clang {
442void RunGRConstants(CFG& cfg) {
443 GREngine<GRConstants> Engine(cfg);
444 Engine.ExecuteWorkList();
Ted Kremenekaa66a322008-01-16 21:46:15 +0000445#ifndef NDEBUG
446 llvm::ViewGraph(*Engine.getGraph().roots_begin(),"GRConstants");
447#endif
Ted Kremenekee985462008-01-16 18:18:48 +0000448}
449}