blob: b0eb37b06524470a1fc8a7a3c4f700659799d185 [file] [log] [blame]
Ted Kremenek11de5cb2007-09-20 21:42:55 +00001//=- LiveVariables.cpp - Live Variable Analysis for Source CFGs -*- C++ --*-==//
Ted Kremeneke4e63342007-09-06 00:17:54 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Ted Kremeneke4e63342007-09-06 00:17:54 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements Live Variables analysis for source-level CFGs.
11//
12//===----------------------------------------------------------------------===//
13
Ted Kremenekcf6e41b2007-12-21 21:42:19 +000014#include "clang/Analysis/Analyses/LiveVariables.h"
Ted Kremenek27b07c52007-09-06 21:26:58 +000015#include "clang/Basic/SourceManager.h"
Ted Kremeneke0dbda12008-12-09 00:14:14 +000016#include "clang/AST/ASTContext.h"
Ted Kremeneke4e63342007-09-06 00:17:54 +000017#include "clang/AST/Expr.h"
18#include "clang/AST/CFG.h"
Ted Kremenekfdd225e2007-09-25 04:31:27 +000019#include "clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h"
Ted Kremenek1de632b2007-09-25 21:00:24 +000020#include "clang/Analysis/FlowSensitive/DataflowSolver.h"
Ted Kremeneke4e63342007-09-06 00:17:54 +000021#include "llvm/ADT/SmallPtrSet.h"
Ted Kremenek7deed0c2008-04-15 18:35:30 +000022#include "llvm/ADT/SmallVector.h"
Ted Kremenekc2b51d82008-01-08 18:19:08 +000023#include "llvm/Support/Compiler.h"
Ted Kremeneke4e63342007-09-06 00:17:54 +000024
Ted Kremenek27b07c52007-09-06 21:26:58 +000025#include <string.h>
26#include <stdio.h>
Ted Kremeneke4e63342007-09-06 00:17:54 +000027
28using namespace clang;
29
30//===----------------------------------------------------------------------===//
Ted Kremenek7deed0c2008-04-15 18:35:30 +000031// Useful constants.
32//===----------------------------------------------------------------------===//
33
34static const bool Alive = true;
35static const bool Dead = false;
36
37//===----------------------------------------------------------------------===//
Ted Kremenekfdd225e2007-09-25 04:31:27 +000038// Dataflow initialization logic.
39//===----------------------------------------------------------------------===//
Ted Kremeneke4e63342007-09-06 00:17:54 +000040
41namespace {
Ted Kremenekc2b51d82008-01-08 18:19:08 +000042class VISIBILITY_HIDDEN RegisterDecls
43 : public CFGRecStmtDeclVisitor<RegisterDecls> {
44
Ted Kremenekfdd225e2007-09-25 04:31:27 +000045 LiveVariables::AnalysisDataTy& AD;
Ted Kremenek7deed0c2008-04-15 18:35:30 +000046
47 typedef llvm::SmallVector<VarDecl*, 20> AlwaysLiveTy;
48 AlwaysLiveTy AlwaysLive;
49
50
Ted Kremenekf63aa452007-09-28 20:38:59 +000051public:
Ted Kremenek7deed0c2008-04-15 18:35:30 +000052 RegisterDecls(LiveVariables::AnalysisDataTy& ad) : AD(ad) {}
53
54 ~RegisterDecls() {
55
56 AD.AlwaysLive.resetValues(AD);
57
58 for (AlwaysLiveTy::iterator I = AlwaysLive.begin(), E = AlwaysLive.end();
59 I != E; ++ I)
60 AD.AlwaysLive(*I, AD) = Alive;
61 }
62
Chris Lattner41110242008-06-17 18:05:57 +000063 void VisitImplicitParamDecl(ImplicitParamDecl* IPD) {
64 // Register the VarDecl for tracking.
65 AD.Register(IPD);
66 }
67
Ted Kremenek7deed0c2008-04-15 18:35:30 +000068 void VisitVarDecl(VarDecl* VD) {
69 // Register the VarDecl for tracking.
70 AD.Register(VD);
71
72 // Does the variable have global storage? If so, it is always live.
73 if (VD->hasGlobalStorage())
74 AlwaysLive.push_back(VD);
75 }
76
Ted Kremenek9f9141c2007-11-20 03:01:58 +000077 CFG& getCFG() { return AD.getCFG(); }
Ted Kremenek11e72182007-10-01 20:33:52 +000078};
Ted Kremeneke4e63342007-09-06 00:17:54 +000079} // end anonymous namespace
80
Ted Kremeneke0dbda12008-12-09 00:14:14 +000081LiveVariables::LiveVariables(ASTContext& Ctx, CFG& cfg) {
Ted Kremenek7cb15932008-03-13 16:55:07 +000082 // Register all referenced VarDecls.
Ted Kremeneke0dbda12008-12-09 00:14:14 +000083 getAnalysisData().setCFG(cfg);
84 getAnalysisData().setContext(Ctx);
85
Ted Kremenek11e72182007-10-01 20:33:52 +000086 RegisterDecls R(getAnalysisData());
Ted Kremenekfdd225e2007-09-25 04:31:27 +000087 cfg.VisitBlockStmts(R);
88}
Ted Kremeneke4e63342007-09-06 00:17:54 +000089
90//===----------------------------------------------------------------------===//
Ted Kremenekfdd225e2007-09-25 04:31:27 +000091// Transfer functions.
92//===----------------------------------------------------------------------===//
Ted Kremeneke4e63342007-09-06 00:17:54 +000093
94namespace {
Ted Kremenekf63aa452007-09-28 20:38:59 +000095
Ted Kremenekc2b51d82008-01-08 18:19:08 +000096class VISIBILITY_HIDDEN TransferFuncs : public CFGRecStmtVisitor<TransferFuncs>{
Ted Kremenekfdd225e2007-09-25 04:31:27 +000097 LiveVariables::AnalysisDataTy& AD;
Ted Kremenekf63aa452007-09-28 20:38:59 +000098 LiveVariables::ValTy LiveState;
Ted Kremeneke4e63342007-09-06 00:17:54 +000099public:
Ted Kremenek11e72182007-10-01 20:33:52 +0000100 TransferFuncs(LiveVariables::AnalysisDataTy& ad) : AD(ad) {}
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000101
Ted Kremenekf63aa452007-09-28 20:38:59 +0000102 LiveVariables::ValTy& getVal() { return LiveState; }
Ted Kremenek9f9141c2007-11-20 03:01:58 +0000103 CFG& getCFG() { return AD.getCFG(); }
Ted Kremenekf1758052007-09-12 19:10:52 +0000104
Ted Kremeneke4e63342007-09-06 00:17:54 +0000105 void VisitDeclRefExpr(DeclRefExpr* DR);
106 void VisitBinaryOperator(BinaryOperator* B);
107 void VisitAssign(BinaryOperator* B);
Ted Kremenek27b07c52007-09-06 21:26:58 +0000108 void VisitDeclStmt(DeclStmt* DS);
Ted Kremenekbfcb7122008-11-12 21:58:46 +0000109 void BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S);
Ted Kremenek27b07c52007-09-06 21:26:58 +0000110 void VisitUnaryOperator(UnaryOperator* U);
Ted Kremenek8f5aab62008-11-11 17:42:10 +0000111 void Visit(Stmt *S);
Ted Kremenek411cdee2008-04-16 21:10:48 +0000112 void VisitTerminator(CFGBlock* B);
Ted Kremenek7deed0c2008-04-15 18:35:30 +0000113
114 void SetTopValue(LiveVariables::ValTy& V) {
Ted Kremenekbf98c992009-01-30 21:35:30 +0000115 V = AD.AlwaysLive;
Ted Kremenek7deed0c2008-04-15 18:35:30 +0000116 }
117
Ted Kremeneke4e63342007-09-06 00:17:54 +0000118};
Ted Kremenek11e72182007-10-01 20:33:52 +0000119
Ted Kremenek11e72182007-10-01 20:33:52 +0000120void TransferFuncs::Visit(Stmt *S) {
Ted Kremenekf63aa452007-09-28 20:38:59 +0000121
Ted Kremenek86946742008-01-17 20:48:37 +0000122 if (S == getCurrentBlkStmt()) {
Ted Kremenek03648652008-07-03 22:25:27 +0000123
124 if (AD.Observer)
125 AD.Observer->ObserveStmt(S,AD,LiveState);
126
Ted Kremenek1aa9a582008-03-05 19:26:46 +0000127 if (getCFG().isBlkExpr(S)) LiveState(S,AD) = Dead;
Ted Kremenek2a9da9c2008-01-18 00:40:21 +0000128 StmtVisitor<TransferFuncs,void>::Visit(S);
Ted Kremenek86946742008-01-17 20:48:37 +0000129 }
Ted Kremenek03648652008-07-03 22:25:27 +0000130 else if (!getCFG().isBlkExpr(S)) {
131
132 if (AD.Observer)
133 AD.Observer->ObserveStmt(S,AD,LiveState);
134
Ted Kremenek86946742008-01-17 20:48:37 +0000135 StmtVisitor<TransferFuncs,void>::Visit(S);
Ted Kremenek03648652008-07-03 22:25:27 +0000136
137 }
Ted Kremenek86946742008-01-17 20:48:37 +0000138 else
139 // For block-level expressions, mark that they are live.
140 LiveState(S,AD) = Alive;
Ted Kremenek11e72182007-10-01 20:33:52 +0000141}
Ted Kremenek37622082008-04-15 04:39:08 +0000142
Ted Kremenek411cdee2008-04-16 21:10:48 +0000143void TransferFuncs::VisitTerminator(CFGBlock* B) {
144
Ted Kremenek8ded8d82008-11-12 21:12:18 +0000145 const Stmt* E = B->getTerminatorCondition();
Ted Kremenek411cdee2008-04-16 21:10:48 +0000146
Ted Kremenek5cd24382008-04-16 17:07:59 +0000147 if (!E)
148 return;
149
Ted Kremenek5cd24382008-04-16 17:07:59 +0000150 assert (getCFG().isBlkExpr(E));
151 LiveState(E, AD) = Alive;
Ted Kremenek37622082008-04-15 04:39:08 +0000152}
153
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000154void TransferFuncs::VisitDeclRefExpr(DeclRefExpr* DR) {
155 if (VarDecl* V = dyn_cast<VarDecl>(DR->getDecl()))
Ted Kremenekf63aa452007-09-28 20:38:59 +0000156 LiveState(V,AD) = Alive;
Ted Kremeneke4e63342007-09-06 00:17:54 +0000157}
Ted Kremeneke4e63342007-09-06 00:17:54 +0000158
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000159void TransferFuncs::VisitBinaryOperator(BinaryOperator* B) {
Ted Kremenekf1758052007-09-12 19:10:52 +0000160 if (B->isAssignmentOp()) VisitAssign(B);
161 else VisitStmt(B);
Ted Kremeneke4e63342007-09-06 00:17:54 +0000162}
163
Ted Kremenekbfcb7122008-11-12 21:58:46 +0000164void
165TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
166
Ted Kremenek06529ae2008-11-14 21:07:14 +0000167 // This is a block-level expression. Its value is 'dead' before this point.
168 LiveState(S, AD) = Dead;
169
Ted Kremeneke97d9db2008-11-11 19:40:47 +0000170 // This represents a 'use' of the collection.
171 Visit(S->getCollection());
Ted Kremenek8f5aab62008-11-11 17:42:10 +0000172
173 // This represents a 'kill' for the variable.
Ted Kremeneke97d9db2008-11-11 19:40:47 +0000174 Stmt* Element = S->getElement();
Ted Kremenek8f646002008-11-14 01:58:12 +0000175 DeclRefExpr* DR = 0;
Ted Kremeneke97d9db2008-11-11 19:40:47 +0000176 VarDecl* VD = 0;
177
178 if (DeclStmt* DS = dyn_cast<DeclStmt>(Element))
Chris Lattner7e24e822009-03-28 06:33:19 +0000179 VD = cast<VarDecl>(DS->getSingleDecl());
Ted Kremeneke97d9db2008-11-11 19:40:47 +0000180 else {
Ted Kremenek8f646002008-11-14 01:58:12 +0000181 Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();
182 if ((DR = dyn_cast<DeclRefExpr>(ElemExpr)))
183 VD = cast<VarDecl>(DR->getDecl());
Ted Kremenek06529ae2008-11-14 21:07:14 +0000184 else {
185 Visit(ElemExpr);
186 return;
187 }
Ted Kremeneke97d9db2008-11-11 19:40:47 +0000188 }
189
Ted Kremenek8f646002008-11-14 01:58:12 +0000190 if (VD) {
191 LiveState(VD, AD) = Dead;
192 if (AD.Observer && DR) { AD.Observer->ObserverKill(DR); }
193 }
Ted Kremenek8f5aab62008-11-11 17:42:10 +0000194}
195
196
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000197void TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
Ted Kremenek5e2b6092008-01-17 17:50:49 +0000198 Expr *E = U->getSubExpr();
Ted Kremenekbcb07d52007-09-28 21:29:33 +0000199
Ted Kremenek27b07c52007-09-06 21:26:58 +0000200 switch (U->getOpcode()) {
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000201 case UnaryOperator::PostInc:
202 case UnaryOperator::PostDec:
203 case UnaryOperator::PreInc:
204 case UnaryOperator::PreDec:
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000205 // Walk through the subexpressions, blasting through ParenExprs
206 // until we either find a DeclRefExpr or some non-DeclRefExpr
207 // expression.
Ted Kremenek56206312008-02-22 00:34:10 +0000208 if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E->IgnoreParens()))
Ted Kremenekdace4c92008-04-15 04:08:54 +0000209 if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl())) {
210 // Treat the --/++ operator as a kill.
Ted Kremenek56206312008-02-22 00:34:10 +0000211 if (AD.Observer) { AD.Observer->ObserverKill(DR); }
Ted Kremenekdace4c92008-04-15 04:08:54 +0000212 LiveState(VD, AD) = Alive;
Ted Kremenek56206312008-02-22 00:34:10 +0000213 return VisitDeclRefExpr(DR);
214 }
Ted Kremenekbcb07d52007-09-28 21:29:33 +0000215
216 // Fall-through.
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000217
218 default:
Ted Kremenek5e2b6092008-01-17 17:50:49 +0000219 return Visit(E);
Ted Kremenek27b07c52007-09-06 21:26:58 +0000220 }
221}
Ted Kremenekbcb07d52007-09-28 21:29:33 +0000222
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000223void TransferFuncs::VisitAssign(BinaryOperator* B) {
Ted Kremenek5e2b6092008-01-17 17:50:49 +0000224 Expr* LHS = B->getLHS();
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000225
Ted Kremenekbcb07d52007-09-28 21:29:33 +0000226 // Assigning to a variable?
Ted Kremenek5e2b6092008-01-17 17:50:49 +0000227 if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(LHS->IgnoreParens())) {
Ted Kremenek7deed0c2008-04-15 18:35:30 +0000228
229 // Update liveness inforamtion.
230 unsigned bit = AD.getIdx(DR->getDecl());
231 LiveState.getDeclBit(bit) = Dead | AD.AlwaysLive.getDeclBit(bit);
232
Ted Kremenekf63aa452007-09-28 20:38:59 +0000233 if (AD.Observer) { AD.Observer->ObserverKill(DR); }
234
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000235 // Handle things like +=, etc., which also generate "uses"
236 // of a variable. Do this just by visiting the subexpression.
Ted Kremenekbcb07d52007-09-28 21:29:33 +0000237 if (B->getOpcode() != BinaryOperator::Assign)
238 VisitDeclRefExpr(DR);
Ted Kremeneke4e63342007-09-06 00:17:54 +0000239 }
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000240 else // Not assigning to a variable. Process LHS as usual.
Ted Kremenek27b07c52007-09-06 21:26:58 +0000241 Visit(LHS);
Ted Kremeneke4e63342007-09-06 00:17:54 +0000242
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000243 Visit(B->getRHS());
Ted Kremeneke4e63342007-09-06 00:17:54 +0000244}
245
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000246void TransferFuncs::VisitDeclStmt(DeclStmt* DS) {
247 // Declarations effectively "kill" a variable since they cannot
248 // possibly be live before they are declared.
Ted Kremenek14f8b4f2008-08-05 20:46:55 +0000249 for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE = DS->decl_end();
250 DI != DE; ++DI)
251 if (VarDecl* VD = dyn_cast<VarDecl>(*DI)) {
Ted Kremenek84fa6b92008-09-26 05:52:45 +0000252 // The initializer is evaluated after the variable comes into scope.
253 // Since this is a reverse dataflow analysis, we must evaluate the
254 // transfer function for this expression first.
Ted Kremenek2bca5e42008-02-07 02:38:55 +0000255 if (Expr* Init = VD->getInit())
256 Visit(Init);
Ted Kremenek84fa6b92008-09-26 05:52:45 +0000257
Ted Kremeneke0dbda12008-12-09 00:14:14 +0000258 if (const VariableArrayType* VT =
259 AD.getContext().getAsVariableArrayType(VD->getType())) {
260 StmtIterator I(const_cast<VariableArrayType*>(VT));
261 StmtIterator E;
262 for (; I != E; ++I) Visit(*I);
263 }
264
Ted Kremenek84fa6b92008-09-26 05:52:45 +0000265 // Update liveness information by killing the VarDecl.
266 unsigned bit = AD.getIdx(VD);
267 LiveState.getDeclBit(bit) = Dead | AD.AlwaysLive.getDeclBit(bit);
Ted Kremenekdcc48102008-02-25 22:28:54 +0000268 }
Ted Kremenek27b07c52007-09-06 21:26:58 +0000269}
Ted Kremenekf63aa452007-09-28 20:38:59 +0000270
Ted Kremeneke4e63342007-09-06 00:17:54 +0000271} // end anonymous namespace
272
Ted Kremenekf63aa452007-09-28 20:38:59 +0000273//===----------------------------------------------------------------------===//
274// Merge operator: if something is live on any successor block, it is live
275// in the current block (a set union).
276//===----------------------------------------------------------------------===//
Ted Kremeneke4e63342007-09-06 00:17:54 +0000277
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000278namespace {
Ted Kremenekfa59f1f2008-03-20 21:46:49 +0000279
280struct Merge {
Ted Kremenek8d798c72008-11-14 01:14:18 +0000281 typedef StmtDeclBitVector_Types::ValTy ValTy;
Ted Kremenekfa59f1f2008-03-20 21:46:49 +0000282
283 void operator()(ValTy& Dst, const ValTy& Src) {
284 Dst.OrDeclBits(Src);
Ted Kremenekbf98c992009-01-30 21:35:30 +0000285 Dst.OrBlkExprBits(Src);
Ted Kremenekfa59f1f2008-03-20 21:46:49 +0000286 }
287};
288
289typedef DataflowSolver<LiveVariables, TransferFuncs, Merge> Solver;
Ted Kremenekf63aa452007-09-28 20:38:59 +0000290} // end anonymous namespace
291
292//===----------------------------------------------------------------------===//
293// External interface to run Liveness analysis.
294//===----------------------------------------------------------------------===//
Ted Kremeneke4e63342007-09-06 00:17:54 +0000295
Ted Kremenek83c01da2008-01-11 00:40:29 +0000296void LiveVariables::runOnCFG(CFG& cfg) {
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000297 Solver S(*this);
298 S.runOnCFG(cfg);
299}
Ted Kremenek27b07c52007-09-06 21:26:58 +0000300
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000301void LiveVariables::runOnAllBlocks(const CFG& cfg,
Ted Kremenek79649df2008-01-17 18:25:22 +0000302 LiveVariables::ObserverTy* Obs,
303 bool recordStmtValues) {
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000304 Solver S(*this);
305 ObserverTy* OldObserver = getAnalysisData().Observer;
Ted Kremenek79649df2008-01-17 18:25:22 +0000306 getAnalysisData().Observer = Obs;
307 S.runOnAllBlocks(cfg, recordStmtValues);
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000308 getAnalysisData().Observer = OldObserver;
Ted Kremenek27b07c52007-09-06 21:26:58 +0000309}
310
311//===----------------------------------------------------------------------===//
312// liveness queries
313//
314
Ted Kremenekc0576ca2007-09-10 17:36:42 +0000315bool LiveVariables::isLive(const CFGBlock* B, const VarDecl* D) const {
Ted Kremenek7cb15932008-03-13 16:55:07 +0000316 DeclBitVector_Types::Idx i = getAnalysisData().getIdx(D);
317 return i.isValid() ? getBlockData(B).getBit(i) : false;
Ted Kremenek27b07c52007-09-06 21:26:58 +0000318}
319
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000320bool LiveVariables::isLive(const ValTy& Live, const VarDecl* D) const {
Ted Kremenek7cb15932008-03-13 16:55:07 +0000321 DeclBitVector_Types::Idx i = getAnalysisData().getIdx(D);
322 return i.isValid() ? Live.getBit(i) : false;
Ted Kremenek055c2752007-09-06 23:00:42 +0000323}
324
Ted Kremenek86946742008-01-17 20:48:37 +0000325bool LiveVariables::isLive(const Stmt* Loc, const Stmt* StmtVal) const {
326 return getStmtData(Loc)(StmtVal,getAnalysisData());
327}
328
Ted Kremenek2a9da9c2008-01-18 00:40:21 +0000329bool LiveVariables::isLive(const Stmt* Loc, const VarDecl* D) const {
330 return getStmtData(Loc)(D,getAnalysisData());
331}
332
Ted Kremenek055c2752007-09-06 23:00:42 +0000333//===----------------------------------------------------------------------===//
Ted Kremeneke4e63342007-09-06 00:17:54 +0000334// printing liveness state for debugging
335//
336
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000337void LiveVariables::dumpLiveness(const ValTy& V, SourceManager& SM) const {
338 const AnalysisDataTy& AD = getAnalysisData();
339
Ted Kremenekf63aa452007-09-28 20:38:59 +0000340 for (AnalysisDataTy::decl_iterator I = AD.begin_decl(),
341 E = AD.end_decl(); I!=E; ++I)
342 if (V.getDeclBit(I->second)) {
Chris Lattnerb9c3f962009-01-27 07:57:44 +0000343 fprintf(stderr, " %s <", I->first->getIdentifier()->getName());
344 I->first->getLocation().dump(SM);
345 fprintf(stderr, ">\n");
Ted Kremeneke4e63342007-09-06 00:17:54 +0000346 }
Ted Kremeneke4e63342007-09-06 00:17:54 +0000347}
348
Ted Kremenek27b07c52007-09-06 21:26:58 +0000349void LiveVariables::dumpBlockLiveness(SourceManager& M) const {
Ted Kremenekfdd225e2007-09-25 04:31:27 +0000350 for (BlockDataMapTy::iterator I = getBlockDataMap().begin(),
351 E = getBlockDataMap().end(); I!=E; ++I) {
352 fprintf(stderr, "\n[ B%d (live variables at block exit) ]\n",
Ted Kremenek27b07c52007-09-06 21:26:58 +0000353 I->first->getBlockID());
354
355 dumpLiveness(I->second,M);
356 }
Ted Kremenekc0576ca2007-09-10 17:36:42 +0000357
358 fprintf(stderr,"\n");
359}