comparison gen/abi-x86-64.cpp @ 1054:a3d7288c4473

Future-proof the code to classify static array members of structs. I made sure to create a merge conflict with the code attached to ticket #229 (which comments this code out due to changes in the DMD 'Type' type hierarchy) so that if it gets committed as-is there will be a human looking at it.
author Frits van Bommel <fvbommel wxs.nl>
date Sun, 08 Mar 2009 01:26:30 +0100
parents dc608dc33081
children 40d7f9b7357f
comparison
equal deleted inserted replaced
1053:11e28922ac76 1054:a3d7288c4473
151 // This isn't creal, yet is > 16 bytes, so pass in memory. 151 // This isn't creal, yet is > 16 bytes, so pass in memory.
152 // Must be after creal case but before arrays and structs, 152 // Must be after creal case but before arrays and structs,
153 // the other types that can get bigger than 16 bytes 153 // the other types that can get bigger than 16 bytes
154 accum.addField(offset, Memory); 154 accum.addField(offset, Memory);
155 } else if (ty->ty == Tsarray) { 155 } else if (ty->ty == Tsarray) {
156 d_uns64 eltsize = ty->next->size(); 156 Type* eltType = ty->nextOf();
157 d_uns64 eltsize = eltType->size();
157 if (eltsize > 0) { 158 if (eltsize > 0) {
158 d_uns64 dim = ty->size() / eltsize; 159 d_uns64 dim = ty->size() / eltsize;
159 assert(dim <= 16 160 assert(dim <= 16
160 && "Array of non-empty type <= 16 bytes but > 16 elements?"); 161 && "Array of non-empty type <= 16 bytes but > 16 elements?");
161 for (d_uns64 i = 0; i < dim; i++) { 162 for (d_uns64 i = 0; i < dim; i++) {
162 classifyType(accum, ty->next, offset); 163 classifyType(accum, eltType, offset);
163 offset += eltsize; 164 offset += eltsize;
164 } 165 }
165 } 166 }
166 } else if (ty->ty == Tstruct) { 167 } else if (ty->ty == Tstruct) {
167 Array* fields = &((TypeStruct*) ty)->sym->fields; 168 Array* fields = &((TypeStruct*) ty)->sym->fields;