summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-05-21 21:05:09 +0000
committerEric Christopher <echristo@gmail.com>2014-05-21 21:05:09 +0000
commitd1b5bdaebdcdfc85854e6dac538bcc273b6a486a (patch)
treec02e41285e7b2c9f0f47589d3b16a28cbf1ff5c2
parent9a3798632893c9fdec7e29afbdd98be6ef82a72a (diff)
downloadllvm-d1b5bdaebdcdfc85854e6dac538bcc273b6a486a.tar.gz
llvm-d1b5bdaebdcdfc85854e6dac538bcc273b6a486a.tar.bz2
llvm-d1b5bdaebdcdfc85854e6dac538bcc273b6a486a.tar.xz
Move MCOptions that aren't shared between programs into their specific
program and have them initialize the MCOptions struct explicitly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209321 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/MC/MCTargetOptionsCommandFlags.h20
-rw-r--r--test/DebugInfo/2010-03-19-DbgDeclare.ll2
-rw-r--r--test/MC/ELF/noexec.s2
-rw-r--r--tools/llc/llc.cpp20
-rw-r--r--tools/llvm-mc/llvm-mc.cpp3
5 files changed, 20 insertions, 27 deletions
diff --git a/include/llvm/MC/MCTargetOptionsCommandFlags.h b/include/llvm/MC/MCTargetOptionsCommandFlags.h
index 24e683f617..17a117a2a3 100644
--- a/include/llvm/MC/MCTargetOptionsCommandFlags.h
+++ b/include/llvm/MC/MCTargetOptionsCommandFlags.h
@@ -33,31 +33,11 @@ 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"));
-
-cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
- cl::desc("Show encoding in .s output"));
-cl::opt<bool> ShowMCInst("show-mc-inst", cl::Hidden,
- cl::desc("Show instruction structure in .s output"));
-
-cl::opt<bool> AsmVerbose("asm-verbose", cl::desc("Add comments to directives."),
- cl::init(false));
-
static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
MCTargetOptions Options;
Options.SanitizeAddress =
(AsmInstrumentation == MCTargetOptions::AsmInstrumentationAddress);
Options.MCRelaxAll = RelaxAll;
- Options.MCUseDwarfDirectory = EnableDwarfDirectory;
- Options.MCNoExecStack = NoExecStack;
- Options.ShowMCEncoding = ShowMCEncoding;
- Options.ShowMCInst = ShowMCInst;
- Options.AsmVerbose = AsmVerbose;
return Options;
}
diff --git a/test/DebugInfo/2010-03-19-DbgDeclare.ll b/test/DebugInfo/2010-03-19-DbgDeclare.ll
index 0c0a4dcb63..1ff7fa88bd 100644
--- a/test/DebugInfo/2010-03-19-DbgDeclare.ll
+++ b/test/DebugInfo/2010-03-19-DbgDeclare.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -verify -S -asm-verbose | FileCheck %s
+; RUN: llvm-as < %s | opt -verify -S | FileCheck %s
; CHECK: lang 0x8001
diff --git a/test/MC/ELF/noexec.s b/test/MC/ELF/noexec.s
index 33cb8ae345..28f50cb7f6 100644
--- a/test/MC/ELF/noexec.s
+++ b/test/MC/ELF/noexec.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -mc-no-exec-stack -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -t | FileCheck %s
+// RUN: llvm-mc -no-exec-stack -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -t | FileCheck %s
// CHECK: Section {
// CHECK: Index: 4
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 47be4a8b71..09ff4613b9 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -81,7 +81,18 @@ static cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
static cl::opt<bool> DisableSimplifyLibCalls("disable-simplify-libcalls",
cl::desc("Disable simplify-libcalls"));
-static int compileModule(char**, LLVMContext&);
+static cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
+ cl::desc("Show encoding in .s output"));
+
+static cl::opt<bool> EnableDwarfDirectory(
+ "enable-dwarf-directory", cl::Hidden,
+ cl::desc("Use .file directives with an explicit directory."));
+
+static cl::opt<bool> AsmVerbose("asm-verbose",
+ cl::desc("Add comments to directives."),
+ cl::init(true));
+
+static int compileModule(char **, LLVMContext &);
// GetFileNameRoot - Helper function to get the basename of a filename.
static inline std::string
@@ -270,10 +281,9 @@ static int compileModule(char **argv, LLVMContext &Context) {
TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
Options.DisableIntegratedAS = NoIntegratedAssembler;
-
- // Override default to generate verbose assembly unless we've seen the flag.
- if (AsmVerbose.getNumOccurrences() == 0)
- Options.MCOptions.AsmVerbose = true;
+ Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
+ Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
+ Options.MCOptions.AsmVerbose = AsmVerbose;
std::unique_ptr<TargetMachine> target(
TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 02dcfcd2dd..84d578b4d0 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -159,6 +159,9 @@ MainFileName("main-file-name",
static cl::opt<bool> SaveTempLabels("save-temp-labels",
cl::desc("Don't discard temporary labels"));
+static cl::opt<bool> NoExecStack("no-exec-stack",
+ cl::desc("File doesn't need an exec stack"));
+
enum ActionType {
AC_AsLex,
AC_Assemble,