@@ -220,6 +220,45 @@ void DataLayout::reset(StringRef Desc) {
220
220
return report_fatal_error (std::move (Err));
221
221
}
222
222
223
+ DataLayout &DataLayout::operator =(const DataLayout &Other) {
224
+ clear ();
225
+ StringRepresentation = Other.StringRepresentation ;
226
+ BigEndian = Other.BigEndian ;
227
+ AllocaAddrSpace = Other.AllocaAddrSpace ;
228
+ ProgramAddrSpace = Other.ProgramAddrSpace ;
229
+ DefaultGlobalsAddrSpace = Other.DefaultGlobalsAddrSpace ;
230
+ StackNaturalAlign = Other.StackNaturalAlign ;
231
+ FunctionPtrAlign = Other.FunctionPtrAlign ;
232
+ TheFunctionPtrAlignType = Other.TheFunctionPtrAlignType ;
233
+ ManglingMode = Other.ManglingMode ;
234
+ LegalIntWidths = Other.LegalIntWidths ;
235
+ IntAlignments = Other.IntAlignments ;
236
+ FloatAlignments = Other.FloatAlignments ;
237
+ VectorAlignments = Other.VectorAlignments ;
238
+ StructAlignment = Other.StructAlignment ;
239
+ Pointers = Other.Pointers ;
240
+ NonIntegralAddressSpaces = Other.NonIntegralAddressSpaces ;
241
+ return *this ;
242
+ }
243
+
244
+ bool DataLayout::operator ==(const DataLayout &Other) const {
245
+ // NOTE: StringRepresentation might differ, it is not canonicalized.
246
+ // FIXME: NonIntegralAddressSpaces isn't compared.
247
+ return BigEndian == Other.BigEndian &&
248
+ AllocaAddrSpace == Other.AllocaAddrSpace &&
249
+ ProgramAddrSpace == Other.ProgramAddrSpace &&
250
+ DefaultGlobalsAddrSpace == Other.DefaultGlobalsAddrSpace &&
251
+ StackNaturalAlign == Other.StackNaturalAlign &&
252
+ FunctionPtrAlign == Other.FunctionPtrAlign &&
253
+ TheFunctionPtrAlignType == Other.TheFunctionPtrAlignType &&
254
+ ManglingMode == Other.ManglingMode &&
255
+ LegalIntWidths == Other.LegalIntWidths &&
256
+ IntAlignments == Other.IntAlignments &&
257
+ FloatAlignments == Other.FloatAlignments &&
258
+ VectorAlignments == Other.VectorAlignments &&
259
+ StructAlignment == Other.StructAlignment && Pointers == Other.Pointers ;
260
+ }
261
+
223
262
Expected<DataLayout> DataLayout::parse (StringRef LayoutDescription) {
224
263
DataLayout Layout (" " );
225
264
if (Error Err = Layout.parseSpecifier (LayoutDescription))
@@ -556,25 +595,6 @@ DataLayout::DataLayout(const Module *M) {
556
595
557
596
void DataLayout::init (const Module *M) { *this = M->getDataLayout (); }
558
597
559
- bool DataLayout::operator ==(const DataLayout &Other) const {
560
- bool Ret = BigEndian == Other.BigEndian &&
561
- AllocaAddrSpace == Other.AllocaAddrSpace &&
562
- StackNaturalAlign == Other.StackNaturalAlign &&
563
- ProgramAddrSpace == Other.ProgramAddrSpace &&
564
- DefaultGlobalsAddrSpace == Other.DefaultGlobalsAddrSpace &&
565
- FunctionPtrAlign == Other.FunctionPtrAlign &&
566
- TheFunctionPtrAlignType == Other.TheFunctionPtrAlignType &&
567
- ManglingMode == Other.ManglingMode &&
568
- LegalIntWidths == Other.LegalIntWidths &&
569
- IntAlignments == Other.IntAlignments &&
570
- FloatAlignments == Other.FloatAlignments &&
571
- VectorAlignments == Other.VectorAlignments &&
572
- StructAlignment == Other.StructAlignment &&
573
- Pointers == Other.Pointers ;
574
- // Note: getStringRepresentation() might differs, it is not canonicalized
575
- return Ret;
576
- }
577
-
578
598
static SmallVectorImpl<LayoutAlignElem>::const_iterator
579
599
findAlignmentLowerBound (const SmallVectorImpl<LayoutAlignElem> &Alignments,
580
600
uint32_t BitWidth) {
0 commit comments