Changeset 3769 in CLRX
 Timestamp:
 Feb 11, 2018, 5:23:38 PM (2 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

CLRadeonExtender/trunk/amdasm/AsmExpression.cpp
r3768 r3769 151 151 const Array<RelMultiply>& relatives2, bool checkRelSpaces) 152 152 { 153 // if no check relspaces or if no real rel spaces in relatives 154 bool equal = true; 155 size_t requals = 0; 156 if (relatives2.size() != relatives.size()) 157 equal = false; 158 else 159 { 160 // check whether relatives as same in two operands 161 for (const RelMultiply& r: relatives2) 162 for (RelMultiply& r2: relatives) 163 if (r.multiply == r2.multiply && 164 r.sectionId == r2.sectionId) 165 { 166 r2.sectionId = ASMSECT_ABS; // ignore in next iter 167 requals++; 168 break; 169 } 170 if (requals != relatives.size()) 171 equal = false; 172 } 173 174 if (equal) // if equal in previous method 175 return true; 176 177 if (!checkRelSpaces) // otherwise is not equal 178 return false; 179 153 180 std::vector<RelMultiply> relSpaces1(relatives.size()); 154 181 std::vector<RelMultiply> relSpaces2(relatives2.size()); 155 182 const std::vector<AsmSection>& sections = assembler.getSections(); 156 183 157 bool haveRealRelSpaces = false; 158 if (checkRelSpaces) 159 { 160 // convert sections to relspaces 161 for (size_t i = 0; i < relSpaces1.size(); i++) 162 if (sections[relatives[i].sectionId].relSpace != UINT_MAX) 163 { 164 relSpaces1[i] = { relatives[i].multiply, 165 sections[relatives[i].sectionId].relSpace }; 166 haveRealRelSpaces = true; 167 } 168 else // treat as separate relSpace 169 relSpaces1[i] = { relatives[i].multiply, 170 0x80000000  relatives[i].sectionId }; 171 172 for (size_t i = 0; i < relSpaces2.size(); i++) 173 if (sections[relatives2[i].sectionId].relSpace != UINT_MAX) 174 { 175 relSpaces2[i] = { relatives2[i].multiply, 176 sections[relatives2[i].sectionId].relSpace }; 177 haveRealRelSpaces = true; 178 } 179 else // treat as separate relSpace 180 relSpaces2[i] = { relatives2[i].multiply, 181 0x80000000  relatives2[i].sectionId }; 182 } 183 184 if (!checkRelSpaces  !haveRealRelSpaces) 185 { 186 // if no check relspaces or if no real rel spaces in relatives 187 size_t requals = 0; 188 if (relatives2.size() != relatives.size()) 184 // convert sections to relspaces 185 for (size_t i = 0; i < relSpaces1.size(); i++) 186 if (sections[relatives[i].sectionId].relSpace != UINT_MAX) 187 relSpaces1[i] = { relatives[i].multiply, 188 sections[relatives[i].sectionId].relSpace }; 189 else // treat as separate relSpace 190 relSpaces1[i] = { relatives[i].multiply, 191 0x80000000  relatives[i].sectionId }; 192 193 for (size_t i = 0; i < relSpaces2.size(); i++) 194 if (sections[relatives2[i].sectionId].relSpace != UINT_MAX) 195 relSpaces2[i] = { relatives2[i].multiply, 196 sections[relatives2[i].sectionId].relSpace }; 197 else // treat as separate relSpace 198 relSpaces2[i] = { relatives2[i].multiply, 199 0x80000000  relatives2[i].sectionId }; 200 201 // sort 202 std::sort(relSpaces1.begin(), relSpaces1.end(), compareRelMSectionLess); 203 std::sort(relSpaces2.begin(), relSpaces2.end(), compareRelMSectionLess); 204 // reduce relspaces by sum multiplies 205 reduceRelMultiplies(relSpaces1); 206 reduceRelMultiplies(relSpaces2); 207 208 /// compare relspaces 209 if (relSpaces1.size() != relSpaces2.size()) 210 return false; 211 for (size_t i = 0; i < relSpaces1.size(); i++) 212 if (relSpaces1[i].multiply != relSpaces2[i].multiply  213 relSpaces1[i].sectionId != relSpaces2[i].sectionId) 189 214 return false; 190 else191 {192 // check whether relatives as same in two operands193 for (const RelMultiply& r: relatives2)194 for (RelMultiply& r2: relatives)195 if (r.multiply == r2.multiply &&196 r.sectionId == r2.sectionId)197 {198 r2.sectionId = ASMSECT_ABS; // ignore in next iter199 requals++;200 break;201 }202 if (requals != relatives.size())203 return false;204 }205 }206 else207 {208 // sort209 std::sort(relSpaces1.begin(), relSpaces1.end(), compareRelMSectionLess);210 std::sort(relSpaces2.begin(), relSpaces2.end(), compareRelMSectionLess);211 // reduce relspaces by sum multiplies212 reduceRelMultiplies(relSpaces1);213 reduceRelMultiplies(relSpaces2);214 215 /// compare relspaces216 if (relSpaces1.size() != relSpaces2.size())217 return false;218 for (size_t i = 0; i < relSpaces1.size(); i++)219 if (relSpaces1[i].multiply != relSpaces2[i].multiply 220 relSpaces1[i].sectionId != relSpaces2[i].sectionId)221 return false;222 }223 215 return true; 224 216 }
Note: See TracChangeset
for help on using the changeset viewer.