summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MIRParser/MIParser.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-06-08 23:27:46 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-06-08 23:27:46 +0000
commit2c6469687d6e9c65f8060ced5768a36864784a13 (patch)
treefd8ac4d2de86f23c9fc9d92fc46d458f820913dc /llvm/lib/CodeGen/MIRParser/MIParser.cpp
parentf05f360debba5bb7b096f7ad8b6effc8c084609c (diff)
downloadbcm5719-llvm-2c6469687d6e9c65f8060ced5768a36864784a13.tar.gz
bcm5719-llvm-2c6469687d6e9c65f8060ced5768a36864784a13.zip
[MIR] Check that generic virtual registers get a size.
Without that check it was possible to write test cases where the size was not specified and we ended up with weird asserts down the road, because the default value (1) would not make sense. llvm-svn: 272226
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIParser.cpp')
-rw-r--r--llvm/lib/CodeGen/MIRParser/MIParser.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 158502ce353..405e508b51e 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -970,10 +970,7 @@ bool MIParser::parseRegisterOperand(MachineOperand &Dest,
TiedDefIdx = Idx;
}
} else if (consumeIfPresent(MIToken::lparen)) {
- // Generic virtual registers must have a size.
- // The "must" part will be verify by the machine verifier,
- // because at this point we actually do not know if Reg is
- // a generic virtual register.
+ // Virtual registers may have a size with GlobalISel.
if (!TargetRegisterInfo::isVirtualRegister(Reg))
return error("unexpected size on physical register");
unsigned Size;
@@ -982,6 +979,11 @@ bool MIParser::parseRegisterOperand(MachineOperand &Dest,
MachineRegisterInfo &MRI = MF.getRegInfo();
MRI.setSize(Reg, Size);
+ } else if (PFS.GenericVRegs.count(Reg)) {
+ // Generic virtual registers must have a size.
+ // If we end up here this means the size hasn't been specified and
+ // this is bad!
+ return error("generic virtual registers must have a size");
}
Dest = MachineOperand::CreateReg(
Reg, Flags & RegState::Define, Flags & RegState::Implicit,
OpenPOWER on IntegriCloud