llvm.org GIT mirror llvm / 41a0243
Propagate CPU string out of SubtargetFeatures git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72335 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 11 years ago
14 changed file(s) with 52 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
8181
8282 /// Set the CPU string. Replaces previous setting. Setting to "" clears CPU.
8383 void setCPU(const std::string &String);
84
84
8585 /// Setting CPU string only if no string is set.
8686 void setCPUIfNone(const std::string &String);
87
87
88 /// Returns current CPU string.
89 const std::string & getCPU() const;
90
8891 /// Adding Features.
8992 void AddFeature(const std::string &String, bool IsEnabled = true);
9093
2222 , UseThumbBacktraces(false)
2323 , IsR9Reserved(false)
2424 , stackAlignment(4)
25 , CPUString("generic")
2526 , TargetType(isELF) // Default to ELF unless otherwise specified.
2627 , TargetABI(ARM_ABI_APCS) {
27
2828 // Determine default and user specified characteristics
29 std::string CPU = "generic";
3029
3130 // Parse features string.
32 ParseSubtargetFeatures(FS, CPU);
31 CPUString = ParseSubtargetFeatures(FS, CPUString);
3332
3433 // Set the boolean corresponding to the current target triple, or the default
3534 // if one cannot be determined, to true.
4646 /// entry to the function and which must be maintained by every function.
4747 unsigned stackAlignment;
4848
49 /// CPUString - String name of used CPU.
50 std::string CPUString;
51
4952 public:
5053 enum {
5154 isELF, isDarwin
7073 }
7174 /// ParseSubtargetFeatures - Parses features string setting specified
7275 /// subtarget options. Definition of function is auto generated by tblgen.
73 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
76 std::string ParseSubtargetFeatures(const std::string &FS,
77 const std::string &CPU);
7478
7579 bool hasV4TOps() const { return ARMArchVersion >= V4T; }
7680 bool hasV5TOps() const { return ARMArchVersion >= V5T; }
7882 bool hasV6Ops() const { return ARMArchVersion >= V6; }
7983
8084 bool hasVFP2() const { return HasVFP2; }
81
85
8286 bool isTargetDarwin() const { return TargetType == isDarwin; }
8387 bool isTargetELF() const { return TargetType == isELF; }
8488
9094 bool useThumbBacktraces() const { return UseThumbBacktraces; }
9195 bool isR9Reserved() const { return IsR9Reserved; }
9296
97 const std::string & getCPUString() const { return CPUString; }
98
9399 /// getStackAlignment - Returns the minimum alignment known to hold of the
94100 /// stack frame on entry to the function and which must be maintained by every
95101 /// function for this subtarget.
3636
3737 /// ParseSubtargetFeatures - Parses features string setting specified
3838 /// subtarget options. Definition of function is auto generated by tblgen.
39 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
39 std::string ParseSubtargetFeatures(const std::string &FS,
40 const std::string &CPU);
4041
4142 bool hasCT() const { return HasCT; }
4243 };
5858
5959 /// ParseSubtargetFeatures - Parses features string setting specified
6060 /// subtarget options. Definition of function is auto generated by tblgen.
61 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
62
61 std::string ParseSubtargetFeatures(const std::string &FS,
62 const std::string &CPU);
63
6364 /// SetJITMode - This is called to inform the subtarget info that we are
6465 /// producing code for the JIT.
6566 void SetJITMode();
3232
3333 /// ParseSubtargetFeatures - Parses features string setting specified
3434 /// subtarget options. Definition of function is auto generated by tblgen.
35 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
35 std::string ParseSubtargetFeatures(const std::string &FS,
36 const std::string &CPU);
3637 };
3738 } // End llvm namespace
3839
108108
109109 /// ParseSubtargetFeatures - Parses features string setting specified
110110 /// subtarget options. Definition of function is auto generated by tblgen.
111 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
111 std::string ParseSubtargetFeatures(const std::string &FS,
112 const std::string &CPU);
112113
113114 bool hasMips2Ops() const { return MipsArchVersion >= Mips2; }
114115
3636
3737 /// ParseSubtargetFeatures - Parses features string setting specified
3838 /// subtarget options. Definition of function is auto generated by tblgen.
39 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
39 std::string ParseSubtargetFeatures(const std::string &FS,
40 const std::string &CPU);
4041 };
4142 } // End llvm namespace
4243
8585
8686 /// ParseSubtargetFeatures - Parses features string setting specified
8787 /// subtarget options. Definition of function is auto generated by tblgen.
88 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
88 std::string ParseSubtargetFeatures(const std::string &FS,
89 const std::string &CPU);
90
8991
9092 /// SetJITMode - This is called to inform the subtarget info that we are
9193 /// producing code for the JIT.
3232
3333 /// ParseSubtargetFeatures - Parses features string setting specified
3434 /// subtarget options. Definition of function is auto generated by tblgen.
35 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
36
35 std::string ParseSubtargetFeatures(const std::string &FS,
36 const std::string &CPU);
37
3738 };
3839
3940 } // end namespace llvm
185185 }
186186
187187
188 /// setCPU - Set the CPU string. Replaces previous setting. Setting to ""
188 /// setCPU - Set the CPU string. Replaces previous setting. Setting to ""
189189 /// clears CPU.
190190 void SubtargetFeatures::setCPU(const std::string &String) {
191191 Features[0] = LowercaseString(String);
198198 if (Features[0].empty()) setCPU(String);
199199 }
200200
201 /// getCPU - Returns current CPU.
202 ///
203 const std::string & SubtargetFeatures::getCPU() const {
204 return Features[0];
205 }
206
207
201208 /// SetImpliedBits - For each feature that is (transitively) implied by this
202209 /// feature, set it.
203 ///
210 ///
204211 static
205212 void SetImpliedBits(uint32_t &Bits, const SubtargetFeatureKV *FeatureEntry,
206213 const SubtargetFeatureKV *FeatureTable,
107107
108108 /// ParseSubtargetFeatures - Parses features string setting specified
109109 /// subtarget options. Definition of function is auto generated by tblgen.
110 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
110 std::string ParseSubtargetFeatures(const std::string &FS,
111 const std::string &CPU);
111112
112113 /// AutoDetectSubtargetFeatures - Auto-detect CPU features using CPUID
113114 /// instruction.
3737
3838 /// ParseSubtargetFeatures - Parses features string setting specified
3939 /// subtarget options. Definition of function is auto generated by tblgen.
40 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
40 std::string ParseSubtargetFeatures(const std::string &FS,
41 const std::string &CPU);
4142 };
4243 } // End llvm namespace
4344
450450
451451 OS << "// ParseSubtargetFeatures - Parses features string setting specified\n"
452452 << "// subtarget options.\n"
453 << "void llvm::";
453 << "std::string llvm::";
454454 OS << Target;
455455 OS << "Subtarget::ParseSubtargetFeatures(const std::string &FS,\n"
456456 << " const std::string &CPU) {\n"
480480 << "Features.getInfo(ProcItinKV, ProcItinKVSize);\n"
481481 << " InstrItins = InstrItineraryData(Stages, Itinerary);\n";
482482 }
483
484 OS << "}\n";
485 }
486
487 //
483
484 OS << " return Features.getCPU();\n"
485 << "}\n";
486 }
487
488 //
488489 // SubtargetEmitter::run - Main subtarget enumeration emitter.
489490 //
490491 void SubtargetEmitter::run(std::ostream &OS) {