diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-08-14 09:37:15 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-08-14 09:37:15 +0000 |
commit | 68fb37ad67d59051585cb7245f802f5c753c074f (patch) | |
tree | 043a3f6ce28486c1eed6210bf69f69a8116393fb /tools/llvmc/CompilerDriver.cpp | |
parent | a3f185577ceff0648a252d1db1dec9a822f0659c (diff) |
Converted to use flex for tokenizing input so we can use an easier to
understand recursive descent parser, we can easily handle more syntax
variety, and we can more easily change the configuration items accepted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc/CompilerDriver.cpp')
-rw-r--r-- | tools/llvmc/CompilerDriver.cpp | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/tools/llvmc/CompilerDriver.cpp b/tools/llvmc/CompilerDriver.cpp index f1d3e58bad..ff63b2100e 100644 --- a/tools/llvmc/CompilerDriver.cpp +++ b/tools/llvmc/CompilerDriver.cpp @@ -29,8 +29,38 @@ namespace { if ( dotpos = std::string::npos ) return ""; return fullName.substr(dotpos+1); } + const char OutputSuffix[] = ".o"; + void WriteAction(CompilerDriver::Action* a) { + std::cerr << a->program; + std::vector<std::string>::iterator I = a->args.begin(); + while (I != a->args.end()) { + std::cerr << " " + *I; + ++I; + } + std::cerr << "\n"; + } + + void DumpConfigData(CompilerDriver::ConfigData* cd, const std::string& type ){ + std::cerr << "Configuration Data For '" << cd->langName << "' (" << type + << ")\n"; + std::cerr << "translator.preprocesses=" << cd->TranslatorPreprocesses + << "\n"; + std::cerr << "translator.groks_dash_O=" << cd->TranslatorGroksDashO << "\n"; + std::cerr << "translator.optimizes=" << cd->TranslatorOptimizes << "\n"; + std::cerr << "preprocessor.needed=" << cd->PreprocessorNeeded << "\n"; + std::cerr << "PreProcessor: "; + WriteAction(&cd->PreProcessor); + std::cerr << "Translator: "; + WriteAction(&cd->Translator); + std::cerr << "Optimizer: "; + WriteAction(&cd->Optimizer); + std::cerr << "Assembler: "; + WriteAction(&cd->Assembler); + std::cerr << "Linker: "; + WriteAction(&cd->Linker); + } } @@ -80,21 +110,13 @@ CompilerDriver::Action* CompilerDriver::GetAction(ConfigData* cd, } assert(pat != 0 && "Invalid command pattern"); Action* a = new Action(*pat); - a->args[pat->inputAt] = input; - a->args[pat->outputAt] = output; + if (pat->inputAt < a->args.size()) + a->args[pat->inputAt] = input; + if (pat->outputAt < a->args.size()) + a->args[pat->outputAt] = output; return a; } -void CompilerDriver::WriteAction(Action* a) { - std::cerr << a->program; - std::vector<std::string>::iterator I = a->args.begin(); - while (I != a->args.end()) { - std::cerr << " " + *I; - ++I; - } - std::cerr << "\n"; -} - void CompilerDriver::DoAction(Action*a) { if (isVerbose) @@ -170,6 +192,8 @@ int CompilerDriver::execute(const InputList& InpList, if (cd == 0) error(std::string("Files of type '") + I->second + "' are not recognized." ); + if (isDebug) + DumpConfigData(cd,I->second); // We have valid configuration data, now figure out where the output // of compilation should end up. |