[llvm] r208833 - Unify command line handling of MCTargetOptions and remove extra
Eric Christopher
echristo at gmail.com
Wed May 14 18:10:50 PDT 2014
Author: echristo
Date: Wed May 14 20:10:50 2014
New Revision: 208833
URL: http://llvm.org/viewvc/llvm-project?rev=208833&view=rev
Log:
Unify command line handling of MCTargetOptions and remove extra
options and code. No functional change.
Modified:
llvm/trunk/include/llvm/CodeGen/CommandFlags.h
llvm/trunk/include/llvm/MC/MCTargetOptionsCommandFlags.h
llvm/trunk/tools/llc/llc.cpp
llvm/trunk/tools/llvm-mc/llvm-mc.cpp
Modified: llvm/trunk/include/llvm/CodeGen/CommandFlags.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CommandFlags.h?rev=208833&r1=208832&r2=208833&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/CommandFlags.h (original)
+++ llvm/trunk/include/llvm/CodeGen/CommandFlags.h Wed May 14 20:10:50 2014
@@ -70,11 +70,6 @@ CMModel("code-model",
"Large code model"),
clEnumValEnd));
-cl::opt<bool>
-RelaxAll("mc-relax-all",
- cl::desc("When used with filetype=obj, "
- "relax all fixups in the emitted object file"));
-
cl::opt<TargetMachine::CodeGenFileType>
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(TargetMach
"Emit nothing, for performance testing"),
clEnumValEnd));
-cl::opt<bool> EnableDwarfDirectory("enable-dwarf-directory", cl::Hidden,
- cl::desc("Use .file directives with an explicit directory."));
-
cl::opt<bool>
DisableRedZone("disable-red-zone",
cl::desc("Do not emit code that uses the red zone."),
Modified: llvm/trunk/include/llvm/MC/MCTargetOptionsCommandFlags.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCTargetOptionsCommandFlags.h?rev=208833&r1=208832&r2=208833&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCTargetOptionsCommandFlags.h (original)
+++ llvm/trunk/include/llvm/MC/MCTargetOptionsCommandFlags.h Wed May 14 20:10:50 2014
@@ -20,22 +20,37 @@
using namespace llvm;
cl::opt<MCTargetOptions::AsmInstrumentation> 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<bool> RelaxAll("mc-relax-all",
+ cl::desc("When used with filetype=obj, "
+ "relax all fixups in the emitted object file"));
+
+cl::opt<bool> EnableDwarfDirectory(
+ "enable-dwarf-directory", cl::Hidden,
+ cl::desc("Use .file directives with an explicit directory."));
+
+cl::opt<bool> NoExecStack("mc-no-exec-stack",
+ cl::desc("File doesn't need an exec stack"));
+
+static cl::opt<bool>
+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;
}
Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=208833&r1=208832&r2=208833&view=diff
==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Wed May 14 20:10:50 2014
@@ -287,9 +287,6 @@ static int compileModule(char **argv, LL
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, LL
// 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());
Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=208833&r1=208832&r2=208833&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Wed May 14 20:10:50 2014
@@ -65,12 +65,6 @@ static cl::opt<unsigned>
OutputAsmVariant("output-asm-variant",
cl::desc("Syntax variant to use for output printing"));
-static cl::opt<bool>
-RelaxAll("mc-relax-all", cl::desc("Relax all fixups"));
-
-static cl::opt<bool>
-NoExecStack("mc-no-exec-stack", cl::desc("File doesn't need an exec stack"));
-
enum OutputFileType {
OFT_Null,
OFT_AssemblyFile,
@@ -148,9 +142,6 @@ NoInitialTextSection("n", cl::desc("Don'
"in the text section"));
static cl::opt<bool>
-SaveTempLabels("L", cl::desc("Don't discard temporary labels"));
-
-static cl::opt<bool>
GenDwarfForAssembly("g", cl::desc("Generate dwarf debugging info for assembly "
"source files"));
More information about the llvm-commits
mailing list