diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-31 19:27:28 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-31 19:27:28 +0000 | 
| commit | ec304151b74f9254d7029ee4d197ce1f7cbe501a (patch) | |
| tree | 63e4ed55e4fbb581fd4731d44a327a7b3278e0a1 /lib/Target/R600/AMDGPUInstrInfo.cpp | |
| parent | 67c32a98315f785a9ec9d531c1f571a0196c7463 (diff) | |
Diffstat (limited to 'lib/Target/R600/AMDGPUInstrInfo.cpp')
| -rw-r--r-- | lib/Target/R600/AMDGPUInstrInfo.cpp | 33 | 
1 files changed, 32 insertions, 1 deletions
| diff --git a/lib/Target/R600/AMDGPUInstrInfo.cpp b/lib/Target/R600/AMDGPUInstrInfo.cpp index 5beaa6841c946..e34a7b7345f12 100644 --- a/lib/Target/R600/AMDGPUInstrInfo.cpp +++ b/lib/Target/R600/AMDGPUInstrInfo.cpp @@ -341,8 +341,39 @@ int AMDGPUInstrInfo::getMaskedMIMGOp(uint16_t Opcode, unsigned Channels) const {  // instead.  namespace llvm {  namespace AMDGPU { -int getMCOpcode(uint16_t Opcode, unsigned Gen) { +static int getMCOpcode(uint16_t Opcode, unsigned Gen) {    return getMCOpcodeGen(Opcode, (enum Subtarget)Gen);  }  }  } + +// This must be kept in sync with the SISubtarget class in SIInstrInfo.td +enum SISubtarget { +  SI = 0, +  VI = 1 +}; + +enum SISubtarget AMDGPUSubtargetToSISubtarget(unsigned Gen) { +  switch (Gen) { +  default: +    return SI; +  case AMDGPUSubtarget::VOLCANIC_ISLANDS: +    return VI; +  } +} + +int AMDGPUInstrInfo::pseudoToMCOpcode(int Opcode) const { +  int MCOp = AMDGPU::getMCOpcode(Opcode, +                        AMDGPUSubtargetToSISubtarget(RI.ST.getGeneration())); + +  // -1 means that Opcode is already a native instruction. +  if (MCOp == -1) +    return Opcode; + +  // (uint16_t)-1 means that Opcode is a pseudo instruction that has +  // no encoding in the given subtarget generation. +  if (MCOp == (uint16_t)-1) +    return -1; + +  return MCOp; +} | 
