[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 23 15:43:35 PDT 2005



Changes in directory llvm/include/llvm/CodeGen:

LiveVariables.h updated: 1.22 -> 1.23
---
Log message:

Add RegisterDefIsDead to correspond to KillsRegister, mark both const


---
Diffs of the changes:  (+14 -2)

 LiveVariables.h |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/CodeGen/LiveVariables.h
diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.22 llvm/include/llvm/CodeGen/LiveVariables.h:1.23
--- llvm/include/llvm/CodeGen/LiveVariables.h:1.22	Thu Apr 21 22:45:18 2005
+++ llvm/include/llvm/CodeGen/LiveVariables.h	Tue Aug 23 17:43:24 2005
@@ -127,8 +127,9 @@
 
   /// KillsRegister - Return true if the specified instruction kills the
   /// specified register.
-  bool KillsRegister(MachineInstr *MI, unsigned Reg) {
-    std::pair<killed_iterator, killed_iterator> KIP = killed_range(MI);
+  bool KillsRegister(MachineInstr *MI, unsigned Reg) const {
+    typedef std::multimap<MachineInstr*, unsigned>::const_iterator cki;
+    std::pair<cki, cki> KIP = RegistersKilled.equal_range(MI);
     for (; KIP.first != KIP.second; ++KIP.first)
       if (KIP.first->second == Reg)
         return true;
@@ -145,6 +146,17 @@
   dead_range(MachineInstr *MI) {
     return RegistersDead.equal_range(MI);
   }
+  
+  /// RegisterDefIsDead - Return true if the specified instruction defines the
+  /// specified register, but that definition is dead.
+  bool RegisterDefIsDead(MachineInstr *MI, unsigned Reg) const {
+    typedef std::multimap<MachineInstr*, unsigned>::const_iterator cki;
+    std::pair<cki, cki> KIP = RegistersDead.equal_range(MI);
+    for (; KIP.first != KIP.second; ++KIP.first)
+      if (KIP.first->second == Reg)
+        return true;
+    return false;
+  }
 
   //===--------------------------------------------------------------------===//
   //  API to update live variable information






More information about the llvm-commits mailing list