uroboros-diversification/src/instrumentation/gfree/inlining.py
def translate_it_block(block):
        """
        Translate IT block using normal branches
        :param block: instruction list of IT block
        :return: instruction list with normal branches
        """
        itloc = get_loc(block[0])
        res = [Types.DoubleInstr(('b' + block[0][1], Types.Label('.LIT_%X.T' % itloc.loc_addr), itloc, False))]
        branches = {'t': [], 'e': []}
        for i in xrange(1, len(block[0][0])):
            op = block[i][0].split('.')
            op[0] = op[0][:-2]
            instr = type(block[i])(('.'.join(op), ) + block[i][1:])
            branches[block[0][0][i]].append(instr)
        endloc = get_loc(block[-1])
        branches['e'].append(Types.DoubleInstr(('b', Types.Label(('.LIT_%X.E' % itloc.loc_addr)), endloc, False)))
        branches['t'][0][-2].loc_label += '.LIT_%X.T: ' % itloc.loc_addr
        res += branches['e'] + branches['t']
        res.append(set_loc(block[-1], Types.Loc('.LIT_%X.E: ' % itloc.loc_addr, endloc.loc_addr, True)))
        return res

        Translate IT block using normal branches
        :param block: instruction list of IT block
        :return: instruction list with normal branches
        
Translate IT block using normal branches
Translate IT block using normal branches
def translate_it_block(block):
        itloc = get_loc(block[0])
        res = [Types.DoubleInstr(('b' + block[0][1], Types.Label('.LIT_%X.T' % itloc.loc_addr), itloc, False))]
        branches = {'t': [], 'e': []}
        for i in xrange(1, len(block[0][0])):
            op = block[i][0].split('.')
            op[0] = op[0][:-2]
            instr = type(block[i])(('.'.join(op), ) + block[i][1:])
            branches[block[0][0][i]].append(instr)
        endloc = get_loc(block[-1])
        branches['e'].append(Types.DoubleInstr(('b', Types.Label(('.LIT_%X.E' % itloc.loc_addr)), endloc, False)))
        branches['t'][0][-2].loc_label += '.LIT_%X.T: ' % itloc.loc_addr
        res += branches['e'] + branches['t']
        res.append(set_loc(block[-1], Types.Loc('.LIT_%X.E: ' % itloc.loc_addr, endloc.loc_addr, True)))
        return res
def translate_it_block ( block ) : itloc = get_loc ( block [ 0 ] ) res = [ Types . DoubleInstr ( ( 'b' + block [ 0 ] [ 1 ] , Types . Label ( '.LIT_%X.T' % itloc . loc_addr ) , itloc , False ) ) ] branches = { 't' : [ ] , 'e' : [ ] } for i in xrange ( 1 , len ( block [ 0 ] [ 0 ] ) ) : op = block [ i ] [ 0 ] . split ( '.' ) op [ 0 ] = op [ 0 ] [ : - 2 ] instr = type ( block [ i ] ) ( ( '.' . join ( op ) , ) + block [ i ] [ 1 : ] ) branches [ block [ 0 ] [ 0 ] [ i ] ] . append ( instr ) endloc = get_loc ( block [ - 1 ] ) branches [ 'e' ] . append ( Types . DoubleInstr ( ( 'b' , Types . Label ( ( '.LIT_%X.E' % itloc . loc_addr ) ) , endloc , False ) ) ) branches [ 't' ] [ 0 ] [ - 2 ] . loc_label += '.LIT_%X.T: ' % itloc . loc_addr res += branches [ 'e' ] + branches [ 't' ] res . append ( set_loc ( block [ - 1 ] , Types . Loc ( '.LIT_%X.E: ' % itloc . loc_addr , endloc . loc_addr , True ) ) ) return res
Translate IT block using normal branches
Translate IT block using normal branches
"""
        Translate IT block using normal branches
        :param block: instruction list of IT block
        :return: instruction list with normal branches
        """
instruction list with normal branches
instruction list with normal branches
block
instruction list of IT block
instruction list of IT block