<div dir="ltr">I'm trying to enable/disable a target feature through clang. <div><br></div><div>Here is how my target looks like</div><div><br></div><div><div>// Esencia subtarget features</div><div>//===----------------------------------------------------------------------===//</div><div>def FeatureMul   : SubtargetFeature<"mul", "HasMul", "true",</div><div>                                   "Enable hardware multiplier">;</div><div>def FeatureDiv   : SubtargetFeature<"div", "HasDiv", "true",</div><div>                                   "Enable hardware divider">;</div><div>def FeatureCmov  : SubtargetFeature<"cmov", "HasCmov", "true",</div><div>                                    "Enable conditional move instruction">;</div><div>def FeatureAddc  : SubtargetFeature<"addc", "HasAddc", "true",</div><div>                                    "Enable add with carry instruction">;</div><div><br></div><div>//===----------------------------------------------------------------------===//</div><div>// Esencia processors supported.</div><div>//===----------------------------------------------------------------------===//</div><div>class Proc<string Name, SchedMachineModel Model,</div><div>           list<SubtargetFeature> Features></div><div> : ProcessorModel<Name, Model, Features>;</div><div><br></div><div>def : Proc<"esencia", EsenciaModel, [FeatureMul,</div><div>                                     FeatureDiv,</div><div>                                     FeatureCmov,</div><div>                                     FeatureAddc</div><div>                                    ]>;</div><div><br></div><div>This is what I have in EsenciaTargetInfo::setFeatureEnabled(...) in clang/lib/Basic/Targets.cpp</div><div><br></div><div><div>  virtual void setFeatureEnabled(llvm::StringMap<bool> &Features,</div><div>                                 StringRef Name,</div><div>                                 bool Enabled) const {</div><div>    if (Name == "mul" ||</div><div>        Name == "div" ||</div><div>        Name == "cmov" ||</div><div>        Name == "addc") {</div><div>      Features[Name] = Enabled;</div><div>    }</div><div>  }</div></div><div><br></div><div>Is there a way to enable/disable a given feature through clang? Any flags I need to pass?</div><div><br></div><div>Any help is appreciated.</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</div></div>