From 6a9366c0c633c4518d55685d4f3b289ef99c0bd1 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Tue, 20 May 2014 21:25:34 +0000 Subject: Move the function and data section flags into the options struct and make the functions to set them non-static. Move and rename the llvm specific backend options to avoid conflicting with the clang option. Paired with a backend commit to update. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209238 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/CommandFlags.h | 11 +++++++++++ include/llvm/Target/TargetMachine.h | 8 ++++---- include/llvm/Target/TargetOptions.h | 14 ++++++++++---- 3 files changed, 25 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/llvm/CodeGen/CommandFlags.h b/include/llvm/CodeGen/CommandFlags.h index ac789e4af8..2956ad8ea3 100644 --- a/include/llvm/CodeGen/CommandFlags.h +++ b/include/llvm/CodeGen/CommandFlags.h @@ -193,6 +193,15 @@ cl::opt StartAfter("start-after", cl::value_desc("pass-name"), cl::init("")); +cl::opt DataSections("data-sections", + cl::desc("Emit data into separate sections"), + cl::init(false)); + +cl::opt +FunctionSections("function-sections", + cl::desc("Emit functions into separate sections"), + cl::init(false)); + // Common utility function tightly tied to the options listed here. Initializes // a TargetOptions object with CodeGen flags and returns it. static inline TargetOptions InitTargetOptionsFromCodeGenFlags() { @@ -215,6 +224,8 @@ static inline TargetOptions InitTargetOptionsFromCodeGenFlags() { Options.TrapFuncName = TrapFuncName; Options.PositionIndependentExecutable = EnablePIE; Options.UseInitArray = UseInitArray; + Options.DataSections = DataSections; + Options.FunctionSections = FunctionSections; Options.MCOptions = InitMCTargetOptionsFromFlags(); diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index bf6963b796..17ebd07e5d 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -195,18 +195,18 @@ public: /// getDataSections - Return true if data objects should be emitted into their /// own section, corresponds to -fdata-sections. - static bool getDataSections(); + bool getDataSections() const; /// getFunctionSections - Return true if functions should be emitted into /// their own section, corresponding to -ffunction-sections. - static bool getFunctionSections(); + bool getFunctionSections() const; /// setDataSections - Set if the data are emit into separate sections. - static void setDataSections(bool); + void setDataSections(bool); /// setFunctionSections - Set if the functions are emit into separate /// sections. - static void setFunctionSections(bool); + void setFunctionSections(bool); /// \brief Register analysis passes for this target with a pass manager. virtual void addAnalysisPasses(PassManagerBase &) {} diff --git a/include/llvm/Target/TargetOptions.h b/include/llvm/Target/TargetOptions.h index 188395968b..636eaf5c05 100644 --- a/include/llvm/Target/TargetOptions.h +++ b/include/llvm/Target/TargetOptions.h @@ -50,10 +50,10 @@ namespace llvm { JITEmitDebugInfoToDisk(false), GuaranteedTailCallOpt(false), DisableTailCalls(false), StackAlignmentOverride(0), EnableFastISel(false), PositionIndependentExecutable(false), - UseInitArray(false), - DisableIntegratedAS(false), CompressDebugSections(false), - TrapUnreachable(false), - TrapFuncName(""), FloatABIType(FloatABI::Default), + UseInitArray(false), DisableIntegratedAS(false), + CompressDebugSections(false), FunctionSections(false), + DataSections(false), TrapUnreachable(false), TrapFuncName(""), + FloatABIType(FloatABI::Default), AllowFPOpFusion(FPOpFusion::Standard) {} /// PrintMachineCode - This flag is enabled when the -print-machineinstrs @@ -164,6 +164,12 @@ namespace llvm { /// Compress DWARF debug sections. unsigned CompressDebugSections : 1; + /// Emit functions into separate sections. + unsigned FunctionSections : 1; + + /// Emit data into separate sections. + unsigned DataSections : 1; + /// Emit target-specific trap instruction for 'unreachable' IR instructions. unsigned TrapUnreachable : 1; -- cgit v1.2.3