[llvm-commits] CVS: llvm/tools/llvmc/c cpp ll CompilerDriver.cpp CompilerDriver.h ConfigLexer.h ConfigLexer.l Configuration.cpp Makefile c.in cpp.in ll.in
Alkis Evlogimenos
alkis at cs.uiuc.edu
Wed May 18 17:52:40 PDT 2005
Changes in directory llvm/tools/llvmc:
c added (r1.1)
cpp updated: 1.2 -> 1.3
ll updated: 1.6 -> 1.7
CompilerDriver.cpp updated: 1.30 -> 1.31
CompilerDriver.h updated: 1.17 -> 1.18
ConfigLexer.h updated: 1.12 -> 1.13
ConfigLexer.l updated: 1.12 -> 1.13
Configuration.cpp updated: 1.19 -> 1.20
Makefile updated: 1.14 -> 1.15
c.in (r1.4) removed
cpp.in (r1.4) removed
ll.in (r1.1) removed
---
Log message:
For PR514: http://llvm.cs.uiuc.edu/PR514 :
* language specification files are no longer configured with "configure"
* add substitutions for %bindir%, %libdir%, and various llvmgcc related
variables needed in the c and cpp spec files.
* Implement the stubstituions in the Compiler Driver.
* Move st.in to projects/Stacker/tools/stkrc where it belongs.
---
Diffs of the changes: (+252 -54)
CompilerDriver.cpp | 34 +++++++++++++++++
CompilerDriver.h | 1
ConfigLexer.h | 102 ++++++++++++++++++++++++++++-------------------------
ConfigLexer.l | 8 ++++
Configuration.cpp | 2 +
Makefile | 25 +++++++++---
c | 61 +++++++++++++++++++++++++++++++
cpp | 61 +++++++++++++++++++++++++++++++
ll | 12 ++++++
9 files changed, 252 insertions(+), 54 deletions(-)
Index: llvm/tools/llvmc/c
diff -c /dev/null llvm/tools/llvmc/c:1.1
*** /dev/null Wed May 18 19:52:39 2005
--- llvm/tools/llvmc/c Wed May 18 19:52:29 2005
***************
*** 0 ****
--- 1,61 ----
+ # C configuration file for llvmc
+
+ ##########################################################
+ # Language definitions
+ ##########################################################
+ lang.name=C
+ lang.opt1=-O1
+ lang.opt2=-O2
+ lang.opt3=-O3
+ lang.opt4=-O3
+ lang.opt5=-O3
+ lang.libs=%llvmgccdir%/lib %llvmgccdir%/lib \
+ %llvmgccdir%/lib/gcc/%llvmgccarch%
+
+ ##########################################################
+ # Pre-processor definitions
+ ##########################################################
+
+ # We use gcc as our pre-processor
+ preprocessor.command=gcc -E %in% -o %out% %incls% %defs%
+ preprocessor.required=true
+
+ ##########################################################
+ # Translator definitions
+ ##########################################################
+
+ # To compile C source, just use llvm-gcc's cc1
+ translator.command=%llvmcc1% -quiet %in% -o %out% \
+ %opt% %incls% %defs% %WOpts% %fOpts% %MOpts% %args% \
+ -D_GNU_SOURCE
+
+ # llvm-gcc does not pre-process
+ translator.preprocesses=false
+
+ # The translator is required to run.
+ translator.required=true
+
+ # Output of the translator is assembly
+ translator.output=assembly
+
+ ##########################################################
+ # Optimizer definitions
+ ##########################################################
+
+ # Use gccas to clean up the generated code
+ optimizer.command=%bindir%/gccas %in% -o %out% %args%
+ optimizer.required = true
+
+ # gccas doesn't translate
+ optimizer.translates = false
+
+ # gccas doesn't preprocess
+ optimizer.preprocesses=false
+
+ # gccas produces bytecode
+ optimizer.output = bytecode
+
+ ##########################################################
+ # Assembler definitions
+ ##########################################################
+ assembler.command=%bindir%/llc %in% -o %out% %target% %time% %stats%
Index: llvm/tools/llvmc/cpp
diff -u /dev/null llvm/tools/llvmc/cpp:1.3
--- /dev/null Wed May 18 19:52:40 2005
+++ llvm/tools/llvmc/cpp Wed May 18 19:52:29 2005
@@ -0,0 +1,61 @@
+# C++ configuration file for llvmc
+
+##########################################################
+# Language definitions
+##########################################################
+ lang.name=C++
+ lang.opt1=-O1
+ lang.opt2=-O2
+ lang.opt3=-O3
+ lang.opt4=-O3
+ lang.opt5=-O3
+ lang.libs=%llvmgccdir%/lib %llvmgccdir%/lib \
+ %llvmgccdir%/lib/gcc/%llvmgccarch%
+
+##########################################################
+# Pre-processor definitions
+##########################################################
+
+ # We use g++ as our pre-processor
+ preprocessor.command=g++ -E %in% -o %out% %incls% %defs%
+ preprocessor.required=true
+
+##########################################################
+# Translator definitions
+##########################################################
+
+ # To compile C++ source, just use llvm-g++'s cc1
+ translator.command=%llvmcc1plus% -quiet %in% -o %out% \
+ %opt% %incls% %defs% %WOpts% %fOpts% %MOpts% %args% \
+ -D_GNU_SOURCE
+
+ # llvm-g++ does not pre-process
+ translator.preprocesses=false
+
+ # The translator is required to run.
+ translator.required=true
+
+ # Output of translator is assembly
+ translator.output=assembly
+
+##########################################################
+# Optimizer definitions
+##########################################################
+
+ # Use gccas to clean up the generated code
+ optimizer.command=%bindir%/gccas %in% -o %out% %args%
+ optimizer.required = true
+
+ # gccas doesn't translate
+ optimizer.translates = false
+
+ # gccas doesn't preprocess
+ optimizer.preprocesses=false
+
+ # gccas produces bytecode
+ optimizer.output = bytecode
+
+##########################################################
+# Assembler definitions
+##########################################################
+ assembler.command=%bindir%/llc %in% -o %out% %target% %time% %stats%
Index: llvm/tools/llvmc/ll
diff -u /dev/null llvm/tools/llvmc/ll:1.7
--- /dev/null Wed May 18 19:52:40 2005
+++ llvm/tools/llvmc/ll Wed May 18 19:52:29 2005
@@ -0,0 +1,12 @@
+# LLVM Assembly Config File For llvmc
+ version="1.0"
+ lang.name=LLVM Assembly
+ preprocessor.command=
+ preprocessor.required=false
+ translator.command=%bindir%/llvm-as %in% -o %out%
+ translator.optimizes=no
+ translator.preprocesses=true
+ translator.required=TRUE
+ optimizer.command=%bindir%/opt %in% -o %out% %opt% %args%
+ optimizer.translates=no
+ assembler.command=%bindir%/llc %in% -o %out%
Index: llvm/tools/llvmc/CompilerDriver.cpp
diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.30 llvm/tools/llvmc/CompilerDriver.cpp:1.31
--- llvm/tools/llvmc/CompilerDriver.cpp:1.30 Tue May 3 15:30:34 2005
+++ llvm/tools/llvmc/CompilerDriver.cpp Wed May 18 19:52:29 2005
@@ -249,6 +249,14 @@
} else
found = false;
break;
+ case 'b':
+ if (*PI == "%bindir%") {
+ std::string tmp(*PI);
+ tmp.replace(0,8,LLVM_BINDIR);
+ action->args.push_back(tmp);
+ } else
+ found = false;
+ break;
case 'd':
if (*PI == "%defs%") {
StringVector::iterator I = Defines.begin();
@@ -282,13 +290,35 @@
found = false;
break;
case 'l':
- if (*PI == "%libs%") {
+ if ((*PI)[1] == 'l') {
+ std::string tmp(*PI);
+ if (*PI == "%llvmgccdir%")
+ tmp.replace(0,12,LLVMGCCDIR);
+ else if (*PI == "%llvmgccarch%")
+ tmp.replace(0,13,LLVMGCCARCH);
+ else if (*PI == "%llvmgcc%")
+ tmp.replace(0,9,LLVMGCC);
+ else if (*PI == "%llvmgxx%")
+ tmp.replace(0,9,LLVMGXX);
+ else if (*PI == "%llvmcc1%")
+ tmp.replace(0,9,LLVMCC1);
+ else if (*PI == "%llvmcc1plus%")
+ tmp.replace(0,9,LLVMCC1);
+ else
+ found = false;
+ if (found)
+ action->args.push_back(tmp);
+ } else if (*PI == "%libs%") {
PathVector::iterator I = LibraryPaths.begin();
PathVector::iterator E = LibraryPaths.end();
while (I != E) {
action->args.push_back( std::string("-L") + I->toString() );
++I;
}
+ } else if (*PI == "%libdir%") {
+ std::string tmp(*PI);
+ tmp.replace(0,8,LLVM_LIBDIR);
+ action->args.push_back(tmp);
} else
found = false;
break;
@@ -896,6 +926,8 @@
CompilerDriver::~CompilerDriver() {
}
+CompilerDriver::ConfigDataProvider::~ConfigDataProvider() {}
+
CompilerDriver*
CompilerDriver::Get(ConfigDataProvider& CDP) {
return new CompilerDriverImpl(CDP);
Index: llvm/tools/llvmc/CompilerDriver.h
diff -u llvm/tools/llvmc/CompilerDriver.h:1.17 llvm/tools/llvmc/CompilerDriver.h:1.18
--- llvm/tools/llvmc/CompilerDriver.h:1.17 Thu Apr 21 18:59:45 2005
+++ llvm/tools/llvmc/CompilerDriver.h Wed May 18 19:52:29 2005
@@ -110,6 +110,7 @@
/// @brief Configuration Data Provider interface
class ConfigDataProvider {
public:
+ virtual ~ConfigDataProvider();
virtual ConfigData* ProvideConfigData(const std::string& filetype) = 0;
virtual void setConfigDir(const sys::Path& dirName) = 0;
};
Index: llvm/tools/llvmc/ConfigLexer.h
diff -u llvm/tools/llvmc/ConfigLexer.h:1.12 llvm/tools/llvmc/ConfigLexer.h:1.13
--- llvm/tools/llvmc/ConfigLexer.h:1.12 Thu Apr 21 18:59:45 2005
+++ llvm/tools/llvmc/ConfigLexer.h Wed May 18 19:52:29 2005
@@ -48,53 +48,61 @@
extern InputProvider* ConfigLexerInput;
enum ConfigLexerTokens {
- EOFTOK = 0, ///< Returned by Configlex when we hit end of file
- EOLTOK, ///< End of line
- ERRORTOK, ///< Error token
- ARGS_SUBST, ///< THe substitution item %args%
- ASSEMBLY, ///< The value "assembly" (and variants)
- ASSEMBLER, ///< The name "assembler" (and variants)
- BYTECODE, ///< The value "bytecode" (and variants)
- COMMAND, ///< The name "command" (and variants)
- DEFS_SUBST, ///< The substitution item %defs%
- EQUALS, ///< The equals sign, =
- FALSETOK, ///< A boolean false value (false/no/off)
- FOPTS_SUBST, ///< The substitution item %fOpts%
- IN_SUBST, ///< The substitution item %in%
- INCLS_SUBST, ///< The substitution item %incls%
- INTEGER, ///< An integer
- LANG, ///< The name "lang" (and variants)
- LIBPATHS, ///< The name "libpaths" (and variants)
- LIBS, ///< The name "libs" (and variants)
- LIBS_SUBST, ///< The substitution item %libs%
- LINKER, ///< The name "linker" (and variants)
- MOPTS_SUBST, ///< The substitution item %Mopts%
- NAME, ///< The name "name" (and variants)
- OPT_SUBST, ///< The substitution item %opt%
- OPTIMIZER, ///< The name "optimizer" (and variants)
- OPTION, ///< A command line option
- OPT1, ///< The name "opt1" (and variants)
- OPT2, ///< The name "opt2" (and variants)
- OPT3, ///< The name "opt3" (and variants)
- OPT4, ///< The name "opt4" (and variants)
- OPT5, ///< The name "opt5" (and variants)
- OUT_SUBST, ///< The output substitution item %out%
- OUTPUT, ///< The name "output" (and variants)
- PREPROCESSES, ///< The name "preprocesses" (and variants)
- PREPROCESSOR, ///< The name "preprocessor" (and variants)
- REQUIRED, ///< The name "required" (and variants)
- SEPARATOR, ///< A configuration item separator
- SPACE, ///< Space between options
- STATS_SUBST, ///< The stats substitution item %stats%
- STRING, ///< A quoted string
- TARGET_SUBST, ///< The substitition item %target%
- TIME_SUBST, ///< The substitution item %time%
- TRANSLATES, ///< The name "translates" (and variants)
- TRANSLATOR, ///< The name "translator" (and variants)
- TRUETOK, ///< A boolean true value (true/yes/on)
- VERBOSE_SUBST,///< The substitution item %verbose%
- VERSION_TOK, ///< The name "version" (and variants)
- WOPTS_SUBST, ///< The %WOpts% substitution
+ EOFTOK = 0, ///< Returned by Configlex when we hit end of file
+ EOLTOK, ///< End of line
+ ERRORTOK, ///< Error token
+ ARGS_SUBST, ///< The substitution item %args%
+ BINDIR_SUBST, ///< The substitution item %bindir%
+ ASSEMBLY, ///< The value "assembly" (and variants)
+ ASSEMBLER, ///< The name "assembler" (and variants)
+ BYTECODE, ///< The value "bytecode" (and variants)
+ COMMAND, ///< The name "command" (and variants)
+ DEFS_SUBST, ///< The substitution item %defs%
+ EQUALS, ///< The equals sign, =
+ FALSETOK, ///< A boolean false value (false/no/off)
+ FOPTS_SUBST, ///< The substitution item %fOpts%
+ IN_SUBST, ///< The substitution item %in%
+ INCLS_SUBST, ///< The substitution item %incls%
+ INTEGER, ///< An integer
+ LANG, ///< The name "lang" (and variants)
+ LIBDIR_SUBST, ///< The substitution item %libdir%
+ LIBPATHS, ///< The name "libpaths" (and variants)
+ LIBS, ///< The name "libs" (and variants)
+ LIBS_SUBST, ///< The substitution item %libs%
+ LINKER, ///< The name "linker" (and variants)
+ LLVMGCCDIR_SUBST, ///< The substitution item %llvmgccdir%
+ LLVMGCCARCH_SUBST, ///< The substitution item %llvmgccarch%
+ LLVMGCC_SUBST, ///< The substitution item %llvmgcc%
+ LLVMGXX_SUBST, ///< The substitution item %llvmgxx%
+ LLVMCC1_SUBST, ///< The substitution item %llvmcc1%
+ LLVMCC1PLUS_SUBST, ///< The substitution item %llvmcc1plus%
+ MOPTS_SUBST, ///< The substitution item %Mopts%
+ NAME, ///< The name "name" (and variants)
+ OPT_SUBST, ///< The substitution item %opt%
+ OPTIMIZER, ///< The name "optimizer" (and variants)
+ OPTION, ///< A command line option
+ OPT1, ///< The name "opt1" (and variants)
+ OPT2, ///< The name "opt2" (and variants)
+ OPT3, ///< The name "opt3" (and variants)
+ OPT4, ///< The name "opt4" (and variants)
+ OPT5, ///< The name "opt5" (and variants)
+ OUT_SUBST, ///< The output substitution item %out%
+ OUTPUT, ///< The name "output" (and variants)
+ PREPROCESSES, ///< The name "preprocesses" (and variants)
+ PREPROCESSOR, ///< The name "preprocessor" (and variants)
+ REQUIRED, ///< The name "required" (and variants)
+ SEPARATOR, ///< A configuration item separator
+ SPACE, ///< Space between options
+ STATS_SUBST, ///< The stats substitution item %stats%
+ STRING, ///< A quoted string
+ TARGET_SUBST, ///< The substitition item %target%
+ TIME_SUBST, ///< The substitution item %time%
+ TRANSLATES, ///< The name "translates" (and variants)
+ TRANSLATOR, ///< The name "translator" (and variants)
+ TRUETOK, ///< A boolean true value (true/yes/on)
+ VERBOSE_SUBST, ///< The substitution item %verbose%
+ VERSION_TOK, ///< The name "version" (and variants)
+ WOPTS_SUBST, ///< The %WOpts% substitution
};
extern ConfigLexerTokens Configlex();
Index: llvm/tools/llvmc/ConfigLexer.l
diff -u llvm/tools/llvmc/ConfigLexer.l:1.12 llvm/tools/llvmc/ConfigLexer.l:1.13
--- llvm/tools/llvmc/ConfigLexer.l:1.12 Fri Dec 10 15:59:47 2004
+++ llvm/tools/llvmc/ConfigLexer.l Wed May 18 19:52:29 2005
@@ -163,10 +163,18 @@
{LINKER} { return handleNameContext(LINKER); }
%args% { return handleSubstitution(ARGS_SUBST); }
+%bindir% { return handleSubstitution(BINDIR_SUBST); }
%defs% { return handleSubstitution(DEFS_SUBST); }
%in% { return handleSubstitution(IN_SUBST); }
%incls% { return handleSubstitution(INCLS_SUBST); }
+%libdir% { return handleSubstitution(LIBDIR_SUBST); }
%libs% { return handleSubstitution(LIBS_SUBST); }
+%llvmgccdir% { return handleSubstitution(LLVMGCCDIR_SUBST); }
+%llvmgccarch% { return handleSubstitution(LLVMGCCARCH_SUBST); }
+%llvmgcc% { return handleSubstitution(LLVMGCC_SUBST); }
+%llvmgxx% { return handleSubstitution(LLVMGXX_SUBST); }
+%llvmcc1% { return handleSubstitution(LLVMCC1_SUBST); }
+%llvmcc1plus% { return handleSubstitution(LLVMCC1PLUS_SUBST); }
%opt% { return handleSubstitution(OPT_SUBST); }
%out% { return handleSubstitution(OUT_SUBST); }
%stats% { return handleSubstitution(STATS_SUBST); }
Index: llvm/tools/llvmc/Configuration.cpp
diff -u llvm/tools/llvmc/Configuration.cpp:1.19 llvm/tools/llvmc/Configuration.cpp:1.20
--- llvm/tools/llvmc/Configuration.cpp:1.19 Tue May 3 15:30:34 2005
+++ llvm/tools/llvmc/Configuration.cpp Wed May 18 19:52:29 2005
@@ -167,9 +167,11 @@
bool parseSubstitution(CompilerDriver::StringVector& optList) {
switch (token) {
case ARGS_SUBST: optList.push_back("%args%"); break;
+ case BINDIR_SUBST: optList.push_back("%bindir%"); break;
case DEFS_SUBST: optList.push_back("%defs%"); break;
case IN_SUBST: optList.push_back("%in%"); break;
case INCLS_SUBST: optList.push_back("%incls%"); break;
+ case LIBDIR_SUBST: optList.push_back("%libdir%"); break;
case LIBS_SUBST: optList.push_back("%libs%"); break;
case OPT_SUBST: optList.push_back("%opt%"); break;
case OUT_SUBST: optList.push_back("%out%"); break;
Index: llvm/tools/llvmc/Makefile
diff -u llvm/tools/llvmc/Makefile:1.14 llvm/tools/llvmc/Makefile:1.15
--- llvm/tools/llvmc/Makefile:1.14 Thu Feb 24 15:43:43 2005
+++ llvm/tools/llvmc/Makefile Wed May 18 19:52:29 2005
@@ -9,14 +9,27 @@
LEVEL = ../..
TOOLNAME = llvmc
USEDLIBS = LLVMBCReader LLVMCore LLVMSupport.a LLVMbzip2 LLVMSystem.a
-CONFIG_FILES = c cpp ll st
-EXTRA_DIST = c cpp ll st
+CONFIG_FILES = c cpp ll
+EXTRA_DIST = c cpp ll
+
+# The CompilerDriver needs to know the locations of several configured
+# directories and paths. We define these as preprocessor symbols so they can
+# be hard coded into the process based on the configuration. Only those
+# configuration values not available in llvm/include/Config/config.h need to be
+# specified here. These values are used as the replacements for the
+# configuration file substitution variables such as %llvmgccdir%
+CPPFLAGS = -DLLVMGCCDIR="\"$(LLVMGCCDIR)\"" \
+ -DLLVMGCCARCH="\"$(LLVMGCCARCH)\"" \
+ -DLLVMGCC="\"$(LLVMGCC)\"" \
+ -DLLVMGXX="\"$(LLVMGXX)\"" \
+ -DLLVMCC1="\"$(LLVMCC1)\"" \
+ -DLLVMCC1PLUS="$(LLVMCC1PLUS)"
include $(LEVEL)/Makefile.common
install::
$(Echo) Installing additional C++ configuration clones
- $(Verb)$(DataInstall) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/cc
- $(Verb)$(DataInstall) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/c++
- $(Verb)$(DataInstall) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/cxx
- $(Verb)$(DataInstall) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/C
+ $(Verb)$(DataInstall) $(PROJ_SRC_DIR)/cpp $(PROJ_etcdir)/cc
+ $(Verb)$(DataInstall) $(PROJ_SRC_DIR)/cpp $(PROJ_etcdir)/c++
+ $(Verb)$(DataInstall) $(PROJ_SRC_DIR)/cpp $(PROJ_etcdir)/cxx
+ $(Verb)$(DataInstall) $(PROJ_SRC_DIR)/cpp $(PROJ_etcdir)/C
More information about the llvm-commits
mailing list