Skip to content

Commit e554f3d

Browse files
committed
[DataLayout] Refactor parseSpecification
1 parent 13983f4 commit e554f3d

File tree

10 files changed

+168
-245
lines changed

10 files changed

+168
-245
lines changed

llvm/include/llvm/IR/DataLayout.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,6 @@ class DataLayout {
115115
// FIXME: `unsigned char` truncates the value parsed by `parseSpecifier`.
116116
SmallVector<unsigned char, 8> LegalIntWidths;
117117

118-
/// Type specifier used by some internal functions.
119-
enum class TypeSpecifier {
120-
Integer = 'i',
121-
Float = 'f',
122-
Vector = 'v',
123-
Aggregate = 'a'
124-
};
125-
126118
/// Primitive type specifications. Sorted and uniqued by type bit width.
127119
SmallVector<PrimitiveSpec, 6> IntSpecs;
128120
SmallVector<PrimitiveSpec, 4> FloatSpecs;
@@ -145,10 +137,9 @@ class DataLayout {
145137
/// well-defined bitwise representation.
146138
SmallVector<unsigned, 8> NonIntegralAddressSpaces;
147139

148-
/// Attempts to set the specification for the given type.
149-
/// Returns an error description on failure.
150-
Error setPrimitiveSpec(TypeSpecifier Specifier, uint32_t BitWidth,
151-
Align ABIAlign, Align PrefAlign);
140+
/// Sets or updates the specification for the given primitive type.
141+
void setPrimitiveSpec(char Specifier, uint32_t BitWidth, Align ABIAlign,
142+
Align PrefAlign);
152143

153144
/// Searches for a pointer specification that matches the given address space.
154145
/// Returns the default address space specification if not found.
@@ -164,7 +155,13 @@ class DataLayout {
164155
/// Internal helper method that returns requested alignment for type.
165156
Align getAlignment(Type *Ty, bool abi_or_pref) const;
166157

167-
/// Attempts to parse a pointer specification ('p').
158+
/// Attempts to parse primitive specification ('i', 'f', or 'v').
159+
Error parsePrimitiveSpec(StringRef Spec);
160+
161+
/// Attempts to parse aggregate specification ('a').
162+
Error parseAggregateSpec(StringRef Spec);
163+
164+
/// Attempts to parse pointer specification ('p').
168165
Error parsePointerSpec(StringRef Spec);
169166

170167
/// Attempts to parse a single specification.

0 commit comments

Comments
 (0)