diff --git a/llvm/lib/Target/PowerPC/PPC.td b/llvm/lib/Target/PowerPC/PPC.td --- a/llvm/lib/Target/PowerPC/PPC.td +++ b/llvm/lib/Target/PowerPC/PPC.td @@ -316,6 +316,9 @@ "true", "Prefer likely predicted branches over selects">; +def FeatureCheapMFLR : + SubtargetFeature<"cheap-MFLR", "CheapMFLR", "true", "Enable cheap MFLR">; + // Since new processors generally contain a superset of features of those that // came before them, the idea is to make implementations of new processors // less error prone and easier to read. @@ -424,7 +427,7 @@ !listconcat(FusionFeatures, [ DirectivePwr10, FeatureISA3_1, FeaturePrefixInstrs, FeaturePCRelativeMemops, FeatureP10Vector, FeatureMMA, - FeaturePairedVectorMemops]); + FeaturePairedVectorMemops, FeatureCheapMFLR]); list P10SpecificFeatures = []; list P10InheritableFeatures = !listconcat(P9InheritableFeatures, P10AdditionalFeatures); diff --git a/llvm/lib/Target/PowerPC/PPCSubtarget.h b/llvm/lib/Target/PowerPC/PPCSubtarget.h --- a/llvm/lib/Target/PowerPC/PPCSubtarget.h +++ b/llvm/lib/Target/PowerPC/PPCSubtarget.h @@ -168,6 +168,7 @@ bool UsePPCPostRASchedStrategy; bool PairedVectorMemops; bool PredictableSelectIsExpensive; + bool CheapMFLR; bool HasModernAIXAs; bool IsAIX; @@ -437,6 +438,10 @@ return PredictableSelectIsExpensive; } + bool isCheapMFLR() const { + return CheapMFLR; + } + // Select allocation orders of GPRC and G8RC. It should be strictly consistent // with corresponding AltOrders in PPCRegisterInfo.td. unsigned getGPRAllocationOrderIdx() const { diff --git a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp --- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp @@ -149,6 +149,7 @@ UsePPCPostRASchedStrategy = false; PairedVectorMemops = false; PredictableSelectIsExpensive = false; + CheapMFLR = false; HasModernAIXAs = false; IsAIX = false;