From 375cf52638cc5330abf0fe95dfa63a013a97a5f5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 24 Mar 2010 23:07:47 +0000 Subject: [PATCH] add a convenient TargetInstrDesc::getNumImplicitUses/Defs method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99446 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetInstrDesc.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/llvm/Target/TargetInstrDesc.h b/include/llvm/Target/TargetInstrDesc.h index 9efb6833fb8..adc37e16e45 100644 --- a/include/llvm/Target/TargetInstrDesc.h +++ b/include/llvm/Target/TargetInstrDesc.h @@ -204,6 +204,16 @@ public: return ImplicitUses; } + /// getNumImplicitUses - Return the number of implicit uses this instruction + /// has. + unsigned getNumImplicitUses() const { + if (ImplicitUses == 0) return 0; + unsigned i = 0; + for (; ImplicitUses[i]; ++i) /*empty*/; + return i; + } + + /// getImplicitDefs - Return a list of registers that are potentially /// written by any instance of this machine instruction. For example, on X86, /// many instructions implicitly set the flags register. In this case, they @@ -218,6 +228,15 @@ public: return ImplicitDefs; } + /// getNumImplicitDefs - Return the number of implicit defs this instruction + /// has. + unsigned getNumImplicitDefs() const { + if (ImplicitDefs == 0) return 0; + unsigned i = 0; + for (; ImplicitDefs[i]; ++i) /*empty*/; + return i; + } + /// hasImplicitUseOfPhysReg - Return true if this instruction implicitly /// uses the specified physical register. bool hasImplicitUseOfPhysReg(unsigned Reg) const {