[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.46 -> 1.47 --- Log message: Properly handle kills of a physical register which has sub-registers that are read by later instructions. --- Diffs of the changes: (+10 -0) LiveVariables.h | 10 ++ 1 files changed, 10 insertions(+) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.46 llvm/include/llvm/CodeGen/LiveVariables.h:1.47 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.46 Tue May 8 14:00:00 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Tue Jun 26 16:02:59 2007 @@ -31,6 +31,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/ADT/BitVector.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallVector.h" #include @@ -163,6 +164,15 @@ bool addRegisterDead(unsigned IncomingReg, MachineInstr *MI, bool AddIfNotFound = false); + void addRegisterKills(unsigned Reg, MachineInstr *MI, +SmallSet &SubKills); + + /// HandlePhysRegKill - Add kills of Reg and its sub-registers to the + /// uses. Pay special attention to the sub-register uses which may come below + /// the last use of the whole register. + bool HandlePhysRegKill(unsigned Reg, MachineInstr *MI, + SmallSet &SubKills); + bool HandlePhysRegKill(unsigned Reg, MachineInstr *MI); void HandlePhysRegUse(unsigned Reg, MachineInstr *MI); void HandlePhysRegDef(unsigned Reg, MachineInstr *MI); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.45 -> 1.46 --- Log message: Eliminate MarkVirtRegAliveInBlock recursion. --- Diffs of the changes: (+2 -0) LiveVariables.h |2 ++ 1 files changed, 2 insertions(+) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.45 llvm/include/llvm/CodeGen/LiveVariables.h:1.46 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.45 Sun May 6 08:37:16 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Tue May 8 14:00:00 2007 @@ -283,6 +283,8 @@ VarInfo &getVarInfo(unsigned RegIdx); void MarkVirtRegAliveInBlock(VarInfo &VRInfo, MachineBasicBlock *BB); + void MarkVirtRegAliveInBlock(VarInfo &VRInfo, MachineBasicBlock *BB, + std::vector &WorkList); void HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB, MachineInstr *MI); }; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.40 -> 1.41 --- Log message: Be careful when to add implicit kill / dead operands. Don't add them during / post reg-allocation. --- Diffs of the changes: (+22 -14) LiveVariables.h | 36 ++-- 1 files changed, 22 insertions(+), 14 deletions(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.40 llvm/include/llvm/CodeGen/LiveVariables.h:1.41 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.40 Wed Apr 25 14:34:00 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Wed Apr 25 20:40:09 2007 @@ -147,12 +147,18 @@ SmallVector *PHIVarInfo; /// addRegisterKilled - We have determined MI kills a register. Look for the - /// operand that uses it and mark it as IsKill. - void addRegisterKilled(unsigned IncomingReg, MachineInstr *MI); + /// operand that uses it and mark it as IsKill. If AddIfNotFound is true, + /// add a implicit operand if it's not found. Returns true if the operand + /// exists / is added. + bool addRegisterKilled(unsigned IncomingReg, MachineInstr *MI, + bool AddIfNotFound = false); /// addRegisterDead - We have determined MI defined a register without a use. - /// Look for the operand that defines it and mark it as IsDead. - void addRegisterDead(unsigned IncomingReg, MachineInstr *MI); + /// Look for the operand that defines it and mark it as IsDead. If + /// AddIfNotFound is true, add a implicit operand if it's not found. Returns + /// true if the operand exists / is added. + bool addRegisterDead(unsigned IncomingReg, MachineInstr *MI, + bool AddIfNotFound = false); void HandlePhysRegUse(unsigned Reg, MachineInstr *MI); void HandlePhysRegDef(unsigned Reg, MachineInstr *MI); @@ -189,11 +195,12 @@ /// addVirtualRegisterKilled - Add information about the fact that the /// specified register is killed after being used by the specified - /// instruction. - /// - void addVirtualRegisterKilled(unsigned IncomingReg, MachineInstr *MI) { -addRegisterKilled(IncomingReg, MI); -getVarInfo(IncomingReg).Kills.push_back(MI); + /// instruction. If AddIfNotFound is true, add a implicit operand if it's + /// not found. + void addVirtualRegisterKilled(unsigned IncomingReg, MachineInstr *MI, +bool AddIfNotFound = false) { +if (addRegisterKilled(IncomingReg, MI, AddIfNotFound)) + getVarInfo(IncomingReg).Kills.push_back(MI); } /// removeVirtualRegisterKilled - Remove the specified virtual @@ -225,11 +232,12 @@ void removeVirtualRegistersKilled(MachineInstr *MI); /// addVirtualRegisterDead - Add information about the fact that the specified - /// register is dead after being used by the specified instruction. - /// - void addVirtualRegisterDead(unsigned IncomingReg, MachineInstr *MI) { -addRegisterDead(IncomingReg, MI); -getVarInfo(IncomingReg).Kills.push_back(MI); + /// register is dead after being used by the specified instruction. If + /// AddIfNotFound is true, add a implicit operand if it's not found. + void addVirtualRegisterDead(unsigned IncomingReg, MachineInstr *MI, + bool AddIfNotFound = false) { +if (addRegisterDead(IncomingReg, MI, AddIfNotFound)) +getVarInfo(IncomingReg).Kills.push_back(MI); } /// removeVirtualRegisterDead - Remove the specified virtual ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.39 -> 1.40 --- Log message: Data structure change to improve compile time (especially in debug mode). --- Diffs of the changes: (+10 -14) LiveVariables.h | 24 ++-- 1 files changed, 10 insertions(+), 14 deletions(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.39 llvm/include/llvm/CodeGen/LiveVariables.h:1.40 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.39 Wed Apr 25 02:30:23 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Wed Apr 25 14:34:00 2007 @@ -31,12 +31,12 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/ADT/BitVector.h" +#include "llvm/ADT/SmallVector.h" #include namespace llvm { class MRegisterInfo; -class BitVector; class LiveVariables : public MachineFunctionPass { public: @@ -127,28 +127,24 @@ // PhysRegInfo - Keep track of which instruction was the last def/use of a // physical register. This is a purely local property, because all physical // register references as presumed dead across basic blocks. - std::vector PhysRegInfo; + MachineInstr **PhysRegInfo; // PhysRegUsed - Keep track whether the physical register has been used after // its last definition. This is local property. - BitVector PhysRegUsed; - - // PhysRegPartDef - Keep track of a list of instructions which "partially" - // defined the physical register (e.g. on X86 AX partially defines EAX). - // These are turned into use/mod/write if there is a use of the register - // later in the same block. This is local property. - std::vector > PhysRegPartDef; + bool *PhysRegUsed; // PhysRegPartUse - Keep track of which instruction was the last partial use // of a physical register (e.g. on X86 a def of EAX followed by a use of AX). // This is a purely local property. - std::vector PhysRegPartUse; + MachineInstr **PhysRegPartUse; - typedef std::map > PHIVarInfoMap; - - PHIVarInfoMap PHIVarInfo; + // PhysRegPartDef - Keep track of a list of instructions which "partially" + // defined the physical register (e.g. on X86 AX partially defines EAX). + // These are turned into use/mod/write if there is a use of the register + // later in the same block. This is local property. + SmallVector *PhysRegPartDef; + SmallVector *PHIVarInfo; /// addRegisterKilled - We have determined MI kills a register. Look for the /// operand that uses it and mark it as IsKill. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.37 -> 1.38 --- Log message: VarInfo::UsedBlocks is no longer used. Remove. --- Diffs of the changes: (+0 -4) LiveVariables.h |4 1 files changed, 4 deletions(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.37 llvm/include/llvm/CodeGen/LiveVariables.h:1.38 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.37 Tue Apr 17 15:22:11 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Wed Apr 18 00:04:38 2007 @@ -79,10 +79,6 @@ /// BitVector AliveBlocks; -/// UsedBlocks - Set of blocks of which this value is actually used. This -/// is a bit set which uses the basic block number as an index. -BitVector UsedBlocks; - /// NumUses - Number of uses of this register across the entire function. /// unsigned NumUses; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.36 -> 1.37 --- Log message: Keep track of number of uses within the function per virtual register. --- Diffs of the changes: (+5 -1) LiveVariables.h |6 +- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.36 llvm/include/llvm/CodeGen/LiveVariables.h:1.37 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.36 Sat Mar 17 04:29:54 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Tue Apr 17 15:22:11 2007 @@ -83,12 +83,16 @@ /// is a bit set which uses the basic block number as an index. BitVector UsedBlocks; +/// NumUses - Number of uses of this register across the entire function. +/// +unsigned NumUses; + /// Kills - List of MachineInstruction's which are the last use of this /// virtual register (kill it) in their basic block. /// std::vector Kills; -VarInfo() : DefInst(0) {} +VarInfo() : DefInst(0), NumUses(0) {} /// removeKill - Delete a kill corresponding to the specified /// machine instruction. Returns true if there was a kill ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.35 -> 1.36 --- Log message: Track the BB's where each virtual register is used. --- Diffs of the changes: (+6 -0) LiveVariables.h |6 ++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.35 llvm/include/llvm/CodeGen/LiveVariables.h:1.36 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.35 Mon Feb 19 15:49:53 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Sat Mar 17 04:29:54 2007 @@ -79,6 +79,10 @@ /// BitVector AliveBlocks; +/// UsedBlocks - Set of blocks of which this value is actually used. This +/// is a bit set which uses the basic block number as an index. +BitVector UsedBlocks; + /// Kills - List of MachineInstruction's which are the last use of this /// virtual register (kill it) in their basic block. /// @@ -116,6 +120,8 @@ BitVector ReservedRegisters; private: // Intermediate data structures + MachineFunction *MF; + const MRegisterInfo *RegInfo; MachineInstr **PhysRegInfo; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.32 -> 1.33 --- Log message: Allow LiveVariables to track liveness of more registers. --- Diffs of the changes: (+5 -4) LiveVariables.h |9 + 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.32 llvm/include/llvm/CodeGen/LiveVariables.h:1.33 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.32 Wed Feb 14 23:57:14 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Sat Feb 17 05:07:08 2007 @@ -36,6 +36,7 @@ namespace llvm { class MRegisterInfo; +class BitVector; class LiveVariables : public MachineFunctionPass { public: @@ -108,11 +109,11 @@ /// std::vector VirtRegInfo; - /// AllocatablePhysicalRegisters - This vector keeps track of which registers - /// are actually register allocatable by the target machine. We can not track - /// liveness for values that are not in this set. + /// ReservedRegisters - This vector keeps track of which registers + /// are reserved register which are not allocatable by the target machine. + /// We can not track liveness for values that are in this set. /// - BitVector AllocatablePhysicalRegisters; + BitVector ReservedRegisters; private: // Intermediate data structures const MRegisterInfo *RegInfo; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.30 -> 1.31 --- Log message: Do away with kill / dead maps. Move kill / dead info onto MI's. --- Diffs of the changes: (+36 -95) LiveVariables.h | 131 +++- 1 files changed, 36 insertions(+), 95 deletions(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.30 llvm/include/llvm/CodeGen/LiveVariables.h:1.31 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.30 Tue Oct 3 02:20:20 2006 +++ llvm/include/llvm/CodeGen/LiveVariables.h Wed Nov 15 14:47:31 2006 @@ -107,23 +107,6 @@ /// std::vector VirtRegInfo; - /// RegistersKilled - This map keeps track of all of the registers that - /// are dead immediately after an instruction reads its operands. If an - /// instruction does not have an entry in this map, it kills no registers. - /// - std::map > RegistersKilled; - - /// RegistersDead - This map keeps track of all of the registers that are - /// dead immediately after an instruction executes, which are not dead after - /// the operands are evaluated. In practice, this only contains registers - /// which are defined by an instruction, but never used. - /// - std::map > RegistersDead; - - /// Dummy - An always empty vector used for instructions without dead or - /// killed operands. - std::vector Dummy; - /// AllocatablePhysicalRegisters - This vector keeps track of which registers /// are actually register allocatable by the target machine. We can not track /// liveness for values that are not in this set. @@ -141,6 +124,15 @@ PHIVarInfoMap PHIVarInfo; + + /// addRegisterKilled - We have determined MI kills a register. Look for the + /// operand that uses it and mark it as IsKill. + void addRegisterKilled(unsigned IncomingReg, MachineInstr *MI); + + /// addRegisterDead - We have determined MI defined a register without a use. + /// Look for the operand that defines it and mark it as IsDead. + void addRegisterDead(unsigned IncomingReg, MachineInstr *MI); + void HandlePhysRegUse(unsigned Reg, MachineInstr *MI); void HandlePhysRegDef(unsigned Reg, MachineInstr *MI); @@ -153,55 +145,17 @@ virtual bool runOnMachineFunction(MachineFunction &MF); - /// killed_iterator - Iterate over registers killed by a machine instruction - /// - typedef std::vector::iterator killed_iterator; - - std::vector &getKillsVector(MachineInstr *MI) { -std::map >::iterator I = - RegistersKilled.find(MI); -return I != RegistersKilled.end() ? I->second : Dummy; - } - std::vector &getDeadDefsVector(MachineInstr *MI) { -std::map >::iterator I = - RegistersDead.find(MI); -return I != RegistersDead.end() ? I->second : Dummy; - } - - - /// killed_begin/end - Get access to the range of registers killed by a - /// machine instruction. - killed_iterator killed_begin(MachineInstr *MI) { -return getKillsVector(MI).begin(); - } - killed_iterator killed_end(MachineInstr *MI) { -return getKillsVector(MI).end(); - } - std::pair - killed_range(MachineInstr *MI) { -std::vector &V = getKillsVector(MI); -return std::make_pair(V.begin(), V.end()); - } - /// KillsRegister - Return true if the specified instruction kills the /// specified register. bool KillsRegister(MachineInstr *MI, unsigned Reg) const; - killed_iterator dead_begin(MachineInstr *MI) { -return getDeadDefsVector(MI).begin(); - } - killed_iterator dead_end(MachineInstr *MI) { -return getDeadDefsVector(MI).end(); - } - std::pair - dead_range(MachineInstr *MI) { -std::vector &V = getDeadDefsVector(MI); -return std::make_pair(V.begin(), V.end()); - } - /// RegisterDefIsDead - Return true if the specified instruction defines the /// specified register, but that definition is dead. bool RegisterDefIsDead(MachineInstr *MI, unsigned Reg) const; + + /// ModifiesRegister - Return true if the specified instruction modifies the + /// specified register. + bool ModifiesRegister(MachineInstr *MI, unsigned Reg) const; //======// // API to update live variable information @@ -217,19 +171,9 @@ /// instruction. /// void addVirtualRegisterKilled(unsigned IncomingReg, MachineInstr *MI) { -std::vector &V = RegistersKilled[MI]; -// Insert in a sorted order. -if (V.empty() || IncomingReg > V.back()) { - V.push_back(IncomingReg); -} else { - std::vector::iterator I = V.begin(); - for (; *I < IncomingReg; ++I) -/*empty*/; - if (*I != IncomingReg) // Don't insert duplicates. -V.insert(I, IncomingReg); -} -getVarInfo(IncomingReg).Kills.push_back(MI); - } +addRegisterKilled(IncomingReg, MI); +getVarInfo(IncomingReg).Kills.push_back(MI); + } /// removeVirtualRegisterKilled - Remove the specified
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.29 -> 1.30 --- Log message: Fix for PR929: http://llvm.org/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. --- Diffs of the changes: (+11 -1) LiveVariables.h | 12 +++- 1 files changed, 11 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.29 llvm/include/llvm/CodeGen/LiveVariables.h:1.30 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.29 Sat Sep 2 19:05:09 2006 +++ llvm/include/llvm/CodeGen/LiveVariables.h Tue Oct 3 02:20:20 2006 @@ -39,7 +39,7 @@ 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 @@ MachineInstr **PhysRegInfo; bool *PhysRegUsed; + typedef std::map > 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); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.28 -> 1.29 --- Log message: Move two methods out of line, make them work when the record for a machine instruction includes physregs. --- Diffs of the changes: (+6 -28) LiveVariables.h | 34 ++ 1 files changed, 6 insertions(+), 28 deletions(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.28 llvm/include/llvm/CodeGen/LiveVariables.h:1.29 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.28 Wed Jan 4 01:29:33 2006 +++ llvm/include/llvm/CodeGen/LiveVariables.h Sat Sep 2 19:05:09 2006 @@ -242,19 +242,8 @@ /// removeVirtualRegistersKilled - Remove all killed info for the specified /// instruction. - void removeVirtualRegistersKilled(MachineInstr *MI) { -std::map >::iterator I = - RegistersKilled.find(MI); -if (I != RegistersKilled.end()) { - std::vector &Regs = I->second; - for (unsigned i = 0, e = Regs.size(); i != e; ++i) { -bool removed = getVarInfo(Regs[i]).removeKill(MI); -assert(removed && "kill not in register's VarInfo?"); - } - RegistersKilled.erase(I); -} - } - + void removeVirtualRegistersKilled(MachineInstr *MI); + /// addVirtualRegisterDead - Add information about the fact that the specified /// register is dead after being used by the specified instruction. /// @@ -292,21 +281,10 @@ return true; } - /// removeVirtualRegistersDead - Remove all of the specified dead - /// registers from the live variable information. - void removeVirtualRegistersDead(MachineInstr *MI) { -std::map >::iterator I = - RegistersDead.find(MI); -if (I != RegistersDead.end()) { - std::vector &Regs = I->second; - for (unsigned i = 0, e = Regs.size(); i != e; ++i) { -bool removed = getVarInfo(Regs[i]).removeKill(MI); -assert(removed && "kill not in register's VarInfo?"); - } - RegistersDead.erase(I); -} - } - + /// removeVirtualRegistersDead - Remove all of the dead registers for the + /// specified instruction from the live variable information. + void removeVirtualRegistersDead(MachineInstr *MI); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.27 -> 1.28 --- Log message: add a comment that I should have written a long time ago --- Diffs of the changes: (+28 -0) LiveVariables.h | 28 1 files changed, 28 insertions(+) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.27 llvm/include/llvm/CodeGen/LiveVariables.h:1.28 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.27 Tue Jan 3 23:39:51 2006 +++ llvm/include/llvm/CodeGen/LiveVariables.h Wed Jan 4 01:29:33 2006 @@ -38,6 +38,34 @@ 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 + /// 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. + /// + /// In the common case where a value is defined and killed in the same block, + /// DefInst is the defining inst, there is one killing instruction, and + /// AliveBlocks is empty. + /// + /// Otherwise, the value is live out of the block. If the value is live + /// across any blocks, these blocks are listed in AliveBlocks. Blocks where + /// the liveness range ends are not included in AliveBlocks, instead being + /// captured by the Kills set. In these blocks, the value is live into the + /// block (unless the value is defined and killed in the same block) and lives + /// until the specified instruction. Note that there cannot ever be a value + /// whose Kills set contains two instructions from the same basic block. + /// + /// PHI nodes complicate things a bit. If a PHI node is the last user of a + /// value in one of its predecessor blocks, it is not listed in the kills set, + /// but does include the predecessor block in the AliveBlocks set (unless that + /// block also defines the value). This leads to the (perfectly sensical) + /// situation where a value is defined in a block, and the last use is a phi + /// node in the successor. In this case, DefInst will be the defining + /// instruction, AliveBlocks is empty (the value is not live across any + /// blocks) and Kills is empty (phi nodes are not included). This is sensical + /// because the value must be live to the end of the block, but is not live in + /// any successor blocks. struct VarInfo { /// DefInst - The machine instruction that defines this register. /// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.26 -> 1.27 --- Log message: add a dump method to help debugging --- Diffs of the changes: (+2 -0) LiveVariables.h |2 ++ 1 files changed, 2 insertions(+) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.26 llvm/include/llvm/CodeGen/LiveVariables.h:1.27 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.26 Thu Aug 25 00:45:31 2005 +++ llvm/include/llvm/CodeGen/LiveVariables.h Tue Jan 3 23:39:51 2006 @@ -68,6 +68,8 @@ } return false; } + +void dump() const; }; private: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits