[llvm-commits] [llvm] r69700 - in /llvm/trunk: Makefile.rules autoconf/configure.ac configure tools/llvmc/plugins/Base/Base.td tools/llvmc/plugins/Base/Base.td.in
Mikhail Glushenkov
foldr at codedgers.com
Tue Apr 21 12:46:10 PDT 2009
Author: foldr
Date: Tue Apr 21 14:46:10 2009
New Revision: 69700
URL: http://llvm.org/viewvc/llvm-project?rev=69700&view=rev
Log:
Support --with-llvmgccdir and friends in llvmc, take 2.
Should now work when building with objdir != srcdir and when llvm-gcc is not
available.
Thanks to Duncan Sands for testing and advice!
Added:
llvm/trunk/tools/llvmc/plugins/Base/Base.td.in
- copied, changed from r69665, llvm/trunk/tools/llvmc/plugins/Base/Base.td
Removed:
llvm/trunk/tools/llvmc/plugins/Base/Base.td
Modified:
llvm/trunk/Makefile.rules
llvm/trunk/autoconf/configure.ac
llvm/trunk/configure
Modified: llvm/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=69700&r1=69699&r2=69700&view=diff
==============================================================================
--- llvm/trunk/Makefile.rules (original)
+++ llvm/trunk/Makefile.rules Tue Apr 21 14:46:10 2009
@@ -1466,7 +1466,8 @@
ifdef LLVMC_BUILD_AUTOGENERATED_INC
-LLVMCPluginSrc := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td))
+LLVMCPluginSrc := $(sort $(strip $(wildcard $(PROJ_SRC_DIR)/*.td)) \
+ $(strip $(wildcard $(PROJ_OBJ_DIR)/*.td)))
TDFiles := $(LLVMCPluginSrc) \
$(strip $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td))
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=69700&r1=69699&r2=69700&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Tue Apr 21 14:46:10 2009
@@ -472,6 +472,14 @@
LLVMGXX=$with_llvmgxx
WITH_LLVMGCCDIR="",)
+if test -n "$LLVMGCC"; then
+ LLVMGCCCOMMAND="$LLVMGCC"
+fi
+
+if test -n "$LLVMGXX"; then
+ LLVMGXXCOMMAND="$LLVMGXX"
+fi
+
if test -n "$LLVMGCC" && test -z "$LLVMGXX"; then
AC_MSG_ERROR([Invalid llvm-g++. Use --with-llvmgxx when --with-llvmgcc is used]);
fi
@@ -663,22 +671,33 @@
[Define if dlopen(0) will open the symbols of the program])
fi
+
if test "$WITH_LLVMGCCDIR" = "default" ; then
LLVMGCC="llvm-gcc${EXEEXT}"
LLVMGXX="llvm-g++${EXEEXT}"
+ LLVMGCCCOMMAND="$LLVMGCC"
+ LLVMGXXCOMMAND="$LLVMGXX"
+ AC_SUBST(LLVMGCCCOMMAND,$LLVMGCCCOMMAND)
+ AC_SUBST(LLVMGXXCOMMAND,$LLVMGXXCOMMAND)
AC_PATH_PROG(LLVMGCC, $LLVMGCC, [])
AC_PATH_PROG(LLVMGXX, $LLVMGXX, [])
else
if test -z "$LLVMGCC"; then
LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}"
+ LLVMGCCCOMMAND="$LLVMGCC"
fi
if test -z "$LLVMGXX"; then
LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}"
+ LLVMGXXCOMMAND="$LLVMGXX"
fi
+
AC_SUBST(LLVMGCC,$LLVMGCC)
AC_SUBST(LLVMGXX,$LLVMGXX)
+ AC_SUBST(LLVMGCCCOMMAND,$LLVMGCCCOMMAND)
+ AC_SUBST(LLVMGXXCOMMAND,$LLVMGXXCOMMAND)
fi
+
AC_MSG_CHECKING([tool compatibility])
dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as
@@ -1065,6 +1084,9 @@
dnl Configure doxygen's configuration file
AC_CONFIG_FILES([docs/doxygen.cfg])
+dnl Configure llvmc's Base plugin
+AC_CONFIG_FILES([tools/llvmc/plugins/Base/Base.td])
+
dnl Do the first stage of configuration for llvm-config.in.
AC_CONFIG_FILES([tools/llvm-config/llvm-config.in])
Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=69700&r1=69699&r2=69700&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Tue Apr 21 14:46:10 2009
@@ -899,6 +899,8 @@
LIBTOOL
LLVMGCC
LLVMGXX
+LLVMGCCCOMMAND
+LLVMGXXCOMMAND
USE_UDIS86
HAVE_PTHREAD
HUGE_VAL_SANITY
@@ -5003,6 +5005,13 @@
WITH_LLVMGCCDIR=""
fi
+if test -n "$LLVMGCC"; then
+ LLVMGCCCOMMAND="$LLVMGCC"
+fi
+
+if test -n "$LLVMGXX"; then
+ LLVMGXXCOMMAND="$LLVMGXX"
+fi
if test -n "$LLVMGCC" && test -z "$LLVMGXX"; then
{ { echo "$as_me:$LINENO: error: Invalid llvm-g++. Use --with-llvmgxx when --with-llvmgcc is used" >&5
@@ -26810,6 +26819,13 @@
if test "$WITH_LLVMGCCDIR" = "default" ; then
LLVMGCC="llvm-gcc${EXEEXT}"
LLVMGXX="llvm-g++${EXEEXT}"
+ LLVMGCCCOMMAND="$LLVMGCC"
+ LLVMGXXCOMMAND="$LLVMGXX"
+
+ LLVMGCCCOMMAND=$LLVMGCCCOMMAND
+
+ LLVMGXXCOMMAND=$LLVMGXXCOMMAND
+
# Extract the first word of "$LLVMGCC", so it can be a program name with args.
set dummy $LLVMGCC; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -26893,16 +26909,24 @@
else
if test -z "$LLVMGCC"; then
LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}"
+ LLVMGCCCOMMAND="$LLVMGCC"
fi
if test -z "$LLVMGXX"; then
LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}"
+ LLVMGXXCOMMAND="$LLVMGXX"
fi
+
LLVMGCC=$LLVMGCC
LLVMGXX=$LLVMGXX
+ LLVMGCCCOMMAND=$LLVMGCCCOMMAND
+
+ LLVMGXXCOMMAND=$LLVMGXXCOMMAND
+
fi
+
{ echo "$as_me:$LINENO: checking tool compatibility" >&5
echo $ECHO_N "checking tool compatibility... $ECHO_C" >&6; }
@@ -34003,6 +34027,9 @@
ac_config_files="$ac_config_files docs/doxygen.cfg"
+ac_config_files="$ac_config_files tools/llvmc/plugins/Base/Base.td"
+
+
ac_config_files="$ac_config_files tools/llvm-config/llvm-config.in"
@@ -34617,6 +34644,7 @@
"Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;;
"llvm.spec") CONFIG_FILES="$CONFIG_FILES llvm.spec" ;;
"docs/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES docs/doxygen.cfg" ;;
+ "tools/llvmc/plugins/Base/Base.td") CONFIG_FILES="$CONFIG_FILES tools/llvmc/plugins/Base/Base.td" ;;
"tools/llvm-config/llvm-config.in") CONFIG_FILES="$CONFIG_FILES tools/llvm-config/llvm-config.in" ;;
"setup") CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;;
"Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;;
@@ -34878,6 +34906,8 @@
LIBTOOL!$LIBTOOL$ac_delim
LLVMGCC!$LLVMGCC$ac_delim
LLVMGXX!$LLVMGXX$ac_delim
+LLVMGCCCOMMAND!$LLVMGCCCOMMAND$ac_delim
+LLVMGXXCOMMAND!$LLVMGXXCOMMAND$ac_delim
USE_UDIS86!$USE_UDIS86$ac_delim
HAVE_PTHREAD!$HAVE_PTHREAD$ac_delim
HUGE_VAL_SANITY!$HUGE_VAL_SANITY$ac_delim
@@ -34911,7 +34941,7 @@
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 77; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Removed: llvm/trunk/tools/llvmc/plugins/Base/Base.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Base/Base.td?rev=69699&view=auto
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Base/Base.td (original)
+++ llvm/trunk/tools/llvmc/plugins/Base/Base.td (removed)
@@ -1,202 +0,0 @@
-//===- Base.td - LLVMC2 toolchain descriptions -------------*- tablegen -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains compilation graph description used by llvmc2.
-//
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
-
-// Options
-
-def OptList : OptionList<[
- (switch_option "emit-llvm",
- (help "Emit LLVM .ll files instead of native object files")),
- (switch_option "E",
- (help "Stop after the preprocessing stage, do not run the compiler")),
- (switch_option "fsyntax-only",
- (help "Stop after checking the input for syntax errors")),
- (switch_option "opt",
- (help "Enable opt")),
- (switch_option "S",
- (help "Stop after compilation, do not assemble")),
- (switch_option "c",
- (help "Compile and assemble, but do not link")),
- (switch_option "pthread",
- (help "Enable threads")),
- (parameter_option "linker",
- (help "Choose linker (possible values: gcc, g++)")),
- (parameter_list_option "include",
- (help "Include the named file prior to preprocessing")),
- (prefix_list_option "I",
- (help "Add a directory to include path")),
- (prefix_list_option "Wa,",
- (help "Pass options to assembler")),
- (prefix_list_option "Wllc,",
- (help "Pass options to llc")),
- (prefix_list_option "L",
- (help "Add a directory to link path")),
- (prefix_list_option "l",
- (help "Search a library when linking")),
- (prefix_list_option "Wl,",
- (help "Pass options to linker")),
- (prefix_list_option "Wo,",
- (help "Pass options to opt"))
-]>;
-
-// Tools
-
-class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool<
-[(in_language in_lang),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (cmd_line (case
- (switch_on "E"),
- (case (not_empty "o"),
- !strconcat(cmd_prefix, " -E $INFILE -o $OUTFILE"),
- (default),
- !strconcat(cmd_prefix, " -E $INFILE")),
- (switch_on "fsyntax-only"),
- !strconcat(cmd_prefix, " -fsyntax-only $INFILE"),
- (and (switch_on "S"), (switch_on "emit-llvm")),
- !strconcat(cmd_prefix, " -S $INFILE -o $OUTFILE -emit-llvm"),
- (default),
- !strconcat(cmd_prefix, " -c $INFILE -o $OUTFILE -emit-llvm"))),
- (actions
- (case
- (switch_on "E"), [(stop_compilation), (output_suffix E_ext)],
- (and (switch_on "emit-llvm"), (switch_on "S")),
- [(output_suffix "ll"), (stop_compilation)],
- (and (switch_on "emit-llvm"), (switch_on "c")), (stop_compilation),
- (switch_on "fsyntax-only"), (stop_compilation),
- (not_empty "include"), (forward "include"),
- (not_empty "I"), (forward "I"))),
- (sink)
-]>;
-
-def llvm_gcc_c : llvm_gcc_based<"llvm-gcc -x c", "c", "i">;
-def llvm_gcc_cpp : llvm_gcc_based<"llvm-g++ -x c++", "c++", "i">;
-def llvm_gcc_m : llvm_gcc_based<"llvm-gcc -x objective-c", "objective-c", "mi">;
-def llvm_gcc_mxx : llvm_gcc_based<"llvm-gcc -x objective-c++",
- "objective-c++", "mi">;
-
-def opt : Tool<
-[(in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (actions (case (not_empty "Wo,"), (unpack_values "Wo,"))),
- (cmd_line "opt -f $INFILE -o $OUTFILE")
-]>;
-
-def llvm_as : Tool<
-[(in_language "llvm-assembler"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (cmd_line "llvm-as $INFILE -o $OUTFILE")
-]>;
-
-def llvm_gcc_assembler : Tool<
-[(in_language "assembler"),
- (out_language "object-code"),
- (output_suffix "o"),
- (cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
- (actions (case
- (switch_on "c"), (stop_compilation),
- (not_empty "Wa,"), (unpack_values "Wa,")))
-]>;
-
-def llc : Tool<
-[(in_language "llvm-bitcode"),
- (out_language "assembler"),
- (output_suffix "s"),
- (cmd_line "llc -f $INFILE -o $OUTFILE"),
- (actions (case
- (switch_on "S"), (stop_compilation),
- (not_empty "Wllc,"), (unpack_values "Wllc,")))
-]>;
-
-// Base class for linkers
-class llvm_gcc_based_linker <string cmd_prefix> : Tool<
-[(in_language "object-code"),
- (out_language "executable"),
- (output_suffix "out"),
- (cmd_line !strconcat(cmd_prefix, " $INFILE -o $OUTFILE")),
- (join),
- (actions (case
- (switch_on "pthread"), (append_cmd "-lpthread"),
- (not_empty "L"), (forward "L"),
- (not_empty "l"), (forward "l"),
- (not_empty "Wl,"), (unpack_values "Wl,")))
-]>;
-
-// Default linker
-def llvm_gcc_linker : llvm_gcc_based_linker<"llvm-gcc">;
-// Alternative linker for C++
-def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"llvm-g++">;
-
-// Language map
-
-def LanguageMap : LanguageMap<
- [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
- LangToSuffixes<"c", ["c"]>,
- LangToSuffixes<"c-cpp-output", ["i"]>,
- LangToSuffixes<"objective-c-cpp-output", ["mi"]>,
- LangToSuffixes<"objective-c++", ["mm"]>,
- LangToSuffixes<"objective-c", ["m"]>,
- LangToSuffixes<"assembler", ["s"]>,
- LangToSuffixes<"assembler-with-cpp", ["S"]>,
- LangToSuffixes<"llvm-assembler", ["ll"]>,
- LangToSuffixes<"llvm-bitcode", ["bc"]>,
- LangToSuffixes<"object-code", ["o"]>,
- LangToSuffixes<"executable", ["out"]>
- ]>;
-
-// Compilation graph
-
-def CompilationGraph : CompilationGraph<[
- Edge<"root", "llvm_gcc_c">,
- Edge<"root", "llvm_gcc_assembler">,
- Edge<"root", "llvm_gcc_cpp">,
- Edge<"root", "llvm_gcc_m">,
- Edge<"root", "llvm_gcc_mxx">,
- Edge<"root", "llvm_as">,
-
- Edge<"llvm_gcc_c", "llc">,
- Edge<"llvm_gcc_cpp", "llc">,
- Edge<"llvm_gcc_m", "llc">,
- Edge<"llvm_gcc_mxx", "llc">,
- Edge<"llvm_as", "llc">,
-
- OptionalEdge<"llvm_gcc_c", "opt", (case (switch_on "opt"), (inc_weight))>,
- OptionalEdge<"llvm_gcc_cpp", "opt", (case (switch_on "opt"), (inc_weight))>,
- OptionalEdge<"llvm_gcc_m", "opt", (case (switch_on "opt"), (inc_weight))>,
- OptionalEdge<"llvm_gcc_mxx", "opt", (case (switch_on "opt"), (inc_weight))>,
- OptionalEdge<"llvm_as", "opt", (case (switch_on "opt"), (inc_weight))>,
- Edge<"opt", "llc">,
-
- Edge<"llc", "llvm_gcc_assembler">,
- Edge<"llvm_gcc_assembler", "llvm_gcc_linker">,
- OptionalEdge<"llvm_gcc_assembler", "llvm_gcc_cpp_linker",
- (case
- (or (input_languages_contain "c++"),
- (input_languages_contain "objective-c++")),
- (inc_weight),
- (or (parameter_equals "linker", "g++"),
- (parameter_equals "linker", "c++")), (inc_weight))>,
-
-
- Edge<"root", "llvm_gcc_linker">,
- OptionalEdge<"root", "llvm_gcc_cpp_linker",
- (case
- (or (input_languages_contain "c++"),
- (input_languages_contain "objective-c++")),
- (inc_weight),
- (or (parameter_equals "linker", "g++"),
- (parameter_equals "linker", "c++")), (inc_weight))>
- ]>;
Copied: llvm/trunk/tools/llvmc/plugins/Base/Base.td.in (from r69665, llvm/trunk/tools/llvmc/plugins/Base/Base.td)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Base/Base.td.in?p2=llvm/trunk/tools/llvmc/plugins/Base/Base.td.in&p1=llvm/trunk/tools/llvmc/plugins/Base/Base.td&r1=69665&r2=69700&rev=69700&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Base/Base.td (original)
+++ llvm/trunk/tools/llvmc/plugins/Base/Base.td.in Tue Apr 21 14:46:10 2009
@@ -80,10 +80,10 @@
(sink)
]>;
-def llvm_gcc_c : llvm_gcc_based<"llvm-gcc -x c", "c", "i">;
-def llvm_gcc_cpp : llvm_gcc_based<"llvm-g++ -x c++", "c++", "i">;
-def llvm_gcc_m : llvm_gcc_based<"llvm-gcc -x objective-c", "objective-c", "mi">;
-def llvm_gcc_mxx : llvm_gcc_based<"llvm-gcc -x objective-c++",
+def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i">;
+def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i">;
+def llvm_gcc_m : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c", "objective-c", "mi">;
+def llvm_gcc_mxx : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++",
"objective-c++", "mi">;
def opt : Tool<
@@ -105,7 +105,7 @@
[(in_language "assembler"),
(out_language "object-code"),
(output_suffix "o"),
- (cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
+ (cmd_line "@LLVMGCCCOMMAND@ -c -x assembler $INFILE -o $OUTFILE"),
(actions (case
(switch_on "c"), (stop_compilation),
(not_empty "Wa,"), (unpack_values "Wa,")))
@@ -136,9 +136,9 @@
]>;
// Default linker
-def llvm_gcc_linker : llvm_gcc_based_linker<"llvm-gcc">;
+def llvm_gcc_linker : llvm_gcc_based_linker<"@LLVMGCCCOMMAND@">;
// Alternative linker for C++
-def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"llvm-g++">;
+def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"@LLVMGXXCOMMAND@">;
// Language map
More information about the llvm-commits
mailing list