[llvm] cadeb87 - [AVR][NFC] Remove redundant target feature PROGMEM

Ben Shi via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 29 19:30:07 PST 2023


Author: Ben Shi
Date: 2023-01-30T11:29:46+08:00
New Revision: cadeb8720bbd6d7273eb27a2c3bf99adfeb0333e

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

LOG: [AVR][NFC] Remove redundant target feature PROGMEM

The functionality of FeaturePROGMEM is all equivalant to FeatureLPM.

Reviewed By: Chenbing.Zheng, aykevl

Differential Revision: https://reviews.llvm.org/D141242

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AVR/AVRAsmPrinter.cpp b/llvm/lib/Target/AVR/AVRAsmPrinter.cpp
index c625290751080..c0372e10ff9a3 100644
--- a/llvm/lib/Target/AVR/AVRAsmPrinter.cpp
+++ b/llvm/lib/Target/AVR/AVRAsmPrinter.cpp
@@ -259,9 +259,9 @@ bool AVRAsmPrinter::doFinalization(Module &M) {
     auto *Section = cast<MCSectionELF>(TLOF.SectionForGlobal(&GO, TM));
     if (Section->getName().startswith(".data"))
       NeedsCopyData = true;
-    else if (Section->getName().startswith(".rodata") && SubTM->hasPROGMEM())
-      // AVRs that have a separate PROGMEM (that's most AVRs) store .rodata
-      // sections in RAM.
+    else if (Section->getName().startswith(".rodata") && SubTM->hasLPM())
+      // AVRs that have a separate program memory (that's most AVRs) store
+      // .rodata sections in RAM.
       NeedsCopyData = true;
     else if (Section->getName().startswith(".bss"))
       NeedsClearBSS = true;

diff  --git a/llvm/lib/Target/AVR/AVRDevices.td b/llvm/lib/Target/AVR/AVRDevices.td
index f2c8a2e7a71e7..8ecb0a1e7b12e 100644
--- a/llvm/lib/Target/AVR/AVRDevices.td
+++ b/llvm/lib/Target/AVR/AVRDevices.td
@@ -65,11 +65,6 @@ def FeatureMOVW : SubtargetFeature<"movw", "m_hasMOVW", "true",
                                    "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 @@ def ELFArchXMEGA7 : ELFArch<"EF_AVR_ARCH_XMEGA7">;
 // 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 @@ def FamilyTiny
               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,

diff  --git a/llvm/lib/Target/AVR/AVRSubtarget.h b/llvm/lib/Target/AVR/AVRSubtarget.h
index 25046e6cf1eaf..78ffb4260de49 100644
--- a/llvm/lib/Target/AVR/AVRSubtarget.h
+++ b/llvm/lib/Target/AVR/AVRSubtarget.h
@@ -73,7 +73,6 @@ class AVRSubtarget : public AVRGenSubtargetInfo {
   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 @@ class AVRSubtarget : public AVRGenSubtargetInfo {
   bool m_hasLPMX = false;
   bool m_hasELPM = false;
   bool m_hasELPMX = false;
-  bool m_hasPROGMEM = false;
   bool m_hasSPM = false;
   bool m_hasSPMX = false;
   bool m_hasDES = false;


        


More information about the llvm-commits mailing list