mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
Add a TargetRegisterInfo::composeSubRegIndices hook with a default
implementation that is correct for most targets. Tablegen will override where needed. Add MachineOperand::subst{Virt,Phys}Reg methods that correctly handle existing subreg indices when sustituting registers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104985 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -111,6 +111,25 @@ void MachineOperand::setReg(unsigned Reg) {
|
||||
Contents.Reg.RegNo = Reg;
|
||||
}
|
||||
|
||||
void MachineOperand::substVirtReg(unsigned Reg, unsigned SubIdx,
|
||||
const TargetRegisterInfo &TRI) {
|
||||
assert(TargetRegisterInfo::isVirtualRegister(Reg));
|
||||
if (SubIdx && getSubReg())
|
||||
SubIdx = TRI.composeSubRegIndices(SubIdx, getSubReg());
|
||||
setReg(Reg);
|
||||
setSubReg(SubIdx);
|
||||
}
|
||||
|
||||
void MachineOperand::substPhysReg(unsigned Reg, const TargetRegisterInfo &TRI) {
|
||||
assert(TargetRegisterInfo::isPhysicalRegister(Reg));
|
||||
if (getSubReg()) {
|
||||
Reg = TRI.getSubReg(Reg, getSubReg());
|
||||
assert(Reg && "Invalid SubReg for physical register");
|
||||
setSubReg(0);
|
||||
}
|
||||
setReg(Reg);
|
||||
}
|
||||
|
||||
/// ChangeToImmediate - Replace this operand with a new immediate operand of
|
||||
/// the specified value. If an operand is known to be an immediate already,
|
||||
/// the setImm method should be used.
|
||||
|
Reference in New Issue
Block a user