Exemplo n.º 1
0
	def op(self, op):
		opT = type(op)


		if isinstance(op, (ast.Load, ast.Store)) and intrinsics.isIntrinsicMemoryOp(op):
			name = "I"+opT.__name__
		else:
			name = opT.__name__

		self.opCount[name] += 1
Exemplo n.º 2
0
    def visitLoad(self, node, g):
        slot = self.getSingleSlot(g.annotation.read.flat)

        if intrinsics.isIntrinsicMemoryOp(node):
            expr = self.valueRef(node.expr, g)
            field = intrinsics.fields[node.name.object.pyobj]
            src = self.slotRef(glsl.Load(expr.ast(), field), slot)
        else:
            src = self.fieldRef(node, slot, g)

        return self.assignmentTransfer(src, g)
Exemplo n.º 3
0
	def visitLoad(self, node, g):
		slot   = self.getSingleSlot(g.annotation.read.flat)

		if intrinsics.isIntrinsicMemoryOp(node):
			expr   = self.valueRef(node.expr, g)
			field  = intrinsics.fields[node.name.object.pyobj]
			src    = self.slotRef(glsl.Load(expr.ast(), field), slot)
		else:
			src  = self.fieldRef(node, slot, g)

		return self.assignmentTransfer(src, g)
Exemplo n.º 4
0
    def visitStore(self, node, g):
        # Source
        src = self(node.value, g)

        slot = self.getSingleSlot(g.annotation.modify.flat)

        # Destination
        if intrinsics.isIntrinsicMemoryOp(node):
            expr = self.valueRef(node.expr, g)
            field = intrinsics.fields[node.name.object.pyobj]
            dst = self.slotRef(glsl.Load(expr.ast(), field), slot)
        else:
            dst = self.fieldRef(node, slot, g)

        return self.transfer(src, dst)
Exemplo n.º 5
0
	def visitStore(self, node, g):
		# Source
		src = self(node.value, g)

		slot   = self.getSingleSlot(g.annotation.modify.flat)

		# Destination
		if intrinsics.isIntrinsicMemoryOp(node):
			expr   = self.valueRef(node.expr, g)
			field  = intrinsics.fields[node.name.object.pyobj]
			dst    = self.slotRef(glsl.Load(expr.ast(), field), slot)
		else:
			dst  = self.fieldRef(node, slot, g)

		return self.transfer(src, dst)
Exemplo n.º 6
0
 def transfer(self, expr, targetInfo, filter=None):
     if isinstance(expr, ast.DirectCall):
         assert filter is not None
         expr = self(expr)
         targetInfo.assignIntrinsic(self, singleType(filter), expr)
     elif isinstance(expr, ast.Load):
         assert filter is not None
         assert intrinsics.isIntrinsicMemoryOp(expr), expr
         expr = self(expr)
         targetInfo.assignIntrinsic(self, singleType(filter), expr)
     elif isinstance(expr, ast.Local):
         refs = self.filteredRefs(expr.annotation.references.merged, filter)
         exprInfo = self(expr)
         targetInfo.copyFrom(self, exprInfo, refs)
     elif isinstance(expr, ast.Existing):
         refs = self.filteredRefs(expr.annotation.references.merged, filter)
         expr = self(expr)
         targetInfo.assignIntrinsic(self, singleType(refs), expr)
     else:
         assert False, expr
Exemplo n.º 7
0
	def transfer(self, expr, targetInfo, filter=None):
		if isinstance(expr, ast.DirectCall):
			assert filter is not None
			expr = self(expr)
			targetInfo.assignIntrinsic(self, singleType(filter), expr)
		elif isinstance(expr, ast.Load):
			assert filter is not None
			assert intrinsics.isIntrinsicMemoryOp(expr), expr
			expr = self(expr)
			targetInfo.assignIntrinsic(self, singleType(filter), expr)
		elif isinstance(expr, ast.Local):
			refs = self.filteredRefs(expr.annotation.references.merged, filter)
			exprInfo = self(expr)
			targetInfo.copyFrom(self, exprInfo, refs)
		elif isinstance(expr, ast.Existing):
			refs = self.filteredRefs(expr.annotation.references.merged, filter)
			expr = self(expr)
			targetInfo.assignIntrinsic(self, singleType(refs), expr)
		else:
			assert False, expr