From bf177ee6fd234dee70ebf6f0ef7c39b55f8ed4f5 Mon Sep 17 00:00:00 2001 From: Sandeep Patel Date: Wed, 11 Nov 2009 03:23:46 +0000 Subject: [PATCH] Show command-line args and features passed into backend in debug output. Approved by Evan Cheng. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86797 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/CommandLine.cpp | 6 ++++++ utils/TableGen/SubtargetEmitter.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 626daa254dd..07900d84936 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -17,6 +17,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/ManagedStatic.h" @@ -765,6 +766,11 @@ void cl::ParseCommandLineOptions(int argc, char **argv, free(*i); } + DEBUG(errs() << "\nArgs: "; + for (int i = 0; i < argc; ++i) + errs() << argv[i] << ' '; + ); + // If we had an error processing our arguments, don't let the program execute if (ErrorParsing) exit(1); } diff --git a/utils/TableGen/SubtargetEmitter.cpp b/utils/TableGen/SubtargetEmitter.cpp index c8cf234ca46..0dbfcbef30c 100644 --- a/utils/TableGen/SubtargetEmitter.cpp +++ b/utils/TableGen/SubtargetEmitter.cpp @@ -519,6 +519,8 @@ void SubtargetEmitter::ParseFeaturesFunction(raw_ostream &OS) { OS << Target; OS << "Subtarget::ParseSubtargetFeatures(const std::string &FS,\n" << " const std::string &CPU) {\n" + << " DEBUG(errs() << \"\\nFeatures:\" << FS);\n" + << " DEBUG(errs() << \"\\nCPU:\" << CPU);\n" << " SubtargetFeatures Features(FS);\n" << " Features.setCPUIfNone(CPU);\n" << " uint32_t Bits = Features.getBits(SubTypeKV, SubTypeKVSize,\n" @@ -558,6 +560,8 @@ void SubtargetEmitter::run(raw_ostream &OS) { EmitSourceFileHeader("Subtarget Enumeration Source Fragment", OS); + OS << "#include \"llvm/Support/Debug.h\"\n"; + OS << "#include \"llvm/Support/raw_ostream.h\"\n"; OS << "#include \"llvm/Target/SubtargetFeature.h\"\n"; OS << "#include \"llvm/Target/TargetInstrItineraries.h\"\n\n"; -- 2.34.1