From 801abe663f55e974cfcfd46c2a8022561aa76e47 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 1 Jan 2005 15:58:55 +0000 Subject: [PATCH] Add a useful accessor git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19209 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/LiveVariables.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index 7820f7414d4..17c1e2a7704 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -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 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); }