summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/LiveVariables.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-23 22:43:24 +0000
committerChris Lattner <sabre@nondot.org>2005-08-23 22:43:24 +0000
commit20647a55bfabd715bfef52f68d6d13753a672940 (patch)
tree47801923ec202ccfe54eac55aeac2435c069764f /include/llvm/CodeGen/LiveVariables.h
parentb980578b4160cf8ef1ba6d33e85c50eaeef0eef8 (diff)
downloadllvm-20647a55bfabd715bfef52f68d6d13753a672940.tar.gz
llvm-20647a55bfabd715bfef52f68d6d13753a672940.tar.bz2
llvm-20647a55bfabd715bfef52f68d6d13753a672940.tar.xz
Add RegisterDefIsDead to correspond to KillsRegister, mark both const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/LiveVariables.h')
-rw-r--r--include/llvm/CodeGen/LiveVariables.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index 866b981b39..b3911ec80b 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -127,8 +127,9 @@ public:
/// 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 @@ public:
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