/** * Emit the Java code to call a particular emit method for a particular opcode. This method * takes representations of the opcode and operands of a given emit method, and generates the * appropriate Java source code to call it. It synthesizes the encoded emit method name, and * uses emitArgs to pass all the required arguments. * * @see #emitArgs * @param opcode the IA32 opcode of the emit method * @param args the encoding of each operand to the emit method * @param count the number of operands * @param level the level of tabbing for pretty output */ private void emitEmitCall( String opcode, ArgumentType[] args, int count, int level, ArgumentType size) { if (DEBUG) { System.err.print("Emitting call for " + opcode + " with args: "); for (ArgumentType arg : args) { System.err.print(arg + " "); } System.err.println(" count=" + count + " level=" + level + " size=" + size); } emitTab(level); emit("emit" + opcode); for (int i = 0; i < count; i++) emit("_" + args[i].getAssemblerName()); if (size != null) emit("_" + size.getAssemblerName()); if (count == 0) emit("();\n"); else { emit("("); for (int i = 0; i < count; i++) { emit("\n"); emitTab(level + 1); emitArgs(i, args[i]); if (i == count - 1) emit(");\n"); else emit(","); } } }