diff options
author | Tim Northover <tnorthover@apple.com> | 2016-09-09 11:46:34 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2016-09-09 11:46:34 +0000 |
commit | 0f140c769a75779991d0bb31c2e34907621d2386 (patch) | |
tree | ee9ab7880246083d7fe91bd95f29a59a98e2e09f /llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp | |
parent | a3afe44d6c1499e7b11968ed502f3d5193479076 (diff) | |
download | bcm5719-llvm-0f140c769a75779991d0bb31c2e34907621d2386.tar.gz bcm5719-llvm-0f140c769a75779991d0bb31c2e34907621d2386.zip |
GlobalISel: move type information to MachineRegisterInfo.
We want each register to have a canonical type, which means the best place to
store this is in MachineRegisterInfo rather than on every MachineInstr that
happens to use or define that register.
Most changes following from this are pretty simple (you need an MRI anyway if
you're going to be doing any transformations, so just check the type there).
But legalization doesn't really want to check redundant operands (when, for
example, a G_ADD only ever has one type) so I've made use of MCInstrDesc's
operand type field to encode these constraints and limit legalization's work.
As an added bonus, more validation is possible, both in MachineVerifier and
MachineIRBuilder (coming soon).
llvm-svn: 281035
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp index 5a950ff17c1..71985268406 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp @@ -367,7 +367,8 @@ unsigned RegisterBankInfo::getSizeInBits(unsigned Reg, // get the size of that register class. RC = TRI.getMinimalPhysRegClass(Reg); } else { - unsigned RegSize = MRI.getSize(Reg); + LLT Ty = MRI.getType(Reg); + unsigned RegSize = Ty.isSized() ? Ty.getSizeInBits() : 0; // If Reg is not a generic register, query the register class to // get its size. if (RegSize) @@ -566,7 +567,7 @@ void RegisterBankInfo::OperandsMapper::createVRegs(unsigned OpIdx) { for (unsigned &NewVReg : NewVRegsForOpIdx) { assert(PartMap != PartMapList.end() && "Out-of-bound access"); assert(NewVReg == 0 && "Register has already been created"); - NewVReg = MRI.createGenericVirtualRegister(PartMap->Length); + NewVReg = MRI.createGenericVirtualRegister(LLT::scalar(PartMap->Length)); MRI.setRegBank(NewVReg, *PartMap->RegBank); ++PartMap; } |