mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-09 05:13:01 +00:00
[mips] Define a helper function which creates an instruction with the same
operands as the prototype instruction but with a different opcode. llvm-svn: 181714
This commit is contained in:
parent
083fece809
commit
4ac9f3dc5b
@ -282,3 +282,16 @@ unsigned MipsInstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MachineInstrBuilder
|
||||
MipsInstrInfo::genInstrWithNewOpc(unsigned NewOpc,
|
||||
MachineBasicBlock::iterator I) const {
|
||||
MachineInstrBuilder MIB;
|
||||
MIB = BuildMI(*I->getParent(), I, I->getDebugLoc(), get(NewOpc));
|
||||
|
||||
for (unsigned J = 0, E = I->getDesc().getNumOperands(); J < E; ++J)
|
||||
MIB.addOperand(I->getOperand(J));
|
||||
|
||||
MIB.setMemRefs(I->memoperands_begin(), I->memoperands_end());
|
||||
return MIB;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Mips.h"
|
||||
#include "MipsAnalyzeImmediate.h"
|
||||
#include "MipsRegisterInfo.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
|
||||
@ -116,6 +117,11 @@ public:
|
||||
const TargetRegisterInfo *TRI,
|
||||
int64_t Offset) const = 0;
|
||||
|
||||
/// Create an instruction which has the same operands and memory operands
|
||||
/// as MI but has a new opcode.
|
||||
MachineInstrBuilder genInstrWithNewOpc(unsigned NewOpc,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
protected:
|
||||
bool isZeroImm(const MachineOperand &op) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user