How to use the deprecated.compiler.lib.lcomp.trans.Value 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
ll_pointer,
                node.span))

    if len(region_types) == 1:
        actions.extend(
            unsafe_write(ll_pointer, update_expr.value, 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_write(ll_pointer, update_expr.value, region_type, field_path, cx) +
                    ['break;']))
        actions.append('}')

    return Value(node, Expr(update_expr.value, actions), cx.type_map[node])
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_reduce(ll_pointer, update_expr.value, op, 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_reduce(ll_pointer, update_expr.value, op, region_type, field_path, cx) +
                    ['break;']))
        actions.append('}')

    return Value(node, Expr(update_expr.value, actions), cx.type_map[node])
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
def __init__(self, node, expr, type, op, element_type):
        Value.__init__(self, node, expr, type)
        self.op = op
        self.element_type = element_type

class Function(Value):
    def __init__(self, node, expr, type, params, variants):
        Value.__init__(self, node, expr, type)
        self.params = params
        self.variants = variants

class ForeignFunction(Value):
    def __init__(self, expr, type):
        Value.__init__(self, None, expr, type)

class Reference(Value):
    def __init__(self, node, pointer_expr, pointer_type, field_path = ()):
        assert isinstance(field_path, tuple)
        type = types.Reference(pointer_type.points_to_type, pointer_type.regions, field_path)
        Value.__init__(self, node, pointer_expr, type)
        self.pointer_type = pointer_type
        self.field_path = field_path
    def read(self, cx):
        pointer_value = Value(self.node, self.expr, self.pointer_type)
        return trans_read_helper(
            self.node, pointer_value, self.field_path, cx).read(cx)
    def write(self, update_value, cx):
        pointer_value = Value(self.node, self.expr, self.pointer_type)
        return trans_write_helper(
            self.node, pointer_value, self.field_path, update_value,
            cx).read(cx)
    def reduce(self, op, update_value, cx):
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
def trans_ispace(node, cx):
    ll_ispace = mangle(node, cx)
    ispace = Value(node, Expr(ll_ispace, []), cx.type_map[node])
    cx.env.insert(node.name, Value(node, Expr(ll_ispace, []), cx.type_map[node]))
    ll_size_expr = trans_node(node.size_expr, cx).read(cx)

    ispace_alloc = mangle_temp()
    create_ispace = (
        ll_size_expr.actions +
        ['IndexSpace %s = runtime->create_index_space(ctx, %s);' % (
                ll_ispace, ll_size_expr.value),
         'IndexAllocator %s = runtime->create_index_allocator(ctx, %s);' % (
                ispace_alloc, ll_ispace),
         'if (%s > 0) {' % ll_size_expr.value,
         Block(['%s.alloc(%s);' % (
                        ispace_alloc, ll_size_expr.value)]),
         '}'])

    cx.created_ispaces[-1].append(ispace)
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
else:
        ll_result = mangle_temp()

    actions = []
    actions.extend(task_expr.actions)
    for arg in foreign_args:
        actions.extend(arg.actions)
    actions.append(
        '%s%s(%s);' % (
            ('%s %s = ' % (
                    ll_return_type,
                    ll_result)
             if not types.is_void(return_type) else ''),
            task_expr.value,
            ', '.join(arg.value for arg in foreign_args)))
    return Value(node, Expr(ll_result, actions), return_type)
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
def trans_unpack(node, cx):
    actions = []

    struct = trans_node(node.expr, cx)
    ll_struct = struct.read(cx)
    ll_struct_type = trans_type(struct.type.as_read(), cx)
    ll_name = mangle(node, cx)

    actions.extend(ll_struct.actions)
    actions.append('%s %s = %s;' % (ll_struct_type, ll_name, ll_struct.value))
    cx.env.insert(node.name, Value(node, Expr(ll_name, []), struct.type.as_read()))

    region_params = cx.type_map[node.expr].as_read().regions
    region_args = cx.type_map[node]

    for index, region_node, region_param, region_arg in zip(
        xrange(len(region_args)), node.regions.regions, region_params, region_args):

        ll_region = mangle(region_node, cx)
        ispace = mangle_temp()

        # We extract the LogicalRegion contained in the region
        # relation, and we could even inline map it to get a
        # PhysicalRegion. But we almost never actually need it because
        # the region is contained within some larger parent region, so
        # we can just access it through that.
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
physical_region_accessors = region_accessors,
                physical_region_privileges = region_privileges.keys(),
                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),
         '}'])
github StanfordLegion / legion / deprecated / compiler / lib / lcomp / trans.py View on Github external
def trans_for(node, cx):
    cx = cx.new_block_scope()

    index_name = mangle(node, cx)
    index_type = cx.type_map[node.indices.indices[0]]
    for index in node.indices.indices:
        cx.env.insert(index.name, Value(node, Expr(index_name, []), index_type))

    ll_index_type = trans_type(index_type, cx)
    region = cx.env.lookup(node.regions.regions[0].name)
    region_type = region.type
    ll_region = region.read(cx)

    ll_ispace = ll_region
    if types.is_region(region_type):
        ll_ispace = Expr(region.ispace, ll_region.actions)

    temp_domain = mangle_temp()
    temp_iterator = mangle_temp()
    block = (
        ll_ispace.actions +
        ['Domain %s = runtime->get_index_space_domain(ctx, %s);' % (
                temp_domain, ll_ispace.value),