mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 14:47:00 +00:00
Added moveReg2Reg() and moveImm2Reg() to accomodate moving data around due to
PHI nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5001 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
367ccab06e
commit
2b46e8eccc
@ -129,6 +129,16 @@ public:
|
||||
unsigned DestReg, unsigned SrcReg,
|
||||
unsigned ImmOffset, unsigned dataSize) const = 0;
|
||||
|
||||
virtual MachineBasicBlock::iterator
|
||||
moveReg2Reg(MachineBasicBlock *MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
unsigned DestReg, unsigned SrcReg, unsigned dataSize) const = 0;
|
||||
|
||||
virtual MachineBasicBlock::iterator
|
||||
moveImm2Reg(MachineBasicBlock *MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
unsigned DestReg, unsigned Imm, unsigned dataSize) const = 0;
|
||||
|
||||
virtual MachineBasicBlock::iterator
|
||||
emitPrologue(MachineBasicBlock *MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
|
@ -63,6 +63,42 @@ X86RegisterInfo::loadRegOffset2Reg(MachineBasicBlock *MBB,
|
||||
return ++(MBB->insert(MBBI, MI));
|
||||
}
|
||||
|
||||
MachineBasicBlock::iterator
|
||||
X86RegisterInfo::moveReg2Reg(MachineBasicBlock *MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
unsigned DestReg, unsigned SrcReg,
|
||||
unsigned dataSize) const
|
||||
{
|
||||
unsigned opcode;
|
||||
switch (dataSize) {
|
||||
case 1: opcode = X86::MOVrr8; break;
|
||||
case 2: opcode = X86::MOVrr16; break;
|
||||
case 4: opcode = X86::MOVrr32; break;
|
||||
default: assert(0 && "Invalid data size!");
|
||||
}
|
||||
|
||||
MachineInstr *MI = BuildMI(opcode, 2).addReg(DestReg).addReg(SrcReg);
|
||||
return ++(MBB->insert(MBBI, MI));
|
||||
}
|
||||
|
||||
MachineBasicBlock::iterator
|
||||
X86RegisterInfo::moveImm2Reg(MachineBasicBlock *MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
unsigned DestReg, unsigned Imm, unsigned dataSize)
|
||||
const
|
||||
{
|
||||
unsigned opcode;
|
||||
switch (dataSize) {
|
||||
case 1: opcode = X86::MOVir8; break;
|
||||
case 2: opcode = X86::MOVir16; break;
|
||||
case 4: opcode = X86::MOVir32; break;
|
||||
default: assert(0 && "Invalid data size!");
|
||||
}
|
||||
|
||||
MachineInstr *MI = BuildMI(opcode, 2).addReg(DestReg).addReg(Imm);
|
||||
return ++(MBB->insert(MBBI, MI));
|
||||
}
|
||||
|
||||
|
||||
unsigned X86RegisterInfo::getFramePointer() const {
|
||||
return X86::EBP;
|
||||
|
@ -29,6 +29,16 @@ struct X86RegisterInfo : public MRegisterInfo {
|
||||
unsigned DestReg, unsigned SrcReg,
|
||||
unsigned ImmOffset, unsigned dataSize) const;
|
||||
|
||||
MachineBasicBlock::iterator
|
||||
moveReg2Reg(MachineBasicBlock *MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
unsigned DestReg, unsigned SrcReg, unsigned dataSize) const;
|
||||
|
||||
MachineBasicBlock::iterator
|
||||
moveImm2Reg(MachineBasicBlock *MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
unsigned DestReg, unsigned Imm, unsigned dataSize) const;
|
||||
|
||||
unsigned getFramePointer() const;
|
||||
unsigned getStackPointer() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user