summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/LiveVariables.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2006-10-03 07:20:20 +0000
committerBill Wendling <isanbard@gmail.com>2006-10-03 07:20:20 +0000
commitf7da4e939f02678cbe56cae666506da3b1a5e100 (patch)
treeda7308d92dc17afbebc6ff48e0089e392db456f2 /include/llvm/CodeGen/LiveVariables.h
parent86f7b2100c7b6b426869178327e352d122056f73 (diff)
downloadllvm-f7da4e939f02678cbe56cae666506da3b1a5e100.tar.gz
llvm-f7da4e939f02678cbe56cae666506da3b1a5e100.tar.bz2
llvm-f7da4e939f02678cbe56cae666506da3b1a5e100.tar.xz
Fix for PR929. The PHI nodes were being gone through for each instruction
in a successor block for every block...resulting in some O(N^k) algorithm which wasn't very good for performance. Calculating this information up front and keeping it in a map made it much faster. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/LiveVariables.h')
-rw-r--r--include/llvm/CodeGen/LiveVariables.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index a61eca89c1..95114c0b70 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -39,7 +39,7 @@ class MRegisterInfo;
class LiveVariables : public MachineFunctionPass {
public:
/// VarInfo - This represents the regions where a virtual register is live in
- /// the program. We represent this with three difference pieces of
+ /// the program. We represent this with three different pieces of
/// information: the instruction that uniquely defines the value, the set of
/// blocks the instruction is live into and live out of, and the set of
/// non-phi instructions that are the last users of the value.
@@ -136,9 +136,19 @@ private: // Intermediate data structures
MachineInstr **PhysRegInfo;
bool *PhysRegUsed;
+ typedef std::map<const MachineBasicBlock*,
+ std::vector<unsigned> > PHIVarInfoMap;
+
+ PHIVarInfoMap PHIVarInfo;
+
void HandlePhysRegUse(unsigned Reg, MachineInstr *MI);
void HandlePhysRegDef(unsigned Reg, MachineInstr *MI);
+ /// analyzePHINodes - Gather information about the PHI nodes in here. In
+ /// particular, we want to map the variable information of a virtual
+ /// register which is used in a PHI node. We map that to the BB the vreg
+ /// is coming from.
+ void analyzePHINodes(const MachineFunction& Fn);
public:
virtual bool runOnMachineFunction(MachineFunction &MF);