Ejemplo n.º 1
0
	def index(self, contexts, root):
		def forward(context):
			return set([invoke.dst for invoke in context.invokeOut.itervalues()])

		idoms = dominator.findIDoms([root], forward)
		tree = dominator.treeFromIDoms(idoms)

		url = os.path.join(self.directory, 'index.html')
		o = XMLOutput(open(url, 'w'))
		o.url = url

		self.dumpTree(None, tree, o)
Ejemplo n.º 2
0
    def printDebug(self, tree, head):
        f = XMLOutput(open('temp.html', 'w'))
        f.begin('ul')

        def printNode(f, node):
            if not isinstance(node, tuple):
                f.begin('li')
                f.write(str(node))
                f.begin('ul')

            children = tree.get(node, ())

            for child in children:
                printNode(f, child)

            if not isinstance(node, tuple):
                f.end('ul')
                f.end('li')

        printNode(f, head)

        f.end('ul')
        f.close()
Ejemplo n.º 3
0
	def printDebug(self, tree, head):
		f = XMLOutput(open('temp.html', 'w'))
		f.begin('ul')

		def printNode(f, node):
			if not isinstance(node, tuple):
				f.begin('li')
				f.write(str(node))
				f.begin('ul')

			children = tree.get(node, ())

			for child in children:
				printNode(f, child)

			if not isinstance(node, tuple):
				f.end('ul')
				f.end('li')

		printNode(f, head)

		f.end('ul')
		f.close()
Ejemplo n.º 4
0
    def debugDump(self, name):
        # Dump output

        directory = 'summaries\\dataflow'

        # Dump information about ops
        f = filesystem.fileOutput(directory, name + '-ops', 'html')
        out = XMLOutput(f)

        with out.scope('html'):
            with out.scope('head'):
                with out.scope('title'):
                    out.write(name)
            out.endl()

            with out.scope('body'):
                for op in self.order:
                    if isinstance(op, (graph.Merge, graph.Split)): continue

                    out.tag('hr')
                    out.endl()

                    out.write(op)
                    out.endl()

                    mask = self.opMask(op)

                    if mask is not self.bool.true:
                        with out.scope('p'):
                            out.write(mask)

                    if self.opReads[op] is not self.set.empty:
                        self.dumpTitle(out, 'Read')
                        self.dumpMasked(out, self.opReads[op], mask)

                    if self.opModifies[op] is not self.set.empty:
                        self.dumpTitle(out, 'Modify')
                        self.dumpMasked(out, self.opModifies[op], mask)

                    if self.opAllocates[op] is not self.set.empty:
                        self.dumpTitle(out, 'Allocates')
                        self.dumpMasked(out, self.opAllocates[op], mask)

                    self.dumpNodes(out, 'Inputs', op.reverse(), mask)
                    self.dumpNodes(out, 'Outputs', op.forward(), mask)
        out.endl()
        f.close()

        # Dump information about memory
        f = filesystem.fileOutput(directory, name + '-memory', 'html')
        out = XMLOutput(f)

        with out.scope('html'):
            with out.scope('head'):
                with out.scope('title'):
                    out.write(name)
            out.endl()

            with out.scope('body'):
                for key, mask in self.objectExistanceMask.iteritems():
                    with out.scope('p'):
                        assert isinstance(key, tuple), key

                        obj, index = key

                        out.write(obj)
                        out.write(' - ')
                        out.write(index)
                        out.tag('br')
                        out.write('preexisting' if self.objectIsPreexisting(
                            obj, index) else 'allocated')
                        out.tag('br')
                        out.write(mask)

        out.endl()
        f.close()
Ejemplo n.º 5
0
	def debugDump(self, name):
		# Dump output

		directory = 'summaries\\dataflow'

		# Dump information about ops
		f   = filesystem.fileOutput(directory, name+'-ops', 'html')
		out = XMLOutput(f)

		with out.scope('html'):
			with out.scope('head'):
				with out.scope('title'):
					out.write(name)
			out.endl()

			with out.scope('body'):
				for op in self.order:
					if isinstance(op, (graph.Merge, graph.Split)): continue

					out.tag('hr')
					out.endl()

					out.write(op)
					out.endl()

					mask = self.opMask(op)

					if mask is not self.bool.true:
						with out.scope('p'):
							out.write(mask)

					if self.opReads[op] is not self.set.empty:
						self.dumpTitle(out, 'Read')
						self.dumpMasked(out, self.opReads[op], mask)

					if self.opModifies[op] is not self.set.empty:
						self.dumpTitle(out, 'Modify')
						self.dumpMasked(out, self.opModifies[op], mask)

					if self.opAllocates[op] is not self.set.empty:
						self.dumpTitle(out, 'Allocates')
						self.dumpMasked(out, self.opAllocates[op], mask)

					self.dumpNodes(out, 'Inputs', op.reverse(), mask)
					self.dumpNodes(out, 'Outputs', op.forward(), mask)
		out.endl()
		f.close()

		# Dump information about memory
		f   = filesystem.fileOutput(directory, name+'-memory', 'html')
		out = XMLOutput(f)

		with out.scope('html'):
			with out.scope('head'):
				with out.scope('title'):
					out.write(name)
			out.endl()

			with out.scope('body'):
				for key, mask in self.objectExistanceMask.iteritems():
					with out.scope('p'):
						assert isinstance(key, tuple), key

						obj, index = key

						out.write(obj)
						out.write(' - ')
						out.write(index)
						out.tag('br')
						out.write('preexisting' if self.objectIsPreexisting(obj, index) else 'allocated')
						out.tag('br')
						out.write(mask)

		out.endl()
		f.close()
Ejemplo n.º 6
0
def makeOutput(reportDir, filename):
    fullpath = os.path.join(reportDir, filename)
    fout = open(fullpath, 'w')
    out = XMLOutput(fout)
    scg = simplecodegen.SimpleCodeGen(out)  # HACK?
    return out, scg
Ejemplo n.º 7
0
	def dumpContext(self, context):
		url = self.contextURL(context)
		o = XMLOutput(open(url, 'w'))
		o.url = url

		with o.scope('html'):
			with o.scope('head'):
				with o.scope('title'):
					o << context.signature.code
					o << ' - '
					o << id(context)
			with o.scope('body'):
				with o.scope('p'):
					o << '['
					with o.scope('a', href='index.html'):
						o << "Index"
					o << ']'
				o.endl()
				with o.scope('p'):
					self.displayContext(context, o, link=False)

				self.fold(context, o)
				self.code(context, o)
				self.criticalOps(context, o)
				self.invokesIn(context, o)
				self.invokesOut(context, o)
				self.locals(context, o)
				self.objects(context, o)

				self.constraints(context.constraints, o)