[llvm] Use TargetABI to assign default-target features in getDefaultSubtargetFeatures (PR #100833)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 17:26:30 PDT 2024


================
@@ -201,7 +201,12 @@ static std::unique_ptr<TargetMachine>
 createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) {
   StringRef TheTriple = M.getTargetTriple();
   SubtargetFeatures Features;
-  Features.getDefaultSubtargetFeatures(Triple(TheTriple));
+  StringRef TargetABI = "";
+  if (auto TargetABIMD =
+          dyn_cast_or_null<MDString>(M.getModuleFlag("target-abi")))
+    TargetABI = TargetABIMD->getString();
----------------
ilovepi wrote:

Seems like this is getting repeated ... maybe a method on the module would simplify? or a helper function in one of the util/support libs?

https://github.com/llvm/llvm-project/pull/100833


More information about the llvm-commits mailing list