def generate_swaps(kernel_info):
    """Generates code to swap main fields with temporary fields"""
    swaps = ''
    for src, dst in kernel_info.field_swaps:
        swaps += '%s->swapDataPointers(%s);\n' % (src, dst)
    return swaps
