diff options
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/CodeGen/CommandFlags.h | 8 | ||||
-rw-r--r-- | llvm/include/llvm/Target/TargetLowering.h | 8 | ||||
-rw-r--r-- | llvm/include/llvm/Target/TargetOptions.h | 6 | ||||
-rw-r--r-- | llvm/include/llvm/Target/TargetRecip.h | 31 |
4 files changed, 23 insertions, 30 deletions
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h index 65ca7a7e613..d8c00fd072a 100644 --- a/llvm/include/llvm/CodeGen/CommandFlags.h +++ b/llvm/include/llvm/CodeGen/CommandFlags.h @@ -27,7 +27,6 @@ #include "llvm/Support/Host.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/Target/TargetRecip.h" #include <string> using namespace llvm; @@ -201,12 +200,6 @@ FuseFPOps("fp-contract", "Only fuse FP ops when the result won't be affected."), clEnumValEnd)); -cl::list<std::string> -ReciprocalOps("recip", - cl::CommaSeparated, - cl::desc("Choose reciprocal operation types and parameters."), - cl::value_desc("all,none,default,divf,!vec-sqrtd,vec-divd:0,sqrt:9...")); - cl::opt<bool> DontPlaceZerosInBSS("nozero-initialized-in-bss", cl::desc("Don't place zero-initialized symbols into bss section"), @@ -305,7 +298,6 @@ static inline TargetOptions InitTargetOptionsFromCodeGenFlags() { TargetOptions Options; Options.LessPreciseFPMADOption = EnableFPMAD; Options.AllowFPOpFusion = FuseFPOps; - Options.Reciprocals = TargetRecip(ReciprocalOps); Options.UnsafeFPMath = EnableUnsafeFPMath; Options.NoInfsFPMath = EnableNoInfsFPMath; Options.NoNaNsFPMath = EnableNoNaNsFPMath; diff --git a/llvm/include/llvm/Target/TargetLowering.h b/llvm/include/llvm/Target/TargetLowering.h index 66eb4179ff6..1027b9005d0 100644 --- a/llvm/include/llvm/Target/TargetLowering.h +++ b/llvm/include/llvm/Target/TargetLowering.h @@ -61,6 +61,7 @@ namespace llvm { class MCSymbol; template<typename T> class SmallVectorImpl; class DataLayout; + struct TargetRecip; class TargetRegisterClass; class TargetLibraryInfo; class TargetLoweringObjectFile; @@ -541,6 +542,12 @@ public: } } + /// Return the reciprocal estimate code generation preferences for this target + /// after potentially overriding settings using the function's attributes. + /// FIXME: Like all unsafe-math target settings, this should really be an + /// instruction-level attribute/metadata/FMF. + TargetRecip getTargetRecipForFunc(MachineFunction &MF) const; + /// Vector types are broken down into some number of legal first class types. /// For example, EVT::v8f32 maps to 2 EVT::v4f32 with Altivec or SSE1, or 8 /// promoted EVT::f64 values with the X86 FP stack. Similarly, EVT::v2i64 @@ -2174,6 +2181,7 @@ protected: /// sequence of memory operands that is recognized by PrologEpilogInserter. MachineBasicBlock *emitPatchPoint(MachineInstr &MI, MachineBasicBlock *MBB) const; + TargetRecip ReciprocalEstimates; }; /// This class defines information used to lower LLVM code to legal SelectionDAG diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h index b051d80b567..97c538be4dc 100644 --- a/llvm/include/llvm/Target/TargetOptions.h +++ b/llvm/include/llvm/Target/TargetOptions.h @@ -111,7 +111,7 @@ namespace llvm { DataSections(false), UniqueSectionNames(true), TrapUnreachable(false), EmulatedTLS(false), EnableIPRA(false), FloatABIType(FloatABI::Default), - AllowFPOpFusion(FPOpFusion::Standard), Reciprocals(TargetRecip()), + AllowFPOpFusion(FPOpFusion::Standard), JTType(JumpTable::Single), ThreadModel(ThreadModel::POSIX), EABIVersion(EABI::Default), DebuggerTuning(DebuggerKind::Default), FPDenormalMode(FPDenormal::IEEE), @@ -252,9 +252,6 @@ namespace llvm { /// the value of this option. FPOpFusion::FPOpFusionMode AllowFPOpFusion; - /// This class encapsulates options for reciprocal-estimate code generation. - TargetRecip Reciprocals; - /// JTType - This flag specifies the type of jump-instruction table to /// create for functions that have the jumptable attribute. JumpTable::JumpTableType JTType; @@ -301,7 +298,6 @@ inline bool operator==(const TargetOptions &LHS, ARE_EQUAL(EmulatedTLS) && ARE_EQUAL(FloatABIType) && ARE_EQUAL(AllowFPOpFusion) && - ARE_EQUAL(Reciprocals) && ARE_EQUAL(JTType) && ARE_EQUAL(ThreadModel) && ARE_EQUAL(EABIVersion) && diff --git a/llvm/include/llvm/Target/TargetRecip.h b/llvm/include/llvm/Target/TargetRecip.h index 309b9607913..d3139dc0d03 100644 --- a/llvm/include/llvm/Target/TargetRecip.h +++ b/llvm/include/llvm/Target/TargetRecip.h @@ -17,7 +17,6 @@ #ifndef LLVM_TARGET_TARGETRECIP_H #define LLVM_TARGET_TARGETRECIP_H -#include "llvm/ADT/StringRef.h" #include <cstdint> #include <map> #include <string> @@ -25,22 +24,21 @@ namespace llvm { +class StringRef; + struct TargetRecip { public: TargetRecip(); - /// Initialize all or part of the operations from command-line options or - /// a front end. - TargetRecip(const std::vector<std::string> &Args); + /// Parse a comma-separated string of reciprocal settings to set values in + /// this struct. + void set(StringRef &Args); - /// Set whether a particular reciprocal operation is enabled and how many - /// refinement steps are needed when using it. Use "all" to set enablement - /// and refinement steps for all operations. - void setDefaults(StringRef Key, bool Enable, unsigned RefSteps); + /// Set enablement and refinement steps for a particular reciprocal operation. + /// Use "all" to give all operations the same values. + void set(StringRef Key, bool Enable, unsigned RefSteps); - /// Return true if the reciprocal operation has been enabled by default or - /// from the command-line. Return false if the operation has been disabled - /// by default or from the command-line. + /// Return true if the reciprocal operation has been enabled. bool isEnabled(StringRef Key) const; /// Return the number of iterations necessary to refine the @@ -50,15 +48,14 @@ public: bool operator==(const TargetRecip &Other) const; private: - enum { - Uninitialized = -1 - }; - + // TODO: We should be able to use special values (enums) to simplify this into + // just an int, but we have to be careful because the user is allowed to + // specify "default" as a setting and just change the refinement step count. struct RecipParams { - int8_t Enabled; + bool Enabled; int8_t RefinementSteps; - RecipParams() : Enabled(Uninitialized), RefinementSteps(Uninitialized) {} + RecipParams() : Enabled(false), RefinementSteps(0) {} }; std::map<StringRef, RecipParams> RecipMap; |