* Add #includes that were yanked out of header files
authorChris Lattner <sabre@nondot.org>
Mon, 4 Feb 2002 16:35:12 +0000 (16:35 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 4 Feb 2002 16:35:12 +0000 (16:35 +0000)
* Convert over to valueset interface that uses insert & erase insead of add and remove
* the -> operator really isn't that hard to use!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1687 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LiveVar/BBLiveVar.cpp
lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
lib/Analysis/LiveVar/LiveVarSet.cpp
lib/Analysis/LiveVar/ValueSet.cpp
lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
lib/Target/SparcV9/LiveVar/LiveVarSet.cpp
lib/Target/SparcV9/LiveVar/ValueSet.cpp

index 0ecf96cf13cad9ff7648f552ef2b2379b137d91f..b1949945bae3725faa16aa12c3968dbf77ba3b68 100644 (file)
@@ -1,6 +1,7 @@
 #include "llvm/Analysis/LiveVar/BBLiveVar.h"
 #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
 #include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/BasicBlock.h"
 
 /// BROKEN: Should not include sparc stuff directly into here
 #include "../../Target/Sparc/SparcInternals.h"  //  Only for PHI defn
@@ -123,8 +124,8 @@ void BBLiveVar::calcDefUseSets()
 //-----------------------------------------------------------------------------
 void  BBLiveVar::addDef(const Value *Op) 
 {
-  DefSet.add( Op );     // operand is a def - so add to def set
-  InSet.remove( Op);    // this definition kills any uses
+  DefSet.insert(Op);     // operand is a def - so add to def set
+  InSet.erase(Op);    // this definition kills any uses
   InSetChanged = true; 
 
   if( DEBUG_LV > 1) {   
@@ -138,8 +139,8 @@ void  BBLiveVar::addDef(const Value *Op)
 //-----------------------------------------------------------------------------
 void  BBLiveVar::addUse(const Value *Op) 
 {
-  InSet.add( Op );      // An operand is a use - so add to use set
-  OutSet.remove( Op );  // remove if there is a def below this use
+  InSet.insert(Op);   // An operand is a use - so add to use set
+  OutSet.erase(Op);   // remove if there is a def below this use
   InSetChanged = true; 
 
   if( DEBUG_LV > 1) {   // debug msg of level 2
index 5de35ff1be58da22dc614d7cc7ff54dff658f1ec..77c8c54e89c5ae17490b692b995f76856854cd8f 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
 #include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/BasicBlock.h"
 #include "Support/PostOrderIterator.h"
 #include <iostream>
 using std::cout;
index 8623aa86549242d35c4f36d5afaec26c483a8d42..9243d05981742a0ec3aff4becfe9af0d76ba6714 100644 (file)
 void LiveVarSet::applyTranferFuncForMInst(const MachineInstr *MInst) {
   for (MachineInstr::val_const_op_iterator OpI(MInst); !OpI.done(); ++OpI) {
     if (OpI.isDef())      // kill only if this operand is a def
-         remove(*OpI);        // this definition kills any uses
+      insert(*OpI);        // this definition kills any uses
   }
 
   // do for implicit operands as well
   for ( unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
     if (MInst->implicitRefIsDefined(i))
-      remove(MInst->getImplicitRef(i));
+      erase(MInst->getImplicitRef(i));
   }
 
 
@@ -26,12 +26,12 @@ void LiveVarSet::applyTranferFuncForMInst(const MachineInstr *MInst) {
     if ((*OpI)->getType()->isLabelType()) continue; // don't process labels
     
     if (!OpI.isDef())      // add only if this operand is a use
-       add(*OpI);            // An operand is a use - so add to use set
+      insert(*OpI);            // An operand is a use - so add to use set
   }
 
   // do for implicit operands as well
   for (unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
     if (!MInst->implicitRefIsDefined(i))
-      add(MInst->getImplicitRef(i));
+      insert(MInst->getImplicitRef(i));
   }
 }
index d176d9e53cffcf58f6f92655675edc3299449b78..8bf0b4df2583f37942499ae249299736b50ea9a2 100644 (file)
@@ -1,16 +1,16 @@
 
 #include "llvm/Analysis/LiveVar/ValueSet.h"
 #include "llvm/ConstantVals.h"
+#include <algorithm>
 #include <iostream>
 using std::cerr;
 using std::endl;
 using std::pair;
 using std::hash_set;
 
-void printValue( const Value *const v)  // func to print a Value 
-{
+void printValue(const Value *v) { // func to print a Value 
   if (v->hasName())
-    cerr << v << "(" << ((*v).getName()) << ") ";
+    cerr << v << "(" << v->getName() << ") ";
   else if (Constant *C = dyn_cast<Constant>(v))
     cerr << v << "(" << C->getStrValue() << ") ";
   else
@@ -20,15 +20,14 @@ void printValue( const Value *const v)  // func to print a Value
 
 //---------------- Method implementations --------------------------
                                              // for performing two set unions
-bool ValueSet::setUnion( const ValueSet *const set1) {   
-  const_iterator set1it;
+bool ValueSet::setUnion( const ValueSet *set1) {   
   pair<iterator, bool> result;
   bool changed = false;
 
-  for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) {  
+  for(const_iterator set1it = set1->begin() ; set1it != set1->end(); ++set1it) {
                                              // for all all elements in set1
-    result = insert( *set1it );              // insert to this set
-      if( result.second == true) changed = true;
+    result = insert(*set1it);                // insert to this set
+    if(result.second == true) changed = true;
   }
 
   return changed;
index 0ecf96cf13cad9ff7648f552ef2b2379b137d91f..b1949945bae3725faa16aa12c3968dbf77ba3b68 100644 (file)
@@ -1,6 +1,7 @@
 #include "llvm/Analysis/LiveVar/BBLiveVar.h"
 #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
 #include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/BasicBlock.h"
 
 /// BROKEN: Should not include sparc stuff directly into here
 #include "../../Target/Sparc/SparcInternals.h"  //  Only for PHI defn
@@ -123,8 +124,8 @@ void BBLiveVar::calcDefUseSets()
 //-----------------------------------------------------------------------------
 void  BBLiveVar::addDef(const Value *Op) 
 {
-  DefSet.add( Op );     // operand is a def - so add to def set
-  InSet.remove( Op);    // this definition kills any uses
+  DefSet.insert(Op);     // operand is a def - so add to def set
+  InSet.erase(Op);    // this definition kills any uses
   InSetChanged = true; 
 
   if( DEBUG_LV > 1) {   
@@ -138,8 +139,8 @@ void  BBLiveVar::addDef(const Value *Op)
 //-----------------------------------------------------------------------------
 void  BBLiveVar::addUse(const Value *Op) 
 {
-  InSet.add( Op );      // An operand is a use - so add to use set
-  OutSet.remove( Op );  // remove if there is a def below this use
+  InSet.insert(Op);   // An operand is a use - so add to use set
+  OutSet.erase(Op);   // remove if there is a def below this use
   InSetChanged = true; 
 
   if( DEBUG_LV > 1) {   // debug msg of level 2
index 5de35ff1be58da22dc614d7cc7ff54dff658f1ec..77c8c54e89c5ae17490b692b995f76856854cd8f 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
 #include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/BasicBlock.h"
 #include "Support/PostOrderIterator.h"
 #include <iostream>
 using std::cout;
index 8623aa86549242d35c4f36d5afaec26c483a8d42..9243d05981742a0ec3aff4becfe9af0d76ba6714 100644 (file)
 void LiveVarSet::applyTranferFuncForMInst(const MachineInstr *MInst) {
   for (MachineInstr::val_const_op_iterator OpI(MInst); !OpI.done(); ++OpI) {
     if (OpI.isDef())      // kill only if this operand is a def
-         remove(*OpI);        // this definition kills any uses
+      insert(*OpI);        // this definition kills any uses
   }
 
   // do for implicit operands as well
   for ( unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
     if (MInst->implicitRefIsDefined(i))
-      remove(MInst->getImplicitRef(i));
+      erase(MInst->getImplicitRef(i));
   }
 
 
@@ -26,12 +26,12 @@ void LiveVarSet::applyTranferFuncForMInst(const MachineInstr *MInst) {
     if ((*OpI)->getType()->isLabelType()) continue; // don't process labels
     
     if (!OpI.isDef())      // add only if this operand is a use
-       add(*OpI);            // An operand is a use - so add to use set
+      insert(*OpI);            // An operand is a use - so add to use set
   }
 
   // do for implicit operands as well
   for (unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
     if (!MInst->implicitRefIsDefined(i))
-      add(MInst->getImplicitRef(i));
+      insert(MInst->getImplicitRef(i));
   }
 }
index d176d9e53cffcf58f6f92655675edc3299449b78..8bf0b4df2583f37942499ae249299736b50ea9a2 100644 (file)
@@ -1,16 +1,16 @@
 
 #include "llvm/Analysis/LiveVar/ValueSet.h"
 #include "llvm/ConstantVals.h"
+#include <algorithm>
 #include <iostream>
 using std::cerr;
 using std::endl;
 using std::pair;
 using std::hash_set;
 
-void printValue( const Value *const v)  // func to print a Value 
-{
+void printValue(const Value *v) { // func to print a Value 
   if (v->hasName())
-    cerr << v << "(" << ((*v).getName()) << ") ";
+    cerr << v << "(" << v->getName() << ") ";
   else if (Constant *C = dyn_cast<Constant>(v))
     cerr << v << "(" << C->getStrValue() << ") ";
   else
@@ -20,15 +20,14 @@ void printValue( const Value *const v)  // func to print a Value
 
 //---------------- Method implementations --------------------------
                                              // for performing two set unions
-bool ValueSet::setUnion( const ValueSet *const set1) {   
-  const_iterator set1it;
+bool ValueSet::setUnion( const ValueSet *set1) {   
   pair<iterator, bool> result;
   bool changed = false;
 
-  for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) {  
+  for(const_iterator set1it = set1->begin() ; set1it != set1->end(); ++set1it) {
                                              // for all all elements in set1
-    result = insert( *set1it );              // insert to this set
-      if( result.second == true) changed = true;
+    result = insert(*set1it);                // insert to this set
+    if(result.second == true) changed = true;
   }
 
   return changed;