From: Eric Christopher Date: Thu, 15 May 2014 01:10:50 +0000 (+0000) Subject: Unify command line handling of MCTargetOptions and remove extra X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=475ac5d302ba84ac13d34a9215c29c1a38ca5690;p=oota-llvm.git Unify command line handling of MCTargetOptions and remove extra options and code. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208833 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/CommandFlags.h b/include/llvm/CodeGen/CommandFlags.h index 619826cf622..ac789e4af8a 100644 --- a/include/llvm/CodeGen/CommandFlags.h +++ b/include/llvm/CodeGen/CommandFlags.h @@ -70,11 +70,6 @@ CMModel("code-model", "Large code model"), clEnumValEnd)); -cl::opt -RelaxAll("mc-relax-all", - cl::desc("When used with filetype=obj, " - "relax all fixups in the emitted object file")); - cl::opt FileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile), cl::desc("Choose a file type (not all types are supported by all targets):"), @@ -87,9 +82,6 @@ FileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile), "Emit nothing, for performance testing"), clEnumValEnd)); -cl::opt EnableDwarfDirectory("enable-dwarf-directory", cl::Hidden, - cl::desc("Use .file directives with an explicit directory.")); - cl::opt DisableRedZone("disable-red-zone", cl::desc("Do not emit code that uses the red zone."), diff --git a/include/llvm/MC/MCTargetOptionsCommandFlags.h b/include/llvm/MC/MCTargetOptionsCommandFlags.h index b26fd944d82..0dddc2fdfb1 100644 --- a/include/llvm/MC/MCTargetOptionsCommandFlags.h +++ b/include/llvm/MC/MCTargetOptionsCommandFlags.h @@ -20,22 +20,37 @@ using namespace llvm; cl::opt AsmInstrumentation( - "asm-instrumentation", - cl::desc("Instrumentation of inline assembly and " - "assembly source files"), + "asm-instrumentation", cl::desc("Instrumentation of inline assembly and " + "assembly source files"), cl::init(MCTargetOptions::AsmInstrumentationNone), - cl::values(clEnumValN(MCTargetOptions::AsmInstrumentationNone, - "none", + cl::values(clEnumValN(MCTargetOptions::AsmInstrumentationNone, "none", "no instrumentation at all"), - clEnumValN(MCTargetOptions::AsmInstrumentationAddress, - "address", + clEnumValN(MCTargetOptions::AsmInstrumentationAddress, "address", "instrument instructions with memory arguments"), clEnumValEnd)); +cl::opt RelaxAll("mc-relax-all", + cl::desc("When used with filetype=obj, " + "relax all fixups in the emitted object file")); + +cl::opt EnableDwarfDirectory( + "enable-dwarf-directory", cl::Hidden, + cl::desc("Use .file directives with an explicit directory.")); + +cl::opt NoExecStack("mc-no-exec-stack", + cl::desc("File doesn't need an exec stack")); + +static cl::opt +SaveTempLabels("L", cl::desc("Don't discard temporary labels")); + static inline MCTargetOptions InitMCTargetOptionsFromFlags() { MCTargetOptions Options; Options.SanitizeAddress = (AsmInstrumentation == MCTargetOptions::AsmInstrumentationAddress); + Options.MCRelaxAll = RelaxAll; + Options.MCUseDwarfDirectory = EnableDwarfDirectory; + Options.MCNoExecStack = NoExecStack; + Options.MCSaveTempLabels = SaveTempLabels; return Options; } diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 712817d9347..269a5df9041 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -287,9 +287,6 @@ static int compileModule(char **argv, LLVMContext &Context) { assert(mod && "Should have exited if we didn't have a module!"); TargetMachine &Target = *target.get(); - if (EnableDwarfDirectory) - Target.setMCUseDwarfDirectory(true); - if (GenerateSoftFloatCalls) FloatABIForCalls = FloatABI::Soft; @@ -315,13 +312,10 @@ static int compileModule(char **argv, LLVMContext &Context) { // Override default to generate verbose assembly. Target.setAsmVerbosityDefault(true); - if (RelaxAll) { - if (FileType != TargetMachine::CGFT_ObjectFile) - errs() << argv[0] + if (RelaxAll.getNumOccurrences() > 0 && + FileType != TargetMachine::CGFT_ObjectFile) + errs() << argv[0] << ": warning: ignoring -mc-relax-all because filetype != obj"; - else - Target.setMCRelaxAll(true); - } { formatted_raw_ostream FOS(Out->os()); diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 364ae73401e..e87f1eef282 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -65,12 +65,6 @@ static cl::opt OutputAsmVariant("output-asm-variant", cl::desc("Syntax variant to use for output printing")); -static cl::opt -RelaxAll("mc-relax-all", cl::desc("Relax all fixups")); - -static cl::opt -NoExecStack("mc-no-exec-stack", cl::desc("File doesn't need an exec stack")); - enum OutputFileType { OFT_Null, OFT_AssemblyFile, @@ -147,9 +141,6 @@ static cl::opt NoInitialTextSection("n", cl::desc("Don't assume assembly file starts " "in the text section")); -static cl::opt -SaveTempLabels("L", cl::desc("Don't discard temporary labels")); - static cl::opt GenDwarfForAssembly("g", cl::desc("Generate dwarf debugging info for assembly " "source files"));