Commit 49bffc79 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

added configure support for heap analyses

[r2825]
parent d75b08be
......@@ -19,3 +19,26 @@ To generate FIRM code from a compiler frontend read the documentation
"libFIRM: A Library for Compiler Optimization Reaserch Implementing
Firm", UKA tech-report 2002-5. About Firm you can learn in UKA
tech-report 1999-14.
You can generate a Java Native Interface for the library. For this
configure libfirm with --enable-firmjni and give the path to
the jni headers, e.g.
--with-includedir=/usr/public2/java/jdk1.3.1-sun/include/:/usr/
public2/java/jdk1.3.1-sun/include/linux/.
Then go to ./<arch>/firmjni and call make. To test the native
interface go on to testprograms and call make test.
If you are using the library for heap analysis with libfirm you
have to configure libfirm with --enable-heapanalysis. If you
use the heap analysis through the java native interface you
must in addition give the paths to the heap analysis installation:
--with-includedir=<path where you find heapanal/heapanal.h>
--with-libdir=<path where you find libheapanal.a>
You can also give the paths by setting environment variables
CPPFLAGS and LDFLAGS before configuring.
......@@ -88,6 +88,9 @@
/* Define to 1 if Firm statistics are activated */
#undef FIRM_STATISTICS
/* Define to 1 for heap analysis support */
#undef DO_HEAPANALYSIS
/* Define the right volatile token */
#undef volatile
......
......@@ -829,6 +829,7 @@ Optional Features:
--enable-profile enable profiling
--enable-autodoc enable auto documentation
--enable-firmjni check for tools necesarry to construct a java native interface for Firm
--enable-heapanalysis Compile with heap analysis.
--disable-libiberty disable own libiberty parts
--enable-statistics enable Firm statistics
......@@ -1305,6 +1306,33 @@ else
fi;
# Check whether --enable-heapanalysis or --disable-heapanalysis was given.
if test "${enable_heapanalysis+set}" = set; then
enableval="$enable_heapanalysis"
enable_heapanalysis=$enableval
else
enable_heapanalysis="no"
fi;
if test "$enable_heapanalysis" = "no"; then
cat >>confdefs.h <<\_ACEOF
#define DO_HEAPANALYSIS 0
_ACEOF
echo "$as_me:$LINENO: result: heapanalysis disabled" >&5
echo "${ECHO_T}heapanalysis disabled" >&6
else
cat >>confdefs.h <<\_ACEOF
#define DO_HEAPANALYSIS 1
_ACEOF
echo "$as_me:$LINENO: result: heapanalysis enabled" >&5
echo "${ECHO_T}heapanalysis enabled" >&6
fi
# Check whether --enable-libiberty or --disable-libiberty was given.
if test "${enable_libiberty+set}" = set; then
enableval="$enable_libiberty"
......@@ -4861,6 +4889,7 @@ s,@enable_debug_libfirm@,$enable_debug_libfirm,;t t
s,@enable_profile_libfirm@,$enable_profile_libfirm,;t t
s,@enable_auto_documentation@,$enable_auto_documentation,;t t
s,@enable_firm_jni@,$enable_firm_jni,;t t
s,@enable_heapanalysis@,$enable_heapanalysis,;t t
s,@disable_libiberty@,$disable_libiberty,;t t
s,@enable_statistics@,$enable_statistics,;t t
s,@CC@,$CC,;t t
......
......@@ -93,6 +93,21 @@ fi],
[enable_firm_jni=no])
AC_SUBST(enable_firm_jni)
dnl set heap analyses support
dnl -------------------------
AC_ARG_ENABLE(heapanalysis, [ --enable-heapanalysis Compile with heap analysis.],
[enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
if test "$enable_heapanalysis" = "no"; then
AC_DEFINE(DO_HEAPANALYSIS, 0, [Don't compile with heap analysis])
AC_MSG_RESULT([heapanalysis disabled])
else
AC_DEFINE(DO_HEAPANALYSIS, 1, [Compile with heap analysis])
AC_MSG_RESULT([heapanalysis enabled])
fi
AC_SUBST(enable_heapanalysis)
dnl to be used!! AM_CONDITIONAL(FIRM_HEAPANALYSIS, test "$enable_heapanalysis" != "no")
dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
dnl ----------------------
AC_ARG_ENABLE(libiberty,
......
......@@ -15,6 +15,8 @@ srcdir = @srcdir@
topdir = ..
subdir = firmjni
enable_heapanal := @enable_heapanalysis@
# The library implementing the JNI methods. This name is also
# known to the generator for the JNI interface and used in the
# static initializer.
......@@ -23,6 +25,8 @@ LIBNAME = libfirmjni.so
# The name of the package containing the Firm JNI
PACKAGENAME = firmjni
include $(topdir)/MakeRules
# where to put libfirmjni.so
libdir = @libdir@
# where to put the directory firmjni containing the generated
......@@ -39,16 +43,12 @@ HFILES = $(MEMBERS:.m=.h)
JAVAFILES = $(MEMBERS:.m=.java)
CLASSFILES = $(MEMBERS:.m=.class)
CPPFLAGS = -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/common \
CPPFLAGS += -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/common \
-I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr \
-I$(top_srcdir)/ir/tv -I$(top_srcdir)/ir/debug \
-I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st \
-I$(top_srcdir)/../opt/heapanal \
-I$(top_srcdir)/include \
-I/usr/local/jdk1.3.1/include \
-I/usr/local/jdk1.3.1/include/freebsd @CPPFLAGS@
-I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st
LDFLAGS += $(topdir)
LDFLAGS += -I$(topdir)
FIRM_HEADERS=$(notdir $(FIRM_PATH_HEADERS))
MEMBERS=$(subst .h,.m,$(shell echo $(FIRM_HEADERS)|$(SHELL_TOUPPER)))
......@@ -68,10 +68,15 @@ FIRM_PATH_HEADERS=common/firm.h common/firm_common.h \
ir/iropt.h ir/irgopt.h ir/ircgopt.h \
ana/irouts.h ana/irdom.h ana/irloop.h ana/cgana.h \
ir/irgmod.h tr/typegmod.h
FIRM_SOURCE_DIR_HEADERS=$(addprefix $(SOURCE_DIR)/,$(FIRM_HEADERS))
# hand implemented members
IMPL_MEMBERS = Dbginfo.m Heapanal.m
IMPL_MEMBERS = Dbginfo.m
ifeq ($(enable_heapanal),yes)
IMPL_MEMBERS += Heapanal.m
endif
# The directory containing crecoder.jar and, for now,
# remove_cpp_comands.perl
......@@ -106,10 +111,10 @@ Type_or_entity.h: Type_or_entity.class
Dbginfo.java:
cp aux/Dbginfo.java aux/Dbginfo.c .
cp $(top_srcdir)/firmjni/aux/Dbginfo.java $(top_srcdir)/firmjni/aux/Dbginfo.c .
Heapanal.java:
cp aux/Heapanal.java aux/Heapanal.c .
cp $(top_srcdir)/firmjni/aux/Heapanal.java $(top_srcdir)/firmjni/aux/Heapanal.c .
%.h: %.class
javah -classpath $(topdir) -o $@ $(PACKAGENAME).$(<:.class=)
......@@ -120,9 +125,16 @@ Heapanal.java:
$(OFILES):
gcc $(CPPFLAGS) -c $(@:.o=.c) -o $@
ifeq ($(enable_heapanal),yes)
HEAPANALLIB = -lheapanal
else
HEAPANALLIB =
endif
jni: $(HFILES) $(OFILES) # ../libfirm.a
gcc -shared -fPIC -o $(LIBNAME) *.o -lfirm -L.. -lheapanal -L../../opt/heapanal \
-liberty -L../../sw/lib
gcc -shared -fPIC -o $(LIBNAME) *.o -lfirm -L.. $(HEAPANALLIB) $(LDFLAGS) -liberty -L../../sw/lib
install:
cp libfirmjni.so $(libdir)
......
......@@ -2,10 +2,9 @@
# include "Heapanal.h"
# include "firm.h"
# include "libfirm/firm.h"
# include "irsimpletype.h"
# include "src/heapanal.h"
# include "src/interprete.h"
# include "heapanal/heapanal.h"
/* boilerplate stuff: */
#include "libfirm/irvrfy.h"
......@@ -157,6 +156,9 @@ void Java_firmjni_Heapanal_analHeap__ (JNIEnv *env, jclass clazz)
/*
* $Log$
* Revision 1.3 2004/04/30 09:00:01 goetz
* added configure support for heap analyses
*
* Revision 1.2 2004/04/29 13:59:11 liekweg
* Removed C++-Style comments --flo
*
......
......@@ -42,9 +42,7 @@
# include "pmap.h"
# include "eset.h"
/* #undef HEAPANAL */
#undef HEAPANAL
#ifdef HEAPANAL
#ifdef DO_HEAPANALYSIS
void dump_chi_term(FILE *FL, ir_node *n);
void dump_state(FILE *FL, ir_node *n);
int get_opt_dump_abstvals(void);
......@@ -797,7 +795,7 @@ static void dump_node(ir_node *n)
dump_node_vcgattr(n, bad);
fprintf(F, "}\n");
dump_const_node_local(n);
#ifdef HEAPANAL
#ifdef DO_HEAPANALYSIS
dump_chi_term(F, n);
dump_state(F, n);
#endif
......@@ -993,7 +991,7 @@ dump_whole_block(ir_node *block) {
fprintf(F, "\" label: \"");
dump_node_opcode(F, block);
fprintf (F, " %ld", get_irn_node_nr(block));
#ifdef HEAPANAL
#ifdef DO_HEAPANALYSIS
if (get_opt_dump_abstvals())
fprintf (F, " seqno: %d", (int)get_Block_seqno(block));
#endif
......@@ -1012,7 +1010,7 @@ dump_whole_block(ir_node *block) {
/* Close the vcg information for the block */
fprintf(F, "}\n");
dump_const_node_local(block);
#ifdef HEAPANAL
#ifdef DO_HEAPANALYSIS
dump_chi_term(F, block);
#endif
fprintf(F, "\n");
......
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