diff src/share/vm/opto/machnode.cpp @ 14437:15120a36272d

8028767: PPC64: (part 121): smaller shared changes needed to build C2 Summary: smaller shared changes required to build the C2 compiler on PPC64. Reviewed-by: kvn
author goetz
date Thu, 21 Nov 2013 19:00:57 -0800
parents 318d0622a6d7
children 4ca6dc0799b6 fc2c88ea11a9
line wrap: on
line diff
--- a/src/share/vm/opto/machnode.cpp	Thu Nov 21 18:29:34 2013 -0800
+++ b/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