PATCH: TableGen: Report an error when defining more than 32 subreg indices
Tom Stellard
tom at stellard.net
Thu Jan 31 06:23:20 PST 2013
Hi,
The maximum number of sub reg indices is limited to 32 by use of the
LaneMask. TableGen currently assigns all sub reg indices after the
first 32 to the same LaneMask, which leads to bugs in the register
allocator. This patch prevents the user from defining more than 32
sub reg indices.
-Tom
-------------- next part --------------
diff --git utils/TableGen/CodeGenRegisters.cpp utils/TableGen/CodeGenRegisters.cpp
index e902ce0..3a960fd 100644
--- utils/TableGen/CodeGenRegisters.cpp
+++ utils/TableGen/CodeGenRegisters.cpp
@@ -1197,8 +1197,11 @@ void CodeGenRegBank::computeSubRegIndexLaneMasks() {
CodeGenSubRegIndex *Idx = SubRegIndices[i];
if (Idx->getComposites().empty()) {
Idx->LaneMask = 1u << Bit;
- // Share bit 31 in the unlikely case there are more than 32 leafs.
- if (Bit < 31) ++Bit;
+ if (Bit > 31) {
+ PrintFatalError("Too many SubRegIndex values have been defined. The "
+ "maximum number allowed is 32.");
+ }
+ ++Bit;
} else {
Idx->LaneMask = 0;
}
More information about the llvm-commits
mailing list