summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-04-05 22:42:04 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-04-05 22:42:04 +0000
commitb29a2b0c4c69971a179652cb262e970fde5fc9ed (patch)
tree1324ebc5419058817bd3547cdb4efeaca2afcb3d /include/llvm
parent553e40036af29f9e8dee46812cd2ad90d97225f0 (diff)
downloadllvm-b29a2b0c4c69971a179652cb262e970fde5fc9ed.tar.gz
llvm-b29a2b0c4c69971a179652cb262e970fde5fc9ed.tar.bz2
llvm-b29a2b0c4c69971a179652cb262e970fde5fc9ed.tar.xz
MachineInstr: introduce explicit_operands and implicit_operands ranges
Makes iteration over implicit and explicit machine operands more explicit (har har). Insipired by code review discussion for r205565. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/CodeGen/MachineInstr.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 440d3a1302..217d2b1666 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -293,6 +293,22 @@ public:
iterator_range<const_mop_iterator> operands() const {
return iterator_range<const_mop_iterator>(operands_begin(), operands_end());
}
+ iterator_range<mop_iterator> explicit_operands() {
+ return iterator_range<mop_iterator>(
+ operands_begin(), operands_begin() + getNumExplicitOperands());
+ }
+ iterator_range<const_mop_iterator> explicit_operands() const {
+ return iterator_range<const_mop_iterator>(
+ operands_begin(), operands_begin() + getNumExplicitOperands());
+ }
+ iterator_range<mop_iterator> implicit_operands() {
+ return iterator_range<mop_iterator>(explicit_operands().end(),
+ operands_end());
+ }
+ iterator_range<const_mop_iterator> implicit_operands() const {
+ return iterator_range<const_mop_iterator>(explicit_operands().end(),
+ operands_end());
+ }
/// Access to memory operands of the instruction
mmo_iterator memoperands_begin() const { return MemRefs; }