--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgen/templates/inca-instr-decoding.h.impl Fri May 11 16:21:51 2012 -0700 @@ -0,0 +1,32 @@ +<%namespace file="base.impl" import="*"/>\ +<%! +def has_arg(instr): + ## don't generate code for unknown opcodes... + if instr.id in ["_unknown_opcode", 'NOP']: + return False + ## x_WITH_IMPL instruction don't have an implementation... + if not instr.impl: + return True + ## check against the "oparg" string being present in the operation implementation... + impl= instr.impl + if hasattr(instr, 'parent'): + impl+= instr.parent.impl + if 'oparg' in impl: + return True + return False +%> + +static inline int +instr_has_argument(unsigned char opcode) { + switch (opcode) { +% for opcode, instr_obj in enumerate(instr_set): + % if has_arg(instr_obj): + case ${ instr_obj.id.upper() }: + % endif +% endfor + return 1; + } // switch-case + + return 0; +} // END instr_has_argument +