hotspot/src/share/vm/opto/machnode.cpp
changeset 22853 308672304981
parent 22850 4e69ce7e1101
child 25637 369f62cdfaba
--- a/hotspot/src/share/vm/opto/machnode.cpp	Thu Nov 21 18:29:34 2013 -0800
+++ b/hotspot/src/share/vm/opto/machnode.cpp	Thu Nov 21 19:00:57 2013 -0800
@@ -397,6 +397,17 @@
   return skipped;
 }
 
+int MachNode::operand_index(const MachOper *oper) const {
+  uint skipped = oper_input_base(); // Sum of leaves skipped so far
+  uint opcnt;
+  for (opcnt = 1; opcnt < num_opnds(); opcnt++) {
+    if (_opnds[opcnt] == oper) break;
+    uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
+    skipped += num_edges;
+  }
+  if (_opnds[opcnt] != oper) return -1;
+  return skipped;
+}
 
 //------------------------------peephole---------------------------------------
 // Apply peephole rule(s) to this instruction