diff options
author | Tom Stellard <[email protected]> | 2012-06-02 09:51:04 -0400 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2012-06-06 13:46:04 -0400 |
commit | f81e4663a766e71e907886640327abea4a0d78e2 (patch) | |
tree | 259c055e49e421d0a9ef792b38d7ba68ed15a080 /src/gallium/drivers | |
parent | 1777c99bff40f160b09dd3c9708b0963c772610a (diff) |
radeon/llvm: Add isMov() to AMDILInstrInfo
This enables the CFGStructurizer to work without the AMDIL::MOV*
instructions.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeon/AMDILCFGStructurizer.cpp | 15 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/AMDILInstrInfo.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/R600InstrInfo.cpp | 11 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/R600InstrInfo.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/SIInstrInfo.cpp | 15 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/SIInstrInfo.h | 1 |
6 files changed, 34 insertions, 11 deletions
diff --git a/src/gallium/drivers/radeon/AMDILCFGStructurizer.cpp b/src/gallium/drivers/radeon/AMDILCFGStructurizer.cpp index 26559a0371d..ba7d246137e 100644 --- a/src/gallium/drivers/radeon/AMDILCFGStructurizer.cpp +++ b/src/gallium/drivers/radeon/AMDILCFGStructurizer.cpp @@ -2862,16 +2862,6 @@ struct CFGStructTraits<AMDILCFGStructurizer> return true; } - static bool isPhimove(MachineInstr *instr) { - switch (instr->getOpcode()) { - ExpandCaseToAllTypes(AMDIL::MOVE); - break; - default: - return false; - } - return true; - } - static DebugLoc getLastDebugLocInBB(MachineBasicBlock *blk) { //get DebugLoc from the first MachineBasicBlock instruction with debug info DebugLoc DL; @@ -2899,6 +2889,9 @@ struct CFGStructTraits<AMDILCFGStructurizer> // instruction. Such move instruction "belong to" the loop backward-edge. // static MachineInstr *getLoopendBlockBranchInstr(MachineBasicBlock *blk) { + const AMDILInstrInfo * TII = static_cast<const AMDILInstrInfo *>( + blk->getParent()->getTarget().getInstrInfo()); + for (MachineBasicBlock::reverse_iterator iter = blk->rbegin(), iterEnd = blk->rend(); iter != iterEnd; ++iter) { // FIXME: Simplify @@ -2906,7 +2899,7 @@ struct CFGStructTraits<AMDILCFGStructurizer> if (instr) { if (isCondBranch(instr) || isUncondBranch(instr)) { return instr; - } else if (!isPhimove(instr)) { + } else if (!TII->isMov(instr->getOpcode())) { break; } } diff --git a/src/gallium/drivers/radeon/AMDILInstrInfo.h b/src/gallium/drivers/radeon/AMDILInstrInfo.h index 211c881e7b9..7ea88348a9a 100644 --- a/src/gallium/drivers/radeon/AMDILInstrInfo.h +++ b/src/gallium/drivers/radeon/AMDILInstrInfo.h @@ -152,6 +152,8 @@ public: int64_t Imm) const = 0; virtual unsigned getIEQOpcode() const = 0; + + virtual bool isMov(unsigned Opcode) const = 0; }; } diff --git a/src/gallium/drivers/radeon/R600InstrInfo.cpp b/src/gallium/drivers/radeon/R600InstrInfo.cpp index 05c291f1b89..363c8148863 100644 --- a/src/gallium/drivers/radeon/R600InstrInfo.cpp +++ b/src/gallium/drivers/radeon/R600InstrInfo.cpp @@ -116,3 +116,14 @@ unsigned R600InstrInfo::getIEQOpcode() const { return AMDIL::SETE_INT; } + +bool R600InstrInfo::isMov(unsigned Opcode) const +{ + switch(Opcode) { + default: return false; + case AMDIL::MOV: + case AMDIL::MOV_IMM_F32: + case AMDIL::MOV_IMM_I32: + return true; + } +} diff --git a/src/gallium/drivers/radeon/R600InstrInfo.h b/src/gallium/drivers/radeon/R600InstrInfo.h index 2b5e5c42995..2db10addef4 100644 --- a/src/gallium/drivers/radeon/R600InstrInfo.h +++ b/src/gallium/drivers/radeon/R600InstrInfo.h @@ -51,6 +51,7 @@ namespace llvm { int64_t Imm) const; virtual unsigned getIEQOpcode() const; + virtual bool isMov(unsigned Opcode) const; }; } // End llvm namespace diff --git a/src/gallium/drivers/radeon/SIInstrInfo.cpp b/src/gallium/drivers/radeon/SIInstrInfo.cpp index 4c7a92075c6..058c772e620 100644 --- a/src/gallium/drivers/radeon/SIInstrInfo.cpp +++ b/src/gallium/drivers/radeon/SIInstrInfo.cpp @@ -115,3 +115,18 @@ MachineInstr * SIInstrInfo::getMovImmInstr(MachineFunction *MF, unsigned DstReg, return MI; } + +bool SIInstrInfo::isMov(unsigned Opcode) const +{ + switch(Opcode) { + default: return false; + case AMDIL::S_MOV_B32: + case AMDIL::S_MOV_B64: + case AMDIL::V_MOV_B32_e32: + case AMDIL::V_MOV_B32_e64: + case AMDIL::V_MOV_IMM_F32: + case AMDIL::V_MOV_IMM_I32: + case AMDIL::S_MOV_IMM_I32: + return true; + } +} diff --git a/src/gallium/drivers/radeon/SIInstrInfo.h b/src/gallium/drivers/radeon/SIInstrInfo.h index 996dceeb075..6cfbaf4623b 100644 --- a/src/gallium/drivers/radeon/SIInstrInfo.h +++ b/src/gallium/drivers/radeon/SIInstrInfo.h @@ -55,6 +55,7 @@ public: int64_t Imm) const; virtual unsigned getIEQOpcode() const { assert(!"Implement"); return 0;} + virtual bool isMov(unsigned Opcode) const; }; |