Move more MC options into the MCTargetOptions structure.

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208932 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-05-15 23:27:49 +00:00
parent 8fde27bceb
commit 6d22500de3
4 changed files with 18 additions and 15 deletions

View File

@ -26,7 +26,8 @@ public:
unsigned MCNoExecStack : 1;
unsigned MCSaveTempLabels : 1;
unsigned MCUseDwarfDirectory : 1;
unsigned ShowMCEncoding : 1;
unsigned ShowMCInst : 1;
MCTargetOptions();
};
@ -36,7 +37,9 @@ inline bool operator==(const MCTargetOptions &LHS, const MCTargetOptions &RHS) {
ARE_EQUAL(MCRelaxAll) &&
ARE_EQUAL(MCNoExecStack) &&
ARE_EQUAL(MCSaveTempLabels) &&
ARE_EQUAL(MCUseDwarfDirectory));
ARE_EQUAL(MCUseDwarfDirectory) &&
ARE_EQUAL(ShowMCEncoding) &&
ARE_EQUAL(ShowMCInst));
#undef ARE_EQUAL
}

View File

@ -42,6 +42,11 @@ cl::opt<bool> NoExecStack("mc-no-exec-stack",
cl::opt<bool> SaveTempLabels("L", cl::desc("Don't discard temporary labels"));
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"));
static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
MCTargetOptions Options;
Options.SanitizeAddress =
@ -50,6 +55,8 @@ static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
Options.MCUseDwarfDirectory = EnableDwarfDirectory;
Options.MCNoExecStack = NoExecStack;
Options.MCSaveTempLabels = SaveTempLabels;
Options.ShowMCEncoding = ShowMCEncoding;
Options.ShowMCInst = ShowMCInst;
return Options;
}

View File

@ -43,11 +43,6 @@ static cl::opt<cl::boolOrDefault>
EnableFastISelOption("fast-isel", cl::Hidden,
cl::desc("Enable the \"fast\" instruction selector"));
static cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
cl::desc("Show encoding in .s output"));
static cl::opt<bool> ShowMCInst("show-mc-inst", cl::Hidden,
cl::desc("Show instruction structure in .s output"));
static cl::opt<cl::boolOrDefault>
AsmVerbose("asm-verbose", cl::desc("Add comments to directives."),
cl::init(cl::BOU_UNSET));
@ -186,17 +181,14 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
// Create a code emitter if asked to show the encoding.
MCCodeEmitter *MCE = nullptr;
if (ShowMCEncoding)
if (Options.MCOptions.ShowMCEncoding)
MCE = getTarget().createMCCodeEmitter(MII, MRI, STI, *Context);
MCAsmBackend *MAB = getTarget().createMCAsmBackend(MRI, getTargetTriple(),
TargetCPU);
MCStreamer *S = getTarget().createAsmStreamer(*Context, Out,
getVerboseAsm(),
hasMCUseDwarfDirectory(),
InstPrinter,
MCE, MAB,
ShowMCInst);
MCStreamer *S = getTarget().createAsmStreamer(
*Context, Out, getVerboseAsm(), hasMCUseDwarfDirectory(), InstPrinter,
MCE, MAB, Options.MCOptions.ShowMCInst);
AsmStreamer.reset(S);
break;
}

View File

@ -13,6 +13,7 @@ namespace llvm {
MCTargetOptions::MCTargetOptions()
: SanitizeAddress(false), MCRelaxAll(false), MCNoExecStack(false),
MCSaveTempLabels(false), MCUseDwarfDirectory(false) {}
MCSaveTempLabels(false), MCUseDwarfDirectory(false),
ShowMCEncoding(false), ShowMCInst(false) {}
} // end namespace llvm