Commit 6777fbb0 authored by Julian Kranz's avatar Julian Kranz

Merge branch 'master' of hg::ssh://hg@bitbucket.org/jucs/mltk

Conflicts:
	specifications/rreil/rreil-opt.ml
	tools/Makefile
parents 81f83a74 b4a10e4b
......@@ -2,7 +2,7 @@
AUTOMAKE_OPTIONS = -Wno-override
CLEANFILES = STATS gdslc.c
CLEANFILES = STATS
noinst_PROGRAMS =
bin_PROGRAMS =
EXTRA_PROGRAMS =
......@@ -38,7 +38,7 @@ AM_CFLAGS = -Wall
# the gdsl compiler
MLTON = @MLTON@
SMLNJ = @SMLNJ@
MLULEX = @MLULEX@
MLANTLR = @MLANTLR@
......@@ -126,20 +126,14 @@ GDSLC_SML_FILES = \
JAR=jrreil.jar
$(builddir)/gdslc$(EXEEXT): $(srcdir)/gdslc.mlb $(GDSLC_SML_FILES)
$(MLTON) $(MLFLAGS) -output $@ $(srcdir)/gdslc.mlb
$(builddir)/gdslc-image: $(srcdir)/gdsl.cm $(GDSLC_SML_FILES)
echo 'CM.make("'$(srcdir)/gdsl.cm'"); SMLofNJ.exportFn ("'$@'",Main.njMain);' | $(SMLNJ)
cd $(builddir) && $(LN_S) $@.* gdslc-image
gdslc.c: $(builddir)/gdslc$(EXEEXT)
touch gdslc.c
CLEANFILES += $(builddir)/gdslc-image
if INSTALL_GDSLC
bin_PROGRAMS += $(builddir)/gdslc$(EXEEXT)
else
noinst_PROGRAMS += $(builddir)/gdslc$(EXEEXT)
endif
GDSLC = $(SMLNJ) @SMLload=$(builddir)/gdslc-image
gdslc_MAIN = $(gdslc_SOURCES)
gdslc_SOURCES = $(srcdir)/gdslc.mlb $(GDSLC_SML_FILES)
RUNTIME = $(srcdir)/detail/codegen/c0/runtime.h \
$(srcdir)/detail/codegen/c0/runtime.c \
......@@ -147,17 +141,13 @@ RUNTIME = $(srcdir)/detail/codegen/c0/runtime.h \
$(srcdir)/detail/codegen/c1/runtime.c \
$(srcdir)/detail/codegen/js0/runtime.js
#gdslc_SOURCES += $(RUNTIME)
%.l.sml : %.l
$(MLULEX) $<
%.g.sml : %.g
$(MLANTLR) $<
GDSLC = $(abspath $(builddir)/gdslc$(EXEEXT))
GDSLC_DEP = $(builddir)/gdslc$(EXEEXT) detail/codegen/c1/runtime.c detail/codegen/c1/runtime.h
#GDSLC_DEP = gdslc$(EXEEXT)
GDSLC_DEP = $(builddir)/gdslc-image detail/codegen/c1/runtime.c detail/codegen/c1/runtime.h
GDSLFLAGS = --runtime=$(srcdir)/detail/codegen
# the decoders
......@@ -374,13 +364,13 @@ $(JAR): pre-build $(JSOURCES:%=libs/jrreil/%)
ABS_DST=$$(pwd)/$(BPRE) && cd $(srcdir)/libs/jrreil && javac $(JSOURCES) -d $$ABS_DST/
jar -cf $@ $(JSOURCES:$(SPRE)/%.java=-C $(BPRE) %.class)
clean-local:
-rm -rf build/
CLEANFILES += jrreil.jar
endif
clean-local:
-rm -rf build/
-rm -f $(builddir)/gdslc-image.*
if INSTALL_AUXLIBS
lib_LTLIBRARIES += libreadhex.la libutil.la
......@@ -407,14 +397,18 @@ endif
if X86_RREIL
if INSTALL_AUXLIBS
if HAVE_POSIX200809_C11
if LINUX
lib_LTLIBRARIES += libx86-tester.la
endif
endif
lib_LTLIBRARIES += libx86.la libgdwrap.la
else
if BUILD_AUXLIBS
if HAVE_POSIX200809_C11
if LINUX
noinst_LTLIBRARIES += libx86-tester.la
endif
endif
noinst_LTLIBRARIES += libx86.la libgdwrap.la
endif
endif
......@@ -423,15 +417,23 @@ endif
if HAVE_POSIX200809_C11
if HAVE_RREIL
if INSTALL_AUXLIBS
lib_LTLIBRARIES += librreil.la
if LINUX
lib_LTLIBRARIES += librreil-sim.la
endif
lib_LTLIBRARIES += librreil.la
if HAVE_JNI_H
lib_LTLIBRARIES += libjrreil.la
endif
lib_LTLIBRARIES += libgdsl-multiplex.la
else
if BUILD_AUXLIBS
noinst_LTLIBRARIES += librreil.la
if LINUX
noinst_LTLIBRARIES += librreil-sim.la
endif
noinst_LTLIBRARIES += librreil.la
if HAVE_JNI_H
noinst_LTLIBRARIES += libjrreil.la
endif
noinst_LTLIBRARIES += libgdsl-multiplex.la
endif
endif
......@@ -570,18 +572,22 @@ endif
if X86_RREIL
if INSTALL_AUXBINS
if HAVE_POSIX200809_C11
if LINUX
bin_PROGRAMS += x86_test_runner
bin_PROGRAMS += x86_test_stats_runner
endif
endif
if HAVE_ELF
bin_PROGRAMS += liveness_sweep
endif
else
if BUILD_AUXBINS
if HAVE_POSIX200809_C11
if LINUX
noinst_PROGRAMS += x86_test_runner
noinst_PROGRAMS += x86_test_stats_runner
endif
endif
if HAVE_ELF
noinst_PROGRAMS += liveness_sweep
endif
......@@ -634,4 +640,4 @@ x86_test_stats_runner_LDADD += librreil.la librreil-sim.la libx86-generator.la l
private_headers += $(srcdir)/tools/x86-test-stats-runner/src/hash_array.h
endif
EXTRA_DIST = LICENSE $(GDSL_BASIS) $(GDSL_X86) $(GDSL_RREIL) $(GDSL_X86SEM) $(GDSL_AVR) $(GDSL_AVRSEM) $(private_headers) $(RUNTIME) $(srcdir)/gdsl.h $(srcdir)/gdslc.mlb $(GDSLC_SML_FILES)
EXTRA_DIST = LICENSE $(GDSL_BASIS) $(GDSL_X86) $(GDSL_RREIL) $(GDSL_X86SEM) $(GDSL_AVR) $(GDSL_AVRSEM) $(private_headers) $(RUNTIME) $(srcdir)/gdsl.h $(srcdir)/gdslc.mlb $(srcdir)/gdsl.cm $(GDSLC_SML_FILES)
......@@ -8,14 +8,15 @@ AC_CONFIG_SRCDIR([LICENSE])
AM_PROG_CC_C_O()
AM_PROG_AR()
AC_PROG_LN_S()
AC_PROG_LIBTOOL()
AC_PROG_INSTALL()
AC_ARG_VAR(MLTON)
AC_PATH_PROG(MLTON, mlton, ["not-found"])
AC_ARG_VAR(SMLNJ)
AC_PATH_PROG(SMLNJ, sml, ["not-found"])
if test [$MLTON == "not-found"]; then
echo "You must install MLton."
if test [$SMLNJ == "not-found"]; then
echo "You must install SML/NJ."
exit 1
fi
......@@ -23,7 +24,7 @@ AC_ARG_VAR(MLULEX)
AC_PATH_PROG(MLULEX, ml-ulex, ["not-found"])
if test [$MLULEX == "not-found"]; then
echo "You must install MLton (to get ml-ulex)."
echo "You must install SML/NJ (to get ml-ulex)."
exit 1
fi
......@@ -31,18 +32,21 @@ AC_ARG_VAR(MLANTLR)
AC_PATH_PROG(MLANTLR, ml-antlr, ["not-found"])
if test [$MLANTLR == "not-found"]; then
echo "You must install MLton (to get ml-antlr)."
echo "You must install SML/NJ (to get ml-antlr)."
exit 1
fi
dnl check if the GDSL compiler should be installed
AC_ARG_ENABLE([install-gdslc],
[AS_HELP_STRING(
[--enable-install-gdslc],
[install the GDSL compiler])],
[], [enable_install_gdslc=no])
AM_CONDITIONAL([INSTALL_GDSLC],[test x$enable_install_gdslc = xyes])
dnl define a variable that helps us to only build Linux-specific stuff on Linux
case "$host_os" in
*linux* )
LINUX=yes;;
*)
LINUX=no;;
esac
AM_CONDITIONAL(LINUX, test "$LINUX" = "yes")
AC_CHECK_HEADERS_ONCE(jni.h)
AM_CONDITIONAL(HAVE_JNI_H, test "$HAVE_JNI_H" != "")
dnl conditionals for the various decoders, either with or without semantics
FRONTENDS="x86 x86-rreil avr avr-rreil";
......@@ -149,8 +153,7 @@ cat <<EOF
GDSL toolkit configuration:
directory prefix: $prefix
C flags: $CFLAGS
front-end to build: $with_frontend
install compiler: $enable_install_gdslc
front-end to build: $with_frontend
build auxiliary libraries: $enable_build_auxlibs
install auxiliary libraries: $enable_install_auxlibs
build auxiliary programs: $enable_build_auxbins
......
......@@ -270,7 +270,7 @@ static string_t int_to_string(state_t s, int_t v) {
char* str = alloc(s, 25);
if(negate)
str[0] = '(';
int size = snprintf(str + negate, 23, "%ld", v);
int size = snprintf(str + negate, 23, "%lld", v);
if(size && negate) {
str[negate + size - 1] = ')';
str[negate + size] = 0;
......
......@@ -182,4 +182,6 @@ structure Main = struct
fun main () =
(processArgs (CommandLine.arguments())
;OS.Process.exit OS.Process.success)
fun njMain (_,args) = (processArgs args; OS.Process.success)
end
......@@ -15,7 +15,7 @@
#endif
void rreil_address_print(struct rreil_address *address) {
printf("{%lu} ", address->size);
printf("{%llu} ", address->size);
rreil_linear_print(address->address);
}
......@@ -79,7 +79,7 @@ void rreil_id_print(FILE *stream, struct rreil_id *id) {
break;
}
case RREIL_ID_TYPE_TEMPORARY: {
fprintf(stream, "T%lu", id->temporary);
fprintf(stream, "T%llu", id->temporary);
break;
}
#ifdef GDSL_X86
......@@ -126,7 +126,7 @@ void rreil_linear_print(struct rreil_linear *linear) {
break;
}
case RREIL_LINEAR_TYPE_IMMEDIATE: {
printf("%lu", linear->immediate);
printf("%llu", linear->immediate);
break;
}
case RREIL_LINEAR_TYPE_SUM: {
......@@ -146,7 +146,7 @@ void rreil_linear_print(struct rreil_linear *linear) {
break;
}
case RREIL_LINEAR_TYPE_SCALE: {
printf("%lu*", linear->scale.imm);
printf("%llu*", linear->scale.imm);
rreil_linear_print(linear->scale.opnd);
break;
}
......@@ -226,12 +226,12 @@ void rreil_expr_print(struct rreil_expr *expr) {
break;
}
case RREIL_EXPR_TYPE_SX: {
printf("{%lu->s*} ", expr->sx.fromsize);
printf("{%llu->s*} ", expr->sx.fromsize);
rreil_linear_print(expr->sx.opnd);
break;
}
case RREIL_EXPR_TYPE_ZX: {
printf("{%lu->u*} ", expr->zx.fromsize);
printf("{%llu->u*} ", expr->zx.fromsize);
rreil_linear_print(expr->zx.opnd);
break;
}
......@@ -258,14 +258,14 @@ void rreil_sexpr_print(struct rreil_sexpr *sexpr) {
void rreil_variable_print(FILE *stream, struct rreil_variable *variable) {
rreil_id_print(stream, variable->id);
if(variable->offset)
fprintf(stream, "/%lu", variable->offset);
fprintf(stream, "/%llu", variable->offset);
}
void rreil_varl_print(FILE *stream, struct rreil_variable_limited *varl) {
rreil_id_print(stream, varl->id);
if(varl->offset)
fprintf(stream, "/%lu", varl->offset);
fprintf(stream, ":%lu", varl->size);
fprintf(stream, "/%llu", varl->offset);
fprintf(stream, ":%llu", varl->size);
}
void rreil_varls_print(FILE *stream, struct rreil_variable_limited_tuple *varls) {
......@@ -301,13 +301,13 @@ void rreil_statement_print(struct rreil_statement *statement) {
switch(statement->type) {
case RREIL_STATEMENT_TYPE_ASSIGN: {
rreil_variable_print(stdout, statement->assign.lhs);
printf(" =:%lu ", statement->assign.size);
printf(" =:%llu ", statement->assign.size);
rreil_expr_print(statement->assign.rhs);
break;
}
case RREIL_STATEMENT_TYPE_LOAD: {
rreil_variable_print(stdout, statement->load.lhs);
printf(" =:%lu *(", statement->load.size);
printf(" =:%llu *(", statement->load.size);
rreil_address_print(statement->load.address);
printf(")");
break;
......@@ -315,7 +315,7 @@ void rreil_statement_print(struct rreil_statement *statement) {
case RREIL_STATEMENT_TYPE_STORE: {
printf("*(");
rreil_address_print(statement->store.address);
printf(") =:%lu ", statement->store.size);
printf(") =:%llu ", statement->store.size);
rreil_expr_print(statement->store.rhs);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment