blob: 8c95eaa84f340dae1023a7bbbc79b8c364cf61e4 [file] [log] [blame]
Chris Lattnerf57b8452002-04-27 06:56:12 +00001//===-- FunctionLiveVarInfo.cpp - Live Variable Analysis for a Function ---===//
Chris Lattner5e5dfa32002-02-05 02:51:01 +00002//
Chris Lattnerf57b8452002-04-27 06:56:12 +00003// This is the interface to function level live variable information that is
Chris Lattner5e5dfa32002-02-05 02:51:01 +00004// provided by live variable analysis.
5//
6//===----------------------------------------------------------------------===//
Ruchira Sasanka683847f2001-07-24 17:14:13 +00007
Chris Lattner92ba2aa2003-01-14 23:05:08 +00008#include "llvm/CodeGen/FunctionLiveVarInfo.h"
Ruchira Sasankae27c3442001-08-20 21:12:49 +00009#include "llvm/CodeGen/MachineInstr.h"
Chris Lattner601fc7c2002-10-28 18:01:21 +000010#include "llvm/CodeGen/MachineFunction.h"
Vikram S. Adve88d962a2003-08-12 22:19:59 +000011#include "llvm/Target/TargetMachine.h"
12#include "llvm/Target/TargetInstrInfo.h"
Chris Lattner221d6882002-02-12 21:07:25 +000013#include "llvm/Support/CFG.h"
Chris Lattnercee8f9a2001-11-27 00:03:19 +000014#include "Support/PostOrderIterator.h"
Chris Lattner7471a7b2002-02-05 03:35:53 +000015#include "Support/SetOperations.h"
Chris Lattner70e60cb2002-05-22 17:08:27 +000016#include "Support/CommandLine.h"
Chris Lattner92ba2aa2003-01-14 23:05:08 +000017#include "BBLiveVar.h"
Ruchira Sasanka683847f2001-07-24 17:14:13 +000018
Chris Lattner1e435162002-07-26 21:12:44 +000019static RegisterAnalysis<FunctionLiveVarInfo>
20X("livevar", "Live Variable Analysis");
Ruchira Sasanka683847f2001-07-24 17:14:13 +000021
Chris Lattner70e60cb2002-05-22 17:08:27 +000022LiveVarDebugLevel_t DEBUG_LV;
23
Chris Lattner5ff62e92002-07-22 02:10:13 +000024static cl::opt<LiveVarDebugLevel_t, true>
25DEBUG_LV_opt("dlivevar", cl::Hidden, cl::location(DEBUG_LV),
26 cl::desc("enable live-variable debugging information"),
27 cl::values(
28clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
29clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
30clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after "
31 "every machine instrn"),
32clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"),
33 0));
Vikram S. Adve9cf85a72002-03-18 03:45:41 +000034
Chris Lattner70e60cb2002-05-22 17:08:27 +000035
36
Chris Lattnerab584112002-02-05 00:34:50 +000037//-----------------------------------------------------------------------------
38// Accessor Functions
39//-----------------------------------------------------------------------------
40
41// gets OutSet of a BB
Chris Lattner483e14e2002-04-27 07:27:19 +000042const ValueSet &FunctionLiveVarInfo::getOutSetOfBB(const BasicBlock *BB) const {
Chris Lattner18961502002-06-25 16:12:52 +000043 return BBLiveVar::GetFromBB(*BB)->getOutSet();
Chris Lattnerab584112002-02-05 00:34:50 +000044}
Vikram S. Adve88d962a2003-08-12 22:19:59 +000045 ValueSet &FunctionLiveVarInfo::getOutSetOfBB(const BasicBlock *BB) {
46 return BBLiveVar::GetFromBB(*BB)->getOutSet();
47}
Chris Lattnerab584112002-02-05 00:34:50 +000048
49// gets InSet of a BB
Chris Lattner483e14e2002-04-27 07:27:19 +000050const ValueSet &FunctionLiveVarInfo::getInSetOfBB(const BasicBlock *BB) const {
Chris Lattner18961502002-06-25 16:12:52 +000051 return BBLiveVar::GetFromBB(*BB)->getInSet();
Chris Lattnerab584112002-02-05 00:34:50 +000052}
Vikram S. Adve88d962a2003-08-12 22:19:59 +000053 ValueSet &FunctionLiveVarInfo::getInSetOfBB(const BasicBlock *BB) {
54 return BBLiveVar::GetFromBB(*BB)->getInSet();
55}
Chris Lattnerab584112002-02-05 00:34:50 +000056
Chris Lattnerbdfd3282002-02-04 20:49:04 +000057
58//-----------------------------------------------------------------------------
Chris Lattnerf57b8452002-04-27 06:56:12 +000059// Performs live var analysis for a function
Chris Lattnerbdfd3282002-02-04 20:49:04 +000060//-----------------------------------------------------------------------------
61
Chris Lattner18961502002-06-25 16:12:52 +000062bool FunctionLiveVarInfo::runOnFunction(Function &F) {
63 M = &F;
Chris Lattnera51c7a82002-02-04 23:31:16 +000064 if (DEBUG_LV) std::cerr << "Analysing live variables ...\n";
Chris Lattnerbdfd3282002-02-04 20:49:04 +000065
66 // create and initialize all the BBLiveVars of the CFG
Chris Lattner18961502002-06-25 16:12:52 +000067 constructBBs(M);
Chris Lattnerbdfd3282002-02-04 20:49:04 +000068
Vikram S. Adve9cf85a72002-03-18 03:45:41 +000069 unsigned int iter=0;
Chris Lattner18961502002-06-25 16:12:52 +000070 while (doSingleBackwardPass(M, iter++))
Chris Lattnerbdfd3282002-02-04 20:49:04 +000071 ; // Iterate until we are done.
72
Chris Lattnera51c7a82002-02-04 23:31:16 +000073 if (DEBUG_LV) std::cerr << "Live Variable Analysis complete!\n";
Chris Lattnerbdfd3282002-02-04 20:49:04 +000074 return false;
75}
76
77
78//-----------------------------------------------------------------------------
79// constructs BBLiveVars and init Def and In sets
80//-----------------------------------------------------------------------------
81
Chris Lattner601fc7c2002-10-28 18:01:21 +000082void FunctionLiveVarInfo::constructBBs(const Function *F) {
83 unsigned POId = 0; // Reverse Depth-first Order ID
84 std::map<const BasicBlock*, unsigned> PONumbering;
Chris Lattnerbdfd3282002-02-04 20:49:04 +000085
Chris Lattner601fc7c2002-10-28 18:01:21 +000086 for (po_iterator<const Function*> BBI = po_begin(M), BBE = po_end(M);
87 BBI != BBE; ++BBI)
88 PONumbering[*BBI] = POId++;
89
90 MachineFunction &MF = MachineFunction::get(F);
91 for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
92 const BasicBlock &BB = *I->getBasicBlock(); // get the current BB
Chris Lattner0665a5f2002-02-05 01:43:49 +000093 if (DEBUG_LV) std::cerr << " For BB " << RAV(BB) << ":\n";
Chris Lattnerbdfd3282002-02-04 20:49:04 +000094
Chris Lattner601fc7c2002-10-28 18:01:21 +000095 BBLiveVar *LVBB;
96 std::map<const BasicBlock*, unsigned>::iterator POI = PONumbering.find(&BB);
97 if (POI != PONumbering.end()) {
98 // create a new BBLiveVar
99 LVBB = BBLiveVar::CreateOnBB(BB, *I, POId);
100 } else {
101 // The PO iterator does not discover unreachable blocks, but the random
102 // iterator later may access these blocks. We must make sure to
103 // initialize unreachable blocks as well. However, LV info is not correct
104 // for those blocks (they are not analyzed)
105 //
106 LVBB = BBLiveVar::CreateOnBB(BB, *I, ++POId);
107 }
Chris Lattnerbdfd3282002-02-04 20:49:04 +0000108
Chris Lattnera51c7a82002-02-04 23:31:16 +0000109 if (DEBUG_LV)
Chris Lattnerbdfd3282002-02-04 20:49:04 +0000110 LVBB->printAllSets();
111 }
Chris Lattnerbdfd3282002-02-04 20:49:04 +0000112}
113
114
115//-----------------------------------------------------------------------------
116// do one backward pass over the CFG (for iterative analysis)
117//-----------------------------------------------------------------------------
Chris Lattnera51c7a82002-02-04 23:31:16 +0000118
Chris Lattner483e14e2002-04-27 07:27:19 +0000119bool FunctionLiveVarInfo::doSingleBackwardPass(const Function *M,
120 unsigned iter) {
Vikram S. Adve9cf85a72002-03-18 03:45:41 +0000121 if (DEBUG_LV) std::cerr << "\n After Backward Pass " << iter << "...\n";
Chris Lattnerbdfd3282002-02-04 20:49:04 +0000122
Chris Lattnera51c7a82002-02-04 23:31:16 +0000123 bool NeedAnotherIteration = false;
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000124 for (po_iterator<const Function*> BBI = po_begin(M), BBE = po_end(M);
125 BBI != BBE; ++BBI) {
Chris Lattner18961502002-06-25 16:12:52 +0000126 BBLiveVar *LVBB = BBLiveVar::GetFromBB(**BBI);
Chris Lattnera51c7a82002-02-04 23:31:16 +0000127 assert(LVBB && "BasicBlock information not set for block!");
Chris Lattnerbdfd3282002-02-04 20:49:04 +0000128
Chris Lattnera51c7a82002-02-04 23:31:16 +0000129 if (DEBUG_LV) std::cerr << " For BB " << (*BBI)->getName() << ":\n";
Chris Lattnerbdfd3282002-02-04 20:49:04 +0000130
Vikram S. Adve9cf85a72002-03-18 03:45:41 +0000131 // InSets are initialized to "GenSet". Recompute only if OutSet changed.
Chris Lattnerbdfd3282002-02-04 20:49:04 +0000132 if(LVBB->isOutSetChanged())
133 LVBB->applyTransferFunc(); // apply the Tran Func to calc InSet
Vikram S. Adve9cf85a72002-03-18 03:45:41 +0000134
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000135 // OutSets are initialized to EMPTY. Recompute on first iter or if InSet
136 // changed.
Vikram S. Adve9cf85a72002-03-18 03:45:41 +0000137 if (iter == 0 || LVBB->isInSetChanged()) // to calc Outsets of preds
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000138 NeedAnotherIteration |= LVBB->applyFlowFunc();
Vikram S. Adve9cf85a72002-03-18 03:45:41 +0000139
Chris Lattnera51c7a82002-02-04 23:31:16 +0000140 if (DEBUG_LV) LVBB->printInOutSets();
Chris Lattnerbdfd3282002-02-04 20:49:04 +0000141 }
142
143 // true if we need to reiterate over the CFG
144 return NeedAnotherIteration;
145}
146
147
Chris Lattner483e14e2002-04-27 07:27:19 +0000148void FunctionLiveVarInfo::releaseMemory() {
Chris Lattner6357a3f2002-02-05 06:52:25 +0000149 // First remove all BBLiveVar annotations created in constructBBs().
150 if (M)
Chris Lattnerb7653df2002-04-08 22:03:57 +0000151 for (Function::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
Chris Lattner6357a3f2002-02-05 06:52:25 +0000152 BBLiveVar::RemoveFromBB(*I);
153 M = 0;
Ruchira Sasanka789cebb2001-12-08 21:05:27 +0000154
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000155 // Then delete all objects of type ValueSet created in calcLiveVarSetsForBB
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000156 // and entered into MInst2LVSetBI and MInst2LVSetAI (these are caches
157 // to return ValueSet's before/after a machine instruction quickly).
158 // We do not need to free up ValueSets in MInst2LVSetAI because it holds
159 // pointers to the same sets as in MInst2LVSetBI (for all instructions
160 // except the last one in a BB) or in BBLiveVar (for the last instruction).
Ruchira Sasanka789cebb2001-12-08 21:05:27 +0000161 //
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000162 for (hash_map<const MachineInstr*, ValueSet*>::iterator
Chris Lattnerab584112002-02-05 00:34:50 +0000163 MI = MInst2LVSetBI.begin(),
Chris Lattnera51c7a82002-02-04 23:31:16 +0000164 ME = MInst2LVSetBI.end(); MI != ME; ++MI)
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000165 delete MI->second; // delete all ValueSets in MInst2LVSetBI
Chris Lattner4fd2dbb2002-02-04 20:00:08 +0000166
167 MInst2LVSetBI.clear();
168 MInst2LVSetAI.clear();
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000169}
170
171
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000172
173
Ruchira Sasanka789cebb2001-12-08 21:05:27 +0000174//-----------------------------------------------------------------------------
Chris Lattnera51c7a82002-02-04 23:31:16 +0000175// Following functions will give the LiveVar info for any machine instr in
Chris Lattnerf57b8452002-04-27 06:56:12 +0000176// a function. It should be called after a call to analyze().
Chris Lattnera51c7a82002-02-04 23:31:16 +0000177//
Misha Brukman2f2d0652003-09-11 18:14:24 +0000178// These functions calculate live var info for all the machine instrs in a
Chris Lattnera51c7a82002-02-04 23:31:16 +0000179// BB when LVInfo for one inst is requested. Hence, this function is useful
180// when live var info is required for many (or all) instructions in a basic
Chris Lattnerf57b8452002-04-27 06:56:12 +0000181// block. Also, the arguments to this function does not require specific
Chris Lattnera51c7a82002-02-04 23:31:16 +0000182// iterators.
Ruchira Sasanka789cebb2001-12-08 21:05:27 +0000183//-----------------------------------------------------------------------------
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000184
Ruchira Sasanka789cebb2001-12-08 21:05:27 +0000185//-----------------------------------------------------------------------------
186// Gives live variable information before a machine instruction
187//-----------------------------------------------------------------------------
Chris Lattnera51c7a82002-02-04 23:31:16 +0000188
Chris Lattner748697d2002-02-05 04:20:12 +0000189const ValueSet &
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000190FunctionLiveVarInfo::getLiveVarSetBeforeMInst(const MachineInstr *MI,
Chris Lattner483e14e2002-04-27 07:27:19 +0000191 const BasicBlock *BB) {
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000192 ValueSet* &LVSet = MInst2LVSetBI[MI]; // ref. to map entry
Vikram S. Adve7a81a0f2003-07-29 19:42:32 +0000193 if (LVSet == NULL && BB != NULL) { // if not found and BB provided
194 calcLiveVarSetsForBB(BB); // calc LVSet for all instrs in BB
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000195 assert(LVSet != NULL);
Ruchira Sasankae27c3442001-08-20 21:12:49 +0000196 }
Vikram S. Adve7a81a0f2003-07-29 19:42:32 +0000197 return *LVSet;
Ruchira Sasankae27c3442001-08-20 21:12:49 +0000198}
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000199
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000200
Ruchira Sasanka789cebb2001-12-08 21:05:27 +0000201//-----------------------------------------------------------------------------
202// Gives live variable information after a machine instruction
203//-----------------------------------------------------------------------------
Vikram S. Adve7a81a0f2003-07-29 19:42:32 +0000204
Chris Lattner748697d2002-02-05 04:20:12 +0000205const ValueSet &
Chris Lattner483e14e2002-04-27 07:27:19 +0000206FunctionLiveVarInfo::getLiveVarSetAfterMInst(const MachineInstr *MI,
207 const BasicBlock *BB) {
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000208
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000209 ValueSet* &LVSet = MInst2LVSetAI[MI]; // ref. to map entry
Vikram S. Adve7a81a0f2003-07-29 19:42:32 +0000210 if (LVSet == NULL && BB != NULL) { // if not found and BB provided
211 calcLiveVarSetsForBB(BB); // calc LVSet for all instrs in BB
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000212 assert(LVSet != NULL);
Ruchira Sasankae27c3442001-08-20 21:12:49 +0000213 }
Vikram S. Adve7a81a0f2003-07-29 19:42:32 +0000214 return *LVSet;
Ruchira Sasankae27c3442001-08-20 21:12:49 +0000215}
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000216
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000217// This function applies a machine instr to a live var set (accepts OutSet) and
218// makes necessary changes to it (produces InSet). Note that two for loops are
219// used to first kill all defs and then to add all uses. This is because there
Misha Brukman2f2d0652003-09-11 18:14:24 +0000220// can be instructions like Val = Val + 1 since we allow multiple defs to a
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000221// machine instruction operand.
222//
223static void applyTranferFuncForMInst(ValueSet &LVS, const MachineInstr *MInst) {
Chris Lattner2f898d22002-02-05 06:02:59 +0000224 for (MachineInstr::const_val_op_iterator OpI = MInst->begin(),
225 OpE = MInst->end(); OpI != OpE; ++OpI) {
Vikram S. Advea22eace2003-05-27 00:06:48 +0000226 if (OpI.isDefOnly() || OpI.isDefAndUse()) // kill if this operand is a def
227 LVS.erase(*OpI); // this definition kills any uses
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000228 }
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000229
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000230 // do for implicit operands as well
231 for (unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
Vikram S. Advea22eace2003-05-27 00:06:48 +0000232 if (MInst->getImplicitOp(i).opIsDefOnly() ||
233 MInst->getImplicitOp(i).opIsDefAndUse())
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000234 LVS.erase(MInst->getImplicitRef(i));
235 }
236
Chris Lattner2f898d22002-02-05 06:02:59 +0000237 for (MachineInstr::const_val_op_iterator OpI = MInst->begin(),
238 OpE = MInst->end(); OpI != OpE; ++OpI) {
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000239 if (!isa<BasicBlock>(*OpI)) // don't process labels
Vikram S. Adve9afa88c2002-07-08 22:56:34 +0000240 // add only if this operand is a use
Vikram S. Advea22eace2003-05-27 00:06:48 +0000241 if (!OpI.isDefOnly() || OpI.isDefAndUse() )
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000242 LVS.insert(*OpI); // An operand is a use - so add to use set
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000243 }
244
245 // do for implicit operands as well
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000246 for (unsigned i = 0, e = MInst->getNumImplicitRefs(); i != e; ++i)
Vikram S. Advea22eace2003-05-27 00:06:48 +0000247 if (MInst->getImplicitOp(i).opIsUse() ||
248 MInst->getImplicitOp(i).opIsDefAndUse())
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000249 LVS.insert(MInst->getImplicitRef(i));
Chris Lattner5e5dfa32002-02-05 02:51:01 +0000250}
Ruchira Sasanka789cebb2001-12-08 21:05:27 +0000251
252//-----------------------------------------------------------------------------
253// This method calculates the live variable information for all the
254// instructions in a basic block and enter the newly constructed live
Chris Lattnera51c7a82002-02-04 23:31:16 +0000255// variable sets into a the caches (MInst2LVSetAI, MInst2LVSetBI)
Ruchira Sasanka789cebb2001-12-08 21:05:27 +0000256//-----------------------------------------------------------------------------
Chris Lattnera51c7a82002-02-04 23:31:16 +0000257
Chris Lattner483e14e2002-04-27 07:27:19 +0000258void FunctionLiveVarInfo::calcLiveVarSetsForBB(const BasicBlock *BB) {
Chris Lattner601fc7c2002-10-28 18:01:21 +0000259 BBLiveVar *BBLV = BBLiveVar::GetFromBB(*BB);
260 assert(BBLV && "BBLiveVar annotation doesn't exist?");
261 const MachineBasicBlock &MIVec = BBLV->getMachineBasicBlock();
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000262 const MachineFunction &MF = MachineFunction::get(M);
263 const TargetMachine &TM = MF.getTarget();
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000264
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000265 if (DEBUG_LV >= LV_DEBUG_Instr)
266 std::cerr << "\n======For BB " << BB->getName()
267 << ": Live var sets for instructions======\n";
Vikram S. Adve9cf85a72002-03-18 03:45:41 +0000268
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000269 ValueSet *SetAI = &getOutSetOfBB(BB); // init SetAI with OutSet
270 ValueSet CurSet(*SetAI); // CurSet now contains OutSet
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000271
Ruchira Sasankae27c3442001-08-20 21:12:49 +0000272 // iterate over all the machine instructions in BB
Chris Lattner55291ea2002-10-28 01:41:47 +0000273 for (MachineBasicBlock::const_reverse_iterator MII = MIVec.rbegin(),
Chris Lattnera51c7a82002-02-04 23:31:16 +0000274 MIE = MIVec.rend(); MII != MIE; ++MII) {
275 // MI is cur machine inst
276 const MachineInstr *MI = *MII;
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000277
Chris Lattnera51c7a82002-02-04 23:31:16 +0000278 MInst2LVSetAI[MI] = SetAI; // record in After Inst map
Ruchira Sasankae27c3442001-08-20 21:12:49 +0000279
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000280 applyTranferFuncForMInst(CurSet, MI); // apply the transfer Func
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000281 ValueSet *NewSet = new ValueSet(CurSet); // create a new set with a copy
282 // of the set after T/F
Chris Lattnera51c7a82002-02-04 23:31:16 +0000283 MInst2LVSetBI[MI] = NewSet; // record in Before Inst map
Ruchira Sasankae27c3442001-08-20 21:12:49 +0000284
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000285 // If the current machine instruction has delay slots, mark values
286 // used by this instruction as live before and after each delay slot
287 // instruction (After(MI) is the same as Before(MI+1) except for last MI).
288 if (unsigned DS = TM.getInstrInfo().getNumDelaySlots(MI->getOpCode())) {
289 MachineBasicBlock::const_iterator fwdMII = MII.base(); // ptr to *next* MI
290 for (unsigned i = 0; i < DS; ++i, ++fwdMII) {
291 assert(fwdMII != MIVec.end() && "Missing instruction in delay slot?");
292 MachineInstr* DelaySlotMI = *fwdMII;
Vikram S. Adve891bd822003-08-14 20:45:56 +0000293 if (! TM.getInstrInfo().isNop(DelaySlotMI->getOpCode())) {
294 set_union(*MInst2LVSetBI[DelaySlotMI], *NewSet);
295 if (i+1 == DS)
296 set_union(*MInst2LVSetAI[DelaySlotMI], *NewSet);
297 }
Vikram S. Adve88d962a2003-08-12 22:19:59 +0000298 }
299 }
300
Vikram S. Adve9cf85a72002-03-18 03:45:41 +0000301 if (DEBUG_LV >= LV_DEBUG_Instr) {
Chris Lattnerfb005fe2002-04-09 05:14:14 +0000302 std::cerr << "\nLive var sets before/after instruction " << *MI;
Anand Shuklaa9284032002-06-25 20:35:19 +0000303 std::cerr << " Before: "; printSet(*NewSet); std::cerr << "\n";
304 std::cerr << " After : "; printSet(*SetAI); std::cerr << "\n";
Vikram S. Adve9cf85a72002-03-18 03:45:41 +0000305 }
306
Ruchira Sasankae27c3442001-08-20 21:12:49 +0000307 // SetAI will be used in the next iteration
308 SetAI = NewSet;
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000309 }
Ruchira Sasanka683847f2001-07-24 17:14:13 +0000310}