/* * libbinrec: a recompiling translator for machine code * Copyright (c) 2016 Andrew Church * * This software may be copied and redistributed under certain conditions; * see the file "COPYING" in the source code distribution for details. * NO WARRANTY is provided with this software. */ #include "src/rtl-internal.h" #include "tests/common.h" static unsigned int opt_flags = BINREC_OPT_DSE; static int add_rtl(RTLUnit *unit) { int reg1, reg2; EXPECT(reg1 = rtl_alloc_register(unit, RTLTYPE_ADDRESS)); EXPECT(rtl_add_insn(unit, RTLOP_LOAD_IMM, reg1, 0, 0, 0x123456789)); EXPECT(reg2 = rtl_alloc_register(unit, RTLTYPE_INT32)); EXPECT(rtl_add_insn(unit, RTLOP_LOAD_IMM, reg2, 0, 0, 1234)); EXPECT(rtl_add_insn(unit, RTLOP_STORE, 0, reg1, reg2, 5678)); return EXIT_SUCCESS; } static const char expected[] = " 0: LOAD_IMM r1, 0x123456789\n" " 1: LOAD_IMM r2, 1234\n" " 2: STORE 5678(r1), r2\n" "\n" "Block 0: --> [0,2] --> \n" ; #include "tests/rtl-optimize-test.i"