diff options
Diffstat (limited to 'llvm/lib/Target/Nios2/Nios2InstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/Nios2/Nios2InstrInfo.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/llvm/lib/Target/Nios2/Nios2InstrInfo.cpp b/llvm/lib/Target/Nios2/Nios2InstrInfo.cpp index 412cfcef3af..df435d2715d 100644 --- a/llvm/lib/Target/Nios2/Nios2InstrInfo.cpp +++ b/llvm/lib/Target/Nios2/Nios2InstrInfo.cpp @@ -13,14 +13,31 @@ #include "Nios2InstrInfo.h" #include "Nios2TargetMachine.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" using namespace llvm; #define GET_INSTRINFO_CTOR_DTOR #include "Nios2GenInstrInfo.inc" -const Nios2InstrInfo *Nios2InstrInfo::create(Nios2Subtarget &STI) { - return new Nios2InstrInfo(STI); -} +// Pin the vtable to this file. +void Nios2InstrInfo::anchor() {} + +Nios2InstrInfo::Nios2InstrInfo(Nios2Subtarget &ST) + : Nios2GenInstrInfo(), RI(ST), Subtarget(ST) {} + +/// Expand Pseudo instructions into real backend instructions +bool Nios2InstrInfo::expandPostRAPseudo(MachineInstr &MI) const { + MachineBasicBlock &MBB = *MI.getParent(); -const Nios2RegisterInfo &Nios2InstrInfo::getRegisterInfo() const { return RI; } + switch (MI.getDesc().getOpcode()) { + default: + return false; + case Nios2::RetRA: + BuildMI(MBB, MI, MI.getDebugLoc(), get(Nios2::RET_R1)).addReg(Nios2::RA); + break; + } + + MBB.erase(MI); + return true; +} |