parameters: (op_def)
return_statement: return {
        # Prefix with 'Op' to make it consistent with SPIR-V spec
        'opname': 'Op{}'.format(opname),
        'inst_category': inst_category,
        'category_args': category_args,
        'traits': traits,
        'description': description,
        'arguments': args,
        'results': results,
        'extras': extras
    }
docstring: Extracts potentially manually specified sections in op's definition.
  
    Arguments: - A string containing the op's TableGen definition
  
    Returns:
      - A dict containing potential manually specified sections
docstring_summary: Extracts potentially manually specified sections in op's definition.
docstring_tokens: Extracts potentially manually specified sections in op s definition .
function: def extract_td_op_info(op_def):
    """Extracts potentially manually specified sections in op's definition.
  
    Arguments: - A string containing the op's TableGen definition
  
    Returns:
      - A dict containing potential manually specified sections
    """
    # Get opname
    opname = [o[8:-2] for o in re.findall('def SPV_\w+Op', op_def)]
    assert len(opname) == 1, 'more than one ops in the same section!'
    opname = opname[0]
  
    # Get instruction category
    inst_category = [
        o[4:] for o in re.findall('SPV_\w+Op',
                                  op_def.split(':', 1)[1])
    ]
    assert len(inst_category) <= 1, 'more than one ops in the same section!'
    inst_category = inst_category[0] if len(inst_category) == 1 else 'Op'
  
    # Get category_args
    op_tmpl_params, _ = get_string_between_nested(op_def, '<', '>')
    opstringname, rest = get_string_between(op_tmpl_params, '"', '"')
    category_args = rest.split('[', 1)[0]
  
    # Get traits
    traits, _ = get_string_between_nested(rest, '[', ']')
  
    # Get description
    description, rest = get_string_between(op_def, 'let description = [{\n',
                                           '}];\n')
  
    # Get arguments
    args, rest = get_string_between(rest, '  let arguments = (ins', ');\n')
  
    # Get results
    results, rest = get_string_between(rest, '  let results = (outs', ');\n')
  
    extras = rest.strip(' }\n')
    if extras:
      extras = '\n  {}\n'.format(extras)
  
    return {
        # Prefix with 'Op' to make it consistent with SPIR-V spec
        'opname': 'Op{}'.format(opname),
        'inst_category': inst_category,
        'category_args': category_args,
        'traits': traits,
        'description': description,
        'arguments': args,
        'results': results,
        'extras': extras
    }
function_tokens: def extract_td_op_info ( op_def ) : # Get opname opname = [ o [ 8 : - 2 ] for o in re . findall ( 'def SPV_\w+Op' , op_def ) ] assert len ( opname ) == 1 , 'more than one ops in the same section!' opname = opname [ 0 ] # Get instruction category inst_category = [ o [ 4 : ] for o in re . findall ( 'SPV_\w+Op' , op_def . split ( ':' , 1 ) [ 1 ] ) ] assert len ( inst_category ) <= 1 , 'more than one ops in the same section!' inst_category = inst_category [ 0 ] if len ( inst_category ) == 1 else 'Op' # Get category_args op_tmpl_params , _ = get_string_between_nested ( op_def , '<' , '>' ) opstringname , rest = get_string_between ( op_tmpl_params , '"' , '"' ) category_args = rest . split ( '[' , 1 ) [ 0 ] # Get traits traits , _ = get_string_between_nested ( rest , '[' , ']' ) # Get description description , rest = get_string_between ( op_def , 'let description = [{\n' , '}];\n' ) # Get arguments args , rest = get_string_between ( rest , '  let arguments = (ins' , ');\n' ) # Get results results , rest = get_string_between ( rest , '  let results = (outs' , ');\n' ) extras = rest . strip ( ' }\n' ) if extras : extras = '\n  {}\n' . format ( extras ) return { # Prefix with 'Op' to make it consistent with SPIR-V spec 'opname' : 'Op{}' . format ( opname ) , 'inst_category' : inst_category , 'category_args' : category_args , 'traits' : traits , 'description' : description , 'arguments' : args , 'results' : results , 'extras' : extras }