def is_target_op(agi, op, target_op):
    """
    @param op: instruction_info_t.operands[i] - the binded operand by an NT row
    @param target_op: string - the name of the target operand
    @param agi: all_generator_info_t - the main generator's data structure
    (as usual)
    Function returns true if op's name is target_op or if op is a macro which
    expansion contains target_op
    """
    state_dict = agi.common.state_bits
    return (op.name.upper() == target_op or
            (op.name.lower() in state_dict and 
            target_op in state_dict[op.name.lower()].dump_str()))