Move more MC options into the MCTargetOptions structure.

No functional change.

llvm-svn: 208932
This commit is contained in:
Eric Christopher 2014-05-15 23:27:49 +00:00
parent 98dcb8c6b1
commit 5d376066df
4 changed files with 18 additions and 15 deletions

View File

@ -26,7 +26,8 @@ public:
unsigned MCNoExecStack : 1; unsigned MCNoExecStack : 1;
unsigned MCSaveTempLabels : 1; unsigned MCSaveTempLabels : 1;
unsigned MCUseDwarfDirectory : 1; unsigned MCUseDwarfDirectory : 1;
unsigned ShowMCEncoding : 1;
unsigned ShowMCInst : 1;
MCTargetOptions(); MCTargetOptions();
}; };
@ -36,7 +37,9 @@ inline bool operator==(const MCTargetOptions &LHS, const MCTargetOptions &RHS) {
ARE_EQUAL(MCRelaxAll) && ARE_EQUAL(MCRelaxAll) &&
ARE_EQUAL(MCNoExecStack) && ARE_EQUAL(MCNoExecStack) &&
ARE_EQUAL(MCSaveTempLabels) && ARE_EQUAL(MCSaveTempLabels) &&
ARE_EQUAL(MCUseDwarfDirectory)); ARE_EQUAL(MCUseDwarfDirectory) &&
ARE_EQUAL(ShowMCEncoding) &&
ARE_EQUAL(ShowMCInst));
#undef ARE_EQUAL #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> 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() { static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
MCTargetOptions Options; MCTargetOptions Options;
Options.SanitizeAddress = Options.SanitizeAddress =
@ -50,6 +55,8 @@ static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
Options.MCUseDwarfDirectory = EnableDwarfDirectory; Options.MCUseDwarfDirectory = EnableDwarfDirectory;
Options.MCNoExecStack = NoExecStack; Options.MCNoExecStack = NoExecStack;
Options.MCSaveTempLabels = SaveTempLabels; Options.MCSaveTempLabels = SaveTempLabels;
Options.ShowMCEncoding = ShowMCEncoding;
Options.ShowMCInst = ShowMCInst;
return Options; return Options;
} }

View File

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

View File

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