[llvm] r206238 - Add iterator_range for MachineInstr defs.
Jim Grosbach
grosbach at apple.com
Mon Apr 14 19:14:07 PDT 2014
Author: grosbach
Date: Mon Apr 14 21:14:06 2014
New Revision: 206238
URL: http://llvm.org/viewvc/llvm-project?rev=206238&view=rev
Log:
Add iterator_range for MachineInstr defs.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineInstr.h
Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=206238&r1=206237&r2=206238&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Mon Apr 14 21:14:06 2014
@@ -318,6 +318,22 @@ public:
return iterator_range<const_mop_iterator>(explicit_operands().end(),
operands_end());
}
+ iterator_range<mop_iterator> defs() {
+ return iterator_range<mop_iterator>(
+ operands_begin(), operands_begin() + getDesc().getNumDefs());
+ }
+ iterator_range<const_mop_iterator> defs() const {
+ return iterator_range<const_mop_iterator>(
+ operands_begin(), operands_begin() + getDesc().getNumDefs());
+ }
+ iterator_range<mop_iterator> uses() {
+ return iterator_range<mop_iterator>(
+ operands_begin() + getDesc().getNumDefs(), operands_end());
+ }
+ iterator_range<const_mop_iterator> uses() const {
+ return iterator_range<const_mop_iterator>(
+ operands_begin() + getDesc().getNumDefs(), operands_end());
+ }
/// Access to memory operands of the instruction
mmo_iterator memoperands_begin() const { return MemRefs; }
More information about the llvm-commits
mailing list