How to use the deprecated.compiler.lib.lcomp.trans.Expr function in Deprecated

To help you get started, we’ve selected a few Deprecated examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
def read(self, cx):
        value = self.expr.value
        for field_name in self.field_path:
            value = '(%s.%s)' % (value, field_name)
        return Expr(value, self.expr.actions)
    def write(self, update_value, cx):
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
field_map = copy_value.field_map,
            field_type_map = copy_value.field_type_map,
            allocator = copy_value.allocator,
            accessor_map = copy_value.accessor_map,
            privilege_map = copy_value.privilege_map)
        cx.env.insert(node.name, region_value)
        cx.regions[region_type] = region_value
        return Statement(
            copy_expr.actions +
            ['%s %s = %s;' % (ll_copy_type, name, copy_expr.value)])

    cx.env.insert(
        node.name,
        Value(
            node,
            Expr(name, []),
            copy_type),
        shadow = True)
    return Statement(
        copy_expr.actions +
        ['%s %s = %s;' % (ll_copy_type, name, copy_expr.value)])
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
ispace = ispace,
                fspace = fspace,
                field_map = region_fields,
                field_type_map = region_field_types,
                allocator = allocator if needs_allocator else None,
                accessor_map = accessor_map,
                privilege_map = privilege_map)

            cx.env.insert(region_node.name, region_value)
            cx.regions[region_type] = region_value

    for param_node, param, param_type in zip(task.params.params, params, param_types):
        if not types.is_region(param_type):
            value = Value(param_node, Expr(param, []), param_type)
            if types.allows_var_binding(param_type):
                value = StackReference(param_node, Expr(param, []), types.StackReference(param_type))
            cx.env.insert(param_node.name, value)

    task_body = trans_node(task.block, cx)
    task_cleanup = trans_cleanup(0, cx)

    task_definition = Expr(
        task_name,
        ['%s %s(%s)' % (
            ll_return_type,
            task_name,
            task_inputs),
         '{',
         Block(task_header + [task_body] + task_cleanup),
         '}'])

    return task_definition
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
region_root = region_type,
        physical_regions = [physical_region],
        physical_region_accessors = [accessors],
        physical_region_privileges = [privilege],
        ispace = ispace,
        fspace = fspace,
        field_map = fields,
        field_type_map = field_types,
        allocator = ispace_alloc,
        accessor_map = accessors,
        privilege_map = privileges)

    cx.env.insert(node.name, region_value)
    cx.regions[region_type] = region_value
    cx.created_regions[-1].append(region_value)
    cx.created_ispaces[-1].append(Value(node, Expr(ispace, []), None))

    return Statement(create_region)
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
ll_pointer,
                node.span))

    if len(region_types) == 1:
        actions.extend(
            unsafe_read(ll_pointer, ll_result, region_types[0], field_path, cx))
    else:
        actions.append('switch (%s) {' % ll_bitmask)
        for index, region_type in zip(xrange(len(region_types)), region_types):
            actions.append('case %s:' % (1 << index))
            actions.append(Block(
                    unsafe_read(ll_pointer, ll_result, region_type, field_path, cx) +
                    ['break;']))
        actions.append('}')

    return Value(node, Expr(ll_result, actions), cx.type_map[node])
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
region_root = array_value.region_root,
            physical_regions = [],
            physical_region_accessors = [],
            physical_region_privileges = [],
            ispace = ispace,
            fspace = array_value.fspace,
            field_map = array_value.field_map,
            field_type_map = array_value.field_type_map,
            allocator = allocator,
            accessor_map = array_value.accessor_map,
            privilege_map = array_value.privilege_map)

        cx.regions[region_type] = region_value

        region_value = copy.copy(region_value)
        region_value.expr = Expr(ll_region, create_region)
        return region_value

    # Handle arrays:
    assert types.is_region(array_type) and types.is_int(index_type)
    pointer_expr = Expr('(ptr_t(%s))' % index_expr.value, index_expr.actions)

    pointer_type = types.Pointer(array_type.kind.contains_type, [array_type])
    return Reference(node, pointer_expr, pointer_type)
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
['IndexSpace %s = runtime->get_index_subspace(ctx, %s, Color(%s));' % (
                        ispace,
                        array_expr.value,
                        index_expr.value),
                 'IndexAllocator %s = runtime->create_index_allocator(ctx, %s);' % (
                        allocator, ispace)])

            ispace_value = Value(
                node = node,
                expr = Expr(ispace, []),
                type = region_type)

            cx.regions[region_type] = ispace_value

            ispace_value = copy.copy(ispace_value)
            ispace_value.expr = Expr(ispace, create_ispace)
            return ispace_value

        # Handle regions:
        create_region = (
            array_expr.actions +
            index_expr.actions +
            ['LogicalRegion %s = runtime->get_logical_subregion_by_color(ctx, %s, Color(%s));' % (
                    ll_region,
                    array_expr.value,
                    index_expr.value),
             'IndexSpace %s = %s.get_index_space();' % (ispace, ll_region),
             'IndexAllocator %s = runtime->create_index_allocator(ctx, %s);' % (
                    allocator, ispace)])

        region_value = Region(
            node = node,
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
def trans_foreign_call(node, task, all_args, return_type, cx):
    task_expr = task.read(cx)

    args = iter(all_args)
    foreign_args = []
    for param_type in task.type.foreign_param_types:
        if types.is_foreign_context(param_type):
            foreign_args.append(Expr('ctx', []))
        elif types.is_foreign_runtime(param_type):
            foreign_args.append(Expr('runtime', []))
        elif types.is_foreign_region(param_type):
            region = next(args)
            physical_regions = mangle_temp()
            arg_actions = []
            arg_actions.append(
                'PhysicalRegion %s[%s];' % (
                    physical_regions,
                    len(region.physical_regions)))
            for physical_region, index in zip(region.physical_regions, xrange(len(region.physical_regions))):
                arg_actions.append(
                    '%s[%s] = %s;' % (
                        physical_regions,
                        index,
                        physical_region))
            foreign_args.append(Expr(physical_regions, arg_actions))
        else:
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
for field_path, field_type in field_types.iteritems():
                    if is_prefix(privilege.field_path, field_path):
                        if privilege.op not in reduction_ops:
                            reduction_ops[privilege.op] = types.wrap([])
                        types.add_key(reduction_ops[privilege.op], field_type)

    reduction_ops = dict((k, types.unwrap(v)) for k, v in reduction_ops.iteritems())

    reduction_classes = []
    for op, element_types in reduction_ops.iteritems():
        for element_type in element_types:
            reduction_class = trans_reduction_op_impl(op, element_type, cx)
            reduction_classes.append(reduction_class)
            cx.reduction_ops[(op, element_type.key())] = Value(
                None,
                Expr(reduction_class.read(cx).value, []),
                None)
    return reduction_classes
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
def trans_import(node, cx):
    module_type = cx.type_map[node]
    for def_name, def_type in module_type.def_types.iteritems():
        if types.is_function(def_type):
            cx.env.insert(def_name, ForeignFunction(Expr(def_name, []), def_type))
    return Value(
        node,
        Expr(None, ['#include "%s"' % node.filename]),
        cx.type_map[node])