forked from OSchip/llvm-project
bpf: Support 32-bit subregister in various InstrInfo hooks
This patch support 32-bit subregister in three InstrInfo hooks, i.e. copyPhysReg, loadRegFromStackSlot and storeRegToStackSlot, Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Reviewed-by: Yonghong Song <yhs@fb.com> llvm-svn: 325988
This commit is contained in:
parent
b1a52bd756
commit
fcd1e0f625
|
@ -36,6 +36,9 @@ void BPFInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
|||
if (BPF::GPRRegClass.contains(DestReg, SrcReg))
|
||||
BuildMI(MBB, I, DL, get(BPF::MOV_rr), DestReg)
|
||||
.addReg(SrcReg, getKillRegState(KillSrc));
|
||||
else if (BPF::GPR32RegClass.contains(DestReg, SrcReg))
|
||||
BuildMI(MBB, I, DL, get(BPF::MOV_rr_32), DestReg)
|
||||
.addReg(SrcReg, getKillRegState(KillSrc));
|
||||
else
|
||||
llvm_unreachable("Impossible reg-to-reg copy");
|
||||
}
|
||||
|
@ -54,6 +57,11 @@ void BPFInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
|
|||
.addReg(SrcReg, getKillRegState(IsKill))
|
||||
.addFrameIndex(FI)
|
||||
.addImm(0);
|
||||
else if (RC == &BPF::GPR32RegClass)
|
||||
BuildMI(MBB, I, DL, get(BPF::STW32))
|
||||
.addReg(SrcReg, getKillRegState(IsKill))
|
||||
.addFrameIndex(FI)
|
||||
.addImm(0);
|
||||
else
|
||||
llvm_unreachable("Can't store this register to stack slot");
|
||||
}
|
||||
|
@ -69,6 +77,8 @@ void BPFInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|||
|
||||
if (RC == &BPF::GPRRegClass)
|
||||
BuildMI(MBB, I, DL, get(BPF::LDD), DestReg).addFrameIndex(FI).addImm(0);
|
||||
else if (RC == &BPF::GPR32RegClass)
|
||||
BuildMI(MBB, I, DL, get(BPF::LDW32), DestReg).addFrameIndex(FI).addImm(0);
|
||||
else
|
||||
llvm_unreachable("Can't load this register from stack slot");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue