yield node
if isinstance(node.value, (pc_ast.GPR, pc_ast.FPR)):
self.__regfetch[str(node.value)].append(node.value)
+ stmt = "".join([
+ str(self[node.op]),
+ f"oppc_reg_fetch({str(self[node.value])})",
+ ])
+ else:
+ stmt = "".join([
+ str(self[node.op]),
+ f"({str(self[node.value])})",
+ ])
+ self[node].emit(stmt=stmt)
+
+ @pc_util.Hook(pc_ast.Not, pc_ast.Add, pc_ast.Sub)
+ def Op(self, node):
+ yield node
+ mapping = {
+ pc_ast.Not: "~",
+ pc_ast.Add: "+",
+ pc_ast.Sub: "-",
+ }
+ stmt = mapping[node.__class__]
+ self[node].emit(stmt=stmt)
@pc_util.Hook(pc_ast.BinLiteral, pc_ast.DecLiteral, pc_ast.HexLiteral)
def Integer(self, node):
self.__decls[str(node)].append(node)
self[node].emit(stmt=str(node))
+ @pc_util.Hook(pc_ast.Node)
+ def Node(self, node):
+ raise NotImplementedError(type(node))
+
def code(name, root):
yield from CodeVisitor(name=name, root=root)