* Big cleanups.
authorChris Lattner <sabre@nondot.org>
Tue, 5 Feb 2002 00:33:19 +0000 (00:33 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 5 Feb 2002 00:33:19 +0000 (00:33 +0000)
* Make BBLiveVar.h effectively an internal header file
* Prepare LiveVarMap.h for deletion

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

include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h
include/llvm/Analysis/LiveVar/LiveVarMap.h
include/llvm/CodeGen/FunctionLiveVarInfo.h
lib/Analysis/LiveVar/BBLiveVar.h
lib/Target/SparcV9/LiveVar/BBLiveVar.h

index d126b6e03ef19b7b07cfd0afbc5fa0b162525e85..05723748d8af6fbe3df97d03fac12edd70ad1616 100644 (file)
 
 static const int DEBUG_LV = 0;
 
-#include "llvm/Analysis/LiveVar/BBLiveVar.h"
 #include "llvm/Pass.h"
+class BBLiveVar;
+class MachineInstr;
+class LiveVarSet;
 
 class MethodLiveVarInfo : public MethodPass {
-
-  // A map betwn the BasicBlock and BBLiveVar
-  BBToBBLiveVarMapType BB2BBLVMap;  
+  // A map between the BasicBlock and BBLiveVar
+  std::map<const BasicBlock *, BBLiveVar *> BB2BBLVMap;  
 
   // Machine Instr to LiveVarSet Map for providing LVset BEFORE each inst
-  MInstToLiveVarSetMapType MInst2LVSetBI; 
+  std::map<const MachineInstr *, const LiveVarSet *> MInst2LVSetBI; 
 
   // Machine Instr to LiveVarSet Map for providing LVset AFTER each inst
-  MInstToLiveVarSetMapType MInst2LVSetAI; 
+  std::map<const MachineInstr *, const LiveVarSet *> MInst2LVSetAI; 
 
 
   // --------- private methods -----------------------------------------
@@ -118,22 +119,18 @@ public:
   // --------- Functions to access analysis results -------------------
 
   // gets OutSet of a BB
-  inline const LiveVarSet *getOutSetOfBB( const BasicBlock *BB) const { 
-    return BB2BBLVMap.find(BB)->second->getOutSet();
-  }
+  const LiveVarSet *getOutSetOfBB(const BasicBlock *BB) const;
 
   // gets InSet of a BB
-  inline const LiveVarSet *getInSetOfBB( const BasicBlock *BB)  const { 
-    return BB2BBLVMap.find(BB)->second->getInSet();
-  }
+  const LiveVarSet *getInSetOfBB(const BasicBlock *BB) const;
 
   // gets the Live var set BEFORE an instruction
-  const LiveVarSet * getLiveVarSetBeforeMInst(const MachineInstr *Inst,
-                                             const BasicBlock *CurBB);
+  const LiveVarSet *getLiveVarSetBeforeMInst(const MachineInstr *MI,
+                                             const BasicBlock *BB);
 
   // gets the Live var set AFTER an instruction
-  const LiveVarSet * getLiveVarSetAfterMInst(const MachineInstr *MInst,
-                                            const BasicBlock *CurBB);
+  const LiveVarSet *getLiveVarSetAfterMInst(const MachineInstr *MI,
+                                            const BasicBlock *BB);
 };
 
 #endif
index a9e170170f960f4eca1c9f179167eed20285c006..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,24 +0,0 @@
-/* Title:   LiveVarMap.h   -*- C++ -*-
-   Author:  Ruchira Sasanka
-   Date:    Jun 30, 01
-   Purpose: This file contains the class for a map between the BasicBlock class
-            and the BBLiveVar class, which is a wrapper class of BasicBlock
-           used for the live variable analysis. The reverse mapping can
-           be found in the BBLiveVar class (It has a pointer to the 
-           corresponding BasicBlock)
-*/
-
-#ifndef LIVE_VAR_MAP_H
-#define LIVE_VAR_MAP_H
-
-#include "Support/HashExtras.h"
-
-class MachineInstr;
-class BasicBlock;
-class BBLiveVar;
-class LiveVarSet;
-
-typedef std::hash_map<const BasicBlock *, BBLiveVar *> BBToBBLiveVarMapType;
-typedef std::hash_map<const MachineInstr *, const LiveVarSet *> MInstToLiveVarSetMapType;
-
-#endif
index d126b6e03ef19b7b07cfd0afbc5fa0b162525e85..05723748d8af6fbe3df97d03fac12edd70ad1616 100644 (file)
 
 static const int DEBUG_LV = 0;
 
-#include "llvm/Analysis/LiveVar/BBLiveVar.h"
 #include "llvm/Pass.h"
+class BBLiveVar;
+class MachineInstr;
+class LiveVarSet;
 
 class MethodLiveVarInfo : public MethodPass {
-
-  // A map betwn the BasicBlock and BBLiveVar
-  BBToBBLiveVarMapType BB2BBLVMap;  
+  // A map between the BasicBlock and BBLiveVar
+  std::map<const BasicBlock *, BBLiveVar *> BB2BBLVMap;  
 
   // Machine Instr to LiveVarSet Map for providing LVset BEFORE each inst
-  MInstToLiveVarSetMapType MInst2LVSetBI; 
+  std::map<const MachineInstr *, const LiveVarSet *> MInst2LVSetBI; 
 
   // Machine Instr to LiveVarSet Map for providing LVset AFTER each inst
-  MInstToLiveVarSetMapType MInst2LVSetAI; 
+  std::map<const MachineInstr *, const LiveVarSet *> MInst2LVSetAI; 
 
 
   // --------- private methods -----------------------------------------
@@ -118,22 +119,18 @@ public:
   // --------- Functions to access analysis results -------------------
 
   // gets OutSet of a BB
-  inline const LiveVarSet *getOutSetOfBB( const BasicBlock *BB) const { 
-    return BB2BBLVMap.find(BB)->second->getOutSet();
-  }
+  const LiveVarSet *getOutSetOfBB(const BasicBlock *BB) const;
 
   // gets InSet of a BB
-  inline const LiveVarSet *getInSetOfBB( const BasicBlock *BB)  const { 
-    return BB2BBLVMap.find(BB)->second->getInSet();
-  }
+  const LiveVarSet *getInSetOfBB(const BasicBlock *BB) const;
 
   // gets the Live var set BEFORE an instruction
-  const LiveVarSet * getLiveVarSetBeforeMInst(const MachineInstr *Inst,
-                                             const BasicBlock *CurBB);
+  const LiveVarSet *getLiveVarSetBeforeMInst(const MachineInstr *MI,
+                                             const BasicBlock *BB);
 
   // gets the Live var set AFTER an instruction
-  const LiveVarSet * getLiveVarSetAfterMInst(const MachineInstr *MInst,
-                                            const BasicBlock *CurBB);
+  const LiveVarSet *getLiveVarSetAfterMInst(const MachineInstr *MI,
+                                            const BasicBlock *BB);
 };
 
 #endif
index 08ccd2fe5c00aa211d6bd7a6a1732b66b403b049..112e8151d971b6222c5badb949cba59f4002882a 100644 (file)
@@ -1,20 +1,21 @@
-/* Title:   BBLiveVar.h                  -*- C++ -*-
-   Author:  Ruchira Sasanka
-   Date:    Jun 30, 01
-   Purpose: This is a wrapper class for BasicBlock which is used by live 
-            variable anaysis.
-*/
+//===-- BBLiveVar.h - Live Variable Analysis for a BasicBlock ----*- C++ -*--=//
+//
+// This is a wrapper class for BasicBlock which is used by live var analysis.
+//
+//===----------------------------------------------------------------------===//
 
 #ifndef LIVE_VAR_BB_H
 #define LIVE_VAR_BB_H
 
 #include "LiveVarSet.h"
-#include "LiveVarMap.h"
+#include <map>
 class Method;
+class BasicBlock;
+class Value;
 
 class BBLiveVar {
-  const BasicBlock* BaseBB;     // pointer to BasicBlock
-  unsigned POId;                // Post-Order ID
+  const BasicBlock *BB;         // pointer to BasicBlock
+  unsigned POID;                // Post-Order ID
 
   LiveVarSet DefSet;            // Def set for LV analysis
   LiveVarSet InSet, OutSet;     // In & Out for LV analysis
@@ -22,12 +23,12 @@ class BBLiveVar {
 
                                 // map that contains phi args->BB they came
                                 // set by calcDefUseSets & used by setPropagate
-  std::hash_map<const Value *, const BasicBlock *> PhiArgMap;  
+  std::map<const Value *, const BasicBlock *> PhiArgMap;  
 
   // method to propogate an InSet to OutSet of a predecessor
-  bool setPropagate( LiveVarSet *OutSetOfPred, 
-                    const LiveVarSet *InSetOfThisBB,
-                    const BasicBlock *PredBB);
+  bool setPropagate(LiveVarSet *OutSetOfPred, 
+                    const LiveVarSet *InSetOfThisBB,
+                    const BasicBlock *PredBB);
 
   // To add an operand which is a def
   void  addDef(const Value *Op); 
@@ -36,21 +37,21 @@ class BBLiveVar {
   void  addUse(const Value *Op);
 
  public:
-  BBLiveVar(const BasicBlock* baseBB, unsigned POId);
+  BBLiveVar(const BasicBlock *BB, unsigned POID);
 
-  inline bool isInSetChanged() const { return InSetChanged; }    
+  inline bool isInSetChanged() const  { return InSetChanged; }    
   inline bool isOutSetChanged() const { return OutSetChanged; }
 
-  inline unsigned getPOId() const { return POId; }
+  inline unsigned getPOId() const { return POID; }
 
-  void calcDefUseSets() ;         // calculates the Def & Use sets for this BB
-  bool  applyTransferFunc();      // calcultes the In in terms of Out 
+  void calcDefUseSets();         // calculates the Def & Use sets for this BB
+  bool applyTransferFunc();      // calcultes the In in terms of Out 
 
   // calculates Out set using In sets of the predecessors
-  bool applyFlowFunc(BBToBBLiveVarMapType LVMap);    
+  bool applyFlowFunc(std::map<const BasicBlock *, BBLiveVar *> &LVMap);    
 
-  inline const LiveVarSet* getOutSet()  const { return &OutSet; }
-  inline const LiveVarSet*  getInSet() const { return &InSet; }
+  inline const LiveVarSet *getOutSet() const { return &OutSet; }
+  inline const LiveVarSet  *getInSet() const { return &InSet; }
 
   void printAllSets() const;      // for printing Def/In/Out sets
   void printInOutSets() const;    // for printing In/Out sets
index 08ccd2fe5c00aa211d6bd7a6a1732b66b403b049..112e8151d971b6222c5badb949cba59f4002882a 100644 (file)
@@ -1,20 +1,21 @@
-/* Title:   BBLiveVar.h                  -*- C++ -*-
-   Author:  Ruchira Sasanka
-   Date:    Jun 30, 01
-   Purpose: This is a wrapper class for BasicBlock which is used by live 
-            variable anaysis.
-*/
+//===-- BBLiveVar.h - Live Variable Analysis for a BasicBlock ----*- C++ -*--=//
+//
+// This is a wrapper class for BasicBlock which is used by live var analysis.
+//
+//===----------------------------------------------------------------------===//
 
 #ifndef LIVE_VAR_BB_H
 #define LIVE_VAR_BB_H
 
 #include "LiveVarSet.h"
-#include "LiveVarMap.h"
+#include <map>
 class Method;
+class BasicBlock;
+class Value;
 
 class BBLiveVar {
-  const BasicBlock* BaseBB;     // pointer to BasicBlock
-  unsigned POId;                // Post-Order ID
+  const BasicBlock *BB;         // pointer to BasicBlock
+  unsigned POID;                // Post-Order ID
 
   LiveVarSet DefSet;            // Def set for LV analysis
   LiveVarSet InSet, OutSet;     // In & Out for LV analysis
@@ -22,12 +23,12 @@ class BBLiveVar {
 
                                 // map that contains phi args->BB they came
                                 // set by calcDefUseSets & used by setPropagate
-  std::hash_map<const Value *, const BasicBlock *> PhiArgMap;  
+  std::map<const Value *, const BasicBlock *> PhiArgMap;  
 
   // method to propogate an InSet to OutSet of a predecessor
-  bool setPropagate( LiveVarSet *OutSetOfPred, 
-                    const LiveVarSet *InSetOfThisBB,
-                    const BasicBlock *PredBB);
+  bool setPropagate(LiveVarSet *OutSetOfPred, 
+                    const LiveVarSet *InSetOfThisBB,
+                    const BasicBlock *PredBB);
 
   // To add an operand which is a def
   void  addDef(const Value *Op); 
@@ -36,21 +37,21 @@ class BBLiveVar {
   void  addUse(const Value *Op);
 
  public:
-  BBLiveVar(const BasicBlock* baseBB, unsigned POId);
+  BBLiveVar(const BasicBlock *BB, unsigned POID);
 
-  inline bool isInSetChanged() const { return InSetChanged; }    
+  inline bool isInSetChanged() const  { return InSetChanged; }    
   inline bool isOutSetChanged() const { return OutSetChanged; }
 
-  inline unsigned getPOId() const { return POId; }
+  inline unsigned getPOId() const { return POID; }
 
-  void calcDefUseSets() ;         // calculates the Def & Use sets for this BB
-  bool  applyTransferFunc();      // calcultes the In in terms of Out 
+  void calcDefUseSets();         // calculates the Def & Use sets for this BB
+  bool applyTransferFunc();      // calcultes the In in terms of Out 
 
   // calculates Out set using In sets of the predecessors
-  bool applyFlowFunc(BBToBBLiveVarMapType LVMap);    
+  bool applyFlowFunc(std::map<const BasicBlock *, BBLiveVar *> &LVMap);    
 
-  inline const LiveVarSet* getOutSet()  const { return &OutSet; }
-  inline const LiveVarSet*  getInSet() const { return &InSet; }
+  inline const LiveVarSet *getOutSet() const { return &OutSet; }
+  inline const LiveVarSet  *getInSet() const { return &InSet; }
 
   void printAllSets() const;      // for printing Def/In/Out sets
   void printInOutSets() const;    // for printing In/Out sets