Add a useful accessor

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19209 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-01-01 15:58:55 +00:00
parent fd1cbc095a
commit 801abe663f

View File

@ -125,6 +125,16 @@ public:
return RegistersKilled.equal_range(MI);
}
/// 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);
for (; KIP.first != KIP.second; ++KIP.first)
if (KIP.first->second == Reg)
return true;
return false;
}
killed_iterator dead_begin(MachineInstr *MI) {
return RegistersDead.lower_bound(MI);
}