Correct a mistaken comment from 238071 [NFC]
[oota-llvm.git] / include / llvm / Target / TargetRecip.h
1 //===--------------------- llvm/Target/TargetRecip.h ------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class is used to customize machine-specific reciprocal estimate code
11 // generation in a target-independent way.
12 // If a target does not support operations in this specification, then code
13 // generation will default to using supported operations.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #ifndef LLVM_TARGET_TARGETRECIP_H
18 #define LLVM_TARGET_TARGETRECIP_H
19
20 #include <vector>
21 #include <string>
22 #include <map>
23
24 namespace llvm {
25
26 struct TargetRecip {
27 public:
28   TargetRecip();
29
30   /// Initialize all or part of the operations from command-line options or
31   /// a front end.
32   TargetRecip(const std::vector<std::string> &Args);
33   
34   /// Set whether a particular reciprocal operation is enabled and how many
35   /// refinement steps are needed when using it. Use "all" to set enablement
36   /// and refinement steps for all operations.
37   void setDefaults(const StringRef &Key, bool Enable, unsigned RefSteps);
38
39   /// Return true if the reciprocal operation has been enabled by default or
40   /// from the command-line. Return false if the operation has been disabled
41   /// by default or from the command-line.
42   bool isEnabled(const StringRef &Key) const;
43
44   /// Return the number of iterations necessary to refine the
45   /// the result of a machine instruction for the given reciprocal operation.
46   unsigned getRefinementSteps(const StringRef &Key) const;
47
48   bool operator==(const TargetRecip &Other) const;
49
50 private:
51   enum {
52     Uninitialized = -1
53   };
54   
55   struct RecipParams {
56     int8_t Enabled;
57     int8_t RefinementSteps;
58     
59     RecipParams() : Enabled(Uninitialized), RefinementSteps(Uninitialized) {}
60   };
61   
62   std::map<StringRef, RecipParams> RecipMap;
63   typedef std::map<StringRef, RecipParams>::iterator RecipIter;
64   typedef std::map<StringRef, RecipParams>::const_iterator ConstRecipIter;
65
66   bool parseGlobalParams(const std::string &Arg);
67   void parseIndividualParams(const std::vector<std::string> &Args);
68 };
69
70 } // End llvm namespace
71
72 #endif