summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mc/llvm-mc.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-06-19 06:22:08 +0000
committerEric Christopher <echristo@gmail.com>2014-06-19 06:22:08 +0000
commit4c5bff36ad5574af0df697192003c5ccef4a1297 (patch)
treedb3f282fdaa850cef0bbf29723f4f05c817b4212 /llvm/tools/llvm-mc/llvm-mc.cpp
parent07634e2a5bfb0ef5667c2c21f01ade34358aeb29 (diff)
downloadbcm5719-llvm-4c5bff36ad5574af0df697192003c5ccef4a1297.tar.gz
bcm5719-llvm-4c5bff36ad5574af0df697192003c5ccef4a1297.zip
Move -dwarf-version to an MC level command line option so it's
used by all of the MC level tools and codegen. Fix up all uses in the compiler to use this and set it on the context accordingly. llvm-svn: 211257
Diffstat (limited to 'llvm/tools/llvm-mc/llvm-mc.cpp')
-rw-r--r--llvm/tools/llvm-mc/llvm-mc.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp
index 60e566c1635..31b3d295b41 100644
--- a/llvm/tools/llvm-mc/llvm-mc.cpp
+++ b/llvm/tools/llvm-mc/llvm-mc.cpp
@@ -150,9 +150,6 @@ static cl::opt<bool>
GenDwarfForAssembly("g", cl::desc("Generate dwarf debugging info for assembly "
"source files"));
-static cl::opt<int>
-DwarfVersion("dwarf-version", cl::desc("Dwarf version"), cl::init(4));
-
static cl::opt<std::string>
DebugCompilationDir("fdebug-compilation-dir",
cl::desc("Specifies the debug info's compilation dir"));
@@ -323,12 +320,12 @@ static int AsLexInput(SourceMgr &SrcMgr, MCAsmInfo &MAI,
static int AssembleInput(const char *ProgName, const Target *TheTarget,
SourceMgr &SrcMgr, MCContext &Ctx, MCStreamer &Str,
MCAsmInfo &MAI, MCSubtargetInfo &STI,
- MCInstrInfo &MCII) {
+ MCInstrInfo &MCII, MCTargetOptions &MCOptions) {
std::unique_ptr<MCAsmParser> Parser(
createMCAsmParser(SrcMgr, Ctx, Str, MAI));
std::unique_ptr<MCTargetAsmParser> TAP(
- TheTarget->createMCAsmParser(STI, *Parser, MCII,
- InitMCTargetOptionsFromFlags()));
+ TheTarget->createMCAsmParser(STI, *Parser, MCII, MCOptions));
+
if (!TAP) {
errs() << ProgName
<< ": error: this target does not support assembly parsing.\n";
@@ -359,6 +356,7 @@ int main(int argc, char **argv) {
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
cl::ParseCommandLineOptions(argc, argv, "llvm machine code playground\n");
+ MCTargetOptions MCOptions = InitMCTargetOptionsFromFlags();
TripleName = Triple::normalize(TripleName);
setDwarfDebugFlags(argc, argv);
@@ -411,6 +409,8 @@ int main(int argc, char **argv) {
Ctx.setAllowTemporaryLabels(false);
Ctx.setGenDwarfForAssembly(GenDwarfForAssembly);
+ // Default to 4 for dwarf version.
+ unsigned DwarfVersion = MCOptions.DwarfVersion ? MCOptions.DwarfVersion : 4;
if (DwarfVersion < 2 || DwarfVersion > 4) {
errs() << ProgName << ": Dwarf version " << DwarfVersion
<< " is not supported." << '\n';
@@ -484,7 +484,7 @@ int main(int argc, char **argv) {
break;
case AC_Assemble:
Res = AssembleInput(ProgName, TheTarget, SrcMgr, Ctx, *Str, *MAI, *STI,
- *MCII);
+ *MCII, MCOptions);
break;
case AC_MDisassemble:
assert(IP && "Expected assembly output");
OpenPOWER on IntegriCloud