[PATCH] Attach function attribute "arm-restrict-it" instead of passing arm-restrict-it as a backend-option

Akira Hatanaka ahatanak at gmail.com
Tue Jun 23 12:03:24 PDT 2015


On Mon, Jun 22, 2015 at 2:00 PM, Eric Christopher <echristo at gmail.com>
wrote:

>
>
> On Mon, Jun 22, 2015 at 1:49 PM Akira Hatanaka <ahatanak at gmail.com> wrote:
>
>> In http://reviews.llvm.org/D10414#191915, @echristo wrote:
>>
>> > Another possibility is that this gets mapped as a normal command line
>> option passed into cc1 and then it can just be a subtarget feature?
>>
>>
>> Would it look something like this in the IR?
>>
>> "target-features"="+neon,+vfp3,arn-restrict-it=false"
>>
>
> was thinking of more just:
>
> "target-features"="+neon,+vfp3,-restrict-it"
>
> Though if we're going for "restrict-it" blocks perhaps a better name that
> works well with +/-?
>
> I've generally stayed away from turning command line options into
> features, but in the case of something that appears to turn on actual code
> generation features it seems like it might be reasonable.
>
>
Since restrict-it is a tri-state, I think you'll have to define two new
subtarget features in ARM.td (see the attached patch). I'm not sure how
prefixing "restrict-it" by "-" is going to work.

This approach can potentially create larger numbers of subtarget objects as
two subtarget objects have to be created If one function has feature
"restricted-it" and another has feature "no-restricted-it". If we take the
approach in my original patch, we need only one subtarget object. Do you
think that's going to be a problem?

-eric
>
>
>>
>>
>> http://reviews.llvm.org/D10414
>>
>> EMAIL PREFERENCES
>>   http://reviews.llvm.org/settings/panel/emailpreferences/
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150623/8e01f4df/attachment.html>
-------------- next part --------------
diff --git a/lib/Target/ARM/ARM.td b/lib/Target/ARM/ARM.td
index c7ea18a..ff896df 100644
--- a/lib/Target/ARM/ARM.td
+++ b/lib/Target/ARM/ARM.td
@@ -182,6 +182,15 @@ def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
                                    "Support ARM v8.1a instructions",
                                    [HasV8Ops, FeatureAClass, FeatureCRC]>;
 
+// RestrictIT
+def FeatureRestrictedIT : SubtargetFeature<"restricted-it", "RestrictedITMode",
+                                           "RestrictedIT", "Restrict IT block">;
+
+def FeatureNoRestrictedIT : SubtargetFeature<"no-restricted-it",
+                                             "RestrictedITMode",
+                                             "NoRestrictedIT",
+                                             "Don't restrict IT block">;
+
 //===----------------------------------------------------------------------===//
 // ARM Processors supported.
 //
diff --git a/lib/Target/ARM/ARMSubtarget.cpp b/lib/Target/ARM/ARMSubtarget.cpp
index 55808df..4cd0e13 100644
--- a/lib/Target/ARM/ARMSubtarget.cpp
+++ b/lib/Target/ARM/ARMSubtarget.cpp
@@ -173,6 +173,7 @@ void ARMSubtarget::initializeEnvironment() {
   Thumb2DSP = false;
   UseNaClTrap = false;
   UnsafeFPMath = false;
+  RestrictedITMode = DefaultIT;
 }
 
 void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h
index f00594f..2691e84 100644
--- a/lib/Target/ARM/ARMSubtarget.h
+++ b/lib/Target/ARM/ARMSubtarget.h
@@ -49,6 +49,12 @@ protected:
     None, AClass, RClass, MClass
   };
 
+  enum RestrictedITModeEnum {
+    DefaultIT, RestrictedIT, NoRestrictedIT
+  };
+
+  RestrictedITModeEnum RestrictedITMode;
+
   /// ARMProcFamily - ARM processor family: Cortex-A8, Cortex-A9, and others.
   ARMProcFamilyEnum ARMProcFamily;
 


More information about the cfe-commits mailing list