public:
/// CreateTargetInfo - Construct a target for the given options.
- static TargetInfo* CreateTargetInfo(Diagnostic &Diags,
- const TargetOptions &Opts);
+ ///
+ /// \param Opts - The options to use to initialize the target. The target may
+ /// modify the options to canonicalize the target feature information to match
+ /// what the backend expects.
+ static TargetInfo* CreateTargetInfo(Diagnostic &Diags, TargetOptions &Opts);
virtual ~TargetInfo();
/// HandleTargetOptions - Perform initialization based on the user configured
/// set of features (e.g., +sse4). The list is guaranteed to have at most one
/// entry per feature.
- virtual void HandleTargetFeatures(const std::vector<std::string> &Features) {
+ ///
+ /// The target may modify the features list, to change which options are
+ /// passed onwards to the backend.
+ virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
}
// getRegParmMax - Returns maximal number of args passed in registers.
bool Enabled) const;
virtual void getDefaultFeatures(const std::string &CPU,
llvm::StringMap<bool> &Features) const;
- virtual void HandleTargetFeatures(const std::vector<std::string> &Features);
+ virtual void HandleTargetFeatures(std::vector<std::string> &Features);
};
void X86TargetInfo::getDefaultFeatures(const std::string &CPU,
/// HandleTargetOptions - Perform initialization based on the user
/// configured set of features.
-void
-X86TargetInfo::HandleTargetFeatures(const std::vector<std::string> &Features) {
+void X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features) {
// Remember the maximum enabled sselevel.
for (unsigned i = 0, e = Features.size(); i !=e; ++i) {
// Ignore disabled features.
/// CreateTargetInfo - Return the target info object for the specified target
/// triple.
TargetInfo *TargetInfo::CreateTargetInfo(Diagnostic &Diags,
- const TargetOptions &Opts) {
+ TargetOptions &Opts) {
llvm::Triple Triple(Opts.Triple);
// Construct the target
//
// FIXME: If we are completely confident that we have the right set, we only
// need to pass the minuses.
- std::vector<std::string> StrFeatures;
+ Opts.Features.clear();
for (llvm::StringMap<bool>::const_iterator it = Features.begin(),
ie = Features.end(); it != ie; ++it)
- StrFeatures.push_back(std::string(it->second ? "+" : "-") + it->first());
- Target->HandleTargetFeatures(StrFeatures);
+ Opts.Features.push_back(std::string(it->second ? "+" : "-") + it->first());
+ Target->HandleTargetFeatures(Opts.Features);
return Target.take();
}