forked from OSchip/llvm-project
Insertion methods now return void instead of #instrs inserted. Also, use
more powerful forms of BuildMI to concisify the code llvm-svn: 15782
This commit is contained in:
parent
772f0d4106
commit
48a3b942ae
|
@ -68,7 +68,7 @@ static unsigned getIdx(const TargetRegisterClass *RC) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
PowerPCRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
|
PowerPCRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator MI,
|
MachineBasicBlock::iterator MI,
|
||||||
unsigned SrcReg, int FrameIdx) const {
|
unsigned SrcReg, int FrameIdx) const {
|
||||||
|
@ -79,17 +79,15 @@ PowerPCRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
|
||||||
|
|
||||||
unsigned OC = Opcode[getIdx(RC)];
|
unsigned OC = Opcode[getIdx(RC)];
|
||||||
if (SrcReg == PPC::LR) {
|
if (SrcReg == PPC::LR) {
|
||||||
MBB.insert(MI, BuildMI(PPC::MFLR, 0, PPC::R0));
|
BuildMI(MBB, MI, PPC::MFLR, 0, PPC::R0);
|
||||||
MBB.insert(MI, addFrameReference(BuildMI(OC,3).addReg(PPC::R0),FrameIdx));
|
addFrameReference(BuildMI(MBB, MI, OC, 3).addReg(PPC::R0),FrameIdx);
|
||||||
return 2;
|
|
||||||
} else {
|
} else {
|
||||||
MBB.insert(MI, BuildMI(PPC::IMPLICIT_DEF, 0, PPC::R0));
|
BuildMI(MBB, MI, PPC::IMPLICIT_DEF, 0, PPC::R0);
|
||||||
MBB.insert(MI, addFrameReference(BuildMI(OC, 3).addReg(SrcReg),FrameIdx));
|
addFrameReference(BuildMI(MBB, MI, OC, 3).addReg(SrcReg),FrameIdx);
|
||||||
return 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
PowerPCRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
|
PowerPCRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator MI,
|
MachineBasicBlock::iterator MI,
|
||||||
unsigned DestReg, int FrameIdx) const{
|
unsigned DestReg, int FrameIdx) const{
|
||||||
|
@ -99,32 +97,28 @@ PowerPCRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
|
||||||
const TargetRegisterClass *RC = getRegClass(DestReg);
|
const TargetRegisterClass *RC = getRegClass(DestReg);
|
||||||
unsigned OC = Opcode[getIdx(RC)];
|
unsigned OC = Opcode[getIdx(RC)];
|
||||||
if (DestReg == PPC::LR) {
|
if (DestReg == PPC::LR) {
|
||||||
MBB.insert(MI, addFrameReference(BuildMI(OC, 2, PPC::R0), FrameIdx));
|
addFrameReference(BuildMI(MBB, MI, OC, 2, PPC::R0), FrameIdx);
|
||||||
MBB.insert(MI, BuildMI(PPC::MTLR, 1).addReg(PPC::R0));
|
BuildMI(MBB, MI, PPC::MTLR, 1).addReg(PPC::R0);
|
||||||
return 2;
|
|
||||||
} else {
|
} else {
|
||||||
MBB.insert(MI, BuildMI(PPC::IMPLICIT_DEF, 0, PPC::R0));
|
BuildMI(MBB, MI, PPC::IMPLICIT_DEF, 0, PPC::R0);
|
||||||
MBB.insert(MI, addFrameReference(BuildMI(OC, 2, DestReg), FrameIdx));
|
addFrameReference(BuildMI(MBB, MI, OC, 2, DestReg), FrameIdx);
|
||||||
return 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int PowerPCRegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
|
void PowerPCRegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator MI,
|
MachineBasicBlock::iterator MI,
|
||||||
unsigned DestReg, unsigned SrcReg,
|
unsigned DestReg, unsigned SrcReg,
|
||||||
const TargetRegisterClass *RC) const {
|
const TargetRegisterClass *RC) const {
|
||||||
MachineInstr *I;
|
MachineInstr *I;
|
||||||
|
|
||||||
if (RC == PowerPC::GPRCRegisterClass) {
|
if (RC == PowerPC::GPRCRegisterClass) {
|
||||||
I = BuildMI(PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg);
|
BuildMI(MBB, MI, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg);
|
||||||
} else if (RC == PowerPC::FPRCRegisterClass) {
|
} else if (RC == PowerPC::FPRCRegisterClass) {
|
||||||
I = BuildMI(PPC::FMR, 1, DestReg).addReg(SrcReg);
|
BuildMI(MBB, MI, PPC::FMR, 1, DestReg).addReg(SrcReg);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Attempt to copy register that is not GPR or FPR";
|
std::cerr << "Attempt to copy register that is not GPR or FPR";
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
MBB.insert(MI, I);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -30,17 +30,17 @@ public:
|
||||||
const TargetRegisterClass* getRegClassForType(const Type* Ty) const;
|
const TargetRegisterClass* getRegClassForType(const Type* Ty) const;
|
||||||
|
|
||||||
/// Code Generation virtual methods...
|
/// Code Generation virtual methods...
|
||||||
int storeRegToStackSlot(MachineBasicBlock &MBB,
|
void storeRegToStackSlot(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator MBBI,
|
|
||||||
unsigned SrcReg, int FrameIndex) const;
|
|
||||||
|
|
||||||
int loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator MBBI,
|
MachineBasicBlock::iterator MBBI,
|
||||||
unsigned DestReg, int FrameIndex) const;
|
unsigned SrcReg, int FrameIndex) const;
|
||||||
|
|
||||||
|
void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
||||||
|
MachineBasicBlock::iterator MBBI,
|
||||||
|
unsigned DestReg, int FrameIndex) const;
|
||||||
|
|
||||||
int copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
|
void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
|
||||||
unsigned DestReg, unsigned SrcReg,
|
unsigned DestReg, unsigned SrcReg,
|
||||||
const TargetRegisterClass *RC) const;
|
const TargetRegisterClass *RC) const;
|
||||||
|
|
||||||
void eliminateCallFramePseudoInstr(MachineFunction &MF,
|
void eliminateCallFramePseudoInstr(MachineFunction &MF,
|
||||||
MachineBasicBlock &MBB,
|
MachineBasicBlock &MBB,
|
||||||
|
|
Loading…
Reference in New Issue