[llvm] [DataLayout] Privatize and rename '*AlignElem' structs and enum (NFC) (PR #103723)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 02:11:25 PDT 2024


================
@@ -136,25 +90,58 @@ class DataLayout {
     MM_Mips,
     MM_XCOFF
   };
-  ManglingModeT ManglingMode;
+  ManglingModeT ManglingMode = MM_None;
 
   // FIXME: `unsigned char` truncates the value parsed by `parseSpecifier`.
   SmallVector<unsigned char, 8> LegalIntWidths;
 
-  /// Primitive type alignment data. This is sorted by type and bit
-  /// width during construction.
-  using AlignmentsTy = SmallVector<LayoutAlignElem, 4>;
-  AlignmentsTy IntAlignments;
-  AlignmentsTy FloatAlignments;
-  AlignmentsTy VectorAlignments;
+  // Primitive type specifier.
+  enum class PrimitiveSpecifier {
+    Integer = 'i',
+    Float = 'f',
+    Vector = 'v',
+    // TODO: Aggregates are not primitives. This should be separated.
+    Aggregate = 'a'
+  };
 
-  /// The string representation used to create this DataLayout
-  std::string StringRepresentation;
+  // Primitive type specification.
+  struct PrimitiveSpec {
----------------
s-barannikov wrote:

Referring to this conversation: https://github.com/llvm/llvm-project/pull/103712/files#r1716487766
Making these two structs public would allow Default*Specs be completely local to cpp file.
It would also make unit-testing easier (need to add public accessors though).


https://github.com/llvm/llvm-project/pull/103723


More information about the llvm-commits mailing list