[llvm] 44ea81a - [X86] Add 64bit and retpoline-external-thunk to list of featuers in X86TargetParser.def.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 00:57:29 PDT 2020


Author: Craig Topper
Date: 2020-07-07T00:57:04-07:00
New Revision: 44ea81acb696592281157656ea7d81ecb41ca161

URL: https://github.com/llvm/llvm-project/commit/44ea81acb696592281157656ea7d81ecb41ca161
DIFF: https://github.com/llvm/llvm-project/commit/44ea81acb696592281157656ea7d81ecb41ca161.diff

LOG: [X86] Add 64bit and retpoline-external-thunk to list of featuers in X86TargetParser.def.

'64bit' shows up from -march=native on 64-bit capable CPUs.
'retpoline-eternal-thunk' isn't a real feature but shows up
when -mretpoline-external-thunk is passed to clang.

Added: 
    

Modified: 
    llvm/include/llvm/Support/X86TargetParser.def
    llvm/lib/Support/X86TargetParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/X86TargetParser.def b/llvm/include/llvm/Support/X86TargetParser.def
index e53ef20f939e..91feb146baaa 100644
--- a/llvm/include/llvm/Support/X86TargetParser.def
+++ b/llvm/include/llvm/Support/X86TargetParser.def
@@ -173,6 +173,7 @@ X86_FEATURE_COMPAT(AVX512VP2INTERSECT, "avx512vp2intersect")
 // Features below here are not in libgcc/compiler-rt.
 X86_FEATURE       (3DNOW,           "3dnow")
 X86_FEATURE       (3DNOWA,          "3dnowa")
+X86_FEATURE       (64BIT,           "64bit")
 X86_FEATURE       (ADX,             "adx")
 X86_FEATURE       (AMX_BF16,        "amx-bf16")
 X86_FEATURE       (AMX_INT8,        "amx-int8")
@@ -183,6 +184,9 @@ X86_FEATURE       (CLWB,            "clwb")
 X86_FEATURE       (CLZERO,          "clzero")
 X86_FEATURE       (CMPXCHG16B,      "cx16")
 X86_FEATURE       (CMPXCHG8B,       "cx8")
+// FIXME: Merge with 64BIT? Currently separate to be used to tell if CPU is
+// valid for 64-bit mode, but has empty string so it doesn't get added to
+// target attributes in IR.
 X86_FEATURE       (EM64T,           "")
 X86_FEATURE       (ENQCMD,          "enqcmd")
 X86_FEATURE       (F16C,            "f16c")
@@ -221,6 +225,7 @@ X86_FEATURE       (XSAVEC,          "xsavec")
 X86_FEATURE       (XSAVEOPT,        "xsaveopt")
 X86_FEATURE       (XSAVES,          "xsaves")
 // These features aren't really CPU features, but the frontend can set them.
+X86_FEATURE       (RETPOLINE_EXTERNAL_THUNK,    "retpoline-external-thunk")
 X86_FEATURE       (RETPOLINE_INDIRECT_BRANCHES, "retpoline-indirect-branches")
 X86_FEATURE       (RETPOLINE_INDIRECT_CALLS,    "retpoline-indirect-calls")
 X86_FEATURE       (LVI_CFI,                     "lvi-cfi")

diff  --git a/llvm/lib/Support/X86TargetParser.cpp b/llvm/lib/Support/X86TargetParser.cpp
index 12182179fe45..261e296b9e5a 100644
--- a/llvm/lib/Support/X86TargetParser.cpp
+++ b/llvm/lib/Support/X86TargetParser.cpp
@@ -390,6 +390,7 @@ ProcessorFeatures llvm::X86::getKeyFeature(X86::CPUKind Kind) {
 }
 
 // Features with no dependencies.
+static constexpr FeatureBitset ImpliedFeatures64BIT = {};
 static constexpr FeatureBitset ImpliedFeaturesADX = {};
 static constexpr FeatureBitset ImpliedFeaturesBMI = {};
 static constexpr FeatureBitset ImpliedFeaturesBMI2 = {};
@@ -435,6 +436,7 @@ static constexpr FeatureBitset ImpliedFeaturesXSAVE = {};
 
 // Not really CPU features, but need to be in the table because clang uses
 // target features to communicate them to the backend.
+static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_EXTERNAL_THUNK = {};
 static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_BRANCHES = {};
 static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_CALLS = {};
 static constexpr FeatureBitset ImpliedFeaturesLVI_CFI = {};
@@ -558,6 +560,8 @@ void llvm::X86::getImpliedFeatures(
   auto I = llvm::find_if(
       FeatureInfos, [&](const FeatureInfo &FI) { return FI.Name == Feature; });
   if (I == std::end(FeatureInfos)) {
+    // FIXME: This shouldn't happen, but may not have all features in the table
+    // yet.
     return;
   }
 


        


More information about the llvm-commits mailing list