From 4d002c7934f0295afb9ff5118a3c10239a299737 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Wed, 29 Jul 2020 23:19:01 +0100 Subject: [PATCH] compiler: Explain use of rpc_tag() in array ops, formatting [nfc] --- artiq/compiler/transforms/artiq_ir_generator.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/artiq/compiler/transforms/artiq_ir_generator.py b/artiq/compiler/transforms/artiq_ir_generator.py index 22482c8c0..66b3d1f78 100644 --- a/artiq/compiler/transforms/artiq_ir_generator.py +++ b/artiq/compiler/transforms/artiq_ir_generator.py @@ -1429,13 +1429,17 @@ class ARTIQIRGenerator(algorithm.Visitor): # differ. def name_error(typ): assert False, "Internal compiler error: No RPC tag for {}".format(typ) + def mangle_name(typ): typ = typ.find() - return ir.rpc_tag(typ["elt"], name_error).decode() +\ - str(typ["num_dims"].find().value) + # rpc_tag is used to turn element types into mangled names for no + # particularly good reason apart from not having to invent yet another + # string representation. + return (ir.rpc_tag(typ["elt"], name_error).decode() + + str(typ["num_dims"].find().value)) + name = "_array_{}_{}_{}_{}".format( - type(op).__name__, - *(map(mangle_name, (result_type, lhs_type, rhs_type)))) + type(op).__name__, *(map(mangle_name, (result_type, lhs_type, rhs_type)))) if name not in self.array_binop_funcs: self.array_binop_funcs[name] = self._make_array_binop( name, op, result_type, lhs_type, rhs_type)