mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
[mips][microMIPS] Implement JALS and JALRS instructions.
Differential Revision: http://reviews.llvm.org/D5003 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217676 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -981,6 +981,16 @@ static const MCInstrDesc &getInstDesc(unsigned Opcode) {
|
||||
return MipsInsts[Opcode];
|
||||
}
|
||||
|
||||
static bool hasShortDelaySlot(unsigned Opcode) {
|
||||
switch (Opcode) {
|
||||
case Mips::JALS_MM:
|
||||
case Mips::JALRS_MM:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
|
||||
SmallVectorImpl<MCInst> &Instructions) {
|
||||
const MCInstrDesc &MCID = getInstDesc(Inst.getOpcode());
|
||||
@@ -1050,10 +1060,16 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
|
||||
// emit a NOP after it.
|
||||
Instructions.push_back(Inst);
|
||||
MCInst NopInst;
|
||||
NopInst.setOpcode(Mips::SLL);
|
||||
NopInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
|
||||
NopInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
|
||||
NopInst.addOperand(MCOperand::CreateImm(0));
|
||||
if (hasShortDelaySlot(Inst.getOpcode())) {
|
||||
NopInst.setOpcode(Mips::MOVE16_MM);
|
||||
NopInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
|
||||
NopInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
|
||||
} else {
|
||||
NopInst.setOpcode(Mips::SLL);
|
||||
NopInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
|
||||
NopInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
|
||||
NopInst.addOperand(MCOperand::CreateImm(0));
|
||||
}
|
||||
Instructions.push_back(NopInst);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user