@@ -191,36 +191,30 @@ static const std::pair<AlignTypeEnum, LayoutAlignElem> DefaultAlignments[] = {
191
191
{VECTOR_ALIGN, {128 , Align (16 ), Align (16 )}}, // v16i8, v8i16, v4i32, ...
192
192
};
193
193
194
- void DataLayout::reset (StringRef Desc) {
195
- clear ();
196
-
197
- LayoutMap = nullptr ;
194
+ DataLayout::DataLayout (StringRef LayoutString) {
198
195
BigEndian = false ;
199
196
AllocaAddrSpace = 0 ;
200
- StackNaturalAlign.reset ();
201
197
ProgramAddrSpace = 0 ;
202
198
DefaultGlobalsAddrSpace = 0 ;
203
- FunctionPtrAlign.reset ();
204
199
TheFunctionPtrAlignType = FunctionPtrAlignType::Independent;
205
200
ManglingMode = MM_None;
206
- NonIntegralAddressSpaces.clear ();
207
201
StructAlignment = LayoutAlignElem::get (Align (1 ), Align (8 ), 0 );
208
202
209
203
// Default alignments
210
204
for (const auto &[Kind, Layout] : DefaultAlignments) {
211
205
if (Error Err = setAlignment (Kind, Layout.ABIAlign , Layout.PrefAlign ,
212
206
Layout.TypeBitWidth ))
213
- return report_fatal_error (std::move (Err));
207
+ report_fatal_error (std::move (Err));
214
208
}
215
209
if (Error Err = setPointerAlignmentInBits (0 , Align (8 ), Align (8 ), 64 , 64 ))
216
- return report_fatal_error (std::move (Err));
210
+ report_fatal_error (std::move (Err));
217
211
218
- if (Error Err = parseSpecifier (Desc ))
219
- return report_fatal_error (std::move (Err));
212
+ if (Error Err = parseSpecifier (LayoutString ))
213
+ report_fatal_error (std::move (Err));
220
214
}
221
215
222
216
DataLayout &DataLayout::operator =(const DataLayout &Other) {
223
- clear ();
217
+ // Copy everything except for LayoutMap, which will be recomputed on demand.
224
218
StringRepresentation = Other.StringRepresentation ;
225
219
BigEndian = Other.BigEndian ;
226
220
AllocaAddrSpace = Other.AllocaAddrSpace ;
@@ -716,19 +710,7 @@ class StructLayoutMap {
716
710
717
711
} // end anonymous namespace
718
712
719
- void DataLayout::clear () {
720
- LegalIntWidths.clear ();
721
- IntAlignments.clear ();
722
- FloatAlignments.clear ();
723
- VectorAlignments.clear ();
724
- Pointers.clear ();
725
- delete static_cast <StructLayoutMap *>(LayoutMap);
726
- LayoutMap = nullptr ;
727
- }
728
-
729
- DataLayout::~DataLayout () {
730
- clear ();
731
- }
713
+ DataLayout::~DataLayout () { delete static_cast <StructLayoutMap *>(LayoutMap); }
732
714
733
715
const StructLayout *DataLayout::getStructLayout (StructType *Ty) const {
734
716
if (!LayoutMap)
0 commit comments