================
@@ -1802,3 +1800,15 @@ def FeatureTaggedGlobals : 
SubtargetFeature<"tagged-globals",
     "AllowTaggedGlobals",
     "true", "Use an instruction sequence for taking the address of a global "
     "that allows a memory tag in the upper address bits">;
+
+// Zicfilp-based CFI
+def FeatureZicfilpUnlabeled
+    : SubtargetFeature<
+          "zicfilp-unlabeled", "HasZicfilpUnlabeled", "true",
+          "Enforce forward-edge control-flow integrity with 
ZICFILP-unlabeled">;
+def FeatureZicfilpFuncSig
+    : SubtargetFeature<
+          "zicfilp-func-sig", "HasZicfilpFuncSig", "true",
+          "Enforce forward-edge control-flow integrity with ZICFILP-func-sig">;
----------------
mylai-mtk wrote:

I'm not sure if the "enum" (or in the TableGen backend implementation, 
"integer") is a proper fit here. It looks like the integer version of 
`SubtargetFeature` actually models features with "leveled" semantics, e.g. 
`-target-feature +feature-10` would override `-target-feature +feature-0`. This 
feels wrong as the leveled semantics does not suit ZicfilpCFI in that different 
options should err instead of override. The current TableGen usages of this 
integer-based SubtargetFeature may work, but I don't think it's semantics 
guarantee future soundness.

>   // Value - Value the XXXSubtarget field to be set to by feature.
>   //
>   // A value of "true" or "false" implies the field is a bool. Otherwise,
>   // it is assumed to be an integer. the integer value may be the name of an
>   // enum constant. If multiple features use the same integer field, the
>   // field will be set to the maximum value of all enabled features that
>   // share the field.
>   //
>   string Value = v;

( 
https://github.com/llvm/llvm-project/blob/0263c15f874d4fc33308db93023e583b816b920e/llvm/include/llvm/Target/Target.td#L499
 )

https://github.com/llvm/llvm-project/pull/152121
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to