radeon/llvm: Don't lower RETURN to S_ENDPGM on SI
authorTom Stellard <thomas.stellard@amd.com>
Sat, 2 Jun 2012 11:57:54 +0000 (07:57 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 6 Jun 2012 17:46:03 +0000 (13:46 -0400)
Instead create an S_ENDPGM instruction in the CodeEmitter and emit
it after all the other instructions.

src/gallium/drivers/radeon/SICodeEmitter.cpp
src/gallium/drivers/radeon/SIInstrInfo.cpp

index d2ea1fb5dec00505b2fd35b6a079d717580d3b61..1d247061e41ae2762efc6acf733375a36f0caa84 100644 (file)
@@ -172,6 +172,10 @@ bool SICodeEmitter::runOnMachineFunction(MachineFunction &MF)
       }
     }
   }
+  // Emit S_END_PGM
+  MachineInstr * End = BuildMI(MF, DebugLoc(),
+                               TM->getInstrInfo()->get(AMDIL::S_ENDPGM));
+  emitInstr(*End);
   return false;
 }
 
index 40a1891b1a60ae7f5005c939982f1325f0d0f343..4c7a92075c64abe1b9673f1fb90585c997fcbaaa 100644 (file)
@@ -100,7 +100,6 @@ unsigned SIInstrInfo::getISAOpcode(unsigned AMDILopcode) const
 {
   switch (AMDILopcode) {
   //XXX We need a better way of detecting end of program
-  case AMDIL::RETURN: return AMDIL::S_ENDPGM;
   case AMDIL::MOVE_f32: return AMDIL::V_MOV_B32_e32;
   default: return AMDILopcode;
   }