[PATCH] D141242: [AVR][NFC] Remove redundant target feature PROGMEM

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 8 17:20:55 PST 2023


benshi001 created this revision.
benshi001 added reviewers: aykevl, dylanmckay.
Herald added subscribers: Jim, hiraditya.
Herald added a project: All.
benshi001 requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.
Herald added a project: LLVM.

The functionality of FeaturePROGMEM is all equivalant to FeatureLPM.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141242

Files:
  llvm/lib/Target/AVR/AVRAsmPrinter.cpp
  llvm/lib/Target/AVR/AVRDevices.td
  llvm/lib/Target/AVR/AVRSubtarget.h


Index: llvm/lib/Target/AVR/AVRSubtarget.h
===================================================================
--- llvm/lib/Target/AVR/AVRSubtarget.h
+++ llvm/lib/Target/AVR/AVRSubtarget.h
@@ -73,7 +73,6 @@
   bool hasLPMX() const { return m_hasLPMX; }
   bool hasELPM() const { return m_hasELPM; }
   bool hasELPMX() const { return m_hasELPMX; }
-  bool hasPROGMEM() const { return m_hasPROGMEM; }
   bool hasSPM() const { return m_hasSPM; }
   bool hasSPMX() const { return m_hasSPMX; }
   bool hasDES() const { return m_hasDES; }
@@ -128,7 +127,6 @@
   bool m_hasLPMX;
   bool m_hasELPM;
   bool m_hasELPMX;
-  bool m_hasPROGMEM;
   bool m_hasSPM;
   bool m_hasSPMX;
   bool m_hasDES;
Index: llvm/lib/Target/AVR/AVRDevices.td
===================================================================
--- llvm/lib/Target/AVR/AVRDevices.td
+++ llvm/lib/Target/AVR/AVRDevices.td
@@ -65,11 +65,6 @@
                                    "The device supports the 16-bit MOVW "
                                    "instruction">;
 
-// The device has a separate flash namespace that must be accessed using special
-// instructions like lpm.
-def FeaturePROGMEM : SubtargetFeature<"progmem", "m_hasPROGMEM", "true",
-                                      "The device has a separate flash namespace">;
-
 // The device supports the `LPM` instruction, with implied destination being r0.
 def FeatureLPM : SubtargetFeature<"lpm", "m_hasLPM", "true",
                                   "The device supports the `LPM` instruction">;
@@ -161,7 +156,7 @@
 // device should have.
 def FamilyAVR0 : Family<"avr0", []>;
 
-def FamilyAVR1 : Family<"avr1", [FamilyAVR0, FeatureLPM, FeaturePROGMEM, FeatureMMR]>;
+def FamilyAVR1 : Family<"avr1", [FamilyAVR0, FeatureLPM, FeatureMMR]>;
 
 def FamilyAVR2
     : Family<"avr2",
@@ -197,13 +192,13 @@
               FeatureSmallStack]>;
 
 def FamilyXMEGA3 : Family<"xmega3",
-                          [FamilyAVR0, FeatureLPM, FeaturePROGMEM, FeatureIJMPCALL,
+                          [FamilyAVR0, FeatureLPM, FeatureIJMPCALL,
                            FeatureADDSUBIW, FeatureSRAM, FeatureJMPCALL,
                            FeatureMultiplication, FeatureMOVW, FeatureLPMX,
                            FeatureBREAK]>;
 
 def FamilyXMEGA : Family<"xmega",
-                         [FamilyAVR0, FeatureLPM, FeaturePROGMEM, FeatureIJMPCALL,
+                         [FamilyAVR0, FeatureLPM, FeatureIJMPCALL,
                           FeatureADDSUBIW, FeatureSRAM, FeatureJMPCALL,
                           FeatureMultiplication, FeatureMOVW, FeatureLPMX,
                           FeatureSPM, FeatureBREAK, FeatureEIJMPCALL,
Index: llvm/lib/Target/AVR/AVRAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/AVR/AVRAsmPrinter.cpp
+++ llvm/lib/Target/AVR/AVRAsmPrinter.cpp
@@ -252,7 +252,7 @@
     auto *Section = cast<MCSectionELF>(TLOF.SectionForGlobal(&GO, TM));
     if (Section->getName().startswith(".data"))
       NeedsCopyData = true;
-    else if (Section->getName().startswith(".rodata") && SubTM->hasPROGMEM())
+    else if (Section->getName().startswith(".rodata") && SubTM->hasLPM())
       // AVRs that have a separate PROGMEM (that's most AVRs) store .rodata
       // sections in RAM.
       NeedsCopyData = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141242.487249.patch
Type: text/x-patch
Size: 3309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230109/8453afdc/attachment.bin>


More information about the llvm-commits mailing list