This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gcjx] Patch: FYI: LLVM build infrastructure


I'm checking this in on the gcjx branch.

Mike Emmel asked me to check in the initial draft of his LLVM work.
I'm only checking in the configure/build bits -- Mike, feel free to
add the code bits (or I can if you prefer).

This adds a new configure switch to enable the LLVM back end.  I don't
know how to build it, Mike will have to say.  It isn't clear what
we'll do when it comes time to merge gcjx to the trunk, but the
changes are minimally intrusive and likely to stay that way, so I
think we can safely defer the decision.

Tom

Index: ChangeLog
from  Mike Emmel  <mike.emmel@gmail.com>

	* Makefile.in: Rebuilt.
	* Makefile.am (gcjx_LDADD): Handle LLVM.
	(libgcjx_la_SOURCES): Likewise.
	(llvm_cppflags, LLVMLIBPATH, llvm_libs, llvm_sources): New
	variables.
	* main.cc: Include llvmgen.hh.
	(parse_args): Handle '-o llvm'.
	* configure, gcjx-config.h.in: Rebuilt.
	* configure.ac (--with-llvm): New option.
	(--enable-llvmdebug): Likewise.

Index: configure.ac
===================================================================
--- configure.ac	(revision 108950)
+++ configure.ac	(working copy)
@@ -18,6 +18,30 @@
     AC_DEFINE(_GLIBCXX_DEBUG, 1, [enable libstdc++ checking])
   fi])
 
+# begin LLVM changed to llvmgen to differ from gcc llvm backend
+AC_ARG_WITH([llvm],
+AC_HELP_STRING([--with-llvm=PATH],[enable the LLVM backend installed in path]),
+	LLVMBASELIBPATH=$withval
+	LLVM_BUILDMODE=Debug
+    AC_DEFINE(ENABLE_LLVM_BACKEND, 1, [enable llvm])
+)
+AM_CONDITIONAL(ENABLE_LLVM, test x$with_llvm = xyes)
+AC_SUBST(LLVMBASELIBPATH)
+AC_SUBST(LLVM_BUILDMODE)
+
+
+AC_ARG_ENABLE(llvmdebug,
+AS_HELP_STRING([--enable-llvmdebug],[use debug version of llvm ]),
+[case ${enableval} in
+  yes) LLVM_BUILDMODE=Debug;;
+  *) LLVM_BUILDMODE=Release;;
+esac])
+AC_SUBST(BUILDMODE)
+
+
+# end LLVM
+
+
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
Index: main.cc
===================================================================
--- main.cc	(revision 109684)
+++ main.cc	(working copy)
@@ -21,6 +21,9 @@
 
 #include "typedefs.hh"
 #include "bytecode/bytegen.hh"
+#ifdef ENABLE_LLVM_BACKEND
+#include "llvm/llvmgen.hh"
+#endif
 #include "header/jni.hh"
 #include "header/jnistub.hh"
 #include "header/cni.hh"
@@ -512,6 +515,11 @@
 	    else if (otype == "jnistub")
 	      comp->add_code_generator (new jni_stub_generator (comp,
 							        comp->get_directory_cache ()));
+#ifdef ENABLE_LLVM_BACKEND
+	    else if (otype == "llvm")
+	      comp->add_code_generator (new llvm_code_generator (comp,
+							        comp->get_directory_cache ()));
+#endif
 	    else if (otype == "none")
 	      {
 		// Nothing.
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 108950)
+++ Makefile.am	(working copy)
@@ -10,11 +10,19 @@
 gcjx_SOURCES = main.cc
 gcjx_LDADD = libgcjx.la -lpthread
 
+if ENABLE_LLVM
+gcjx_LDADD += $(llvm_libs)
+endif
+
 libgcjx_la_SOURCES = $(dot_sources) $(model_sources) $(reader_sources) \
 $(source_sources) $(format_sources) $(bytecode_sources)	\
 $(header_sources) $(fdlibm_c_sources) $(fdlibm_cc_sources) \
 $(aot_sources)
 
+if ENABLE_LLVM
+libgcjx_la_SOURCES += $(llvm_sources) 
+endif
+
 BUILT_SOURCES = source/keyword.h source/chartables.h typedefs.hh.gch
 
 EXTRA_DIST = source/keyword.gperf source/gen-table.pl
@@ -137,3 +145,27 @@
 fdlibm_cc_sources = fdlibm/classpath.cc
 
 aot_sources = aot/aotclass.cc aot/aotfactory.cc aot/mangle.cc
+
+llvm_cppflags=-I$(LLVMBASELIBPATH)/include -D__STDC_LIMIT_MACROS
+LLVMLIBPATH = $(LLVMBASELIBPATH)/$(LLVM_BUILDMODE)/lib
+
+
+llvm_libs = -L$(LLVMLIBPATH) \
+    $(LLVMLIBPATH)/LLVMCBackend.o \
+    $(LLVMLIBPATH)/LLVMBCReader.o \
+    $(LLVMLIBPATH)/LLVMBCWriter.o \
+    $(LLVMLIBPATH)/LLVMbzip2.o \
+    -lLLVMipa \
+    -lLLVMTransforms \
+    -lLLVMScalarOpts \
+    -lLLVMTransformUtils \
+    -lLLVMAnalysis \
+    $(LLVMLIBPATH)/LLVMSelectionDAG.o \
+    $(LLVMLIBPATH)/LLVMCodeGen.o \
+    -lLLVMTarget \
+    $(LLVMLIBPATH)/LLVMCore.o \
+    -lLLVMSupport \
+    -lLLVMSystem \
+    -ldl
+
+llvm_sources = llvm/llvmgen.cc


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]