diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-25 06:19:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-25 06:19:04 +0000 |
commit | 51ebdec5c0bf26f6cdba13282433b135f9f44352 (patch) | |
tree | 9e591122fd58046fd2283dfcda59fe11c6a7ffb2 /llvm/lib/Target/SparcV8 | |
parent | 74614b0c301e527b011f1026b6c2c34b9b23bebc (diff) | |
download | bcm5719-llvm-51ebdec5c0bf26f6cdba13282433b135f9f44352.tar.gz bcm5719-llvm-51ebdec5c0bf26f6cdba13282433b135f9f44352.zip |
I think that V8 should coallesce registers, don't you?
llvm-svn: 15192
Diffstat (limited to 'llvm/lib/Target/SparcV8')
-rw-r--r-- | llvm/lib/Target/SparcV8/SparcV8InstrInfo.cpp | 19 | ||||
-rw-r--r-- | llvm/lib/Target/SparcV8/SparcV8InstrInfo.h | 6 |
2 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/Target/SparcV8/SparcV8InstrInfo.cpp b/llvm/lib/Target/SparcV8/SparcV8InstrInfo.cpp index b9ce21cf70f..64e225faf21 100644 --- a/llvm/lib/Target/SparcV8/SparcV8InstrInfo.cpp +++ b/llvm/lib/Target/SparcV8/SparcV8InstrInfo.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "SparcV8InstrInfo.h" +#include "SparcV8.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "SparcV8GenInstrInfo.inc" using namespace llvm; @@ -20,3 +21,21 @@ SparcV8InstrInfo::SparcV8InstrInfo() : TargetInstrInfo(SparcV8Insts, sizeof(SparcV8Insts)/sizeof(SparcV8Insts[0])){ } +/// Return true if the instruction is a register to register move and +/// leave the source and dest operands in the passed parameters. +/// +bool SparcV8InstrInfo::isMoveInstr(const MachineInstr &MI, + unsigned &SrcReg, unsigned &DstReg) const { + if (MI.getOpcode() == V8::ORrr) { + if (MI.getOperand(1).getReg() == V8::G0) { // X = or G0, Y -> X = Y + DstReg = MI.getOperand(0).getReg(); + SrcReg = MI.getOperand(2).getReg(); + } + return true; + } else if (MI.getOpcode() == V8::FMOVS) { + SrcReg = MI.getOperand(1).getReg(); + DstReg = MI.getOperand(0).getReg(); + return true; + } + return false; +} diff --git a/llvm/lib/Target/SparcV8/SparcV8InstrInfo.h b/llvm/lib/Target/SparcV8/SparcV8InstrInfo.h index 52cd7c7f8d0..9c7838dfdd7 100644 --- a/llvm/lib/Target/SparcV8/SparcV8InstrInfo.h +++ b/llvm/lib/Target/SparcV8/SparcV8InstrInfo.h @@ -41,6 +41,12 @@ public: /// always be able to get register info as well (through this method). /// virtual const MRegisterInfo &getRegisterInfo() const { return RI; } + + /// Return true if the instruction is a register to register move and + /// leave the source and dest operands in the passed parameters. + /// + virtual bool isMoveInstr(const MachineInstr &MI, + unsigned &SrcReg, unsigned &DstReg) const; }; } |