Beispiel #1
0
def mk_mem_wrapper (m):
	return syntax.mk_rel_wrapper ('MemWrapper', [m])
Beispiel #2
0
def mk_stack_wrapper (stack_ptr, stack, excepts):
	return syntax.mk_rel_wrapper ('StackWrapper',
		[stack_ptr, stack] + excepts)
Beispiel #3
0
def mk_mem_acc_wrapper (addr, v):
	return syntax.mk_rel_wrapper ('MemAccWrapper', [addr, v])
Beispiel #4
0
def word32_list_from_tm (t):
	xs = []
	while t.is_op ('Plus'):
		[x, t] = t.vals
		assert x.kind == 'Num' and x.typ == word32T
		xs.append (x.val)
	if t.kind == 'Num':
		xs.append (t.val)
	return xs

def mk_eq_selective_wrapper (v, (xs, ys)):
	# this is a huge hack, but we need to put these lists somewhere
	xs = tm_with_word32_list (xs)
	ys = tm_with_word32_list (ys)
	return syntax.mk_rel_wrapper ('EqSelectiveWrapper', [v, xs, ys])

def apply_rel_wrapper (lhs, rhs):
	assert lhs.typ == syntax.builtinTs['RelWrapper']
	assert rhs.typ == syntax.builtinTs['RelWrapper']
	assert lhs.kind == 'Op'
	assert rhs.kind == 'Op'
	ops = set ([lhs.name, rhs.name])
	if ops == set (['StackWrapper']):
		[sp1, st1] = lhs.vals[:2]
		[sp2, st2] = rhs.vals[:2]
		excepts = list (set (lhs.vals[2:] + rhs.vals[2:]))
		for p in excepts:
			st1 = syntax.mk_memupd (st1, p, syntax.mk_word32 (0))
			st2 = syntax.mk_memupd (st2, p, syntax.mk_word32 (0))
		return syntax.Expr ('Op', boolT, name = 'StackEquals',