Example #1
0
    # Inline alias checks.
    time_start_inlining = time.time()
    if args.disable_inline:
        cmd = ' '.join(('cp', bc_hybrid_opt, bc_hybrid_opt_inline))
    else:
        cmd = ng_utils.load_all_plugins('opt')
        cmd = ' '.join((cmd, '-inline-alias-checker'))
        cmd = ' '.join((cmd, '-o', bc_hybrid_opt_inline, '<', bc_hybrid_opt))
    rcs_utils.invoke(cmd)

    # Codegen.
    time_start_codegen = time.time()
    cmd = ' '.join(('clang++', bc_hybrid_opt_inline))
    # ReportMissingAlias won't be inlined anyway, so we have to link
    # libDynAAAliasChecker.a
    cmd = ' '.join((cmd, rcs_utils.get_libdir() + '/libDynAAAliasChecker.a'))
    cmd = ' '.join((cmd, rcs_utils.get_libdir() + '/libDynAAMemoryHooks.a'))
    cmd = ' '.join((cmd, '-o', exe_hybrid))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    cmd = ' '.join((cmd, ' '.join(linking_flags)))
    rcs_utils.invoke(cmd)

    # Print runtime of each stage.
    time_finish = time.time()
    print 'Inserting alias checks and hooking memory access:', \
        time_start_o3 - time_start_hybrid
    print 'Running O3:', time_start_inlining - time_start_o3
    print 'Inlining:', time_start_codegen - time_start_inlining
    print 'Codegen:', time_finish - time_start_codegen
Example #2
0
                        str(ng_utils.get_aa_choices()),
                        metavar = 'aa',
                        choices = ng_utils.get_aa_choices())
    parser.add_argument('vid1', help='ValueID of Pointer 1')
    parser.add_argument('vid2', help='ValueID of Pointer 2')
    args = parser.parse_args()

    cmd = ng_utils.load_all_plugins('opt')
    # reducer need be put before aa
    cmd = ' '.join((cmd, '-remove-untouched-code'))
    cmd = ' '.join((cmd, '-simplifycfg'))

    # Load the checked AA
    cmd = ng_utils.load_aa(cmd, args.aa)

    cmd = ' '.join((cmd, '-verify-reducer'))
    cmd = ' '.join((cmd, '-strip'))
    for log in args.logs:
        cmd = ' '.join((cmd, '-log-file', log))
    cmd = ' '.join((cmd, '-pointer-value', args.vid1))
    cmd = ' '.join((cmd, '-pointer-value', args.vid2))
    cmd = ' '.join((cmd, '-o', args.prog + '.reduce.bc'))
    cmd = ' '.join((cmd, '<', args.prog + '.bc'))
    rcs_utils.invoke(cmd)

    cmd = ' '.join(
        ('clang++', args.prog + '.reduce.bc', '-o', args.prog + '.reduce'))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    cmd = ' '.join((cmd, ' '.join(linking_flags)))
    rcs_utils.invoke(cmd)