def gen_check(input): for _, dst, src in input: print 'input:', dst, src result = ' '.join(gen_assignments(input)) print result result = result.replace('{ int', '').replace('}', '').strip() d = {} for _, dst, src in input: d[src] = '<value of %s>' % (src, ) exec result in d for _, dst, src in input: assert d[dst] == '<value of %s>' % (src, )
def gen_check(input): for _, dst, src in input: print 'input:', dst, src result = ' '.join(gen_assignments(input)) print result result = result.replace('{ int', '').replace('}', '').strip() d = {} for _, dst, src in input: d[src] = '<value of %s>' % (src,) exec result in d for _, dst, src in input: assert d[dst] == '<value of %s>' % (src,)
def gen_link(self, link): "Generate the code to jump across the given Link." assignments = [] for a1, a2 in zip(link.args, link.target.inputargs): a2type, a2typename = self.illtypes[a2] if a2type is Void: continue src = self.expr(a1) dest = LOCALVAR % a2.name assignments.append((a2typename, dest, src)) for line in gen_assignments(assignments): yield line for line in self.gen_goto(link.target, link): yield line
def gen_link(self, link): "Generate the code to jump across the given Link." assignments = [] for a1, a2 in zip(link.args, link.target.inputargs): a2type, a2typename = self.illtypes[a2] if a2type is Void: continue src = self.expr(a1) dest = LOCALVAR % a2.name assignments.append((a2typename, dest, src)) for line in gen_assignments(assignments): yield line label = 'block%d' % self.blocknum[link.target] if link.target in self.innerloops: loop = self.innerloops[link.target] if link is loop.links[-1]: # link that ends a loop label += '_back' yield 'goto %s;' % label