[llvm] r371082 - [Alignment][NFC] Change internal representation of TargetLowering.h

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 08:44:33 PDT 2019


Author: gchatelet
Date: Thu Sep  5 08:44:33 2019
New Revision: 371082

URL: http://llvm.org/viewvc/llvm-project?rev=371082&view=rev
Log:
[Alignment][NFC] Change internal representation of TargetLowering.h

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

Modified:
    llvm/trunk/include/llvm/CodeGen/TargetLowering.h
    llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp

Modified: llvm/trunk/include/llvm/CodeGen/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLowering.h?rev=371082&r1=371081&r2=371082&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLowering.h Thu Sep  5 08:44:33 2019
@@ -1578,22 +1578,22 @@ public:
 
   /// Return the minimum stack alignment of an argument.
   unsigned getMinStackArgumentAlignment() const {
-    return MinStackArgumentAlignment;
+    return MinStackArgumentAlignment.value();
   }
 
   /// Return the minimum function alignment.
   unsigned getMinFunctionLogAlignment() const {
-    return MinFunctionLogAlignment;
+    return Log2(MinFunctionAlignment);
   }
 
   /// Return the preferred function alignment.
   unsigned getPrefFunctionLogAlignment() const {
-    return PrefFunctionLogAlignment;
+    return Log2(PrefFunctionAlignment);
   }
 
   /// Return the preferred loop alignment.
   virtual unsigned getPrefLoopLogAlignment(MachineLoop *ML = nullptr) const {
-    return PrefLoopLogAlignment;
+    return Log2(PrefLoopAlignment);
   }
 
   /// Should loops be aligned even when the function is marked OptSize (but not
@@ -2106,14 +2106,14 @@ protected:
 
   /// Set the target's minimum function alignment (in log2(bytes))
   void setMinFunctionLogAlignment(unsigned LogAlign) {
-    MinFunctionLogAlignment = LogAlign;
+    MinFunctionAlignment = llvm::Align(1ULL << LogAlign);
   }
 
   /// Set the target's preferred function alignment.  This should be set if
   /// there is a performance benefit to higher-than-minimum alignment (in
   /// log2(bytes))
   void setPrefFunctionLogAlignment(unsigned LogAlign) {
-    PrefFunctionLogAlignment = LogAlign;
+    PrefFunctionAlignment = llvm::Align(1ULL << LogAlign);
   }
 
   /// Set the target's preferred loop alignment. Default alignment is zero, it
@@ -2121,12 +2121,12 @@ protected:
   /// specified in log2(bytes). The target may also override
   /// getPrefLoopAlignment to provide per-loop values.
   void setPrefLoopLogAlignment(unsigned LogAlign) {
-    PrefLoopLogAlignment = LogAlign;
+    PrefLoopAlignment = llvm::Align(1ULL << LogAlign);
   }
 
   /// Set the minimum stack alignment of an argument.
   void setMinStackArgumentAlignment(unsigned Align) {
-    MinStackArgumentAlignment = Align;
+    MinStackArgumentAlignment = llvm::Align(Align);
   }
 
   /// Set the maximum atomic operation size supported by the
@@ -2688,18 +2688,18 @@ private:
   Sched::Preference SchedPreferenceInfo;
 
   /// The minimum alignment that any argument on the stack needs to have.
-  unsigned MinStackArgumentAlignment;
+  llvm::Align MinStackArgumentAlignment;
 
   /// The minimum function alignment (used when optimizing for size, and to
   /// prevent explicitly provided alignment from leading to incorrect code).
-  unsigned MinFunctionLogAlignment;
+  llvm::Align MinFunctionAlignment;
 
   /// The preferred function alignment (used when alignment unspecified and
   /// optimizing for speed).
-  unsigned PrefFunctionLogAlignment;
+  llvm::Align PrefFunctionAlignment;
 
   /// The preferred loop alignment (in log2 bot in bytes).
-  unsigned PrefLoopLogAlignment;
+  llvm::Align PrefLoopAlignment;
 
   /// Size in bits of the maximum atomics size the backend supports.
   /// Accesses larger than this will be expanded by AtomicExpandPass.

Modified: llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp?rev=371082&r1=371081&r2=371082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp Thu Sep  5 08:44:33 2019
@@ -583,11 +583,7 @@ TargetLoweringBase::TargetLoweringBase(c
   BooleanFloatContents = UndefinedBooleanContent;
   BooleanVectorContents = UndefinedBooleanContent;
   SchedPreferenceInfo = Sched::ILP;
-  MinFunctionLogAlignment = 0;
-  PrefFunctionLogAlignment = 0;
-  PrefLoopLogAlignment = 0;
   GatherAllAliasesMaxDepth = 18;
-  MinStackArgumentAlignment = 1;
   // TODO: the default will be switched to 0 in the next commit, along
   // with the Target-specific changes necessary.
   MaxAtomicSizeInBitsSupported = 1024;




More information about the llvm-commits mailing list