[llvm] r255810 - Set debugger tuning from TargetOptions (NFC)
Paul Robinson via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 16 11:58:30 PST 2015
Author: probinson
Date: Wed Dec 16 13:58:30 2015
New Revision: 255810
URL: http://llvm.org/viewvc/llvm-project?rev=255810&view=rev
Log:
Set debugger tuning from TargetOptions (NFC)
Differential Revision: http://reviews.llvm.org/D15427
Modified:
llvm/trunk/include/llvm/CodeGen/CommandFlags.h
llvm/trunk/include/llvm/Target/TargetOptions.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/include/llvm/CodeGen/CommandFlags.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CommandFlags.h?rev=255810&r1=255809&r2=255810&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/CommandFlags.h (original)
+++ llvm/trunk/include/llvm/CodeGen/CommandFlags.h Wed Dec 16 13:58:30 2015
@@ -256,6 +256,17 @@ cl::opt<llvm::EABI> EABIVersion(
clEnumValN(EABI::EABI5, "5", "EABI version 5"),
clEnumValN(EABI::GNU, "gnu", "EABI GNU"), clEnumValEnd));
+cl::opt<DebuggerKind>
+DebuggerTuningOpt("debugger-tune",
+ cl::desc("Tune debug info for a particular debugger"),
+ cl::init(DebuggerKind::Default),
+ cl::values(
+ clEnumValN(DebuggerKind::GDB, "gdb", "gdb"),
+ clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"),
+ clEnumValN(DebuggerKind::SCE, "sce",
+ "SCE targets (e.g. PS4)"),
+ clEnumValEnd));
+
// Common utility function tightly tied to the options listed here. Initializes
// a TargetOptions object with CodeGen flags and returns it.
static inline TargetOptions InitTargetOptionsFromCodeGenFlags() {
@@ -285,6 +296,7 @@ static inline TargetOptions InitTargetOp
Options.ThreadModel = TMModel;
Options.EABIVersion = EABIVersion;
+ Options.DebuggerTuning = DebuggerTuningOpt;
return Options;
}
Modified: llvm/trunk/include/llvm/Target/TargetOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=255810&r1=255809&r2=255810&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetOptions.h (original)
+++ llvm/trunk/include/llvm/Target/TargetOptions.h Wed Dec 16 13:58:30 2015
@@ -66,6 +66,30 @@ namespace llvm {
GNU
};
+ /// Identify a debugger for "tuning" the debug info.
+ ///
+ /// The "debugger tuning" concept allows us to present a more intuitive
+ /// interface that unpacks into different sets of defaults for the various
+ /// individual feature-flag settings, that suit the preferences of the
+ /// various debuggers. However, it's worth remembering that debuggers are
+ /// not the only consumers of debug info, and some variations in DWARF might
+ /// better be treated as target/platform issues. Fundamentally,
+ /// o if the feature is useful (or not) to a particular debugger, regardless
+ /// of the target, that's a tuning decision;
+ /// o if the feature is useful (or not) on a particular platform, regardless
+ /// of the debugger, that's a target decision.
+ /// It's not impossible to see both factors in some specific case.
+ ///
+ /// The "tuning" should be used to set defaults for individual feature flags
+ /// in DwarfDebug; if a given feature has a more specific command-line option,
+ /// that option should take precedence over the tuning.
+ enum class DebuggerKind {
+ Default, // No specific tuning requested.
+ GDB, // Tune debug info for gdb.
+ LLDB, // Tune debug info for lldb.
+ SCE // Tune debug info for SCE targets (e.g. PS4).
+ };
+
class TargetOptions {
public:
TargetOptions()
@@ -80,7 +104,7 @@ namespace llvm {
EmulatedTLS(false), FloatABIType(FloatABI::Default),
AllowFPOpFusion(FPOpFusion::Standard), Reciprocals(TargetRecip()),
JTType(JumpTable::Single), ThreadModel(ThreadModel::POSIX),
- EABIVersion(EABI::Default) {}
+ EABIVersion(EABI::Default), DebuggerTuning(DebuggerKind::Default) {}
/// PrintMachineCode - This flag is enabled when the -print-machineinstrs
/// option is specified on the command line, and should enable debugging
@@ -221,6 +245,9 @@ namespace llvm {
/// EABIVersion - This flag specifies the EABI version
EABI EABIVersion;
+ /// Which debugger to tune for.
+ DebuggerKind DebuggerTuning;
+
/// Machine level options.
MCTargetOptions MCOptions;
};
@@ -250,6 +277,7 @@ inline bool operator==(const TargetOptio
ARE_EQUAL(JTType) &&
ARE_EQUAL(ThreadModel) &&
ARE_EQUAL(EABIVersion) &&
+ ARE_EQUAL(DebuggerTuning) &&
ARE_EQUAL(MCOptions);
#undef ARE_EQUAL
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=255810&r1=255809&r2=255810&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Dec 16 13:58:30 2015
@@ -77,17 +77,6 @@ static cl::opt<bool> GenerateARangeSecti
cl::desc("Generate dwarf aranges"),
cl::init(false));
-static cl::opt<DebuggerKind>
-DebuggerTuningOpt("debugger-tune",
- cl::desc("Tune debug info for a particular debugger"),
- cl::init(DebuggerKind::Default),
- cl::values(
- clEnumValN(DebuggerKind::GDB, "gdb", "gdb"),
- clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"),
- clEnumValN(DebuggerKind::SCE, "sce",
- "SCE targets (e.g. PS4)"),
- clEnumValEnd));
-
namespace {
enum DefaultOnOff { Default, Enable, Disable };
}
@@ -228,10 +217,10 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
CurMI = nullptr;
Triple TT(Asm->getTargetTriple());
- // Make sure we know our "debugger tuning." The command-line option takes
+ // Make sure we know our "debugger tuning." The target option takes
// precedence; fall back to triple-based defaults.
- if (DebuggerTuningOpt != DebuggerKind::Default)
- DebuggerTuning = DebuggerTuningOpt;
+ if (Asm->TM.Options.DebuggerTuning != DebuggerKind::Default)
+ DebuggerTuning = Asm->TM.Options.DebuggerTuning;
else if (IsDarwin || TT.isOSFreeBSD())
DebuggerTuning = DebuggerKind::LLDB;
else if (TT.isPS4CPU())
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=255810&r1=255809&r2=255810&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Dec 16 13:58:30 2015
@@ -33,6 +33,7 @@
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Target/TargetOptions.h"
#include <memory>
namespace llvm {
@@ -186,30 +187,6 @@ struct SymbolCU {
DwarfCompileUnit *CU;
};
-/// Identify a debugger for "tuning" the debug info.
-///
-/// The "debugger tuning" concept allows us to present a more intuitive
-/// interface that unpacks into different sets of defaults for the various
-/// individual feature-flag settings, that suit the preferences of the
-/// various debuggers. However, it's worth remembering that debuggers are
-/// not the only consumers of debug info, and some variations in DWARF might
-/// better be treated as target/platform issues. Fundamentally,
-/// o if the feature is useful (or not) to a particular debugger, regardless
-/// of the target, that's a tuning decision;
-/// o if the feature is useful (or not) on a particular platform, regardless
-/// of the debugger, that's a target decision.
-/// It's not impossible to see both factors in some specific case.
-///
-/// The "tuning" should be used to set defaults for individual feature flags
-/// in DwarfDebug; if a given feature has a more specific command-line option,
-/// that option should take precedence over the tuning.
-enum class DebuggerKind {
- Default, // No specific tuning requested.
- GDB, // Tune debug info for gdb.
- LLDB, // Tune debug info for lldb.
- SCE // Tune debug info for SCE targets (e.g. PS4).
-};
-
/// Collects and handles dwarf debug information.
class DwarfDebug : public AsmPrinterHandler {
/// Target of Dwarf emission.
More information about the llvm-commits
mailing list