Skip to content

Commit

Permalink
Tuples which are accessed with variable indexes implemented as tree v…
Browse files Browse the repository at this point in the history
…ectors.
  • Loading branch information
schani committed Jun 1, 2009
1 parent 3025b21 commit 5f6ac07
Show file tree
Hide file tree
Showing 12 changed files with 550 additions and 55 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ CXX = g++

export CFLAGS CC

COMMON_OBJECTS = mathmap_common.o builtins.o exprtree.o parser.o scanner.o vars.o tags.o tuples.o internals.o macros.o userval.o overload.o jump.o noise.o spec_func.o compiler.o bitvector.o expression_db.o drawable.o floatmap.o designer/designer.o designer/cycles.o designer/loadsave.o designer_filter.o native-filters/gauss.o compopt/dce.o compopt/resize.o backends/cc.o backends/lazy_creator.o $(FFTW_OBJECTS) $(LLVM_OBJECTS)
COMMON_OBJECTS = mathmap_common.o builtins.o exprtree.o parser.o scanner.o vars.o tags.o tuples.o internals.o macros.o userval.o overload.o jump.o noise.o spec_func.o compiler.o bitvector.o expression_db.o drawable.o floatmap.o tree_vectors.o designer/designer.o designer/cycles.o designer/loadsave.o designer_filter.o native-filters/gauss.o compopt/dce.o compopt/resize.o backends/cc.o backends/lazy_creator.o $(FFTW_OBJECTS) $(LLVM_OBJECTS)
#COMMON_OBJECTS += designer/widget.o
COMMON_OBJECTS += designer/cairo_widget.o

GIMP_OBJECTS = mathmap.o

OBJECTS = $(COMMON_OBJECTS) $(CMDLINE_OBJECTS) $(GIMP_OBJECTS)

TEMPLATE_INPUTS = tuples.h mathmap.h userval.h drawable.h compiler.h builtins.h noise.h native-filters/native-filters.h
TEMPLATE_INPUTS = tuples.h mathmap.h userval.h drawable.h compiler.h builtins.h noise.h tree_vectors.h native-filters/native-filters.h

mathmap : compiler_types.h $(OBJECTS) $(CMDLINE_TARGETS) liblispreader new_template.c $(LLVM_TARGETS)
$(CXX) $(CGEN_LDFLAGS) -o mathmap $(OBJECTS) $(CMDLINE_LIBS) $(LLVM_LDFLAGS) lispreader/liblispreader.a $(LDFLAGS)
Expand Down
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ speed up compiler - see what the bottlenecks are with valgrind's callgrind
replace resize with a simple internal filter
don't use x_consts and y_consts structs in filter_func
make two different filter_XXX functions: one for calling in closure, one without closure, so as not to require building the closure
make solve ops and ell-jac foldable (requires pools in the folders)
make solve ops and ell-jac foldable, also tuple-nth, tree-vector-nth (requires pools in the folders)
loops which don't compute anything are still emitted for sliced code. this shouldn't be.
make internals typed
don't put easy to produce constants in slices
Expand Down
22 changes: 22 additions & 0 deletions backends/cc.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ print_tuple (float *tuple)
g_assert_not_reached();
}

static void
print_tree_vector (tree_vector_t *tree_vector)
{
g_assert_not_reached();
}

static void
output_value_name (FILE *out, value_t *value, int for_decl)
{
Expand Down Expand Up @@ -290,6 +296,22 @@ output_rhs (FILE *out, rhs_t *rhs)
}
break;

case RHS_TREE_VECTOR :
{
int i;

fprintf(out, "({ float tuple[%d]; ", rhs->v.tuple.length);

for (i = 0; i < rhs->v.tuple.length; ++i)
{
fprintf(out, "tuple[%d] = ", i);
output_primary(out, &rhs->v.tuple.args[i]);
fprintf(out, "; ");
}
fprintf(out, "; ALLOC_TREE_VECTOR(%d, tuple); })", rhs->v.tuple.length);
}
break;

default :
g_assert_not_reached();
}
Expand Down
3 changes: 2 additions & 1 deletion compiler-internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ typedef struct _inlining_history_t
#define RHS_FILTER 4
#define RHS_CLOSURE 5
#define RHS_TUPLE 6
#define RHS_TREE_VECTOR 7

typedef struct
{
Expand Down Expand Up @@ -174,7 +175,7 @@ typedef struct
{
int length;
primary_t *args;
} tuple;
} tuple; /* also for tree vectors */
} v;
} rhs_t;

Expand Down
Loading

0 comments on commit 5f6ac07

Please sign in to comment.