[llvm-commits] CVS: llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp BBLiveVar.h FunctionLiveVarInfo.cpp FunctionLiveVarInfo.h ValueSet.cpp
Misha Brukman
brukman at cs.uiuc.edu
Thu Apr 21 16:27:46 PDT 2005
Changes in directory llvm/lib/Target/SparcV9/LiveVar:
BBLiveVar.cpp updated: 1.48 -> 1.49
BBLiveVar.h updated: 1.27 -> 1.28
FunctionLiveVarInfo.cpp updated: 1.58 -> 1.59
FunctionLiveVarInfo.h updated: 1.2 -> 1.3
ValueSet.cpp updated: 1.17 -> 1.18
---
Log message:
Remove trailing whitespace
---
Diffs of the changes: (+73 -73)
BBLiveVar.cpp | 54 ++++++++++++++++++++++++------------------------
BBLiveVar.h | 14 ++++++------
FunctionLiveVarInfo.cpp | 42 ++++++++++++++++++-------------------
FunctionLiveVarInfo.h | 30 +++++++++++++-------------
ValueSet.cpp | 6 ++---
5 files changed, 73 insertions(+), 73 deletions(-)
Index: llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
diff -u llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp:1.48 llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp:1.49
--- llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp:1.48 Wed Sep 1 17:55:36 2004
+++ llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp Thu Apr 21 18:27:35 2005
@@ -1,10 +1,10 @@
//===-- BBLiveVar.cpp - Live Variable Analysis for a BasicBlock -----------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This is a wrapper class for BasicBlock which is used by live var analysis.
@@ -43,7 +43,7 @@
for (MachineBasicBlock::const_reverse_iterator MII = MBB.rbegin(),
MIE = MBB.rend(); MII != MIE; ++MII) {
const MachineInstr *MI = &*MII;
-
+
if (DEBUG_LV >= LV_DEBUG_Verbose) {
std::cerr << " *Iterating over machine instr ";
MI->dump();
@@ -60,7 +60,7 @@
for (unsigned i = 0; i < MI->getNumImplicitRefs(); ++i)
if (MI->getImplicitOp(i).isDef())
addDef(MI->getImplicitRef(i));
-
+
// iterate over MI operands to find uses
for (MachineInstr::const_val_op_iterator OpI = MI->begin(), OpE = MI->end();
OpI != OpE; ++OpI) {
@@ -75,16 +75,16 @@
// instructions is untested. The previous code was broken and I
// fixed it, but it turned out to be unused as long as Phi
// elimination is performed during instruction selection.
- //
+ //
// Put Phi operands in UseSet for the incoming edge, not node.
// They must not "hide" later defs, and must be handled specially
// during set propagation over the CFG.
if (MI->getOpcode() == V9::PHI) { // for a phi node
const Value *ArgVal = Op;
const BasicBlock *PredBB = cast<BasicBlock>(*++OpI); // next ptr is BB
-
- PredToEdgeInSetMap[PredBB].insert(ArgVal);
-
+
+ PredToEdgeInSetMap[PredBB].insert(ArgVal);
+
if (DEBUG_LV >= LV_DEBUG_Verbose)
std::cerr << " - phi operand " << RAV(ArgVal) << " came from BB "
<< RAV(PredBB) << "\n";
@@ -108,7 +108,7 @@
addUse(Op);
}
} // for all machine instructions
-}
+}
@@ -118,7 +118,7 @@
void BBLiveVar::addDef(const Value *Op) {
DefSet.insert(Op); // operand is a def - so add to def set
InSet.erase(Op); // this definition kills any later uses
- InSetChanged = true;
+ InSetChanged = true;
if (DEBUG_LV >= LV_DEBUG_Verbose) std::cerr << " +Def: " << RAV(Op) << "\n";
}
@@ -130,7 +130,7 @@
void BBLiveVar::addUse(const Value *Op) {
InSet.insert(Op); // An operand is a use - so add to use set
DefSet.erase(Op); // remove if there is a def below this use
- InSetChanged = true;
+ InSetChanged = true;
if (DEBUG_LV >= LV_DEBUG_Verbose) std::cerr << " Use: " << RAV(Op) << "\n";
}
@@ -138,16 +138,16 @@
//-----------------------------------------------------------------------------
// Applies the transfer function to a basic block to produce the InSet using
-// the OutSet.
+// the OutSet.
//-----------------------------------------------------------------------------
bool BBLiveVar::applyTransferFunc() {
- // IMPORTANT: caller should check whether the OutSet changed
+ // IMPORTANT: caller should check whether the OutSet changed
// (else no point in calling)
ValueSet OutMinusDef = set_difference(OutSet, DefSet);
InSetChanged = set_union(InSet, OutMinusDef);
-
+
OutSetChanged = false; // no change to OutSet since transf func applied
return InSetChanged;
}
@@ -157,31 +157,31 @@
// calculates Out set using In sets of the successors
//-----------------------------------------------------------------------------
-bool BBLiveVar::setPropagate(ValueSet *OutSet, const ValueSet *InSet,
+bool BBLiveVar::setPropagate(ValueSet *OutSet, const ValueSet *InSet,
const BasicBlock *PredBB) {
bool Changed = false;
-
+
// merge all members of InSet into OutSet of the predecessor
for (ValueSet::const_iterator InIt = InSet->begin(), InE = InSet->end();
InIt != InE; ++InIt)
if ((OutSet->insert(*InIt)).second)
Changed = true;
-
- //
+
+ //
//**** WARNING: The following code for handling dummy PHI machine
// instructions is untested. See explanation above.
- //
+ //
// then merge all members of the EdgeInSet for the predecessor into the OutSet
const ValueSet& EdgeInSet = PredToEdgeInSetMap[PredBB];
for (ValueSet::const_iterator InIt = EdgeInSet.begin(), InE = EdgeInSet.end();
InIt != InE; ++InIt)
if ((OutSet->insert(*InIt)).second)
Changed = true;
- //
+ //
//****
-
+
return Changed;
-}
+}
//-----------------------------------------------------------------------------
@@ -190,25 +190,25 @@
bool BBLiveVar::applyFlowFunc(hash_map<const BasicBlock*,
BBLiveVar*> &BBLiveVarInfo) {
- // IMPORTANT: caller should check whether inset changed
+ // IMPORTANT: caller should check whether inset changed
// (else no point in calling)
-
+
// If this BB changed any OutSets of preds whose POID is lower, than we need
// another iteration...
//
- bool needAnotherIt = false;
+ bool needAnotherIt = false;
for (pred_const_iterator PI = pred_begin(&BB), PE = pred_end(&BB);
PI != PE ; ++PI) {
BBLiveVar *PredLVBB = BBLiveVarInfo[*PI];
// do set union
- if (setPropagate(&PredLVBB->OutSet, &InSet, *PI)) {
+ if (setPropagate(&PredLVBB->OutSet, &InSet, *PI)) {
PredLVBB->OutSetChanged = true;
// if the predec POID is lower than mine
if (PredLVBB->getPOId() <= POID)
- needAnotherIt = true;
+ needAnotherIt = true;
}
} // for
Index: llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.h
diff -u llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.h:1.27 llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.h:1.28
--- llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.h:1.27 Wed Sep 1 17:55:36 2004
+++ llvm/lib/Target/SparcV9/LiveVar/BBLiveVar.h Thu Apr 21 18:27:35 2005
@@ -1,10 +1,10 @@
//===-- BBLiveVar.h - Live Variable Analysis for a BasicBlock ---*- C++ -*-===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This is a BasicBlock annotation class that is used by live var analysis to
@@ -46,14 +46,14 @@
// coming in on that edge. such uses have to be
// treated differently from ordinary uses.
hash_map<const BasicBlock *, ValueSet> PredToEdgeInSetMap;
-
+
// method to propagate an InSet to OutSet of a predecessor
- bool setPropagate(ValueSet *OutSetOfPred,
+ bool setPropagate(ValueSet *OutSetOfPred,
const ValueSet *InSetOfThisBB,
const BasicBlock *PredBB);
// To add an operand which is a def
- void addDef(const Value *Op);
+ void addDef(const Value *Op);
// To add an operand which is a use
void addUse(const Value *Op);
@@ -63,14 +63,14 @@
BBLiveVar(const BasicBlock &BB, const MachineBasicBlock &MBB, unsigned POID);
- inline bool isInSetChanged() const { return InSetChanged; }
+ inline bool isInSetChanged() const { return InSetChanged; }
inline bool isOutSetChanged() const { return OutSetChanged; }
const MachineBasicBlock &getMachineBasicBlock() const { return MBB; }
inline unsigned getPOId() const { return POID; }
- bool applyTransferFunc(); // calcultes the In in terms of Out
+ bool applyTransferFunc(); // calcultes the In in terms of Out
// calculates Out set using In sets of the predecessors
bool applyFlowFunc(hash_map<const BasicBlock*, BBLiveVar*> &BBLiveVarInfo);
Index: llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
diff -u llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp:1.58 llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp:1.59
--- llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp:1.58 Wed Sep 1 17:55:36 2004
+++ llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp Thu Apr 21 18:27:35 2005
@@ -1,10 +1,10 @@
//===-- FunctionLiveVarInfo.cpp - Live Variable Analysis for a Function ---===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This is the interface to function level live variable information that is
@@ -79,7 +79,7 @@
unsigned int iter=0;
while (doSingleBackwardPass(M, iter++))
; // Iterate until we are done.
-
+
if (DEBUG_LV) std::cerr << "Live Variable Analysis complete!\n";
return false;
}
@@ -99,7 +99,7 @@
MachineFunction &MF = MachineFunction::get(F);
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
- const BasicBlock &BB = *I->getBasicBlock(); // get the current BB
+ const BasicBlock &BB = *I->getBasicBlock(); // get the current BB
if (DEBUG_LV) std::cerr << " For BB " << RAV(BB) << ":\n";
BBLiveVar *LVBB;
@@ -116,7 +116,7 @@
LVBB = new BBLiveVar(BB, *I, ++POId);
}
BBLiveVarInfo[&BB] = LVBB;
-
+
if (DEBUG_LV)
LVBB->printAllSets();
}
@@ -140,19 +140,19 @@
if (DEBUG_LV) std::cerr << " For BB " << (*BBI)->getName() << ":\n";
// InSets are initialized to "GenSet". Recompute only if OutSet changed.
- if(LVBB->isOutSetChanged())
+ if(LVBB->isOutSetChanged())
LVBB->applyTransferFunc(); // apply the Tran Func to calc InSet
-
+
// OutSets are initialized to EMPTY. Recompute on first iter or if InSet
// changed.
if (iter == 0 || LVBB->isInSetChanged()) // to calc Outsets of preds
NeedAnotherIteration |= LVBB->applyFlowFunc(BBLiveVarInfo);
-
+
if (DEBUG_LV) LVBB->printInOutSets();
}
// true if we need to reiterate over the CFG
- return NeedAnotherIteration;
+ return NeedAnotherIteration;
}
@@ -188,10 +188,10 @@
// Following functions will give the LiveVar info for any machine instr in
// a function. It should be called after a call to analyze().
//
-// These functions calculate live var info for all the machine instrs in a
-// BB when LVInfo for one inst is requested. Hence, this function is useful
-// when live var info is required for many (or all) instructions in a basic
-// block. Also, the arguments to this function does not require specific
+// These functions calculate live var info for all the machine instrs in a
+// BB when LVInfo for one inst is requested. Hence, this function is useful
+// when live var info is required for many (or all) instructions in a basic
+// block. Also, the arguments to this function does not require specific
// iterators.
//-----------------------------------------------------------------------------
@@ -215,12 +215,12 @@
// Gives live variable information after a machine instruction
//-----------------------------------------------------------------------------
-const ValueSet &
+const ValueSet &
FunctionLiveVarInfo::getLiveVarSetAfterMInst(const MachineInstr *MI,
const BasicBlock *BB) {
ValueSet* &LVSet = MInst2LVSetAI[MI]; // ref. to map entry
- if (LVSet == NULL && BB != NULL) { // if not found and BB provided
+ if (LVSet == NULL && BB != NULL) { // if not found and BB provided
calcLiveVarSetsForBB(BB); // calc LVSet for all instrs in BB
assert(LVSet != NULL);
}
@@ -230,7 +230,7 @@
// This function applies a machine instr to a live var set (accepts OutSet) and
// makes necessary changes to it (produces InSet). Note that two for loops are
// used to first kill all defs and then to add all uses. This is because there
-// can be instructions like Val = Val + 1 since we allow multiple defs to a
+// can be instructions like Val = Val + 1 since we allow multiple defs to a
// machine instruction operand.
//
static void applyTranferFuncForMInst(ValueSet &LVS, const MachineInstr *MInst) {
@@ -261,7 +261,7 @@
}
//-----------------------------------------------------------------------------
-// This method calculates the live variable information for all the
+// This method calculates the live variable information for all the
// instructions in a basic block and enter the newly constructed live
// variable sets into a the caches (MInst2LVSetAI, MInst2LVSetBI)
//-----------------------------------------------------------------------------
@@ -276,15 +276,15 @@
if (DEBUG_LV >= LV_DEBUG_Instr)
std::cerr << "\n======For BB " << BB->getName()
<< ": Live var sets for instructions======\n";
-
+
ValueSet *SetAI = &getOutSetOfBB(BB); // init SetAI with OutSet
ValueSet CurSet(*SetAI); // CurSet now contains OutSet
// iterate over all the machine instructions in BB
for (MachineBasicBlock::const_reverse_iterator MII = MIVec.rbegin(),
- MIE = MIVec.rend(); MII != MIE; ++MII) {
+ MIE = MIVec.rend(); MII != MIE; ++MII) {
// MI is cur machine inst
- const MachineInstr *MI = &*MII;
+ const MachineInstr *MI = &*MII;
MInst2LVSetAI[MI] = SetAI; // record in After Inst map
@@ -316,7 +316,7 @@
}
// SetAI will be used in the next iteration
- SetAI = NewSet;
+ SetAI = NewSet;
}
}
Index: llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h
diff -u llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h:1.2 llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h:1.3
--- llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h:1.2 Wed Sep 1 17:55:36 2004
+++ llvm/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h Thu Apr 21 18:27:35 2005
@@ -1,34 +1,34 @@
//===-- CodeGen/FunctionLiveVarInfo.h - LiveVar Analysis --------*- C++ -*-===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
-// This is the interface for live variable info of a function that is required
+// This is the interface for live variable info of a function that is required
// by any other part of the compiler
//
-// After the analysis, getInSetOfBB or getOutSetofBB can be called to get
+// After the analysis, getInSetOfBB or getOutSetofBB can be called to get
// live var info of a BB.
//
// The live var set before an instruction can be obtained in 2 ways:
//
-// 1. Use the method getLiveVarSetAfterInst(Instruction *) to get the LV Info
+// 1. Use the method getLiveVarSetAfterInst(Instruction *) to get the LV Info
// just after an instruction. (also exists getLiveVarSetBeforeInst(..))
//
-// This function caluclates the LV info for a BB only once and caches that
-// info. If the cache does not contain the LV info of the instruction, it
+// This function caluclates the LV info for a BB only once and caches that
+// info. If the cache does not contain the LV info of the instruction, it
// calculates the LV info for the whole BB and caches them.
//
-// Getting liveVar info this way uses more memory since, LV info should be
+// Getting liveVar info this way uses more memory since, LV info should be
// cached. However, if you need LV info of nearly all the instructions of a
// BB, this is the best and simplest interfrace.
//
-// 2. Use the OutSet and applyTranferFuncForInst(const Instruction *const Inst)
-// declared in LiveVarSet and traverse the instructions of a basic block in
-// reverse (using const_reverse_iterator in the BB class).
+// 2. Use the OutSet and applyTranferFuncForInst(const Instruction *const Inst)
+// declared in LiveVarSet and traverse the instructions of a basic block in
+// reverse (using const_reverse_iterator in the BB class).
//
//===----------------------------------------------------------------------===//
@@ -47,7 +47,7 @@
class FunctionLiveVarInfo : public FunctionPass {
// Machine Instr to LiveVarSet Map for providing LVset BEFORE each inst
// These sets are owned by this map and will be freed in releaseMemory().
- hash_map<const MachineInstr *, ValueSet *> MInst2LVSetBI;
+ hash_map<const MachineInstr *, ValueSet *> MInst2LVSetBI;
// Machine Instr to LiveVarSet Map for providing LVset AFTER each inst.
// These sets are just pointers to sets in MInst2LVSetBI or BBLiveVar.
@@ -62,13 +62,13 @@
// constructs BBLiveVars and init Def and In sets
void constructBBs(const Function *F);
-
+
// do one backward pass over the CFG
- bool doSingleBackwardPass(const Function *F, unsigned int iter);
+ bool doSingleBackwardPass(const Function *F, unsigned int iter);
// calculates live var sets for instructions in a BB
void calcLiveVarSetsForBB(const BasicBlock *BB);
-
+
public:
// --------- Implement the FunctionPass interface ----------------------
Index: llvm/lib/Target/SparcV9/LiveVar/ValueSet.cpp
diff -u llvm/lib/Target/SparcV9/LiveVar/ValueSet.cpp:1.17 llvm/lib/Target/SparcV9/LiveVar/ValueSet.cpp:1.18
--- llvm/lib/Target/SparcV9/LiveVar/ValueSet.cpp:1.17 Sat Jul 17 19:37:35 2004
+++ llvm/lib/Target/SparcV9/LiveVar/ValueSet.cpp Thu Apr 21 18:27:35 2005
@@ -1,9 +1,9 @@
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
// FIXME: Eliminate this file.
@@ -13,7 +13,7 @@
namespace llvm {
-std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value
+std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value
const Value &v = V.V;
if (v.hasName())
return O << (void*)&v << "(" << v.getName() << ") ";
More information about the llvm-commits
mailing list