aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-07-30 23:48:14 +0000
committerAndrew Trick <atrick@apple.com>2012-07-30 23:48:14 +0000
commit0492a8c530df6c7b2ebcfa91fed930c1a1bf664d (patch)
treed75460480081b2dae3b3b20cee2e6c23c51edae3 /include
parent269120cd9b45b24665433ea28eb7d092c138ca76 (diff)
downloadexternal_llvm-0492a8c530df6c7b2ebcfa91fed930c1a1bf664d.zip
external_llvm-0492a8c530df6c7b2ebcfa91fed930c1a1bf664d.tar.gz
external_llvm-0492a8c530df6c7b2ebcfa91fed930c1a1bf664d.tar.bz2
Added MachineRegisterInfo::hasOneDef()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/MachineRegisterInfo.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h
index 1c2baef..061d60a 100644
--- a/include/llvm/CodeGen/MachineRegisterInfo.h
+++ b/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -172,6 +172,15 @@ public:
/// specified register (it may be live-in).
bool def_empty(unsigned RegNo) const { return def_begin(RegNo) == def_end(); }
+ /// hasOneDef - Return true if there is exactly one instruction defining the
+ /// specified register.
+ bool hasOneDef(unsigned RegNo) const {
+ def_iterator DI = def_begin(RegNo);
+ if (DI == def_end())
+ return false;
+ return ++DI == def_end();
+ }
+
/// use_iterator/use_begin/use_end - Walk all uses of the specified register.
typedef defusechain_iterator<true,false,false> use_iterator;
use_iterator use_begin(unsigned RegNo) const {