From afc6099348a77ec9c9b81fe90824975dca9f2d75 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 15 May 2014 01:08:00 +0000 Subject: [PATCH] Move the TargetMachine MC options to MCTargetOptions. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208832 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCTargetOptions.h | 11 ++++++++++- include/llvm/Target/TargetMachine.h | 20 ++++++++------------ lib/MC/MCTargetOptions.cpp | 4 +++- lib/Target/TargetMachine.cpp | 4 ---- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/include/llvm/MC/MCTargetOptions.h b/include/llvm/MC/MCTargetOptions.h index 3adaf0d5bd7..225ed7d85f9 100644 --- a/include/llvm/MC/MCTargetOptions.h +++ b/include/llvm/MC/MCTargetOptions.h @@ -22,12 +22,21 @@ public: /// Enables AddressSanitizer instrumentation at machine level. bool SanitizeAddress : 1; + unsigned MCRelaxAll : 1; + unsigned MCNoExecStack : 1; + unsigned MCSaveTempLabels : 1; + unsigned MCUseDwarfDirectory : 1; + MCTargetOptions(); }; inline bool operator==(const MCTargetOptions &LHS, const MCTargetOptions &RHS) { #define ARE_EQUAL(X) LHS.X == RHS.X - return ARE_EQUAL(SanitizeAddress); + return (ARE_EQUAL(SanitizeAddress) && + ARE_EQUAL(MCRelaxAll) && + ARE_EQUAL(MCNoExecStack) && + ARE_EQUAL(MCSaveTempLabels) && + ARE_EQUAL(MCUseDwarfDirectory)); #undef ARE_EQUAL } diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index 151be732112..905cbc66319 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -84,10 +84,6 @@ protected: // Can only create subclasses. /// const MCAsmInfo *AsmInfo; - unsigned MCRelaxAll : 1; - unsigned MCNoExecStack : 1; - unsigned MCSaveTempLabels : 1; - unsigned MCUseDwarfDirectory : 1; unsigned RequireStructuredCFG : 1; public: @@ -168,33 +164,33 @@ public: /// hasMCRelaxAll - Check whether all machine code instructions should be /// relaxed. - bool hasMCRelaxAll() const { return MCRelaxAll; } + bool hasMCRelaxAll() const { return Options.MCOptions.MCRelaxAll; } /// setMCRelaxAll - Set whether all machine code instructions should be /// relaxed. - void setMCRelaxAll(bool Value) { MCRelaxAll = Value; } + void setMCRelaxAll(bool Value) { Options.MCOptions.MCRelaxAll = Value; } /// hasMCSaveTempLabels - Check whether temporary labels will be preserved /// (i.e., not treated as temporary). - bool hasMCSaveTempLabels() const { return MCSaveTempLabels; } + bool hasMCSaveTempLabels() const { return Options.MCOptions.MCSaveTempLabels; } /// setMCSaveTempLabels - Set whether temporary labels will be preserved /// (i.e., not treated as temporary). - void setMCSaveTempLabels(bool Value) { MCSaveTempLabels = Value; } + void setMCSaveTempLabels(bool Value) { Options.MCOptions.MCSaveTempLabels = Value; } /// hasMCNoExecStack - Check whether an executable stack is not needed. - bool hasMCNoExecStack() const { return MCNoExecStack; } + bool hasMCNoExecStack() const { return Options.MCOptions.MCNoExecStack; } /// setMCNoExecStack - Set whether an executabel stack is not needed. - void setMCNoExecStack(bool Value) { MCNoExecStack = Value; } + void setMCNoExecStack(bool Value) { Options.MCOptions.MCNoExecStack = Value; } /// hasMCUseDwarfDirectory - Check whether we should use .file directives with /// explicit directories. - bool hasMCUseDwarfDirectory() const { return MCUseDwarfDirectory; } + bool hasMCUseDwarfDirectory() const { return Options.MCOptions.MCUseDwarfDirectory; } /// setMCUseDwarfDirectory - Set whether all we should use .file directives /// with explicit directories. - void setMCUseDwarfDirectory(bool Value) { MCUseDwarfDirectory = Value; } + void setMCUseDwarfDirectory(bool Value) { Options.MCOptions.MCUseDwarfDirectory = Value; } /// getRelocationModel - Returns the code generation relocation model. The /// choices are static, PIC, and dynamic-no-pic, and target default. diff --git a/lib/MC/MCTargetOptions.cpp b/lib/MC/MCTargetOptions.cpp index a38990934d9..0bcfce9eac9 100644 --- a/lib/MC/MCTargetOptions.cpp +++ b/lib/MC/MCTargetOptions.cpp @@ -11,6 +11,8 @@ namespace llvm { -MCTargetOptions::MCTargetOptions() : SanitizeAddress(false) {} +MCTargetOptions::MCTargetOptions() + : SanitizeAddress(false), MCRelaxAll(false), MCNoExecStack(false), + MCSaveTempLabels(false), MCUseDwarfDirectory(false) {} } // end namespace llvm diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 741209162a5..d60a70846a7 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -55,10 +55,6 @@ TargetMachine::TargetMachine(const Target &T, const TargetOptions &Options) : TheTarget(T), TargetTriple(TT), TargetCPU(CPU), TargetFS(FS), CodeGenInfo(nullptr), AsmInfo(nullptr), - MCRelaxAll(false), - MCNoExecStack(false), - MCSaveTempLabels(false), - MCUseDwarfDirectory(false), RequireStructuredCFG(false), Options(Options) { } -- 2.34.1