mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Change to match the newer, simpler, interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8026a6982e
commit
5a051f65d3
@ -79,24 +79,6 @@ int X86RegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool X86RegisterInfo::canFoldMemoryOperand(MachineInstr* MI,
|
||||
unsigned i) const
|
||||
{
|
||||
switch(MI->getOpcode()) {
|
||||
case X86::ADDrr8: case X86::ADDrr16: case X86::ADDrr32:
|
||||
case X86::ADDri8: case X86::ADDri16: case X86::ADDri32:
|
||||
case X86::ANDrr8: case X86::ANDrr16: case X86::ANDrr32:
|
||||
case X86::ANDri8: case X86::ANDri16: case X86::ANDri32:
|
||||
case X86::MOVrr8: case X86::MOVrr16: case X86::MOVrr32:
|
||||
return true;
|
||||
case X86::IMULrr16: case X86::IMULrr32:
|
||||
case X86::IMULrri16: case X86::IMULrri32:
|
||||
return i == 1;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static MachineInstr *MakeMRInst(unsigned Opcode, unsigned FrameIndex,
|
||||
MachineInstr *MI) {
|
||||
return addFrameReference(BuildMI(Opcode, 5), FrameIndex)
|
||||
@ -122,11 +104,8 @@ static MachineInstr *MakeRMIInst(unsigned Opcode, unsigned FrameIndex,
|
||||
}
|
||||
|
||||
|
||||
|
||||
int X86RegisterInfo::foldMemoryOperand(MachineInstr* MI,
|
||||
unsigned i,
|
||||
int FrameIndex) const
|
||||
{
|
||||
bool X86RegisterInfo::foldMemoryOperand(MachineBasicBlock::iterator &MI,
|
||||
unsigned i, int FrameIndex) const {
|
||||
/// FIXME: This should obviously be autogenerated by tablegen when patterns
|
||||
/// are available!
|
||||
MachineBasicBlock& MBB = *MI->getParent();
|
||||
@ -148,8 +127,7 @@ int X86RegisterInfo::foldMemoryOperand(MachineInstr* MI,
|
||||
case X86::ANDri8: NI = MakeMIInst(X86::ANDmi8 , FrameIndex, MI); break;
|
||||
case X86::ANDri16: NI = MakeMIInst(X86::ANDmi16, FrameIndex, MI); break;
|
||||
case X86::ANDri32: NI = MakeMIInst(X86::ANDmi32, FrameIndex, MI); break;
|
||||
|
||||
default: assert(0 && "Operand cannot be folded");
|
||||
default: return false; // Cannot fold
|
||||
}
|
||||
} else if (i == 1) {
|
||||
switch(MI->getOpcode()) {
|
||||
@ -166,15 +144,14 @@ int X86RegisterInfo::foldMemoryOperand(MachineInstr* MI,
|
||||
case X86::IMULrr32:NI = MakeRMInst(X86::IMULrm32, FrameIndex, MI); break;
|
||||
case X86::IMULrri16: NI = MakeRMIInst(X86::IMULrmi16, FrameIndex, MI); break;
|
||||
case X86::IMULrri32: NI = MakeRMIInst(X86::IMULrmi32, FrameIndex, MI); break;
|
||||
|
||||
default: assert(0 && "Operand cannot be folded");
|
||||
default: return false; // cannot fold.
|
||||
}
|
||||
} else {
|
||||
assert(0 && "Operand cannot be folded");
|
||||
return false; // cannot fold.
|
||||
}
|
||||
|
||||
MBB.insert(MBB.erase(MI), NI);
|
||||
return 0;
|
||||
MI = MBB.insert(MBB.erase(MI), NI);
|
||||
return true;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -42,10 +42,15 @@ struct X86RegisterInfo : public X86GenRegisterInfo {
|
||||
unsigned DestReg, unsigned SrcReg,
|
||||
const TargetRegisterClass *RC) const;
|
||||
|
||||
virtual bool canFoldMemoryOperand(MachineInstr* MI, unsigned i) const;
|
||||
/// foldMemoryOperand - If this target supports it, fold a load or store of
|
||||
/// the specified stack slot into the specified machine instruction for the
|
||||
/// specified operand. If this is possible, the target should perform the
|
||||
/// folding and return true, otherwise it should return false. If it folds
|
||||
/// the instruction, it is likely that the MachineInstruction the iterator
|
||||
/// references has been changed.
|
||||
virtual bool foldMemoryOperand(MachineBasicBlock::iterator &MI,unsigned OpNum,
|
||||
int FrameIndex) const;
|
||||
|
||||
virtual int foldMemoryOperand(MachineInstr* MI, unsigned i,
|
||||
int FrameIndex) const;
|
||||
|
||||
void eliminateCallFramePseudoInstr(MachineFunction &MF,
|
||||
MachineBasicBlock &MBB,
|
||||
|
Loading…
Reference in New Issue
Block a user