def compute_all_shapes(v):
    """Compute the tensor-, index-, and total shape of an expr.

    Returns (shape, size, index_shape, index_size, total_shape, total_size).
    """
    shape = v.ufl_shape
    index_shape = v.ufl_index_dimensions
    total_shape = shape + index_shape
    return shape, index_shape, total_shape
