mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-07 11:59:09 +00:00
TableGen: Work around assert on Mips register definitions
This would hit the "Biggest class wasn't first" assert in getMatchingSubClassWithSubRegs in a future patch for EXTRACT_SUBREG handling. Mips defines 4 identical register classes (MSA128B, MSA128H, MSA128BW, MSA128D). These have the same set of registers, and only differ by the isel type. I believe this is an ill formed way of defining registers, that probably is just to work around the inconvenience of mixing different types in a single register class in DAG patterns. Since these all have the same size, they would all sort to the beginning, but you would not necessarily get the same super register at the front as the assert enforces. Breaking the ambiguity by also sorting by name doesn't work, since each of these register classes all want to be first. Force sorting of the original register class if the size is the same.
This commit is contained in:
parent
4033ac12d5
commit
a3296c73e9
@ -990,8 +990,12 @@ void CodeGenRegisterClass::computeSubClasses(CodeGenRegBank &RegBank) {
|
||||
Optional<std::pair<CodeGenRegisterClass *, CodeGenRegisterClass *>>
|
||||
CodeGenRegisterClass::getMatchingSubClassWithSubRegs(
|
||||
CodeGenRegBank &RegBank, const CodeGenSubRegIndex *SubIdx) const {
|
||||
auto SizeOrder = [](const CodeGenRegisterClass *A,
|
||||
auto SizeOrder = [this](const CodeGenRegisterClass *A,
|
||||
const CodeGenRegisterClass *B) {
|
||||
// If there are multiple, identical register classes, prefer the original
|
||||
// register class.
|
||||
if (A->getMembers().size() == B->getMembers().size())
|
||||
return A == this;
|
||||
return A->getMembers().size() > B->getMembers().size();
|
||||
};
|
||||
|
||||
@ -1008,7 +1012,9 @@ CodeGenRegisterClass::getMatchingSubClassWithSubRegs(
|
||||
if (SuperRegRCsBV[RC.EnumValue])
|
||||
SuperRegRCs.emplace_back(&RC);
|
||||
llvm::sort(SuperRegRCs, SizeOrder);
|
||||
assert(SuperRegRCs.front() == BiggestSuperRegRC && "Biggest class wasn't first");
|
||||
|
||||
assert(SuperRegRCs.front() == BiggestSuperRegRC &&
|
||||
"Biggest class wasn't first");
|
||||
|
||||
// Find all the subreg classes and order them by size too.
|
||||
std::vector<std::pair<CodeGenRegisterClass *, BitVector>> SuperRegClasses;
|
||||
|
Loading…
x
Reference in New Issue
Block a user